diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-30 09:14:24 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-30 09:14:24 (GMT) |
commit | e927cdd850053bd59c57056b72607853783bf35f (patch) | |
tree | 168df2ed5706db8e5871d7ff01870754be248603 /src/declarative/qml/qmlworkerscript_p.h | |
parent | bd2ba54d85415047a581b7b441309572a756dcc5 (diff) | |
download | Qt-e927cdd850053bd59c57056b72607853783bf35f.zip Qt-e927cdd850053bd59c57056b72607853783bf35f.tar.gz Qt-e927cdd850053bd59c57056b72607853783bf35f.tar.bz2 |
Two way WorkerScript communications
Diffstat (limited to 'src/declarative/qml/qmlworkerscript_p.h')
-rw-r--r-- | src/declarative/qml/qmlworkerscript_p.h | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/src/declarative/qml/qmlworkerscript_p.h b/src/declarative/qml/qmlworkerscript_p.h index 90861f8..b7106c5 100644 --- a/src/declarative/qml/qmlworkerscript_p.h +++ b/src/declarative/qml/qmlworkerscript_p.h @@ -59,6 +59,7 @@ #include <QtScript/qscriptvalue.h> #include <QtCore/qurl.h> +class QmlWorkerScript; class QmlWorkerScriptEnginePrivate; class QmlWorkerScriptEngine : public QThread { @@ -67,26 +68,10 @@ public: QmlWorkerScriptEngine(QObject *parent = 0); virtual ~QmlWorkerScriptEngine(); - class Data; - class WorkerScript { - public: - void sendMessage(Data *); - void executeUrl(const QUrl &); - - private: - WorkerScript(); - friend class QmlWorkerScriptEngine; - QmlWorkerScriptEngine *engine; - int id; - }; - WorkerScript *createWorkerScript(); - - struct Data { - QVariant var; - }; - - void executeUrl(WorkerScript *, const QUrl &); - void sendMessage(WorkerScript *, Data *); + int registerWorkerScript(QmlWorkerScript *); + void removeWorkerScript(int); + void executeUrl(int, const QUrl &); + void sendMessage(int, const QVariant &); protected: virtual void run(); @@ -112,12 +97,15 @@ public slots: signals: void sourceChanged(); + void message(const QScriptValue &messageObject); protected: virtual void componentComplete(); + virtual bool event(QEvent *); private: - QmlWorkerScriptEngine::WorkerScript *m_script; + QmlWorkerScriptEngine *m_engine; + int m_scriptId; QUrl m_source; }; QML_DECLARE_TYPE(QmlWorkerScript); |