summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/applicationmanager-project.qdocconf4
-rw-r--r--src/src.pro6
-rw-r--r--src/tools/launcher-qml/launcher-qml.cpp (renamed from src/launchers/qml/main.cpp)67
-rw-r--r--src/tools/launcher-qml/launcher-qml.pro (renamed from src/launchers/qml/qml.pro)5
-rw-r--r--src/tools/launcher-qml/launcher-qml_p.h94
-rw-r--r--src/tools/testrunner/testrunner.cpp105
-rw-r--r--src/tools/testrunner/testrunner.pro3
-rw-r--r--src/tools/testrunner/testrunner_p.h106
8 files changed, 254 insertions, 136 deletions
diff --git a/doc/applicationmanager-project.qdocconf b/doc/applicationmanager-project.qdocconf
index 7e6c12e8..0532d1d7 100644
--- a/doc/applicationmanager-project.qdocconf
+++ b/doc/applicationmanager-project.qdocconf
@@ -23,9 +23,9 @@ headerdirs += \
../src/notification-lib \
../src/window-lib \
../src/launcher-lib \
- ../src/launchers/qml \
../src/monitor-lib \
../src/plugin-interfaces \
+ ../src/tools/launcher-qml \
sourcedirs += \
. \
@@ -39,11 +39,11 @@ sourcedirs += \
../src/notification-lib \
../src/window-lib \
../src/launcher-lib \
- ../src/launchers/qml \
../src/monitor-lib \
../src/plugin-interfaces \
../src/tools/packager \
../src/tools/controller \
+ ../src/tools/launcher-qml \
$$BUILDDIR \
exampledirs = ../examples
diff --git a/src/src.pro b/src/src.pro
index 2089677d..416a7e0b 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -53,8 +53,8 @@ main_lib.depends = shared_main_lib manager_lib installer_lib window_lib monitor_
main_lib.depends += dbus_lib
}
-launchers_qml.subdir = launchers/qml
-launchers_qml.depends = launcher_lib plugin_interfaces
+tools_launcher_qml.subdir = tools/launcher-qml
+tools_launcher_qml.depends = launcher_lib plugin_interfaces
tools_appman.subdir = tools/appman
tools_appman.depends = main_lib
@@ -109,7 +109,7 @@ SUBDIRS = \
tools_dumpqmltypes \
multi-process:qtHaveModule(qml):qtHaveModule(dbus):SUBDIRS += \
- launchers_qml \
+ tools_launcher_qml \
}
!android:SUBDIRS += \
diff --git a/src/launchers/qml/main.cpp b/src/tools/launcher-qml/launcher-qml.cpp
index 253fff7f..257c1f32 100644
--- a/src/launchers/qml/main.cpp
+++ b/src/tools/launcher-qml/launcher-qml.cpp
@@ -39,11 +39,8 @@
**
****************************************************************************/
-
-#include <QQmlApplicationEngine>
#include <QQmlComponent>
#include <QQmlContext>
-#include <QQmlIncubationController>
#include <QQmlDebuggingEnabler>
#include <QSocketNotifier>
@@ -92,54 +89,7 @@
#include "startuptimer.h"
#include "processtitle.h"
#include "qml-utilities.h"
-
-QT_BEGIN_NAMESPACE_AM
-
-// maybe make this configurable for specific workloads?
-class HeadlessIncubationController : public QObject, public QQmlIncubationController // clazy:exclude=missing-qobject-macro
-{
-public:
- HeadlessIncubationController(QObject *parent)
- : QObject(parent)
- {
- startTimer(50);
- }
-
-protected:
- void timerEvent(QTimerEvent *) override
- {
- incubateFor(25);
- }
-};
-
-
-
-class Controller : public QObject
-{
- Q_OBJECT
-
-public:
- Controller(LauncherMain *a, bool quickLaunched, const QString &directLoad = QString());
-
-public slots:
- void startApplication(const QString &baseDir, const QString &qmlFile, const QString &document,
- const QString &mimeType, const QVariantMap &application, const QVariantMap systemProperties);
-
-private:
- QQmlApplicationEngine m_engine;
- QmlApplicationInterface *m_applicationInterface = nullptr;
- QVariantMap m_configuration;
- bool m_launched = false;
- bool m_quickLaunched;
-#if !defined(AM_HEADLESS)
- QQuickWindow *m_window = nullptr;
-private slots:
- void updateSlowMode(bool isSlow);
-#endif
-};
-
-
-QT_END_NAMESPACE_AM
+#include "launcher-qml_p.h"
QT_USE_NAMESPACE_AM
@@ -210,6 +160,7 @@ int main(int argc, char *argv[])
}
}
+
Controller::Controller(LauncherMain *a, bool quickLaunched, const QString &directLoad)
: QObject(a)
, m_quickLaunched(quickLaunched)
@@ -298,7 +249,7 @@ Controller::Controller(LauncherMain *a, bool quickLaunched, const QString &direc
void Controller::startApplication(const QString &baseDir, const QString &qmlFile, const QString &document,
const QString &mimeType, const QVariantMap &application,
- const QVariantMap systemProperties)
+ const QVariantMap &systemProperties)
{
if (m_launched)
return;
@@ -527,4 +478,14 @@ void Controller::updateSlowMode(bool isSlow)
}
#endif // !defined(AM_HEADLESS)
-#include "main.moc"
+
+HeadlessIncubationController::HeadlessIncubationController(QObject *parent)
+ : QObject(parent)
+{
+ startTimer(50);
+}
+
+void HeadlessIncubationController::timerEvent(QTimerEvent *)
+{
+ incubateFor(25);
+}
diff --git a/src/launchers/qml/qml.pro b/src/tools/launcher-qml/launcher-qml.pro
index 43f92ee1..6053c5d8 100644
--- a/src/launchers/qml/qml.pro
+++ b/src/tools/launcher-qml/launcher-qml.pro
@@ -12,8 +12,11 @@ QT *= \
appman_plugininterfaces-private \
appman_launcher-private \
+HEADERS += \
+ launcher-qml_p.h
+
SOURCES += \
- main.cpp \
+ launcher-qml.cpp \
load(qt_tool)
diff --git a/src/tools/launcher-qml/launcher-qml_p.h b/src/tools/launcher-qml/launcher-qml_p.h
new file mode 100644
index 00000000..ce8f8eab
--- /dev/null
+++ b/src/tools/launcher-qml/launcher-qml_p.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Pelagicore Application Manager.
+**
+** $QT_BEGIN_LICENSE:LGPL-QTAS$
+** Commercial License Usage
+** Licensees holding valid commercial Qt Automotive Suite 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 https://www.qt.io/terms-conditions.
+** For further information use the contact form at https://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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: LGPL-3.0
+**
+****************************************************************************/
+
+#pragma once
+
+#include <QObject>
+#include <QVariantMap>
+#include <QQmlIncubationController>
+#include <QQmlApplicationEngine>
+#include <QtAppManCommon/global.h>
+
+QT_FORWARD_DECLARE_CLASS(QTimerEvent)
+QT_FORWARD_DECLARE_CLASS(QQuickWindow)
+
+QT_BEGIN_NAMESPACE_AM
+
+// maybe make this configurable for specific workloads?
+class HeadlessIncubationController : public QObject, public QQmlIncubationController // clazy:exclude=missing-qobject-macro
+{
+public:
+ HeadlessIncubationController(QObject *parent);
+
+protected:
+ void timerEvent(QTimerEvent *) override;
+};
+
+
+class LauncherMain;
+class QmlApplicationInterface;
+
+class Controller : public QObject
+{
+ Q_OBJECT
+
+public:
+ Controller(LauncherMain *a, bool quickLaunched, const QString &directLoad = QString());
+
+public slots:
+ void startApplication(const QString &baseDir, const QString &qmlFile, const QString &document,
+ const QString &mimeType, const QVariantMap &application,
+ const QVariantMap &systemProperties);
+
+private:
+ QQmlApplicationEngine m_engine;
+ QmlApplicationInterface *m_applicationInterface = nullptr;
+ QVariantMap m_configuration;
+ bool m_launched = false;
+ bool m_quickLaunched;
+#if !defined(AM_HEADLESS)
+ QQuickWindow *m_window = nullptr;
+private slots:
+ void updateSlowMode(bool isSlow);
+#endif
+};
+
+QT_END_NAMESPACE_AM
diff --git a/src/tools/testrunner/testrunner.cpp b/src/tools/testrunner/testrunner.cpp
index 7a6f50d2..ec32a014 100644
--- a/src/tools/testrunner/testrunner.cpp
+++ b/src/tools/testrunner/testrunner.cpp
@@ -43,17 +43,15 @@
#include <QCoreApplication>
#include <QEventLoop>
-#include <QObject>
-#include <QPointer>
#include <QQmlEngine>
#include <QRegExp>
#include <QRegularExpression>
#include <qlogging.h>
-#include <QtQml/qqmlpropertymap.h>
#include <QtTest/qtestsystem.h>
#include <private/quicktestresult_p.h>
#include <private/qtestlog_p.h>
+#include "testrunner_p.h"
QT_BEGIN_NAMESPACE
namespace QTest {
@@ -63,77 +61,8 @@ QT_END_NAMESPACE
QT_BEGIN_NAMESPACE_AM
-class QTestRootObject : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(bool windowShown READ windowShown NOTIFY windowShownChanged)
- Q_PROPERTY(bool hasTestCase READ hasTestCase WRITE setHasTestCase NOTIFY hasTestCaseChanged)
- Q_PROPERTY(QObject *defined READ defined)
-
-public:
- QTestRootObject(QObject *parent = nullptr)
- : QObject(parent)
- , m_windowShown(false)
- , m_hasTestCase(false)
- , m_hasQuit(false)
- , m_defined(new QQmlPropertyMap(this))
- {
-#if defined(QT_OPENGL_ES_2_ANGLE)
- m_defined->insert(QLatin1String("QT_OPENGL_ES_2_ANGLE"), QVariant(true));
-#endif
- }
-
- static QTestRootObject *instance()
- {
- static QPointer<QTestRootObject> object = new QTestRootObject;
- if (!object) {
- qWarning("A new test root object has been created, the behavior may be compromised");
- object = new QTestRootObject;
- }
- return object;
- }
-
- bool hasQuit() const { return m_hasQuit; }
-
- bool hasTestCase() const { return m_hasTestCase; }
- void setHasTestCase(bool value) { m_hasTestCase = value; emit hasTestCaseChanged(); }
-
- bool windowShown() const { return m_windowShown; }
- void setWindowShown(bool value) { m_windowShown = value; emit windowShownChanged(); }
- QQmlPropertyMap *defined() const { return m_defined; }
-
- void init() { setWindowShown(false); setHasTestCase(false); m_hasQuit = false; }
-
-Q_SIGNALS:
- void windowShownChanged();
- void hasTestCaseChanged();
-
-private Q_SLOTS:
- void quit() { m_hasQuit = true; }
-
-private:
- bool m_windowShown;
- bool m_hasTestCase;
- bool m_hasQuit;
- QQmlPropertyMap *m_defined;
- friend class TestRunner;
-};
-
-class AmTest : public QObject
-{
- Q_OBJECT
-
- AmTest() {}
-
-public:
- enum MsgType { DebugMsg, WarningMsg, CriticalMsg, FatalMsg, InfoMsg, SystemMsg = CriticalMsg };
- Q_ENUM(MsgType)
-
- static AmTest *instance();
-
- Q_INVOKABLE void ignoreMessage(MsgType type, const char* msg);
- Q_INVOKABLE void ignoreMessage(MsgType type, const QRegExp &expression);
-};
+AmTest::AmTest()
+{}
AmTest *AmTest::instance()
{
@@ -178,6 +107,32 @@ void AmTest::ignoreMessage(MsgType type, const QRegExp &expression)
#endif
}
+
+QTestRootObject::QTestRootObject(QObject *parent)
+ : QObject(parent)
+ , m_windowShown(false)
+ , m_hasTestCase(false)
+ , m_hasQuit(false)
+ , m_defined(new QQmlPropertyMap(this))
+{
+#if defined(QT_OPENGL_ES_2_ANGLE)
+ m_defined->insert(QLatin1String("QT_OPENGL_ES_2_ANGLE"), QVariant(true));
+#endif
+}
+
+QTestRootObject *QTestRootObject::instance()
+{
+ static QPointer<QTestRootObject> object = new QTestRootObject;
+ if (!object) {
+ qWarning("A new test root object has been created, the behavior may be compromised");
+ object = new QTestRootObject;
+ }
+ return object;
+}
+
+
+
+
static QObject *testRootObject(QQmlEngine *engine, QJSEngine *jsEngine)
{
Q_UNUSED(engine);
@@ -237,5 +192,3 @@ int TestRunner::exec(QQmlEngine *engine)
}
QT_END_NAMESPACE_AM
-
-#include "testrunner.moc"
diff --git a/src/tools/testrunner/testrunner.pro b/src/tools/testrunner/testrunner.pro
index 8d26f115..aa4817bd 100644
--- a/src/tools/testrunner/testrunner.pro
+++ b/src/tools/testrunner/testrunner.pro
@@ -9,7 +9,8 @@ CONFIG *= console
QT += qmltest qmltest-private
HEADERS += \
- testrunner.h
+ testrunner.h \
+ testrunner_p.h
SOURCES += \
testrunner.cpp
diff --git a/src/tools/testrunner/testrunner_p.h b/src/tools/testrunner/testrunner_p.h
new file mode 100644
index 00000000..5ba8a3f0
--- /dev/null
+++ b/src/tools/testrunner/testrunner_p.h
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Pelagicore Application Manager.
+**
+** $QT_BEGIN_LICENSE:LGPL-QTAS$
+** Commercial License Usage
+** Licensees holding valid commercial Qt Automotive Suite 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 https://www.qt.io/terms-conditions.
+** For further information use the contact form at https://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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: LGPL-3.0
+**
+****************************************************************************/
+
+#pragma once
+
+#include <QObject>
+#include <QtQml/qqmlpropertymap.h>
+#include <QPointer>
+
+#include <QtAppManCommon/global.h>
+
+QT_BEGIN_NAMESPACE_AM
+
+class QTestRootObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool windowShown READ windowShown NOTIFY windowShownChanged)
+ Q_PROPERTY(bool hasTestCase READ hasTestCase WRITE setHasTestCase NOTIFY hasTestCaseChanged)
+ Q_PROPERTY(QObject *defined READ defined)
+
+public:
+ QTestRootObject(QObject *parent = nullptr);
+
+ static QTestRootObject *instance();
+
+ bool hasQuit() const { return m_hasQuit; }
+
+ bool hasTestCase() const { return m_hasTestCase; }
+ void setHasTestCase(bool value) { m_hasTestCase = value; emit hasTestCaseChanged(); }
+
+ bool windowShown() const { return m_windowShown; }
+ void setWindowShown(bool value) { m_windowShown = value; emit windowShownChanged(); }
+ QQmlPropertyMap *defined() const { return m_defined; }
+
+ void init() { setWindowShown(false); setHasTestCase(false); m_hasQuit = false; }
+
+Q_SIGNALS:
+ void windowShownChanged();
+ void hasTestCaseChanged();
+
+private Q_SLOTS:
+ void quit() { m_hasQuit = true; }
+
+private:
+ bool m_windowShown;
+ bool m_hasTestCase;
+ bool m_hasQuit;
+ QQmlPropertyMap *m_defined;
+ friend class TestRunner;
+};
+
+class AmTest : public QObject
+{
+ Q_OBJECT
+
+ AmTest();
+
+public:
+ enum MsgType { DebugMsg, WarningMsg, CriticalMsg, FatalMsg, InfoMsg, SystemMsg = CriticalMsg };
+ Q_ENUM(MsgType)
+
+ static AmTest *instance();
+
+ Q_INVOKABLE void ignoreMessage(MsgType type, const char* msg);
+ Q_INVOKABLE void ignoreMessage(MsgType type, const QRegExp &expression);
+};
+
+QT_END_NAMESPACE_AM