aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmltooling
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-07-21 16:39:57 +0200
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-08-04 13:35:28 +0000
commit38fe08b8af9015264a1f8a5f4dcf1dd40f04f4ba (patch)
tree60b9d8c3902272f1653de43e21211ef5f5e14b7a /src/plugins/qmltooling
parent5652c4163f94aaf4bd9cef994be2ae8e7f4096c5 (diff)
Move QQmlConfigurableDebugService into qmltooling/shared
It's only used by plugins now. Change-Id: Ia73a2a22ba6bccbd85bbca6eda2fb9f5a8d6dd3b Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/plugins/qmltooling')
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qmldbg_debugger.pro1
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.h2
-rw-r--r--src/plugins/qmltooling/qmldbg_profiler/qmldbg_profiler.pro1
-rw-r--r--src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h2
-rw-r--r--src/plugins/qmltooling/shared/qqmlconfigurabledebugservice.h106
5 files changed, 110 insertions, 2 deletions
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qmldbg_debugger.pro b/src/plugins/qmltooling/qmldbg_debugger/qmldbg_debugger.pro
index 951b212d17..6c29411981 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qmldbg_debugger.pro
+++ b/src/plugins/qmltooling/qmldbg_debugger/qmldbg_debugger.pro
@@ -13,6 +13,7 @@ SOURCES += \
$$PWD/qv4debugservice.cpp
HEADERS += \
+ $$PWD/../shared/qqmlconfigurabledebugservice.h \
$$PWD/qdebugmessageservice.h \
$$PWD/qqmldebuggerservicefactory.h \
$$PWD/qqmlenginedebugservice.h \
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.h b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.h
index b009a0fead..4829ae414f 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.h
+++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.h
@@ -45,7 +45,7 @@
// We mean it.
//
-#include <private/qqmlconfigurabledebugservice_p.h>
+#include "qqmlconfigurabledebugservice.h"
#include <private/qqmldebugserviceinterfaces_p.h>
#include <private/qv4debugging_p.h>
diff --git a/src/plugins/qmltooling/qmldbg_profiler/qmldbg_profiler.pro b/src/plugins/qmltooling/qmldbg_profiler/qmldbg_profiler.pro
index dc5ee44711..e1c4095d88 100644
--- a/src/plugins/qmltooling/qmldbg_profiler/qmldbg_profiler.pro
+++ b/src/plugins/qmltooling/qmldbg_profiler/qmldbg_profiler.pro
@@ -13,6 +13,7 @@ SOURCES += \
$$PWD/qv4profileradapter.cpp
HEADERS += \
+ $$PWD/../shared/qqmlconfigurabledebugservice.h \
$$PWD/qqmlenginecontrolservice.h \
$$PWD/qqmlprofileradapter.h \
$$PWD/qqmlprofilerservice.h \
diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h
index da96f58ce6..9b139ffabb 100644
--- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h
+++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h
@@ -45,7 +45,7 @@
// We mean it.
//
-#include <private/qqmlconfigurabledebugservice_p.h>
+#include "qqmlconfigurabledebugservice.h"
#include <private/qqmldebugserviceinterfaces_p.h>
#include <private/qqmlprofilerdefinitions_p.h>
#include <private/qqmlabstractprofileradapter_p.h>
diff --git a/src/plugins/qmltooling/shared/qqmlconfigurabledebugservice.h b/src/plugins/qmltooling/shared/qqmlconfigurabledebugservice.h
new file mode 100644
index 0000000000..9aa4531428
--- /dev/null
+++ b/src/plugins/qmltooling/shared/qqmlconfigurabledebugservice.h
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QQMLCONFIGURABLEDEBUGSEVICE_H
+#define QQMLCONFIGURABLEDEBUGSEVICE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qqmldebugservice_p.h>
+#include <private/qqmldebugconnector_p.h>
+#include <QtCore/qmutex.h>
+
+QT_BEGIN_NAMESPACE
+
+template <class Base>
+class QQmlConfigurableDebugService : public Base
+{
+protected:
+ QQmlConfigurableDebugService(float version, QObject *parent = 0) :
+ Base(version, parent), m_configMutex(QMutex::Recursive)
+ {
+ init();
+ }
+
+ void stopWaiting()
+ {
+ QMutexLocker lock(&m_configMutex);
+ m_waitingForConfiguration = false;
+ foreach (QQmlEngine *engine, m_waitingEngines)
+ emit Base::attachedToEngine(engine);
+ m_waitingEngines.clear();
+ }
+
+ void init()
+ {
+ QMutexLocker lock(&m_configMutex);
+ // If we're not enabled or not blocking, don't wait for configuration
+ m_waitingForConfiguration = (Base::state() == QQmlDebugService::Enabled &&
+ QQmlDebugConnector::instance()->blockingMode());
+ }
+
+ void stateChanged(QQmlDebugService::State newState)
+ {
+ if (newState != QQmlDebugService::Enabled)
+ stopWaiting();
+ else
+ init();
+ }
+
+ void engineAboutToBeAdded(QQmlEngine *engine)
+ {
+ QMutexLocker lock(&m_configMutex);
+ if (m_waitingForConfiguration)
+ m_waitingEngines.append(engine);
+ else
+ emit Base::attachedToEngine(engine);
+ }
+
+ QMutex m_configMutex;
+ QList<QQmlEngine *> m_waitingEngines;
+ bool m_waitingForConfiguration;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQMLCONFIGURABLEDEBUGSEVICE_H