diff options
author | Bernd Weimer <bernd.weimer@pelagicore.com> | 2017-03-06 16:44:37 +0100 |
---|---|---|
committer | Robert Griebl <robert.griebl@pelagicore.com> | 2017-03-06 18:28:45 +0000 |
commit | bb94bd655067a959e717c3c1564c16339c730095 (patch) | |
tree | da1339c248cce8e01c7bd791b51ef6a418cdca09 | |
parent | efc8305db323daf003558e38d09b07006b05668f (diff) | |
download | qtapplicationmanager-bb94bd655067a959e717c3c1564c16339c730095.tar.gz |
Fix application startup interface and add documentation
The initialize() function of the startup interface gets the
system properties. However, the QML launcher initialized those after the
function was called. The order has been changed now.
Also added documentation for "plugins" configuration.
Change-Id: I5d802ed7cba6ba000de2780e0b858b1ac105368d
Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
-rw-r--r-- | doc/configuration.qdoc | 23 | ||||
-rw-r--r-- | src/launchers/qml/main.cpp | 30 |
2 files changed, 37 insertions, 16 deletions
diff --git a/doc/configuration.qdoc b/doc/configuration.qdoc index 5d5fd780..f5352d16 100644 --- a/doc/configuration.qdoc +++ b/doc/configuration.qdoc @@ -162,7 +162,16 @@ all your imports paths and file references relative to your main config file. \li \b -I \br \e ui/importPaths \li array<string> - \li Add an additional QML import path to the system UI. + \li Adds additional QML import paths to the system UI. +\row + \li \b - + \br \e plugins + \li map<array<string>> + \li A string-to-string-list map that defines plugins that the application-manager should load. + The value must be a list of plugin library file path names. A single plugin will also be + accepted. Currently the only valid key is \c startup. The plugin itself must implement the + \c StartupInterface. The application-manager will call the function hooks during startup of + the system UI. \row \li \b - \target system properties @@ -431,6 +440,18 @@ an additional column specifying which runtime a configuration option applies to: \li array<string> \li Add an additional QML import path for apps started via this runtime. \row + \li \c plugins + \li qml + \li map<array<string>> + \li A string-to-string-list map that defines plugins that the QML runtime should load. The + value must be a list of plugin library file path names. A single plugin will also be + accepted. Currently the only valid keys are \c startup and \c container: + \list + \li \c startup: this plugin must implement the \c StartupInterface. The QML runtime will + call the function hooks during startup of an application. + \li \c container: this plugin must implement the \c ContainerInterface (see \l Containers). + \endlist +\row \li \c quicklaunchQml \li qml \li string diff --git a/src/launchers/qml/main.cpp b/src/launchers/qml/main.cpp index c6dac50b..419c6e3b 100644 --- a/src/launchers/qml/main.cpp +++ b/src/launchers/qml/main.cpp @@ -474,10 +474,24 @@ void Controller::startApplication(const QString &baseDir, const QString &qmlFile return; } + if (m_applicationInterface) { + m_engine.rootContext()->setContextProperty(qSL("ApplicationInterface"), m_applicationInterface); + + QVariantMap &svm = m_applicationInterface->m_systemProperties; + svm = qdbus_cast<QVariantMap>(systemProperties); + for (auto it = svm.begin(); it != svm.end(); ++it) + it.value() = convertFromDBusVariant(it.value()); + + QVariantMap &avm = m_applicationInterface->m_applicationProperties; + avm = qdbus_cast<QVariantMap>(application.value(qSL("applicationProperties"))); + for (auto it = avm.begin(); it != avm.end(); ++it) + it.value() = convertFromDBusVariant(it.value()); + } + QStringList startupPluginFiles = variantToStringList(m_configuration.value(qSL("plugins")).toMap().value(qSL("startup"))); auto startupPlugins = loadPlugins<StartupInterface>("startup", startupPluginFiles); foreach (StartupInterface *iface, startupPlugins) - iface->initialize(m_applicationInterface->systemProperties()); + iface->initialize(m_applicationInterface ? m_applicationInterface->systemProperties() : QVariantMap()); bool loadDummyData = runtimeParameters.value(qSL("loadDummyData")).toBool() || m_configuration.value(qSL("loadDummydata")).toBool(); @@ -500,20 +514,6 @@ void Controller::startApplication(const QString &baseDir, const QString &qmlFile } qCDebug(LogQmlRuntime) << "Qml import paths:" << m_engine.importPathList(); - if (m_applicationInterface) { - m_engine.rootContext()->setContextProperty(qSL("ApplicationInterface"), m_applicationInterface); - - QVariantMap &svm = m_applicationInterface->m_systemProperties; - svm = qdbus_cast<QVariantMap>(systemProperties); - for (auto it = svm.begin(); it != svm.end(); ++it) - it.value() = convertFromDBusVariant(it.value()); - - QVariantMap &avm = m_applicationInterface->m_applicationProperties; - avm = qdbus_cast<QVariantMap>(application.value(qSL("applicationProperties"))); - for (auto it = avm.begin(); it != avm.end(); ++it) - it.value() = convertFromDBusVariant(it.value()); - } - foreach (StartupInterface *iface, startupPlugins) iface->beforeQmlEngineLoad(&m_engine); |