diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2010-08-24 12:23:40 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-08-24 16:02:59 (GMT) |
commit | e9e6be0de1e1691b9d10cc9524aabf5d493858d6 (patch) | |
tree | b353778678df1ac416534820ad032fc8bf6b6e4c | |
parent | 11c844de157bab85caec3ec0afe01b3f81f53bf0 (diff) | |
download | Qt-e9e6be0de1e1691b9d10cc9524aabf5d493858d6.zip Qt-e9e6be0de1e1691b9d10cc9524aabf5d493858d6.tar.gz Qt-e9e6be0de1e1691b9d10cc9524aabf5d493858d6.tar.bz2 |
QDeclarativeEngineDebugServer: make it a singleton.
It is already a singleton, just formalize it so it can be used in other
files than qdeclarativeengine.cpp
This also remove the global olbject QDeclarativeEngineDebugServer::m_engines
Reviewed-by: Lasse Holmstedt
-rw-r--r-- | src/declarative/qml/qdeclarativeengine.cpp | 7 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeenginedebug.cpp | 8 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeenginedebug_p.h | 8 |
3 files changed, 14 insertions, 9 deletions
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 4e45636..c5a5c18 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -438,8 +438,6 @@ void QDeclarativeEnginePrivate::clear(SimpleList<QDeclarativeParserStatus> &pss) pss.clear(); } -Q_GLOBAL_STATIC(QDeclarativeEngineDebugServer, qmlEngineDebugServer); - void QDeclarativePrivate::qdeclarativeelement_destructor(QObject *o) { QObjectPrivate *p = QObjectPrivate::get(o); @@ -481,9 +479,8 @@ void QDeclarativeEnginePrivate::init() if (QCoreApplication::instance()->thread() == q->thread() && QDeclarativeEngineDebugServer::isDebuggingEnabled()) { - qmlEngineDebugServer(); isDebugging = true; - QDeclarativeEngineDebugServer::addEngine(q); + QDeclarativeEngineDebugServer::instance()->addEngine(q); } } @@ -547,7 +544,7 @@ QDeclarativeEngine::~QDeclarativeEngine() { Q_D(QDeclarativeEngine); if (d->isDebugging) - QDeclarativeEngineDebugServer::remEngine(this); + QDeclarativeEngineDebugServer::instance()->remEngine(this); } /*! \fn void QDeclarativeEngine::quit() diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp index 688e0fc..056d8a0 100644 --- a/src/declarative/qml/qdeclarativeenginedebug.cpp +++ b/src/declarative/qml/qdeclarativeenginedebug.cpp @@ -58,7 +58,13 @@ QT_BEGIN_NAMESPACE -QList<QDeclarativeEngine *> QDeclarativeEngineDebugServer::m_engines; +Q_GLOBAL_STATIC(QDeclarativeEngineDebugServer, qmlEngineDebugServer); + +QDeclarativeEngineDebugServer *QDeclarativeEngineDebugServer::instance() +{ + return qmlEngineDebugServer(); +} + QDeclarativeEngineDebugServer::QDeclarativeEngineDebugServer(QObject *parent) : QDeclarativeDebugService(QLatin1String("QDeclarativeEngine"), parent), m_watch(new QDeclarativeWatcher(this)) diff --git a/src/declarative/qml/qdeclarativeenginedebug_p.h b/src/declarative/qml/qdeclarativeenginedebug_p.h index aa450f3..4704393 100644 --- a/src/declarative/qml/qdeclarativeenginedebug_p.h +++ b/src/declarative/qml/qdeclarativeenginedebug_p.h @@ -92,8 +92,10 @@ public: bool hasNotifySignal; }; - static void addEngine(QDeclarativeEngine *); - static void remEngine(QDeclarativeEngine *); + void addEngine(QDeclarativeEngine *); + void remEngine(QDeclarativeEngine *); + + static QDeclarativeEngineDebugServer *instance(); protected: virtual void messageReceived(const QByteArray &); @@ -111,7 +113,7 @@ private: void resetBinding(int objectId, const QString &propertyName); void setMethodBody(int objectId, const QString &method, const QString &body); - static QList<QDeclarativeEngine *> m_engines; + QList<QDeclarativeEngine *> m_engines; QDeclarativeWatcher *m_watch; }; Q_DECLARATIVE_EXPORT QDataStream &operator<<(QDataStream &, const QDeclarativeEngineDebugServer::QDeclarativeObjectData &); |