Commit 1e7a77c1e33718a8449395bc5ebbe03333585be9
- Diff rendering mode:
- inline
- side by side
hooq/Interpreter.cpp
(15 / 1)
|   | |||
| 119 | 119 | ||
| 120 | 120 | void Interpreter::connectRemoteApplication(RemoteApplicationPrototype* object) | |
| 121 | 121 | { | |
| 122 | m_applicationUuid = object->uuid(); | ||
| 123 | qDebug() << Q_FUNC_INFO << "Launching" << object->uuid(); | ||
| 122 | 124 | if(object->useDefaults()) | |
| 123 | 125 | { | |
| 124 | 126 | emit startApplicationAndAttach(); | |
| … | … | ||
| 139 | 139 | ||
| 140 | 140 | void Interpreter::closeApplication() | |
| 141 | 141 | { | |
| 142 | qDebug() << Q_FUNC_INFO; | ||
| 142 | RemoteApplicationPrototype* object = qobject_cast<RemoteApplicationPrototype*>(sender()); | ||
| 143 | if(object) | ||
| 144 | { | ||
| 145 | if(object->uuid() != m_applicationUuid) | ||
| 146 | { | ||
| 147 | qDebug() << Q_FUNC_INFO << "Ignoring request. Current UUID:" << m_applicationUuid << "Requested UUID:" << object->uuid(); | ||
| 148 | return; | ||
| 149 | } | ||
| 150 | } | ||
| 143 | 151 | if(device()) | |
| 144 | 152 | { | |
| 153 | qDebug() << Q_FUNC_INFO << "Closing UUID" << m_applicationUuid; | ||
| 145 | 154 | writeEndElement(); // hooq | |
| 146 | 155 | writeEndDocument(); | |
| 147 | 156 | ||
| … | … | ||
| 159 | 159 | waitForAck(); | |
| 160 | 160 | m_attachState = NotAttached; | |
| 161 | 161 | setDevice(0); | |
| 162 | m_applicationUuid = QString(); | ||
| 162 | 163 | } | |
| 163 | 164 | } | |
| 164 | 165 | ||
| … | … | ||
| 536 | 536 | ||
| 537 | 537 | void Interpreter::run() | |
| 538 | 538 | { | |
| 539 | m_applicationUuid = QString(); | ||
| 539 | 540 | qDebug() << Q_FUNC_INFO; | |
| 540 | 541 | m_attachState = NotAttached; | |
| 541 | 542 | m_engine->evaluate(m_script, m_scriptPath); | |
| 543 | m_engine->collectGarbage(); | ||
| 542 | 544 | closeApplication(); | |
| 543 | 545 | emit finished(); | |
| 544 | 546 | } |
hooq/Interpreter.h
(1 / 0)
|   | |||
| 95 | 95 | AttachState m_attachState; | |
| 96 | 96 | void waitForAttach(); | |
| 97 | 97 | void ensureAttached(); | |
| 98 | QString m_applicationUuid; | ||
| 98 | 99 | ||
| 99 | 100 | bool m_haveRequiredQtScriptExtensions; | |
| 100 | 101 | QScriptEngine* m_engine; |
|   | |||
| 18 | 18 | */ | |
| 19 | 19 | #include "RemoteApplicationPrototype.h" | |
| 20 | 20 | ||
| 21 | #include <QUuid> | ||
| 22 | |||
| 21 | 23 | RemoteApplicationPrototype::RemoteApplicationPrototype(QObject* parent) | |
| 22 | 24 | : QObject(parent) | |
| 23 | 25 | , m_closed(false) | |
| 26 | , m_uuid(QUuid::createUuid()) | ||
| 24 | 27 | { | |
| 25 | 28 | } | |
| 26 | 29 | ||
| 30 | QString RemoteApplicationPrototype::uuid() const | ||
| 31 | { | ||
| 32 | return m_uuid; | ||
| 33 | } | ||
| 34 | |||
| 27 | 35 | RemoteApplicationPrototype::RemoteApplicationPrototype(const QString& path, const QStringList& arguments, QObject* parent) | |
| 28 | 36 | : QObject(parent) | |
| 29 | 37 | , m_closed(false) | |
| 38 | , m_uuid(QUuid::createUuid()) | ||
| 30 | 39 | , m_path(path) | |
| 31 | 40 | , m_arguments(arguments) | |
| 32 | 41 | { |
|   | |||
| 32 | 32 | bool useDefaults() const; | |
| 33 | 33 | QString path() const; | |
| 34 | 34 | QStringList arguments() const; | |
| 35 | |||
| 36 | QString uuid() const; | ||
| 35 | 37 | public slots: | |
| 36 | 38 | void close(); | |
| 37 | 39 | signals: | |
| 38 | 40 | void closeRequested(); | |
| 39 | 41 | private: | |
| 40 | 42 | bool m_closed; | |
| 43 | QString m_uuid; | ||
| 41 | 44 | QString m_path; | |
| 42 | 45 | QStringList m_arguments; | |
| 43 | 46 | }; |

