From 21ae572d2152bd52096aef759534a803b98eb50d Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Mon, 26 Sep 2016 02:35:54 +0200 Subject: Reimplemented build-system as a real Qt module This should help with doc generation and actually running the unit-tests in the CI system. Please note that the binaries are now installed into $$[QT_INSTALL_BINS] Change-Id: I6f27ba39f8e5d923e1aeff550ba11c1fbd8ac5cf Reviewed-by: Robert Griebl --- src/manager-lib/abstractcontainer.h | 2 +- src/manager-lib/abstractruntime.h | 4 +- src/manager-lib/application.cpp | 419 --------------------- src/manager-lib/application.h | 200 ---------- src/manager-lib/applicationdatabase.h | 2 +- src/manager-lib/applicationinterface.h | 2 +- src/manager-lib/applicationipcinterface.cpp | 16 +- src/manager-lib/applicationipcinterface.h | 2 +- src/manager-lib/applicationipcinterface_p.h | 2 +- src/manager-lib/applicationipcmanager.cpp | 1 - src/manager-lib/applicationipcmanager.h | 2 +- src/manager-lib/applicationmanager.cpp | 33 +- src/manager-lib/applicationmanager.h | 6 +- src/manager-lib/applicationscanner.h | 70 ---- src/manager-lib/containerfactory.h | 2 +- src/manager-lib/dbus-policy.cpp | 142 ------- src/manager-lib/dbus-policy.h | 66 ---- src/manager-lib/fakeapplicationmanagerwindow.h | 2 +- src/manager-lib/fpsmonitor.h | 2 +- src/manager-lib/installationlocation.cpp | 230 ----------- src/manager-lib/installationlocation.h | 95 ----- src/manager-lib/installationreport.cpp | 262 ------------- src/manager-lib/installationreport.h | 95 ----- src/manager-lib/manager-lib.pro | 78 ++-- src/manager-lib/memorymonitor.cpp | 4 +- src/manager-lib/memorymonitor.h | 2 +- src/manager-lib/nativeruntime.cpp | 4 +- src/manager-lib/nativeruntime.h | 4 +- src/manager-lib/notificationmanager.cpp | 6 +- src/manager-lib/notificationmanager.h | 4 +- src/manager-lib/plugincontainer.h | 2 +- src/manager-lib/processcontainer.h | 2 +- src/manager-lib/processmonitor.h | 4 +- src/manager-lib/qml-utilities.cpp | 70 ---- src/manager-lib/qml-utilities.h | 52 --- src/manager-lib/qmlinprocessapplicationinterface.h | 4 +- src/manager-lib/qmlinprocessruntime.cpp | 2 +- src/manager-lib/qmlinprocessruntime.h | 2 +- src/manager-lib/quicklauncher.cpp | 2 +- src/manager-lib/quicklauncher.h | 2 +- src/manager-lib/runtimefactory.cpp | 2 +- src/manager-lib/runtimefactory.h | 4 +- src/manager-lib/sysfsreader.cpp | 2 +- src/manager-lib/sysfsreader.h | 4 +- src/manager-lib/systemmonitor.cpp | 2 +- src/manager-lib/systemmonitor.h | 2 +- src/manager-lib/systemmonitor_p.h | 2 +- src/manager-lib/window.h | 2 +- src/manager-lib/yamlapplicationscanner.cpp | 209 ---------- src/manager-lib/yamlapplicationscanner.h | 62 --- 50 files changed, 101 insertions(+), 2091 deletions(-) delete mode 100644 src/manager-lib/application.cpp delete mode 100644 src/manager-lib/application.h delete mode 100644 src/manager-lib/applicationscanner.h delete mode 100644 src/manager-lib/dbus-policy.cpp delete mode 100644 src/manager-lib/dbus-policy.h delete mode 100644 src/manager-lib/installationlocation.cpp delete mode 100644 src/manager-lib/installationlocation.h delete mode 100644 src/manager-lib/installationreport.cpp delete mode 100644 src/manager-lib/installationreport.h delete mode 100644 src/manager-lib/qml-utilities.cpp delete mode 100644 src/manager-lib/qml-utilities.h delete mode 100644 src/manager-lib/yamlapplicationscanner.cpp delete mode 100644 src/manager-lib/yamlapplicationscanner.h (limited to 'src/manager-lib') diff --git a/src/manager-lib/abstractcontainer.h b/src/manager-lib/abstractcontainer.h index 8dded8d0..828aa1ce 100644 --- a/src/manager-lib/abstractcontainer.h +++ b/src/manager-lib/abstractcontainer.h @@ -46,7 +46,7 @@ #include #include -#include "global.h" +#include AM_BEGIN_NAMESPACE diff --git a/src/manager-lib/abstractruntime.h b/src/manager-lib/abstractruntime.h index 1e307bf5..804bd6ab 100644 --- a/src/manager-lib/abstractruntime.h +++ b/src/manager-lib/abstractruntime.h @@ -45,7 +45,7 @@ #include #include -#include "global.h" +#include QT_FORWARD_DECLARE_CLASS(QQmlEngine) QT_FORWARD_DECLARE_CLASS(QQuickItem) @@ -85,7 +85,7 @@ private: }; -class AM_EXPORT AbstractRuntime : public QObject +class AbstractRuntime : public QObject { Q_OBJECT Q_PROPERTY(AbstractContainer *container READ container) diff --git a/src/manager-lib/application.cpp b/src/manager-lib/application.cpp deleted file mode 100644 index 46a98690..00000000 --- a/src/manager-lib/application.cpp +++ /dev/null @@ -1,419 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 -** -****************************************************************************/ - -#include -#include -#include - -#include "application.h" -#include "utilities.h" -#include "exception.h" -#include "installationreport.h" -#include "yamlapplicationscanner.h" - -AM_BEGIN_NAMESPACE - -Application::Application() -{ } - -QVariantMap Application::toVariantMap() const -{ - //TODO: only used in the installer -- replace there with code that mimicks - // ApplicationManager::get() to get consistent key names in the objects - - QVariantMap map; - map[qSL("id")] = m_id; - map[qSL("codeFilePath")] = m_codeFilePath; - map[qSL("runtimeName")] = m_runtimeName; - map[qSL("runtimeParameters")] = m_runtimeParameters; - QVariantMap displayName; - for (auto it = m_name.constBegin(); it != m_name.constEnd(); ++it) - displayName.insert(it.key(), it.value()); - map[qSL("displayName")] = displayName; - map[qSL("displayIcon")] = m_icon; - map[qSL("preload")] = m_preload; - map[qSL("importance")] = m_importance; - map[qSL("capabilities")] = m_capabilities; - map[qSL("mimeTypes")] = m_mimeTypes; - map[qSL("categories")] = m_categories; - QString backgroundMode; - switch (m_backgroundMode) { - default: - case Auto: backgroundMode = qSL("Auto"); break; - case Never: backgroundMode = qSL("Never"); break; - case ProvidesVoIP: backgroundMode = qSL("ProvidesVoIP"); break; - case PlaysAudio: backgroundMode = qSL("PlaysAudio"); break; - case TracksLocation: backgroundMode = qSL("TracksLocation"); break; - } - map[qSL("backgroundMode")] = backgroundMode; - map[qSL("version")] = m_version; - map[qSL("baseDir")] = m_baseDir.absolutePath(); - map[qSL("installationLocationId")] = m_installationReport ? m_installationReport->installationLocationId() : QString(); - return map; -} - - -QString Application::id() const -{ - return m_id; -} - -QString Application::absoluteCodeFilePath() const -{ - QString code = m_nonAliased ? m_nonAliased->m_codeFilePath : m_codeFilePath; - return code.isEmpty() ? QString() : baseDir().absoluteFilePath(code); -} - -QString Application::codeFilePath() const -{ - return m_nonAliased ? m_nonAliased->m_codeFilePath : m_codeFilePath; -} - -QString Application::runtimeName() const -{ - return m_nonAliased ? m_nonAliased->m_runtimeName : m_runtimeName; -} - -QVariantMap Application::runtimeParameters() const -{ - return m_nonAliased ? m_nonAliased->m_runtimeParameters : m_runtimeParameters; -} - -QMap Application::names() const -{ - return m_name; -} - -QString Application::name(const QString &language) const -{ - return m_name.value(language); -} - -QString Application::icon() const -{ - return m_icon.isEmpty() ? QString() : baseDir().absoluteFilePath(m_icon); -} - -QString Application::documentUrl() const -{ - return m_documentUrl; -} - -bool Application::isPreloaded() const -{ - return m_nonAliased ? m_nonAliased->m_preload : m_preload; -} - -qreal Application::importance() const -{ - return m_nonAliased ? m_nonAliased->m_importance : m_importance; -} - -bool Application::isBuiltIn() const -{ - return m_nonAliased ? m_nonAliased->m_builtIn : m_builtIn; -} - -bool Application::isAlias() const -{ - return (m_nonAliased); -} - -const Application *Application::nonAliased() const -{ - return m_nonAliased; -} - -QStringList Application::capabilities() const -{ - return m_nonAliased ? m_nonAliased->m_capabilities : m_capabilities; -} - -QStringList Application::supportedMimeTypes() const -{ - return m_nonAliased ? m_nonAliased->m_mimeTypes : m_mimeTypes; -} - -QStringList Application::categories() const -{ - return m_nonAliased ? m_nonAliased->m_categories : m_categories; -} - -Application::Type Application::type() const -{ - return m_nonAliased ? m_nonAliased->m_type : m_type; -} - -Application::BackgroundMode Application::backgroundMode() const -{ - return m_nonAliased ? m_nonAliased->m_backgroundMode : m_backgroundMode; -} - -QString Application::version() const -{ - return m_nonAliased ? m_nonAliased->m_version : m_version; -} - -void Application::validate() const throw(Exception) -{ - if (isAlias()) { - if (!m_id.startsWith(nonAliased()->id())) - throw Exception(Error::Parse, "aliasId '%1' does not match base application id '%2'") - .arg(m_id, nonAliased()->id()); - } - - QString rdnsError; - if (!isValidDnsName(id(), isAlias(), &rdnsError)) - throw Exception(Error::Parse, "the identifier (%1) is not a valid reverse-DNS name: %2").arg(id()).arg(rdnsError); - if (absoluteCodeFilePath().isEmpty()) - throw Exception(Error::Parse, "the 'code' field must not be empty"); - - if (runtimeName().isEmpty()) - throw Exception(Error::Parse, "the 'runtimeName' field must not be empty"); - - if (type() == Gui) { - if (icon().isEmpty()) - throw Exception(Error::Parse, "the 'icon' field must not be empty"); - - if (names().isEmpty()) - throw Exception(Error::Parse, "the 'name' field must not be empty"); - } - - // This check won't work during installations, since icon.png is extracted after info.json - // if (!QFile::exists(displayIcon())) - // throw Exception("the 'icon' field refers to a non-existent file"); - - //TODO: check for valid capabilities -} - - -void Application::mergeInto(Application *app) const -{ - if (app->m_id != m_id) - return; - app->m_codeFilePath = m_codeFilePath; - app->m_runtimeName = m_runtimeName; - app->m_runtimeParameters = m_runtimeParameters; - app->m_name = m_name; - app->m_icon = m_icon; - app->m_preload = m_preload; - app->m_importance = m_importance; - app->m_capabilities = m_capabilities; - app->m_mimeTypes = m_mimeTypes; - app->m_categories = m_categories; - app->m_backgroundMode = m_backgroundMode; - app->m_version = m_version; -} - -const InstallationReport *Application::installationReport() const -{ - return m_installationReport.data(); -} - -void Application::setInstallationReport(InstallationReport *report) -{ - m_installationReport.reset(report); -} - -QDir Application::baseDir() const -{ - switch (m_state) { - default: - case Installed: - return m_baseDir; - case BeingInstalled: - case BeingUpdated: - return QDir(m_baseDir.absolutePath() + QLatin1Char('+')); - case BeingRemoved: - return QDir(m_baseDir.absolutePath() + QLatin1Char('-')); - } -} - -uint Application::uid() const -{ - return m_nonAliased ? m_nonAliased->m_uid : m_uid; -} - -void Application::setBaseDir(const QString &path) -{ - m_baseDir = path; -} - -AbstractRuntime *Application::currentRuntime() const -{ - return m_nonAliased ? m_nonAliased->m_runtime : m_runtime; -} - -void Application::setCurrentRuntime(AbstractRuntime *rt) const -{ - if (m_nonAliased) - m_nonAliased->m_runtime = rt; - else - m_runtime = rt; -} - -bool Application::isLocked() const -{ - return (m_nonAliased ? m_nonAliased->m_locked : m_locked).load() == 1; -} - -bool Application::lock() const -{ - return (m_nonAliased ? m_nonAliased->m_locked : m_locked).testAndSetOrdered(0, 1); -} - -bool Application::unlock() const -{ - return (m_nonAliased ? m_nonAliased->m_locked : m_locked).testAndSetOrdered(1, 0); -} - -Application::State Application::state() const -{ - return m_nonAliased ? m_nonAliased->m_state : m_state; -} - -qreal Application::progress() const -{ - return m_nonAliased ? m_nonAliased->m_progress : m_progress; -} - -Application *Application::readFromDataStream(QDataStream &ds, const QVector &applicationDatabase) throw (Exception) -{ - QScopedPointer app(new Application); - bool isAlias; - qint32 backgroundMode; - QString baseDir; - QByteArray installationReport; - - ds >> app->m_id - >> app->m_codeFilePath - >> app->m_runtimeName - >> app->m_runtimeParameters - >> app->m_name - >> app->m_icon - >> app->m_documentUrl - >> app->m_preload - >> app->m_importance - >> app->m_builtIn - >> isAlias - >> app->m_capabilities - >> app->m_categories - >> app->m_mimeTypes - >> backgroundMode - >> app->m_version - >> baseDir - >> app->m_uid - >> installationReport; - - app->m_capabilities.sort(); - app->m_categories.sort(); - app->m_mimeTypes.sort(); - - app->m_backgroundMode = static_cast(backgroundMode); - app->m_baseDir.setPath(baseDir); - if (!installationReport.isEmpty()) { - QBuffer buffer(&installationReport); - buffer.open(QBuffer::ReadOnly); - app->m_installationReport.reset(new InstallationReport(app->m_id)); - if (!app->m_installationReport->deserialize(&buffer)) - app->m_installationReport.reset(0); - } - - if (isAlias) { - QString baseId = app->m_id.section(qL1C('@'), 0, 0); - bool found = false; - foreach (const Application *otherApp, applicationDatabase) { - if (otherApp->id() == baseId) { - app->m_nonAliased = otherApp; - found = true; - break; - } - } - if (!found) - throw Exception(Error::Parse, "Could not find base app id %1 for alias id %2").arg(baseId, app->m_id); - } - - return app.take(); -} - -void Application::writeToDataStream(QDataStream &ds, const QVector &applicationDatabase) const throw (Exception) -{ - QByteArray serializedReport; - - if (auto report = installationReport()) { - QBuffer buffer(&serializedReport); - buffer.open(QBuffer::WriteOnly); - report->serialize(&buffer); - } - - ds << m_id - << m_codeFilePath - << m_runtimeName - << m_runtimeParameters - << m_name - << m_icon - << m_documentUrl - << m_preload - << m_importance - << m_builtIn - << bool(m_nonAliased && applicationDatabase.contains(m_nonAliased)) - << m_capabilities - << m_categories - << m_mimeTypes - << qint32(m_backgroundMode) - << m_version - << m_baseDir.absolutePath() - << m_uid - << serializedReport; -} - -AM_END_NAMESPACE - -QDebug operator<<(QDebug debug, const AM_PREPEND_NAMESPACE(Application) *app) -{ - debug << "App Object:"; - if (app) - debug << app->toVariantMap(); - else - debug << "(null)"; - return debug; -} - diff --git a/src/manager-lib/application.h b/src/manager-lib/application.h deleted file mode 100644 index 226c146c..00000000 --- a/src/manager-lib/application.h +++ /dev/null @@ -1,200 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 -#include -#include -#include -#include - -#include "global.h" -#include "installationreport.h" -#include "exception.h" - -AM_BEGIN_NAMESPACE - -class AbstractRuntime; -class ApplicationManager; -class JsonApplicationScanner; -class InstallationReport; - -class AM_EXPORT Application : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QString id READ id) - Q_PROPERTY(QString runtimeName READ runtimeName) - Q_PROPERTY(QVariantMap runtimeParameters READ runtimeParameters) - Q_PROPERTY(QString icon READ icon) - Q_PROPERTY(QString documentUrl READ documentUrl) - Q_PROPERTY(qreal importance READ importance) - Q_PROPERTY(bool builtIn READ isBuiltIn) - Q_PROPERTY(bool alias READ isAlias) - Q_PROPERTY(bool preload READ isPreloaded) - Q_PROPERTY(const AM_PREPEND_NAMESPACE(Application) *nonAliased READ nonAliased) - Q_PROPERTY(QStringList capabilities READ capabilities) - Q_PROPERTY(QStringList supportedMimeTypes READ supportedMimeTypes) - Q_PROPERTY(QStringList categories READ categories) - Q_PROPERTY(AM_PREPEND_NAMESPACE(AbstractRuntime) *runtime READ currentRuntime) - -public: - enum Type { Gui, Headless }; - - QString id() const; - QString absoluteCodeFilePath() const; - QString codeFilePath() const; - QString runtimeName() const; - QVariantMap runtimeParameters() const; - QMap names() const; - Q_INVOKABLE QString name(const QString &language) const; - QString icon() const; - QString documentUrl() const; - - bool isPreloaded() const; - qreal importance() const; - bool isBuiltIn() const; - bool isAlias() const; - const Application *nonAliased() const; - - QStringList capabilities() const; - QStringList supportedMimeTypes() const; - QStringList categories() const; - Type type() const; - - enum BackgroundMode - { - Auto, - Never, - ProvidesVoIP, - PlaysAudio, - TracksLocation - }; - BackgroundMode backgroundMode() const; - - QString version() const; - - void validate() const throw (Exception); - QVariantMap toVariantMap() const; - static Application *fromVariantMap(const QVariantMap &map, QString *error = 0); - void mergeInto(Application *app) const; - - const InstallationReport *installationReport() const; - void setInstallationReport(InstallationReport *report); - QDir baseDir() const; - uint uid() const; - - // dynamic part - AbstractRuntime *currentRuntime() const; - void setCurrentRuntime(AbstractRuntime *rt) const; - bool isLocked() const; - bool lock() const; - bool unlock() const; - - enum State { - Installed, - BeingInstalled, - BeingUpdated, - BeingRemoved - }; - State state() const; - qreal progress() const; - - void setBaseDir(const QString &path); //TODO: replace baseDir handling with something that works :) - -private: - Application(); - - // static part from info.json - QString m_id; - - QString m_codeFilePath; // relative to info.json location - QString m_runtimeName; - QVariantMap m_runtimeParameters; - QMap m_name; // language -> name - QString m_icon; // relative to info.json location - QString m_documentUrl; - - bool m_preload = false; - qreal m_importance = 0; // relative to all others, with 0 being "normal" - bool m_builtIn = false; // system app - not removable - const Application *m_nonAliased = nullptr; // builtin only - multiple icons for the same app - - QStringList m_capabilities; - QStringList m_categories; - QStringList m_mimeTypes; - - BackgroundMode m_backgroundMode = Auto; - - QString m_version; - - // added by installer - QScopedPointer m_installationReport; - QDir m_baseDir; - uint m_uid = uint(-1); // unix user id - move to installationReport - - Type m_type = Gui; - - // dynamic part - mutable AbstractRuntime *m_runtime = 0; - mutable QAtomicInt m_locked; - mutable QAtomicInt m_mounted; - - mutable State m_state = Installed; - mutable qreal m_progress = 0; - - friend class YamlApplicationScanner; - friend class ApplicationManager; // needed to update installation status - friend class ApplicationDatabase; // needed to create Application objects - friend class InstallationTask; // needed to set m_uid and m_builtin during the installation - - static Application *readFromDataStream(QDataStream &ds, const QVector &applicationDatabase) throw(Exception); - void writeToDataStream(QDataStream &ds, const QVector &applicationDatabase) const throw(Exception); - - Q_DISABLE_COPY(Application) -}; - -AM_END_NAMESPACE - -Q_DECLARE_METATYPE(const AM_PREPEND_NAMESPACE(Application *)) - -QDebug operator<<(QDebug debug, const AM_PREPEND_NAMESPACE(Application) *app); diff --git a/src/manager-lib/applicationdatabase.h b/src/manager-lib/applicationdatabase.h index a4748083..a0b22bcb 100644 --- a/src/manager-lib/applicationdatabase.h +++ b/src/manager-lib/applicationdatabase.h @@ -44,7 +44,7 @@ #include #include -#include "exception.h" +#include AM_BEGIN_NAMESPACE diff --git a/src/manager-lib/applicationinterface.h b/src/manager-lib/applicationinterface.h index df09cdbc..766507df 100644 --- a/src/manager-lib/applicationinterface.h +++ b/src/manager-lib/applicationinterface.h @@ -44,7 +44,7 @@ #include #include #include -#include "global.h" +#include AM_BEGIN_NAMESPACE diff --git a/src/manager-lib/applicationipcinterface.cpp b/src/manager-lib/applicationipcinterface.cpp index f390569d..d847b59a 100644 --- a/src/manager-lib/applicationipcinterface.cpp +++ b/src/manager-lib/applicationipcinterface.cpp @@ -232,7 +232,7 @@ IpcProxyObject::IpcProxyObject(QObject *object, const QString &serviceName, cons // handle our annotation mechanism to add types to method parameters if (propName.startsWith(TYPE_ANNOTATION_PREFIX)) { - QString slotName = propName.mid(qstrlen(TYPE_ANNOTATION_PREFIX)); + QByteArray slotName = propName.mid(qstrlen(TYPE_ANNOTATION_PREFIX)); bool found = false; foreach (int slotIndex, m_slots) { QMetaMethod mm = mo->method(slotIndex); @@ -475,7 +475,7 @@ QString IpcProxyObject::introspect(const QString &path) const bool IpcProxyObject::handleMessage(const QDBusMessage &message, const QDBusConnection &connection) { QString interface = message.interface(); - QString function = message.member(); + QByteArray function = message.member().toLatin1(); const QMetaObject *mo = m_object->metaObject(); m_sender = m_connectionNamesToApplicationIds.value(connection.name()); @@ -549,8 +549,8 @@ bool IpcProxyObject::handleMessage(const QDBusMessage &message, const QDBusConne const QMetaObject *mo = m_object->metaObject(); - if (function == qL1S("Get")) { - QString name = message.arguments().at(1).toString(); + if (function == "Get") { + QByteArray name = message.arguments().at(1).toString().toLatin1(); QVariant result; foreach (int pi, m_properties) { @@ -568,10 +568,10 @@ bool IpcProxyObject::handleMessage(const QDBusMessage &message, const QDBusConne connection.call(message.createErrorReply(QDBusError::UnknownProperty, qL1S("unknown property"))); return true; - } else if (function == qL1S("GetAll")) { + } else if (function == "GetAll") { //TODO - } else if (function == qL1S("Set")) { - QString name = message.arguments().at(1).toString(); + } else if (function == "Set") { + QByteArray name = message.arguments().at(1).toString().toLatin1(); foreach (int pi, m_properties) { QMetaProperty mp = mo->property(pi); @@ -637,7 +637,7 @@ void IpcProxyObject::relaySignal(int signalIndex, void **argv) args << convertFromJSVariant(QVariant(mm.parameterType(i), argv[i + 1])); } - QDBusMessage message = QDBusMessage::createSignal(pathName, m_interfaceName, mm.name()); + QDBusMessage message = QDBusMessage::createSignal(pathName, m_interfaceName, qL1S(mm.name())); message.setArguments(args); connection.send(message); diff --git a/src/manager-lib/applicationipcinterface.h b/src/manager-lib/applicationipcinterface.h index 36de5af0..02f5b7f6 100644 --- a/src/manager-lib/applicationipcinterface.h +++ b/src/manager-lib/applicationipcinterface.h @@ -46,7 +46,7 @@ #if defined(QT_DBUS_LIB) # include #endif -#include "global.h" +#include AM_BEGIN_NAMESPACE diff --git a/src/manager-lib/applicationipcinterface_p.h b/src/manager-lib/applicationipcinterface_p.h index 9bfc2b3f..fd7f03b6 100644 --- a/src/manager-lib/applicationipcinterface_p.h +++ b/src/manager-lib/applicationipcinterface_p.h @@ -48,7 +48,7 @@ #if defined(QT_DBUS_LIB) # include #endif -#include "global.h" +#include AM_BEGIN_NAMESPACE diff --git a/src/manager-lib/applicationipcmanager.cpp b/src/manager-lib/applicationipcmanager.cpp index 37d642d3..a94bb132 100644 --- a/src/manager-lib/applicationipcmanager.cpp +++ b/src/manager-lib/applicationipcmanager.cpp @@ -97,7 +97,6 @@ QObject *ApplicationIPCManager::instanceForQml(QQmlEngine *qmlEngine, QJSEngine return instance(); } - ApplicationIPCManager::ApplicationIPCManager(QObject *parent) : QObject(parent) { } diff --git a/src/manager-lib/applicationipcmanager.h b/src/manager-lib/applicationipcmanager.h index 1fa32fdb..84a8de9b 100644 --- a/src/manager-lib/applicationipcmanager.h +++ b/src/manager-lib/applicationipcmanager.h @@ -45,7 +45,7 @@ #include #include #include -#include "global.h" +#include AM_BEGIN_NAMESPACE diff --git a/src/manager-lib/applicationmanager.cpp b/src/manager-lib/applicationmanager.cpp index 4c71e7ff..50e84229 100644 --- a/src/manager-lib/applicationmanager.cpp +++ b/src/manager-lib/applicationmanager.cpp @@ -46,7 +46,9 @@ #include #include #include -#include +#if defined(QT_GUI_LIB) +# include +#endif #include "global.h" @@ -68,7 +70,7 @@ #define AM_AUTHENTICATE_DBUS(RETURN_TYPE) \ do { \ - if (!checkDBusPolicy(this, d->dbusPolicy, __FUNCTION__)) \ + if (!checkDBusPolicy(this, d->dbusPolicy, __FUNCTION__, [](qint64 pid) -> QStringList { return ApplicationManager::instance()->capabilities(ApplicationManager::instance()->identifyApplication(pid)); })) \ return RETURN_TYPE(); \ } while (false); @@ -335,7 +337,7 @@ ApplicationManager *ApplicationManager::createInstance(ApplicationDatabase *adb, am->registerMimeTypes(); } catch (const Exception &e) { if (error) - *error = e.what(); + *error = e.errorString(); return 0; } @@ -595,8 +597,10 @@ void ApplicationManager::registerMimeTypes() schemes << mime.mid(pos + 1); } } +#if defined(QT_GUI_LIB) foreach (const QString &scheme, schemes) QDesktopServices::setUrlHandler(scheme, this, "openUrlRelay"); +#endif } bool ApplicationManager::startApplication(const Application *app, const QString &documentUrl, @@ -830,6 +834,8 @@ bool ApplicationManager::startApplication(const QString &id, const AM_PREPEND_NA else if (which == qL1S("err")) redirectStd[2] = dup(fd); } +#else + Q_UNUSED(redirections) #endif return startApplication(fromId(id), documentUrl, qSL("--internal-redirect-only--"), redirectStd); } @@ -853,6 +859,8 @@ bool ApplicationManager::debugApplication(const QString &id, const QString &debu else if (which == qL1S("err")) redirectStd[2] = dup(fd); } +#else + Q_UNUSED(redirections) #endif return startApplication(fromId(id), documentUrl, debugWrapper, redirectStd); } @@ -935,11 +943,7 @@ QStringList ApplicationManager::capabilities(const QString &id) const AM_AUTHENTICATE_DBUS(QStringList) const Application *app = fromId(id); - - if (!app) - return QStringList(); - - return app->capabilities(); + return app ? app->capabilities() : QStringList(); } /*! @@ -954,12 +958,8 @@ QString ApplicationManager::identifyApplication(qint64 pid) const { AM_AUTHENTICATE_DBUS(QString) - const Application *app1 = fromProcessId(pid); - - if (app1) - return app1->id(); - else - return QString(); + const Application *app = fromProcessId(pid); + return app ? app->id() : QString(); } bool ApplicationManager::lockApplication(const QString &id) @@ -991,7 +991,6 @@ bool ApplicationManager::startingApplicationInstallation(Application *installApp if (!installApp || installApp->id().isEmpty()) return false; const Application *app = fromId(installApp->id()); - if (!RuntimeFactory::instance()->manager(installApp->runtimeName())) return false; @@ -1156,7 +1155,7 @@ void ApplicationManager::emitDataChanged(const Application *app, const QVectorroleNames[role]; + stringRoles << qL1S(d->roleNames[role]); emit applicationChanged(app->id(), stringRoles); } } @@ -1282,7 +1281,7 @@ QVariantMap ApplicationManager::get(int row) const QVariantMap map; QHash roles = roleNames(); for (auto it = roles.begin(); it != roles.end(); ++it) - map.insert(it.value(), data(index(row), it.key())); + map.insert(qL1S(it.value()), data(index(row), it.key())); return map; } diff --git a/src/manager-lib/applicationmanager.h b/src/manager-lib/applicationmanager.h index 9671fea4..8ece8096 100644 --- a/src/manager-lib/applicationmanager.h +++ b/src/manager-lib/applicationmanager.h @@ -48,9 +48,9 @@ #if defined(QT_DBUS_LIB) # include # include -# include "dbus-utilities.h" +# include #endif -#include "global.h" +#include QT_FORWARD_DECLARE_CLASS(QDir) QT_FORWARD_DECLARE_CLASS(QQmlEngine) @@ -166,7 +166,7 @@ private slots: // need to use BlockingQueuedConnections bool lockApplication(const QString &id); bool unlockApplication(const QString &id); - bool startingApplicationInstallation(AM_PREPEND_NAMESPACE(Application) *installApp); + bool startingApplicationInstallation(AM_PREPEND_NAMESPACE(Application*) installApp); bool startingApplicationRemoval(const QString &id); void progressingApplicationInstall(const QString &id, qreal progress); bool finishedApplicationInstall(const QString &id); diff --git a/src/manager-lib/applicationscanner.h b/src/manager-lib/applicationscanner.h deleted file mode 100644 index 8a50dea0..00000000 --- a/src/manager-lib/applicationscanner.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 - -#include "exception.h" - -AM_BEGIN_NAMESPACE - -class Application; - -class ApplicationScanner -{ -public: - virtual ~ApplicationScanner() = default; - - virtual Application *scan(const QString &filePath) throw (Exception) = 0; - virtual Application *scanAlias(const QString &filePath, const Application *application) throw (Exception) = 0; - - virtual QString metaDataFileName() const = 0; - -protected: - ApplicationScanner() = default; - static bool validate(const Application *app, QString *error = 0); - -private: - Q_DISABLE_COPY(ApplicationScanner) -}; - -AM_END_NAMESPACE diff --git a/src/manager-lib/containerfactory.h b/src/manager-lib/containerfactory.h index dea2e66d..48c58d69 100644 --- a/src/manager-lib/containerfactory.h +++ b/src/manager-lib/containerfactory.h @@ -44,7 +44,7 @@ #include #include -#include "global.h" +#include AM_BEGIN_NAMESPACE diff --git a/src/manager-lib/dbus-policy.cpp b/src/manager-lib/dbus-policy.cpp deleted file mode 100644 index 65bd0de0..00000000 --- a/src/manager-lib/dbus-policy.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 -** -****************************************************************************/ - -#include - -#include "applicationmanager.h" -#include "application.h" -#include "utilities.h" -#include "dbus-policy.h" - -AM_BEGIN_NAMESPACE - -QMap parseDBusPolicy(const QVariantMap &yamlFragment) -{ - QMap result; - -#if defined(QT_DBUS_LIB) - for (auto it = yamlFragment.cbegin(); it != yamlFragment.cend(); ++it) { - const QVariantMap &policy = it->toMap(); - DBusPolicy dbp; - - bool ok; - const QVariantList uidList = policy.value(qSL("uids")).toList(); - foreach (const QVariant &v, uidList) { - uint uid = v.toUInt(&ok); - if (ok) - dbp.m_uids << uid; - } - qSort(dbp.m_uids); - dbp.m_executables = variantToStringList(policy.value(qSL("executables"))); - dbp.m_executables.sort(); - dbp.m_capabilities = variantToStringList(policy.value(qSL("capabilities"))); - dbp.m_capabilities.sort(); - - result.insert(it.key().toLocal8Bit(), dbp); - } -#else - Q_UNUSED(yamlFragment) -#endif - return result; -} - - -bool checkDBusPolicy(const QDBusContext *dbusContext, const QMap &dbusPolicy, const QByteArray &function) -{ -#if !defined(QT_DBUS_LIB) || defined(Q_OS_WIN) - Q_UNUSED(dbusContext) - Q_UNUSED(dbusPolicy) - Q_UNUSED(function) - return true; -#else - if (!dbusContext->calledFromDBus()) - return true; - - auto ip = dbusPolicy.find(function); - if (ip == dbusPolicy.cend()) - return true; - - try { - uint pid = uint(-1); - - if (!ip->m_capabilities.isEmpty()) { - pid = dbusContext->connection().interface()->servicePid(dbusContext->message().service()); - const Application *app = ApplicationManager::instance()->fromProcessId(pid); - if (!app) - throw "not an app with capabilities"; - QStringList appCaps = app->capabilities(); - bool match = false; - foreach (const QString &cap, ip->m_capabilities) { - if (qBinaryFind(appCaps, cap) != appCaps.cend()) - match = true; - } - if (!match) - throw "insufficient capabilities"; - } - if (!ip->m_executables.isEmpty()) { -# ifdef Q_OS_LINUX - if (pid == uint(-1)) - pid = dbusContext->connection().interface()->servicePid(dbusContext->message().service()); - QString executable = QFileInfo("/proc/" + QByteArray::number(pid) + "/exe").symLinkTarget(); - if (executable.isEmpty()) - throw "cannot get executable"; - if (qBinaryFind(ip->m_executables, executable) == ip->m_executables.cend()) - throw "executable blocked"; -# else - throw false; -# endif - } - if (!ip->m_uids.isEmpty()) { - uint uid = dbusContext->connection().interface()->serviceUid(dbusContext->message().service()); - if (qBinaryFind(ip->m_uids, uid) == ip->m_uids.cend()) - throw "uid blocked"; - } - - return true; - - } catch (const char *msg) { - dbusContext->sendErrorReply(QDBusError::AccessDenied, QString::fromLatin1("Protected function call (%1)").arg(msg)); - return false; - } -#endif -} - -AM_END_NAMESPACE diff --git a/src/manager-lib/dbus-policy.h b/src/manager-lib/dbus-policy.h deleted file mode 100644 index 36e8eba9..00000000 --- a/src/manager-lib/dbus-policy.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 "global.h" - -#if defined(QT_DBUS_LIB) -QT_FORWARD_DECLARE_CLASS(QDBusContext) -#else -typedef QObject QDBusContext; // evil hack :) -#endif - -AM_BEGIN_NAMESPACE - -struct DBusPolicy -{ - QList m_uids; - QStringList m_executables; - QStringList m_capabilities; -}; - -QMap parseDBusPolicy(const QVariantMap &yamlFragment); - -bool checkDBusPolicy(const QDBusContext *dbusContext, const QMap &dbusPolicy, const QByteArray &function); - -AM_END_NAMESPACE - diff --git a/src/manager-lib/fakeapplicationmanagerwindow.h b/src/manager-lib/fakeapplicationmanagerwindow.h index b09d59b8..b12f022f 100644 --- a/src/manager-lib/fakeapplicationmanagerwindow.h +++ b/src/manager-lib/fakeapplicationmanagerwindow.h @@ -43,7 +43,7 @@ #include #include -#include "global.h" +#include AM_BEGIN_NAMESPACE diff --git a/src/manager-lib/fpsmonitor.h b/src/manager-lib/fpsmonitor.h index 325f06b9..c2a630dd 100644 --- a/src/manager-lib/fpsmonitor.h +++ b/src/manager-lib/fpsmonitor.h @@ -42,7 +42,7 @@ #pragma once #include -#include "global.h" +#include AM_BEGIN_NAMESPACE diff --git a/src/manager-lib/installationlocation.cpp b/src/manager-lib/installationlocation.cpp deleted file mode 100644 index cdad40d1..00000000 --- a/src/manager-lib/installationlocation.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 -** -****************************************************************************/ - -#include - -#include "installationlocation.h" -#include "global.h" -#include "utilities.h" -#include "exception.h" - -AM_BEGIN_NAMESPACE - -static QString fixPath(const QString &path) -{ - QString realPath = path; - realPath.replace(qL1S("@HARDWARE-ID@"), hardwareId()); - QDir dir(realPath); - return (dir.exists() ? dir.canonicalPath() : dir.absolutePath()) + qL1C('/'); -} - -bool InstallationLocation::operator==(const InstallationLocation &other) const -{ - return (m_type == other.m_type) - && (m_index == other.m_index) - && (m_installationPath == other.m_installationPath) - && (m_documentPath == other.m_documentPath) - && (m_mountPoint == other.m_mountPoint); -} - -InstallationLocation::Type InstallationLocation::typeFromString(const QString &str) -{ - for (Type t: { Invalid, Internal, Removable}) { - if (typeToString(t) == str) - return t; - } - return Invalid; -} - -QString InstallationLocation::typeToString(Type type) -{ - switch (type) { - default: - case Invalid: return qSL("invalid"); - case Internal: return qSL("internal"); - case Removable: return qSL("removable"); - } -} - -QString InstallationLocation::id() const -{ - QString name = typeToString(m_type); - if (m_type != Invalid) - name = name + QLatin1Char('-') + QString::number(m_index); - return name; -} - -InstallationLocation::Type InstallationLocation::type() const -{ - return m_type; -} - -int InstallationLocation::index() const -{ - return m_index; -} - -bool InstallationLocation::isValid() const -{ - return m_type != Invalid; -} - -bool InstallationLocation::isDefault() const -{ - return m_isDefault; -} - -bool InstallationLocation::isRemovable() const -{ - return m_type == Removable; -} - -bool InstallationLocation::isMounted() const -{ - if (!isRemovable()) - return true; - else if (m_mountPoint.isEmpty()) - return false; - else - return mountedDirectories().uniqueKeys().contains(QDir(m_mountPoint).canonicalPath()); -} - -QString InstallationLocation::installationPath() const -{ - return m_installationPath; -} - -QString InstallationLocation::documentPath() const -{ - return m_documentPath; -} - -QVariantMap InstallationLocation::toVariantMap() const -{ - QVariantMap map; - map[qSL("id")] = id(); - map[qSL("type")] = typeToString(type()); - map[qSL("index")] = index(); - map[qSL("installationPath")] = installationPath(); - map[qSL("documentPath")] = documentPath(); - map[qSL("isRemovable")] = isRemovable(); - map[qSL("isDefault")] = isDefault(); - - bool mounted = isMounted(); - - quint64 total = 0, free = 0; - if (mounted) - diskUsage(installationPath(), &total, &free); - - map[qSL("isMounted")] = mounted; - map[qSL("installationDeviceSize")] = total; - map[qSL("installationDeviceFree")] = free; - - total = free = 0; - if (mounted) - diskUsage(documentPath(), &total, &free); - - map[qSL("documentDeviceSize")] = total; - map[qSL("documentDeviceFree")] = free; - - return map; -} - -QString InstallationLocation::mountPoint() const -{ - return m_mountPoint; -} - -QVector InstallationLocation::parseInstallationLocations(const QVariantList &list) throw (Exception) -{ - QVector locations; - bool gotDefault = false; - - foreach (const QVariant &v, list) { - QVariantMap map = v.toMap(); - - QString id = map.value(qSL("id")).toString(); - QString instPath = map.value(qSL("installationPath")).toString(); - QString documentPath = map.value(qSL("documentPath")).toString(); - QString mountPoint = map.value(qSL("mountPoint")).toString(); - bool isDefault = map.value(qSL("isDefault")).toBool(); - - if (isDefault) { - if (!gotDefault) - gotDefault = true; - else - throw Exception(Error::Parse, "multiple default installation locations defined"); - } - - Type type = InstallationLocation::typeFromString(id.section('-', 0, 0)); - bool ok = false; - int index = id.section('-', 1).toInt(&ok); - - if ((type != Invalid) && (index >= 0) && ok) { - InstallationLocation il; - il.m_type = type; - il.m_index = index; - il.m_installationPath = fixPath(instPath); - il.m_documentPath = fixPath(documentPath); - il.m_mountPoint = mountPoint; - il.m_isDefault = isDefault; - - //RG: should we disallow Removable locations to be the default location? - - if (!il.isRemovable()) { - if (!QDir::root().mkpath(instPath)) - throw Exception(Error::Parse, "the app directory %2 for the installation location %1 does not exist although the location is not removable").arg(id).arg(instPath); - if (!QDir::root().mkpath(documentPath)) - throw Exception(Error::Parse, "the doc directory %2 for the installation location %1 does not exist although the location is not removable").arg(id).arg(documentPath); - } - locations.append(il); - } else { - throw Exception(Error::Parse, "could not parse the installation location with id %1").arg(id); - } - } - - if (locations.isEmpty()) - throw Exception(Error::Parse, "no installation locations defined in config file"); - - return locations; -} - -AM_END_NAMESPACE diff --git a/src/manager-lib/installationlocation.h b/src/manager-lib/installationlocation.h deleted file mode 100644 index 478e38e9..00000000 --- a/src/manager-lib/installationlocation.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 -#include - -#include "exception.h" - -AM_BEGIN_NAMESPACE - -class InstallationLocation -{ -public: - enum Type { - Invalid = -1, - Internal, - Removable, - }; - - static const InstallationLocation invalid; - - bool operator==(const InstallationLocation &other) const; - inline bool operator!=(const InstallationLocation &other) const { return !((*this) == other); } - - QString id() const; - Type type() const; - int index() const; - - QString installationPath() const; - QString documentPath() const; - - bool isValid() const; - bool isDefault() const; - bool isRemovable() const; - bool isMounted() const; - - QVariantMap toVariantMap() const; - - QString mountPoint() const; // debug only / not exported to QVariantMap - - static Type typeFromString(const QString &str); - static QString typeToString(Type type); - - static QVector parseInstallationLocations(const QVariantList &list) throw (Exception); - -private: - Type m_type = Invalid; - int m_index = 0; - bool m_isDefault = false; - QString m_installationPath; - QString m_documentPath; - QString m_mountPoint; -}; - -AM_END_NAMESPACE diff --git a/src/manager-lib/installationreport.cpp b/src/manager-lib/installationreport.cpp deleted file mode 100644 index 22f9486d..00000000 --- a/src/manager-lib/installationreport.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 -** -****************************************************************************/ - -#include -#include -#include -#include - -#include - -#include "global.h" -#include "qtyaml.h" -#include "utilities.h" -#include "digestfilter.h" -#include "installationreport.h" - -AM_BEGIN_NAMESPACE - -// you can generate a new set with -// xxd -i <(dd if=/dev/urandom bs=64 count=1) -static const unsigned char privateHmacKeyData[64] = { - 0xd8, 0xde, 0x41, 0x25, 0xee, 0x24, 0xd0, 0x19, 0xa2, 0x43, 0x06, 0x22, - 0x30, 0xa4, 0x87, 0xf0, 0x12, 0x07, 0xe9, 0xd3, 0x1c, 0xd4, 0x6f, 0xd6, - 0x1c, 0xc5, 0x38, 0x22, 0x2d, 0x7a, 0xe9, 0x90, 0x1e, 0xdf, 0xc8, 0x85, - 0x86, 0x96, 0xc4, 0x64, 0xc5, 0x59, 0xee, 0xc4, 0x69, 0xb6, 0x0f, 0x94, - 0x5c, 0xb0, 0x2a, 0xf0, 0xf1, 0xc0, 0x8a, 0x7a, 0xf0, 0xf6, 0x3f, 0x17, - 0xe6, 0xab, 0x2e, 0xc7 -}; - - -InstallationReport::InstallationReport(const QString &applicationId) - : m_applicationId(applicationId) -{ } - -QString InstallationReport::applicationId() const -{ - return m_applicationId; -} - -void InstallationReport::setApplicationId(const QString &applicationId) -{ - m_applicationId = applicationId; -} - -QString InstallationReport::installationLocationId() const -{ - return m_installationLocationId; -} - -void InstallationReport::setInstallationLocationId(const QString &installationLocationId) -{ - m_installationLocationId = installationLocationId; -} - -QByteArray InstallationReport::digest() const -{ - return m_digest; -} - -void InstallationReport::setDigest(const QByteArray &digest) -{ - m_digest = digest; -} - -quint64 InstallationReport::diskSpaceUsed() const -{ - return m_diskSpaceUsed; -} - -void InstallationReport::setDiskSpaceUsed(quint64 diskSpaceUsed) -{ - m_diskSpaceUsed = diskSpaceUsed; -} - -QByteArray InstallationReport::developerSignature() const -{ - return m_developerSignature; -} - -void InstallationReport::setDeveloperSignature(const QByteArray &developerSignature) -{ - m_developerSignature = developerSignature; -} - -QByteArray InstallationReport::storeSignature() const -{ - return m_storeSignature; -} - -void InstallationReport::setStoreSignature(const QByteArray &storeSignature) -{ - m_storeSignature = storeSignature; -} - -QStringList InstallationReport::files() const -{ - return m_files; -} - -void InstallationReport::addFile(const QString &file) -{ - m_files << file; -} - -void InstallationReport::addFiles(const QStringList &files) -{ - m_files << files; -} - -bool InstallationReport::isValid() const -{ - return isValidDnsName(m_applicationId) && !m_digest.isEmpty() && !m_files.isEmpty(); -} - -bool InstallationReport::deserialize(QIODevice *from) -{ - if (!from || !from->isReadable() || (from->size() > 2*1024*1024)) - return false; - - m_digest.clear(); - m_files.clear(); - - QtYaml::ParseError error; - QVector docs = QtYaml::variantDocumentsFromYaml(from->readAll(), &error); - - if (error.error != QJsonParseError::NoError) - return false; - - if ((docs.size() != 3) - || (docs.first().toMap().value(qSL("formatType")).toString() != qL1S("am-installation-report")) - || (docs.first().toMap().value(qSL("formatVersion")).toInt(0) != 1)) { - return false; - } - - const QVariantMap &root = docs.at(1).toMap(); - - try { - if (m_applicationId.isEmpty()) { - m_applicationId = root[qSL("applicationId")].toString(); - if (m_applicationId.isEmpty()) - throw false; - } else if (root[qSL("applicationId")].toString() != m_applicationId) { - throw false; - } - - m_installationLocationId = root[qSL("installationLocationId")].toString(); - m_diskSpaceUsed = root[qSL("diskSpaceUsed")].toULongLong(); - m_digest = QByteArray::fromHex(root[qSL("digest")].toString().toLatin1()); - if (m_digest.isEmpty()) - throw false; - - auto devSig = root.find(qSL("developerSignature")); - if (devSig != root.end()) { - m_developerSignature = QByteArray::fromBase64(devSig.value().toString().toLatin1()); - if (m_developerSignature.isEmpty()) - throw false; - } - auto storeSig = root.find(qSL("storeSignature")); - if (storeSig != root.end()) { - m_storeSignature = QByteArray::fromBase64(storeSig.value().toString().toLatin1()); - if (m_storeSignature.isEmpty()) - throw false; - } - m_files = root[qSL("files")].toStringList(); - if (m_files.isEmpty()) - throw false; - - // see if the file has been tampered with by checking the hmac - QByteArray hmacFile = QByteArray::fromHex(docs[2].toMap().value(qSL("hmac")).toString().toLatin1()); - QByteArray hmacKey = QByteArray::fromRawData((const char *) privateHmacKeyData, sizeof(privateHmacKeyData)); - QByteArray hmacCalc= HMACFilter::hmac(HMACFilter::Sha256, hmacKey, QtYaml::yamlFromVariantDocuments({ docs[0], docs[1] }, QtYaml::BlockStyle)); - - if (hmacFile != hmacCalc) - throw false; - - return true; - } catch (bool) { - m_digest.clear(); - m_diskSpaceUsed = 0; - m_files.clear(); - - return false; - } -} - -bool InstallationReport::serialize(QIODevice *to) const -{ - if (!isValid() || !to || !to->isWritable()) - return false; - - QVariantMap header { - { "formatVersion", 1 }, - { "formatType", "am-installation-report" } - }; - QVariantMap root { - { qSL("applicationId"), applicationId() }, - { qSL("installationLocationId"), installationLocationId() }, - { qSL("diskSpaceUsed"), diskSpaceUsed() }, - { qSL("digest"), QLatin1String(digest().toHex()) } - }; - if (!m_developerSignature.isEmpty()) - root[qSL("developerSignature")] = QLatin1String(m_developerSignature.toBase64()); - if (!m_storeSignature.isEmpty()) - root[qSL("storeSignature")] = QLatin1String(m_storeSignature.toBase64()); - - root[qSL("files")] = files(); - - QVector docs; - docs << header; - docs << root; - - // generate hmac to prevent tampering - QByteArray hmacKey = QByteArray::fromRawData((const char *) privateHmacKeyData, sizeof(privateHmacKeyData)); - QByteArray hmacCalc= HMACFilter::hmac(HMACFilter::Sha256, hmacKey, QtYaml::yamlFromVariantDocuments({ docs[0], docs[1] }, QtYaml::BlockStyle)); - - QVariantMap footer { { qSL("hmac"), QString::fromLatin1(hmacCalc.toHex()) } }; - docs << footer; - - QByteArray out = QtYaml::yamlFromVariantDocuments(docs, QtYaml::BlockStyle); - - return (to->write(out) == out.size()); -} - -AM_END_NAMESPACE diff --git a/src/manager-lib/installationreport.h b/src/manager-lib/installationreport.h deleted file mode 100644 index f22ab355..00000000 --- a/src/manager-lib/installationreport.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 -#include -#include -#include "global.h" - -QT_FORWARD_DECLARE_CLASS(QIODevice) - -AM_BEGIN_NAMESPACE - -class InstallationReport -{ -public: - InstallationReport(const QString &applicationId = QString()); - - QString applicationId() const; - void setApplicationId(const QString &applicationId); - - QString installationLocationId() const; - void setInstallationLocationId(const QString &installationLocationId); - - QByteArray digest() const; - void setDigest(const QByteArray &sha1); - - quint64 diskSpaceUsed() const; - void setDiskSpaceUsed(quint64 diskSpaceUsed); - - QByteArray developerSignature() const; - void setDeveloperSignature(const QByteArray &developerSignature); - - QByteArray storeSignature() const; - void setStoreSignature(const QByteArray &storeSignature); - - QStringList files() const; - void addFile(const QString &file); - void addFiles(const QStringList &files); - - bool isValid() const; - - bool deserialize(QIODevice *from); - bool serialize(QIODevice *to) const; - -private: - QString m_applicationId; - QString m_installationLocationId; - QByteArray m_digest; - quint64 m_diskSpaceUsed = 0; - QStringList m_files; - QByteArray m_developerSignature; - QByteArray m_storeSignature; -}; - -AM_END_NAMESPACE diff --git a/src/manager-lib/manager-lib.pro b/src/manager-lib/manager-lib.pro index 44b44393..b76523cd 100644 --- a/src/manager-lib/manager-lib.pro +++ b/src/manager-lib/manager-lib.pro @@ -1,52 +1,40 @@ - -TEMPLATE = lib -TARGET = manager-lib +TARGET = QtAppManManager +MODULE = appman_manager load(am-config) -CONFIG += static create_prl - -QT = core network qml qml-private +QT = core network qml !headless:QT *= gui quick qtHaveModule(dbus):QT *= dbus +QT_FOR_PRIVATE *= \ + appman_common-private \ + appman_crypto-private \ + appman_application-private \ + appman_notification-private \ + +CONFIG *= static internal_module multi-process { PKGCONFIG += "'dbus-1 >= 1.6'" } -DEFINES *= AM_BUILD_APPMAN - -load(add-static-library) -addStaticLibrary(../common-lib) -addStaticLibrary(../crypto-lib) -addStaticLibrary(../notification-lib) - HEADERS += \ - application.h \ - applicationdatabase.h \ applicationmanager.h \ - applicationscanner.h \ - runtimefactory.h \ applicationinterface.h \ - abstractruntime.h \ - yamlapplicationscanner.h \ - installationlocation.h \ - installationreport.h \ - dbus-policy.h \ + applicationdatabase.h \ notificationmanager.h \ - qmlinprocessruntime.h \ - qmlinprocessapplicationinterface.h \ - qml-utilities.h \ - processcontainer.h \ abstractcontainer.h \ containerfactory.h \ + plugincontainer.h \ + processcontainer.h \ + abstractruntime.h \ + runtimefactory.h \ quicklauncher.h \ - systemmonitor.h \ - systemmonitor_p.h \ applicationipcmanager.h \ applicationipcinterface.h \ applicationipcinterface_p.h \ - plugincontainer.h \ + systemmonitor.h \ + systemmonitor_p.h \ processmonitor.h \ memorymonitor.h \ fpsmonitor.h \ @@ -62,30 +50,26 @@ multi-process:HEADERS += \ linux:HEADERS += \ sysfsreader.h \ +qtHaveModule(qml):HEADERS += \ + qmlinprocessruntime.h \ + qmlinprocessapplicationinterface.h \ + SOURCES += \ - application.cpp \ - applicationdatabase.cpp \ applicationmanager.cpp \ - runtimefactory.cpp \ applicationinterface.cpp \ - abstractruntime.cpp \ - yamlapplicationscanner.cpp \ - installationlocation.cpp \ - installationreport.cpp \ - dbus-policy.cpp \ + applicationdatabase.cpp \ notificationmanager.cpp \ - qmlinprocessruntime.cpp \ - qmlinprocessapplicationinterface.cpp \ - qml-utilities.cpp \ - processcontainer.cpp \ abstractcontainer.cpp \ containerfactory.cpp \ + plugincontainer.cpp \ + processcontainer.cpp \ + abstractruntime.cpp \ + runtimefactory.cpp \ quicklauncher.cpp \ - systemmonitor.cpp \ - systemmonitor_p.cpp \ applicationipcmanager.cpp \ applicationipcinterface.cpp \ - plugincontainer.cpp \ + systemmonitor.cpp \ + systemmonitor_p.cpp \ processmonitor.cpp \ memorymonitor.cpp \ fpsmonitor.cpp \ @@ -100,6 +84,12 @@ multi-process:SOURCES += \ linux:SOURCES += \ sysfsreader.cpp \ +qtHaveModule(qml):SOURCES += \ + qmlinprocessruntime.cpp \ + qmlinprocessapplicationinterface.cpp \ + # we have an external plugin interface with signals, so we need to # compile the moc-data into the exporting binary (appman itself) HEADERS += ../plugin-interfaces/containerinterface.h + +load(qt_module) diff --git a/src/manager-lib/memorymonitor.cpp b/src/manager-lib/memorymonitor.cpp index 7b6c4475..5f5a8796 100644 --- a/src/manager-lib/memorymonitor.cpp +++ b/src/manager-lib/memorymonitor.cpp @@ -203,7 +203,7 @@ public: int p = pss.at(pss.size() - 2).toInt() * 1000; t.pss = t.pss + p; - QString libName = header.at(header.size()-1); + QString libName = QString::fromLocal8Bit(header.at(header.size()-1)); if (readLibraryList) { if (!libName.isEmpty()) { @@ -445,7 +445,7 @@ QVariantMap MemoryMonitor::get(int row) const QVariantMap map; QHash roles = roleNames(); for (auto it = roles.cbegin(); it != roles.cend(); ++it) { - map.insert(it.value(), data(index(row), it.key())); + map.insert(qL1S(it.value()), data(index(row), it.key())); } return map; diff --git a/src/manager-lib/memorymonitor.h b/src/manager-lib/memorymonitor.h index 8b6eed06..8136ba0d 100644 --- a/src/manager-lib/memorymonitor.h +++ b/src/manager-lib/memorymonitor.h @@ -44,7 +44,7 @@ #include #include #include -#include "processmonitor.h" +#include AM_BEGIN_NAMESPACE diff --git a/src/manager-lib/nativeruntime.cpp b/src/manager-lib/nativeruntime.cpp index a473c609..282c8d08 100644 --- a/src/manager-lib/nativeruntime.cpp +++ b/src/manager-lib/nativeruntime.cpp @@ -183,8 +183,8 @@ bool NativeRuntime::start() //env.insert(qSL("QT_WAYLAND_DISABLE_WINDOWDECORATION"), "1"); env.insert(qSL("AM_SECURITY_TOKEN"), qL1S(securityToken().toHex())); env.insert(qSL("AM_DBUS_PEER_ADDRESS"), static_cast(manager())->applicationInterfaceServer()->address()); - env.insert(qSL("AM_RUNTIME_CONFIGURATION"), QtYaml::yamlFromVariantDocuments({ configuration() })); - env.insert(qSL("AM_RUNTIME_ADDITIONAL_CONFIGURATION"), QtYaml::yamlFromVariantDocuments({ additionalConfiguration() })); + env.insert(qSL("AM_RUNTIME_CONFIGURATION"), QString::fromUtf8(QtYaml::yamlFromVariantDocuments({ configuration() }))); + env.insert(qSL("AM_RUNTIME_ADDITIONAL_CONFIGURATION"), QString::fromUtf8(QtYaml::yamlFromVariantDocuments({ additionalConfiguration() }))); env.insert(qSL("AM_BASE_DIR"), QDir::currentPath()); for (QMapIterator it(configuration().value(qSL("environmentVariables")).toMap()); it.hasNext(); ) { diff --git a/src/manager-lib/nativeruntime.h b/src/manager-lib/nativeruntime.h index a540f23b..da6a698c 100644 --- a/src/manager-lib/nativeruntime.h +++ b/src/manager-lib/nativeruntime.h @@ -48,8 +48,8 @@ #include #include -#include "abstractruntime.h" -#include "abstractcontainer.h" +#include +#include #define AM_NATIVE_RUNTIME_AVAILABLE diff --git a/src/manager-lib/notificationmanager.cpp b/src/manager-lib/notificationmanager.cpp index 156326a3..14545d96 100644 --- a/src/manager-lib/notificationmanager.cpp +++ b/src/manager-lib/notificationmanager.cpp @@ -413,7 +413,7 @@ QVariantMap NotificationManager::get(int index) const QVariantMap map; QHash roles = roleNames(); for (auto it = roles.begin(); it != roles.end(); ++it) - map.insert(it.value(), data(QAbstractListModel::index(index), it.key())); + map.insert(qL1S(it.value()), data(QAbstractListModel::index(index), it.key())); return map; } @@ -607,14 +607,10 @@ uint NotificationManager::notifyHelper(const QString &app_name, uint id, bool re // we could do better here and actually find out which fields changed... emit notificationChanged(n->id, QStringList()); } - - emit notificationUpdate(idx.row()); // deprecated } else { d->notifications << n; endInsertRows(); emit notificationAdded(n->id); - - emit notificationUpdate(rowCount()-1); // deprecated } if (timeout > 0) { diff --git a/src/manager-lib/notificationmanager.h b/src/manager-lib/notificationmanager.h index dfdbeb11..7e0959a3 100644 --- a/src/manager-lib/notificationmanager.h +++ b/src/manager-lib/notificationmanager.h @@ -43,7 +43,7 @@ #include #include -#include "global.h" +#include QT_FORWARD_DECLARE_CLASS(QQmlEngine) QT_FORWARD_DECLARE_CLASS(QJSEngine) @@ -95,8 +95,6 @@ signals: void notificationAboutToBeRemoved(int id); void notificationChanged(int id, const QStringList &rolesChanged); - QT_DEPRECATED void notificationUpdate(int notificationIndex); - private: uint notifyHelper(const QString &app_name, uint id, bool replaces, const QString &app_icon, const QString &summary, const QString &body, const QStringList &actions, const QVariantMap &hints, int timeout); diff --git a/src/manager-lib/plugincontainer.h b/src/manager-lib/plugincontainer.h index ecc14173..8ac5ebc6 100644 --- a/src/manager-lib/plugincontainer.h +++ b/src/manager-lib/plugincontainer.h @@ -41,7 +41,7 @@ #pragma once -#include "abstractcontainer.h" +#include #include "../plugin-interfaces/containerinterface.h" AM_BEGIN_NAMESPACE diff --git a/src/manager-lib/processcontainer.h b/src/manager-lib/processcontainer.h index a9a94277..a8ae0527 100644 --- a/src/manager-lib/processcontainer.h +++ b/src/manager-lib/processcontainer.h @@ -41,7 +41,7 @@ #pragma once -#include "abstractcontainer.h" +#include #define AM_HOST_CONTAINER_AVAILABLE diff --git a/src/manager-lib/processmonitor.h b/src/manager-lib/processmonitor.h index f9297305..adffabd9 100644 --- a/src/manager-lib/processmonitor.h +++ b/src/manager-lib/processmonitor.h @@ -43,8 +43,8 @@ #include #include -#include "fpsmonitor.h" -#include "systemmonitor.h" +#include +#include AM_BEGIN_NAMESPACE diff --git a/src/manager-lib/qml-utilities.cpp b/src/manager-lib/qml-utilities.cpp deleted file mode 100644 index f418a152..00000000 --- a/src/manager-lib/qml-utilities.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 -** -****************************************************************************/ - -#include -#include - -#include "qml-utilities.h" - -AM_BEGIN_NAMESPACE - -void retakeSingletonOwnershipFromQmlEngine(QQmlEngine *qmlEngine, QObject *singleton, bool immediately) -{ - // QQmlEngine is taking ownership of singletons after the first call to instanceForQml() and - // there is nothing to prevent this. This means that the singleton will be destroyed once the - // QQmlEngine is destroyed, which is not what we want. - // The workaround (until Qt has an API for that) is to remove the singleton QObject from QML's - // internal singleton registry *after* the instanceForQml() function has finished. - - auto retake = [qmlEngine, singleton]() { - foreach (const QQmlType *singletonType, QQmlMetaType::qmlSingletonTypes()) { - if (singletonType->singletonInstanceInfo()->qobjectApi(qmlEngine) == singleton) - singletonType->singletonInstanceInfo()->qobjectApis.remove(qmlEngine); - } - }; - - if (immediately) - retake(); - else - QTimer::singleShot(0, qmlEngine, retake); -} - -AM_END_NAMESPACE diff --git a/src/manager-lib/qml-utilities.h b/src/manager-lib/qml-utilities.h deleted file mode 100644 index ac14474f..00000000 --- a/src/manager-lib/qml-utilities.h +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 -#include -#include "global.h" - -AM_BEGIN_NAMESPACE - -void retakeSingletonOwnershipFromQmlEngine(QQmlEngine *qmlEngine, QObject *singleton, bool immediately = false); - -AM_END_NAMESPACE diff --git a/src/manager-lib/qmlinprocessapplicationinterface.h b/src/manager-lib/qmlinprocessapplicationinterface.h index 963b8856..2827364c 100644 --- a/src/manager-lib/qmlinprocessapplicationinterface.h +++ b/src/manager-lib/qmlinprocessapplicationinterface.h @@ -44,8 +44,8 @@ #include #include -#include "applicationinterface.h" -#include "notification.h" +#include +#include AM_BEGIN_NAMESPACE diff --git a/src/manager-lib/qmlinprocessruntime.cpp b/src/manager-lib/qmlinprocessruntime.cpp index 15a93f2b..14299799 100644 --- a/src/manager-lib/qmlinprocessruntime.cpp +++ b/src/manager-lib/qmlinprocessruntime.cpp @@ -132,7 +132,7 @@ bool QmlInProcessRuntime::start() for (int i = 0; i < importPaths.size(); i++) { QString importPath = importPaths[i]; if (QFileInfo(importPath).isRelative()) - importPath = m_app->baseDir().absolutePath() + "/" + importPath; + importPath = m_app->baseDir().absolutePath() + qSL("/") + importPath; absoluteImportPaths.append(importPath); } diff --git a/src/manager-lib/qmlinprocessruntime.h b/src/manager-lib/qmlinprocessruntime.h index b09642bf..10b3ed09 100644 --- a/src/manager-lib/qmlinprocessruntime.h +++ b/src/manager-lib/qmlinprocessruntime.h @@ -41,7 +41,7 @@ #pragma once -#include "abstractruntime.h" +#include AM_BEGIN_NAMESPACE diff --git a/src/manager-lib/quicklauncher.cpp b/src/manager-lib/quicklauncher.cpp index bdf56a61..bff9df45 100644 --- a/src/manager-lib/quicklauncher.cpp +++ b/src/manager-lib/quicklauncher.cpp @@ -89,7 +89,7 @@ void QuickLauncher::initialize(int runtimesPerContainer, qreal idleLoad) m_quickLaunchPool << entry; - qCDebug(LogSystem) << "Created quick-launch slot for" << containerId + "/" + runtimeId; + qCDebug(LogSystem) << "Created quick-launch slot for" << containerId + qSL("/") + runtimeId; } } if (idleLoad > 0) { diff --git a/src/manager-lib/quicklauncher.h b/src/manager-lib/quicklauncher.h index dba54e5d..efee3ac2 100644 --- a/src/manager-lib/quicklauncher.h +++ b/src/manager-lib/quicklauncher.h @@ -44,7 +44,7 @@ #include #include #include -#include "global.h" +#include AM_BEGIN_NAMESPACE diff --git a/src/manager-lib/runtimefactory.cpp b/src/manager-lib/runtimefactory.cpp index 960fb1aa..5a2b4ccf 100644 --- a/src/manager-lib/runtimefactory.cpp +++ b/src/manager-lib/runtimefactory.cpp @@ -76,7 +76,7 @@ AbstractRuntimeManager *RuntimeFactory::manager(const QString &id) return nullptr; AbstractRuntimeManager *arm = m_runtimes.value(id); if (!arm) - arm = m_runtimes.value(id + "-inprocess"); + arm = m_runtimes.value(id + qSL("-inprocess")); return arm; } diff --git a/src/manager-lib/runtimefactory.h b/src/manager-lib/runtimefactory.h index edc36a02..1dc9b096 100644 --- a/src/manager-lib/runtimefactory.h +++ b/src/manager-lib/runtimefactory.h @@ -44,7 +44,7 @@ #include #include -#include "global.h" +#include AM_BEGIN_NAMESPACE @@ -54,7 +54,7 @@ class AbstractRuntimeManager; class AbstractContainer; -class AM_EXPORT RuntimeFactory : public QObject +class RuntimeFactory : public QObject { Q_OBJECT public: diff --git a/src/manager-lib/sysfsreader.cpp b/src/manager-lib/sysfsreader.cpp index 0eb5587c..e9ef4575 100644 --- a/src/manager-lib/sysfsreader.cpp +++ b/src/manager-lib/sysfsreader.cpp @@ -60,7 +60,7 @@ static inline int qt_safe_open(const char *pathname, int flags, mode_t mode = 07 AM_BEGIN_NAMESPACE -SysFsReader::SysFsReader(const char *path, int maxRead) +SysFsReader::SysFsReader(const QByteArray &path, int maxRead) : m_path(path) { m_buffer.resize(maxRead); diff --git a/src/manager-lib/sysfsreader.h b/src/manager-lib/sysfsreader.h index 7356bdc0..bee301c5 100644 --- a/src/manager-lib/sysfsreader.h +++ b/src/manager-lib/sysfsreader.h @@ -42,14 +42,14 @@ #pragma once #include -#include "global.h" +#include AM_BEGIN_NAMESPACE class SysFsReader { public: - SysFsReader(const char *path, int maxRead = 2048); + SysFsReader(const QByteArray &path, int maxRead = 2048); ~SysFsReader(); bool isOpen() const; QByteArray fileName() const; diff --git a/src/manager-lib/systemmonitor.cpp b/src/manager-lib/systemmonitor.cpp index 84df4def..4d9dfc2f 100644 --- a/src/manager-lib/systemmonitor.cpp +++ b/src/manager-lib/systemmonitor.cpp @@ -456,7 +456,7 @@ QVariantMap SystemMonitor::get(int row) const QVariantMap map; QHash roles = roleNames(); for (auto it = roles.cbegin(); it != roles.cend(); ++it) - map.insert(it.value(), data(index(row), it.key())); + map.insert(qL1S(it.value()), data(index(row), it.key())); return map; } diff --git a/src/manager-lib/systemmonitor.h b/src/manager-lib/systemmonitor.h index a7624e1f..15d5cbe0 100644 --- a/src/manager-lib/systemmonitor.h +++ b/src/manager-lib/systemmonitor.h @@ -42,7 +42,7 @@ #pragma once #include -#include "global.h" +#include QT_FORWARD_DECLARE_CLASS(QQmlEngine) QT_FORWARD_DECLARE_CLASS(QJSEngine) diff --git a/src/manager-lib/systemmonitor_p.h b/src/manager-lib/systemmonitor_p.h index 01cbb2b0..36e66e18 100644 --- a/src/manager-lib/systemmonitor_p.h +++ b/src/manager-lib/systemmonitor_p.h @@ -45,7 +45,7 @@ #include #include #include -#include "global.h" +#include #if defined(Q_OS_LINUX) # include diff --git a/src/manager-lib/window.h b/src/manager-lib/window.h index 2a05378c..e47ba789 100644 --- a/src/manager-lib/window.h +++ b/src/manager-lib/window.h @@ -45,7 +45,7 @@ #include #include #include -#include "global.h" +#include AM_BEGIN_NAMESPACE diff --git a/src/manager-lib/yamlapplicationscanner.cpp b/src/manager-lib/yamlapplicationscanner.cpp deleted file mode 100644 index 6cc45ddc..00000000 --- a/src/manager-lib/yamlapplicationscanner.cpp +++ /dev/null @@ -1,209 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include - -#include "global.h" -#include "qtyaml.h" -#include "exception.h" -#include "application.h" -#include "yamlapplicationscanner.h" -#include "utilities.h" - -AM_BEGIN_NAMESPACE - -YamlApplicationScanner::YamlApplicationScanner() -{ -} - -Application *YamlApplicationScanner::scan(const QString &filePath) throw (Exception) -{ - return scanInternal(filePath, false, nullptr); -} - -Application *YamlApplicationScanner::scanAlias(const QString &filePath, const Application *application) throw (Exception) -{ - return scanInternal(filePath, true, application); -} - -Application *YamlApplicationScanner::scanInternal(const QString &filePath, bool scanAlias, const Application *application) throw (Exception) -{ - try { - if (scanAlias && !application) - throw Exception(Error::System, "cannot scan an alias without a valid base application"); - - QFile f(filePath); - if (!f.open(QIODevice::ReadOnly)) - throw Exception(f, "could not open file for reading"); - - QtYaml::ParseError parseError; - QVector docs = QtYaml::variantDocumentsFromYaml(f.readAll(), &parseError); - - if (parseError.error != QJsonParseError::NoError) { - throw Exception(Error::IO, "YAML parse error at line %1, column %2: %3") - .arg(parseError.line).arg(parseError.column).arg(parseError.errorString()); - } - - if ((docs.size() != 2) - || (docs.first().toMap().value(qSL("formatVersion")).toInt(0) != 1)) { - throw Exception(Error::Parse, "not a valid YAML application meta-data file"); - } - - bool isApp = (docs.first().toMap().value(qSL("formatType")).toString() == qL1S("am-application")); - bool isAlias = (docs.first().toMap().value(qSL("formatType")).toString() == qL1S("am-application-alias")); - - if (!isApp && !isAlias) - throw Exception(Error::Parse, "not a valid YAML application manifest"); - if (isAlias && !scanAlias) - throw Exception(Error::Parse, "is an alias, but expected a normal manifest"); - if (!isAlias && scanAlias) - throw Exception(Error::Parse, "is an not alias, although expected such a manifest"); - - QScopedPointer app(new Application); - app->m_baseDir = QFileInfo(f).absoluteDir().absolutePath(); - - QVariantMap yaml = docs.at(1).toMap(); - for (auto it = yaml.constBegin(); it != yaml.constEnd(); ++it) { - QByteArray field = it.key().toLatin1(); - bool unknownField = false; - const QVariant &v = it.value(); - - if ((!isAlias && (field == "id")) - || (isAlias && (field == "aliasId"))) { - app->m_id = v.toString(); - if (isAlias) { - int sepPos = app->m_id.indexOf(qL1C('@')); - if (sepPos < 0 || sepPos == (app->m_id.size() - 1)) - throw Exception(Error::Parse, "malformed aliasId '%1'").arg(app->m_id); - QString realId = app->m_id.left(sepPos); - if (application->id() != realId) { - throw Exception(Error::Parse, "aliasId '%1' does not match base application id '%2'") - .arg(app->m_id, application->id()); - } - app->m_nonAliased = application; - } - } else if (field == "icon") { - app->m_icon = v.toString(); - } else if (field == "name") { - auto nameMap = v.toMap(); - for (auto it = nameMap.constBegin(); it != nameMap.constEnd(); ++it) - app->m_name.insert(it.key(), it.value().toString()); - } else if (field == "documentUrl") { - app->m_documentUrl = v.toString(); - } else if (!isAlias) { - if (field == "code") { - app->m_codeFilePath = v.toString(); - } else if (field == "runtime") { - app->m_runtimeName = v.toString(); - } else if (field == "runtimeParameters") { - app->m_runtimeParameters = v.toMap(); - } else if (field == "preload") { - app->m_preload = v .toBool(); - } else if (field == "importance") { - app->m_importance = v.toReal(); - } else if (field == "builtIn" || field == "built-in") { - app->m_builtIn = v.toBool(); - } else if (field == "type") { - app->m_type = (v.toString() == qL1S("headless") ? Application::Headless : Application::Gui); - } else if (field == "capabilities") { - app->m_capabilities = variantToStringList(v); - app->m_capabilities.sort(); - } else if (field == "categories") { - app->m_categories = variantToStringList(v); - app->m_categories.sort(); - } else if (field == "mimeTypes") { - app->m_mimeTypes = variantToStringList(v); - app->m_mimeTypes.sort(); - } else if (field == "version") { - app->m_version = v.toString(); - } else if (field == "backgroundMode") { - static const QPair backgroundMap[] = { - { "never", Application::Never }, - { "voip", Application::ProvidesVoIP }, - { "audio", Application::PlaysAudio }, - { "location", Application::TracksLocation }, - { "auto", Application::Auto }, - { 0, Application::Auto } - }; - QByteArray enumValue = v.toString().toLatin1(); - - bool found = false; - for (auto it = backgroundMap; backgroundMap->first; ++it) { - if (enumValue == it->first) { - app->m_backgroundMode = it->second; - found = true; - break; - } - } - if (!found) - throw Exception(Error::Parse, "the 'backgroundMode' value '%1' is not valid").arg(enumValue); - } else { - unknownField = true; - } - } else { - unknownField = true; - } - - if (unknownField) - throw Exception(Error::Parse, "contains unsupported field: '%1'").arg(field); - } - - app->validate(); - return app.take(); - } catch (const Exception &e) { - throw Exception(e.errorCode(), "Failed to parse manifest file %1: %2").arg(filePath, e.errorString()); - } - -} - - -QString YamlApplicationScanner::metaDataFileName() const -{ - return qSL("info.yaml"); -} - -AM_END_NAMESPACE diff --git a/src/manager-lib/yamlapplicationscanner.h b/src/manager-lib/yamlapplicationscanner.h deleted file mode 100644 index 0850a1aa..00000000 --- a/src/manager-lib/yamlapplicationscanner.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 "applicationscanner.h" - -AM_BEGIN_NAMESPACE - -class YamlApplicationScanner : public ApplicationScanner -{ -public: - YamlApplicationScanner(); - - Application *scan(const QString &filePath) throw (Exception) override; - Application *scanAlias(const QString &filePath, const Application *application) throw (Exception) override; - - QString metaDataFileName() const override; - -private: - Application *scanInternal(const QString &filePath, bool scanAlias, const Application *application) throw (Exception); -}; - -AM_END_NAMESPACE -- cgit v1.2.1