diff options
author | Robert Griebl <robert.griebl@pelagicore.com> | 2016-09-20 21:43:33 +0200 |
---|---|---|
committer | Robert Griebl <robert.griebl@pelagicore.com> | 2016-09-23 12:46:59 +0000 |
commit | e5e76e61dc5054f606b9806d5ab7a00923cdc68d (patch) | |
tree | 0fecbdb144607351962d6d38c98b747bbd97cac1 /src | |
parent | 2ec52b37516ecb1c2ec355af09fe4c756abb1a9c (diff) | |
download | qtapplicationmanager-e5e76e61dc5054f606b9806d5ab7a00923cdc68d.tar.gz |
Moved all symbols to a private namespace
This was done to avoid conflicts with C++ plugins that get loaded
into both the system-ui or the QML app runtime.
Change-Id: I03fc222d806292f0f0734709568514862b6da56d
Reviewed-by: Bernd Weimer <bernd.weimer@pelagicore.com>
Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
Diffstat (limited to 'src')
142 files changed, 639 insertions, 118 deletions
diff --git a/src/common-lib/dbus-utilities.cpp b/src/common-lib/dbus-utilities.cpp index c1f07c9b..373315be 100644 --- a/src/common-lib/dbus-utilities.cpp +++ b/src/common-lib/dbus-utilities.cpp @@ -52,6 +52,7 @@ #include "dbus-utilities.h" +AM_BEGIN_NAMESPACE QVariant convertFromJSVariant(const QVariant &variant) { @@ -139,6 +140,8 @@ void registerDBusTypes() #endif } +AM_END_NAMESPACE + #if defined(QT_DBUS_LIB) QT_BEGIN_NAMESPACE @@ -160,7 +163,7 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, QUrl &url) return argument; } -QDBusArgument &operator<<(QDBusArgument &argument, const UnixFdMap &fdMap) +QDBusArgument &operator<<(QDBusArgument &argument, const AM_PREPEND_NAMESPACE(UnixFdMap) &fdMap) { argument.beginMap(qMetaTypeId<QString>(), qMetaTypeId<QDBusUnixFileDescriptor>()); for (auto it = fdMap.cbegin(); it != fdMap.cend(); ++it) { @@ -173,7 +176,7 @@ QDBusArgument &operator<<(QDBusArgument &argument, const UnixFdMap &fdMap) return argument; } -const QDBusArgument &operator>>(const QDBusArgument &argument, UnixFdMap &fdMap) +const QDBusArgument &operator>>(const QDBusArgument &argument, AM_PREPEND_NAMESPACE(UnixFdMap) &fdMap) { argument.beginMap(); fdMap.clear(); diff --git a/src/common-lib/dbus-utilities.h b/src/common-lib/dbus-utilities.h index 25040964..576ced71 100644 --- a/src/common-lib/dbus-utilities.h +++ b/src/common-lib/dbus-utilities.h @@ -42,16 +42,23 @@ #pragma once #include <QVariant> +#include "global.h" #if defined(QT_DBUS_LIB) # include <QDBusUnixFileDescriptor> +AM_BEGIN_NAMESPACE typedef QMap<QString, QDBusUnixFileDescriptor> UnixFdMap; -Q_DECLARE_METATYPE(UnixFdMap) +AM_END_NAMESPACE +Q_DECLARE_METATYPE(AM_PREPEND_NAMESPACE(UnixFdMap)) #endif QT_FORWARD_DECLARE_CLASS(QDBusUnixFileDescriptor) +AM_BEGIN_NAMESPACE + QVariant convertFromJSVariant(const QVariant &variant); QVariant convertFromDBusVariant(const QVariant &variant); void registerDBusTypes(); + +AM_END_NAMESPACE diff --git a/src/common-lib/error.h b/src/common-lib/error.h index b2318a45..ac3db2f1 100644 --- a/src/common-lib/error.h +++ b/src/common-lib/error.h @@ -42,6 +42,9 @@ #pragma once #include <QDebug> +#include "global.h" + +AM_BEGIN_NAMESPACE enum class Error { None = 0, @@ -68,9 +71,11 @@ enum class Error { WrongMedium = 51, }; -Q_DECLARE_METATYPE(Error) +AM_END_NAMESPACE + +Q_DECLARE_METATYPE(AM_PREPEND_NAMESPACE(Error)) -inline QDebug &operator<<(QDebug &debug, Error error) +inline QDebug &operator<<(QDebug &debug, AM_PREPEND_NAMESPACE(Error) error) { return debug << int(error); } diff --git a/src/common-lib/exception.cpp b/src/common-lib/exception.cpp index 5d8600ad..64a221e1 100644 --- a/src/common-lib/exception.cpp +++ b/src/common-lib/exception.cpp @@ -44,6 +44,7 @@ #include "exception.h" +AM_BEGIN_NAMESPACE Exception::Exception(Error errorCode, const char *errorString) : m_errorCode(errorCode) @@ -97,3 +98,5 @@ const char *Exception::what() const throw() m_whatBuffer = new QByteArray(m_errorString.toLocal8Bit()); return *m_whatBuffer; } + +AM_END_NAMESPACE diff --git a/src/common-lib/exception.h b/src/common-lib/exception.h index d7302c33..efb70015 100644 --- a/src/common-lib/exception.h +++ b/src/common-lib/exception.h @@ -52,6 +52,8 @@ QT_FORWARD_DECLARE_CLASS(QFile) +AM_BEGIN_NAMESPACE + class AM_EXPORT Exception : public std::exception { public: @@ -97,3 +99,4 @@ private: mutable QByteArray *m_whatBuffer = 0; }; +AM_END_NAMESPACE diff --git a/src/common-lib/global.cpp b/src/common-lib/global.cpp index 2baf05e4..dc83bc00 100644 --- a/src/common-lib/global.cpp +++ b/src/common-lib/global.cpp @@ -68,6 +68,8 @@ Q_CORE_EXPORT void qWinMsgHandler(QtMsgType t, const char* str); # define QDLT_REGISTER_APPLICATION(a,b) #endif +AM_BEGIN_NAMESPACE + QDLT_REGISTER_APPLICATION("PCAM", "Pelagicore Application-Manager") QDLT_LOGGING_CATEGORY(LogSystem, "am.system", "SYS", "General messages") QDLT_LOGGING_CATEGORY(LogInstaller, "am.installer", "INST", "Installer sub-system") @@ -266,6 +268,7 @@ QString hardwareId() return QString(); } - void am_trace(QDebug) { } + +AM_END_NAMESPACE diff --git a/src/common-lib/global.h b/src/common-lib/global.h index a6926ec0..dc76416d 100644 --- a/src/common-lib/global.h +++ b/src/common-lib/global.h @@ -41,6 +41,7 @@ #pragma once #include <qglobal.h> +#include <QLoggingCategory> #if defined(AM_BUILD_APPMAN) # define AM_EXPORT Q_DECL_EXPORT @@ -48,7 +49,12 @@ # define AM_EXPORT Q_DECL_IMPORT #endif -#include <QLoggingCategory> +#define AM_BEGIN_NAMESPACE namespace QtAM { +#define AM_END_NAMESPACE } +#define AM_USE_NAMESPACE using namespace ::QtAM; +#define AM_PREPEND_NAMESPACE(name) ::QtAM::name + +AM_BEGIN_NAMESPACE AM_EXPORT Q_DECLARE_LOGGING_CATEGORY(LogSystem) AM_EXPORT Q_DECLARE_LOGGING_CATEGORY(LogInstaller) @@ -66,9 +72,11 @@ void am_trace(QDebug); template <typename T, typename... TRest> void am_trace(QDebug dbg, T t, TRest... trest) { dbg << t; am_trace(dbg, trest...); } +AM_END_NAMESPACE + #define AM_TRACE(category, ...) \ for (bool qt_category_enabled = category().isDebugEnabled(); qt_category_enabled; qt_category_enabled = false) { \ - am_trace(QMessageLogger(__FILE__, __LINE__, __FUNCTION__, category().categoryName()).debug(), "TRACE", __FUNCTION__, __VA_ARGS__); \ + AM_PREPEND_NAMESPACE(am_trace(QMessageLogger(__FILE__, __LINE__, __FUNCTION__, category().categoryName()).debug(), "TRACE", __FUNCTION__, __VA_ARGS__)); \ } // make the source a lot less ugly and more readable (until we can finally use user defined literals) diff --git a/src/common-lib/startuptimer.cpp b/src/common-lib/startuptimer.cpp index 02315b25..48ba3959 100644 --- a/src/common-lib/startuptimer.cpp +++ b/src/common-lib/startuptimer.cpp @@ -55,6 +55,7 @@ # include <sys/sysctl.h> #endif +AM_BEGIN_NAMESPACE StartupTimer::StartupTimer() { @@ -234,3 +235,4 @@ void StartupTimer::createReport() const } } +AM_END_NAMESPACE diff --git a/src/common-lib/startuptimer.h b/src/common-lib/startuptimer.h index 09d3330f..c16857f3 100644 --- a/src/common-lib/startuptimer.h +++ b/src/common-lib/startuptimer.h @@ -45,6 +45,9 @@ #include <QPair> #include <QByteArray> #include <QElapsedTimer> +#include "global.h" + +AM_BEGIN_NAMESPACE class StartupTimer { @@ -65,3 +68,5 @@ private: Q_DISABLE_COPY(StartupTimer) }; + +AM_END_NAMESPACE diff --git a/src/common-lib/utilities.cpp b/src/common-lib/utilities.cpp index b18d28ae..9598020b 100644 --- a/src/common-lib/utilities.cpp +++ b/src/common-lib/utilities.cpp @@ -67,6 +67,8 @@ # include <qplatformdefs.h> #endif +AM_BEGIN_NAMESPACE + bool diskUsage(const QString &path, quint64 *bytesTotal, quint64 *bytesFree) { QString cpath = QFileInfo(path).canonicalPath(); @@ -315,7 +317,9 @@ bool SetOwnerAndPermissions::operator()(const QString &path, RecursiveOperationT #if defined(Q_OS_ANDROID) +AM_END_NAMESPACE #include <QtAndroidExtras> +AM_BEGIN_NAMESPACE QString findOnSDCard(const QString &file) { @@ -342,15 +346,18 @@ QString findOnSDCard(const QString &file) #if defined(Q_OS_LINUX) +AM_END_NAMESPACE #include <cxxabi.h> #include <execinfo.h> #include <setjmp.h> #include <signal.h> +#include <inttypes.h> #if defined(AM_USE_LIBBACKTRACE) # include <libbacktrace/backtrace.h> # include <libbacktrace/backtrace-supported.h> #endif +AM_BEGIN_NAMESPACE static bool printBacktrace; static bool dumpCore; @@ -359,7 +366,6 @@ static int waitForGdbAttach; static char *demangleBuffer; static size_t demangleBufferSize; -#include <inttypes.h> static void crashHandler(const char *why) __attribute__((noreturn)); @@ -660,3 +666,5 @@ qint64 getParentPid(qint64 pid) #endif return 0; } + +AM_END_NAMESPACE diff --git a/src/common-lib/utilities.h b/src/common-lib/utilities.h index f0c75f9c..684cea10 100644 --- a/src/common-lib/utilities.h +++ b/src/common-lib/utilities.h @@ -49,9 +49,17 @@ #include <QByteArray> #include <QMultiMap> +#include "global.h" + #include <stdlib.h> +#if defined(Q_OS_UNIX) +# include <unistd.h> +# include <sys/stat.h> +#endif +AM_BEGIN_NAMESPACE + bool isValidDnsName(const QString &rnds, bool isAliasName = false, QString *errorString = 0); int versionCompare(const QString &version1, const QString &version2); @@ -138,8 +146,6 @@ public: // changes owner and permissions (Unix only) #if defined(Q_OS_UNIX) -# include <unistd.h> -# include <sys/stat.h> class SetOwnerAndPermissions { @@ -163,3 +169,5 @@ void setCrashActionConfiguration(const QVariantMap &config); bool canOutputAnsiColors(int fd); qint64 getParentPid(qint64 pid); + +AM_END_NAMESPACE diff --git a/src/crypto-lib/cryptography.cpp b/src/crypto-lib/cryptography.cpp index 308ddf34..ef433058 100644 --- a/src/crypto-lib/cryptography.cpp +++ b/src/crypto-lib/cryptography.cpp @@ -63,13 +63,18 @@ # include "libcryptofunction.h" # include <openssl/err.h> +AM_BEGIN_NAMESPACE + Q_GLOBAL_STATIC(QMutex, initMutex) // clazy:excludeall=non-pod-global-static static AM_LIBCRYPTO_FUNCTION(ERR_error_string_n); +AM_END_NAMESPACE + #endif +AM_BEGIN_NAMESPACE QByteArray Cryptography::generateRandomBytes(int size) { @@ -141,3 +146,5 @@ QString Cryptography::errorString(qint64 osCryptoError, const char *errorDescrip return result; } + +AM_END_NAMESPACE diff --git a/src/crypto-lib/cryptography.h b/src/crypto-lib/cryptography.h index 3c71a3cc..6f743415 100644 --- a/src/crypto-lib/cryptography.h +++ b/src/crypto-lib/cryptography.h @@ -43,6 +43,9 @@ #include <QByteArray> #include <QString> +#include "global.h" + +AM_BEGIN_NAMESPACE namespace Cryptography { @@ -53,3 +56,5 @@ void initialize(); QString errorString(qint64 osCryptoError, const char *errorDescription = nullptr); } + +AM_END_NAMESPACE diff --git a/src/crypto-lib/digestfilter.cpp b/src/crypto-lib/digestfilter.cpp index 17a1e31b..73f64679 100644 --- a/src/crypto-lib/digestfilter.cpp +++ b/src/crypto-lib/digestfilter.cpp @@ -44,6 +44,7 @@ #include "digestfilter_p.h" #include "cryptography.h" +AM_BEGIN_NAMESPACE HMACFilter::HMACFilter(Type t, const QByteArray &key) : DigestFilter(t, key) @@ -182,3 +183,5 @@ int DigestFilter::size() const default : return 0; } } + +AM_END_NAMESPACE diff --git a/src/crypto-lib/digestfilter.h b/src/crypto-lib/digestfilter.h index 9f9e235c..0dc63929 100644 --- a/src/crypto-lib/digestfilter.h +++ b/src/crypto-lib/digestfilter.h @@ -43,6 +43,9 @@ #include <QString> #include <QByteArray> +#include "global.h" + +AM_BEGIN_NAMESPACE class DigestFilterPrivate; @@ -86,3 +89,5 @@ private: using DigestFilter::digest; Q_DISABLE_COPY(HMACFilter) }; + +AM_END_NAMESPACE diff --git a/src/crypto-lib/digestfilter_openssl.cpp b/src/crypto-lib/digestfilter_openssl.cpp index 02d2c0ca..5998e686 100644 --- a/src/crypto-lib/digestfilter_openssl.cpp +++ b/src/crypto-lib/digestfilter_openssl.cpp @@ -47,6 +47,8 @@ #include <openssl/evp.h> #include <openssl/hmac.h> +AM_BEGIN_NAMESPACE + // clazy:excludeall=non-pod-global-static // EVP @@ -150,3 +152,4 @@ qint64 DigestFilterPrivate::finish(char *result, unsigned int *size) } } +AM_END_NAMESPACE diff --git a/src/crypto-lib/digestfilter_osx.cpp b/src/crypto-lib/digestfilter_osx.cpp index 01202478..1ee20e4c 100644 --- a/src/crypto-lib/digestfilter_osx.cpp +++ b/src/crypto-lib/digestfilter_osx.cpp @@ -47,6 +47,8 @@ #include <CommonCrypto/CommonHMAC.h> +AM_BEGIN_NAMESPACE + bool DigestFilterPrivate::init() { if (isHmac) { @@ -143,3 +145,5 @@ qint64 DigestFilterPrivate::finish(char *result, unsigned int *size) } return 0; } + +AM_END_NAMESPACE diff --git a/src/crypto-lib/digestfilter_p.h b/src/crypto-lib/digestfilter_p.h index 0be2f97f..ddab5662 100644 --- a/src/crypto-lib/digestfilter_p.h +++ b/src/crypto-lib/digestfilter_p.h @@ -64,6 +64,7 @@ typedef ULONG_PTR HCRYPTKEY; # error "No DigestFilter backend available for this platform" #endif +AM_BEGIN_NAMESPACE class DigestFilterPrivate { @@ -107,3 +108,5 @@ private: }; #endif }; + +AM_END_NAMESPACE diff --git a/src/crypto-lib/digestfilter_win.cpp b/src/crypto-lib/digestfilter_win.cpp index 351de10a..37cfddfc 100644 --- a/src/crypto-lib/digestfilter_win.cpp +++ b/src/crypto-lib/digestfilter_win.cpp @@ -47,6 +47,7 @@ #include <windows.h> #include <wincrypt.h> +AM_BEGIN_NAMESPACE bool DigestFilterPrivate::init() { @@ -133,3 +134,5 @@ qint64 DigestFilterPrivate::finish(char *result, unsigned int *size) *size = ok ? hashSize : 0; return ok ? 0 : GetLastError(); } + +AM_END_NAMESPACE diff --git a/src/crypto-lib/libcryptofunction.cpp b/src/crypto-lib/libcryptofunction.cpp index bf48f011..13093c36 100644 --- a/src/crypto-lib/libcryptofunction.cpp +++ b/src/crypto-lib/libcryptofunction.cpp @@ -56,6 +56,8 @@ # error "Your OpenSSL version is too old - the minimum supported version is 1.0.1" #endif +AM_BEGIN_NAMESPACE + // clazy:excludeall=non-pod-global-static static AM_LIBCRYPTO_FUNCTION(SSLeay, 0); static AM_LIBCRYPTO_FUNCTION(OPENSSL_add_all_algorithms_noconf); @@ -127,3 +129,5 @@ void Cryptography::LibCryptoFunctionBase::resolve() m_tried = true; } } + +AM_END_NAMESPACE diff --git a/src/crypto-lib/libcryptofunction.h b/src/crypto-lib/libcryptofunction.h index 5a05d571..53e0bc52 100644 --- a/src/crypto-lib/libcryptofunction.h +++ b/src/crypto-lib/libcryptofunction.h @@ -43,6 +43,7 @@ #include <qglobal.h> #include <utility> +#include "global.h" QT_FORWARD_DECLARE_CLASS(QLibrary) @@ -52,6 +53,7 @@ namespace std { } #endif +AM_BEGIN_NAMESPACE namespace Cryptography { @@ -129,3 +131,5 @@ public: #define AM_LIBCRYPTO_FUNCTION(f, ...) Cryptography::LibCryptoFunction<decltype(&f)> am_ ## f(#f, ##__VA_ARGS__) } + +AM_END_NAMESPACE diff --git a/src/crypto-lib/signature.cpp b/src/crypto-lib/signature.cpp index 8cfdbb37..281726a7 100644 --- a/src/crypto-lib/signature.cpp +++ b/src/crypto-lib/signature.cpp @@ -43,6 +43,7 @@ #include "signature_p.h" #include "cryptography.h" +AM_BEGIN_NAMESPACE Signature::Signature(const QByteArray &hash) : d(new SignaturePrivate) @@ -88,3 +89,5 @@ bool Signature::verify(const QByteArray &signaturePkcs7, const QList<QByteArray> return false; } } + +AM_END_NAMESPACE diff --git a/src/crypto-lib/signature.h b/src/crypto-lib/signature.h index 035c4e4d..82b80642 100644 --- a/src/crypto-lib/signature.h +++ b/src/crypto-lib/signature.h @@ -42,6 +42,9 @@ #include <QString> #include <QByteArray> +#include "global.h" + +AM_BEGIN_NAMESPACE class SignaturePrivate; @@ -60,3 +63,5 @@ private: SignaturePrivate *d; Q_DISABLE_COPY(Signature) }; + +AM_END_NAMESPACE diff --git a/src/crypto-lib/signature_openssl.cpp b/src/crypto-lib/signature_openssl.cpp index dbd8063e..9f512d59 100644 --- a/src/crypto-lib/signature_openssl.cpp +++ b/src/crypto-lib/signature_openssl.cpp @@ -50,6 +50,8 @@ #include <openssl/pkcs12.h> #include <openssl/bio.h> +AM_BEGIN_NAMESPACE + // clazy:excludeall=non-pod-global-static // deleter @@ -222,3 +224,5 @@ bool SignaturePrivate::verify(const QByteArray &signaturePkcs7, const QList<QByt return true; } } + +AM_END_NAMESPACE diff --git a/src/crypto-lib/signature_osx.cpp b/src/crypto-lib/signature_osx.cpp index 814ddf05..0df4ef89 100644 --- a/src/crypto-lib/signature_osx.cpp +++ b/src/crypto-lib/signature_osx.cpp @@ -53,6 +53,7 @@ # undef verify #endif +AM_BEGIN_NAMESPACE class SecurityException : public Exception { @@ -197,3 +198,4 @@ bool SignaturePrivate::verify(const QByteArray &signaturePkcs7, const QList<QByt return true; } +AM_END_NAMESPACE diff --git a/src/crypto-lib/signature_p.h b/src/crypto-lib/signature_p.h index e39aaa02..ce996e19 100644 --- a/src/crypto-lib/signature_p.h +++ b/src/crypto-lib/signature_p.h @@ -44,6 +44,8 @@ #include "signature.h" #include "exception.h" +AM_BEGIN_NAMESPACE + class SignaturePrivate { public: @@ -55,3 +57,5 @@ public: bool verify(const QByteArray &signaturePkcs7, const QList<QByteArray> &chainOfTrust) throw(Exception); }; + +AM_END_NAMESPACE diff --git a/src/crypto-lib/signature_win.cpp b/src/crypto-lib/signature_win.cpp index 90ed2f4e..e32b9127 100644 --- a/src/crypto-lib/signature_win.cpp +++ b/src/crypto-lib/signature_win.cpp @@ -52,6 +52,7 @@ #include <windows.h> #include <wincrypt.h> +AM_BEGIN_NAMESPACE class WinCryptException : public Exception { @@ -237,3 +238,5 @@ bool SignaturePrivate::verify(const QByteArray &signaturePkcs7, const QList<QByt throw; } } + +AM_END_NAMESPACE diff --git a/src/dbus/io.qt.applicationmanager.xml b/src/dbus/io.qt.applicationmanager.xml index 481c957d..5caf83ff 100644 --- a/src/dbus/io.qt.applicationmanager.xml +++ b/src/dbus/io.qt.applicationmanager.xml @@ -45,7 +45,7 @@ <arg name="id" type="s" direction="in"/> <arg name="debugWrapper" type="s" direction="in"/> <arg name="redirections" type="a{sh}" direction="in"/> - <annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="UnixFdMap"/> + <annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="QtAM::UnixFdMap"/> <arg name="documentUrl" type="s" direction="in"/> </method> <method name="debugApplication"> diff --git a/src/installer-lib/applicationinstaller.cpp b/src/installer-lib/applicationinstaller.cpp index 8657fe35..ab7d1e59 100644 --- a/src/installer-lib/applicationinstaller.cpp +++ b/src/installer-lib/applicationinstaller.cpp @@ -191,6 +191,7 @@ \sa taskStateChanged() */ +AM_BEGIN_NAMESPACE ApplicationInstaller *ApplicationInstaller::s_instance = 0; @@ -1098,3 +1099,5 @@ bool removeRecursiveHelper(const QString &path) else return recursiveOperation(path, SafeRemove()); } + +AM_END_NAMESPACE diff --git a/src/installer-lib/applicationinstaller.h b/src/installer-lib/applicationinstaller.h index 115e3e2e..fc09ea8a 100644 --- a/src/installer-lib/applicationinstaller.h +++ b/src/installer-lib/applicationinstaller.h @@ -57,6 +57,8 @@ QT_FORWARD_DECLARE_CLASS(QQmlEngine) QT_FORWARD_DECLARE_CLASS(QJSEngine) +AM_BEGIN_NAMESPACE + class ApplicationManager; class ApplicationInstallerPrivate; class AsynchronousTask; @@ -176,3 +178,5 @@ private: friend class InstallationTask; friend class DeinstallationTask; }; + +AM_END_NAMESPACE diff --git a/src/installer-lib/applicationinstaller_p.h b/src/installer-lib/applicationinstaller_p.h index beffe6e7..77f74ca2 100644 --- a/src/installer-lib/applicationinstaller_p.h +++ b/src/installer-lib/applicationinstaller_p.h @@ -52,10 +52,10 @@ #include "dbus-policy.h" #include "global.h" +AM_BEGIN_NAMESPACE bool removeRecursiveHelper(const QString &path); - class ApplicationInstallerPrivate { public: @@ -83,3 +83,5 @@ public: QMap<QByteArray, DBusPolicy> dbusPolicy; }; + +AM_END_NAMESPACE diff --git a/src/installer-lib/asynchronoustask.cpp b/src/installer-lib/asynchronoustask.cpp index e1578275..90c4b402 100644 --- a/src/installer-lib/asynchronoustask.cpp +++ b/src/installer-lib/asynchronoustask.cpp @@ -44,6 +44,8 @@ #include "global.h" #include "asynchronoustask.h" +AM_BEGIN_NAMESPACE + AsynchronousTask::AsynchronousTask(QObject *parent) : QThread(parent) , m_id(QUuid::createUuid().toString()) @@ -130,3 +132,5 @@ void AsynchronousTask::run() { execute(); } + +AM_END_NAMESPACE diff --git a/src/installer-lib/asynchronoustask.h b/src/installer-lib/asynchronoustask.h index 62d5abd9..293c19b7 100644 --- a/src/installer-lib/asynchronoustask.h +++ b/src/installer-lib/asynchronoustask.h @@ -46,6 +46,8 @@ #include "error.h" +AM_BEGIN_NAMESPACE + class AsynchronousTask : public QThread { Q_OBJECT @@ -82,7 +84,7 @@ public: QString applicationId() const; // convenience signals: - void stateChanged(AsynchronousTask::State newState); + void stateChanged(AM_PREPEND_NAMESPACE(AsynchronousTask::State) newState); void progress(qreal p); protected: @@ -100,4 +102,6 @@ protected: QString m_errorString; }; -Q_DECLARE_METATYPE(AsynchronousTask::State) +AM_END_NAMESPACE + +Q_DECLARE_METATYPE(AM_PREPEND_NAMESPACE(AsynchronousTask::State)) diff --git a/src/installer-lib/deinstallationtask.cpp b/src/installer-lib/deinstallationtask.cpp index 7a4c6eee..4c23a0bb 100644 --- a/src/installer-lib/deinstallationtask.cpp +++ b/src/installer-lib/deinstallationtask.cpp @@ -49,6 +49,7 @@ #include "scopeutilities.h" #include "deinstallationtask.h" +AM_BEGIN_NAMESPACE DeinstallationTask::DeinstallationTask(const Application *app, const InstallationLocation &installationLocation, bool forceDeinstallation, bool keepDocuments, QObject *parent) @@ -161,3 +162,5 @@ void DeinstallationTask::execute() setError(e.errorCode(), e.errorString()); } } + +AM_END_NAMESPACE diff --git a/src/installer-lib/deinstallationtask.h b/src/installer-lib/deinstallationtask.h index 01641b5f..85686e21 100644 --- a/src/installer-lib/deinstallationtask.h +++ b/src/installer-lib/deinstallationtask.h @@ -43,6 +43,8 @@ #include "asynchronoustask.h" +AM_BEGIN_NAMESPACE + class Application; class InstallationLocation; @@ -63,4 +65,4 @@ private: bool m_keepDocuments; }; - +AM_END_NAMESPACE diff --git a/src/installer-lib/installationtask.cpp b/src/installer-lib/installationtask.cpp index 28c9fbed..70de2d76 100644 --- a/src/installer-lib/installationtask.cpp +++ b/src/installer-lib/installationtask.cpp @@ -52,7 +52,6 @@ #include "sudo.h" #include "installationtask.h" - /* Overview of what happens on an installation of an app with <id> to <location>: @@ -124,6 +123,7 @@ rename <location>/<id>+ to <location>/<id> */ +AM_BEGIN_NAMESPACE InstallationTask::InstallationTask(const InstallationLocation &installationLocation, const QUrl &sourceUrl, QObject *parent) : AsynchronousTask(parent) @@ -329,7 +329,7 @@ void InstallationTask::checkExtractedFile(const QString &file) throw(Exception) "startingApplicationInstallation", Qt::BlockingQueuedConnection, Q_RETURN_ARG(bool, m_managerApproval), - Q_ARG(Application *, m_app)); + Q_ARG(AM_PREPEND_NAMESPACE(Application) *, m_app)); if (!m_managerApproval) throw Exception(Error::System, "Application Manager declined the installation of %1").arg(m_app->id()); @@ -553,3 +553,5 @@ void InstallationTask::finishInstallation() throw (Exception) m_errorString.clear(); } + +AM_END_NAMESPACE diff --git a/src/installer-lib/installationtask.h b/src/installer-lib/installationtask.h index 54d89f19..6a03ecfd 100644 --- a/src/installer-lib/installationtask.h +++ b/src/installer-lib/installationtask.h @@ -52,6 +52,8 @@ #include "scopeutilities.h" #include "exception.h" +AM_BEGIN_NAMESPACE + class Application; class PackageExtractor; @@ -107,3 +109,5 @@ private: ScopedLoopbackCreator m_loopbackCreator; ScopedMounter m_imageMounter; }; + +AM_END_NAMESPACE diff --git a/src/installer-lib/package_p.cpp b/src/installer-lib/package_p.cpp index b56dace8..5074222c 100644 --- a/src/installer-lib/package_p.cpp +++ b/src/installer-lib/package_p.cpp @@ -48,6 +48,7 @@ #include "package_p.h" #include "digestfilter.h" +AM_BEGIN_NAMESPACE ArchiveException::ArchiveException(struct ::archive *ar, const char *errorString) : Exception(Error::Archive, qSL("[libarchive] ") + qL1S(errorString) + qSL(": ") + QString::fromLocal8Bit(::archive_error_string(ar))) @@ -83,3 +84,5 @@ void PackageUtilities::addImportantHeaderDataToDigest(const QVariantMap &header, } } } + +AM_END_NAMESPACE diff --git a/src/installer-lib/package_p.h b/src/installer-lib/package_p.h index cdc463f1..5f807154 100644 --- a/src/installer-lib/package_p.h +++ b/src/installer-lib/package_p.h @@ -47,6 +47,9 @@ struct archive; QT_FORWARD_DECLARE_CLASS(QFileInfo) + +AM_BEGIN_NAMESPACE + class DigestFilter; class PackageUtilities @@ -72,3 +75,4 @@ public: ArchiveException(struct ::archive *ar, const char *errorString); }; +AM_END_NAMESPACE diff --git a/src/installer-lib/packagecreator.cpp b/src/installer-lib/packagecreator.cpp index 945ffb1e..a7b19ebf 100644 --- a/src/installer-lib/packagecreator.cpp +++ b/src/installer-lib/packagecreator.cpp @@ -66,6 +66,7 @@ # define S_IEXEC S_IXUSR #endif +AM_BEGIN_NAMESPACE /*! \internal This is a workaround for the stupid filename encoding handling in libarchive: @@ -387,3 +388,5 @@ void PackageCreatorPrivate::setError(Error errorCode, const QString &errorString m_errorString = errorString; } } + +AM_END_NAMESPACE diff --git a/src/installer-lib/packagecreator.h b/src/installer-lib/packagecreator.h index 86411fd7..f5d71e1d 100644 --- a/src/installer-lib/packagecreator.h +++ b/src/installer-lib/packagecreator.h @@ -48,6 +48,8 @@ QT_FORWARD_DECLARE_CLASS(QIODevice) QT_FORWARD_DECLARE_CLASS(QDir) +AM_BEGIN_NAMESPACE + class PackageCreatorPrivate; class InstallationReport; @@ -83,3 +85,5 @@ private: friend class PackageCreatorPrivate; }; + +AM_END_NAMESPACE diff --git a/src/installer-lib/packagecreator_p.h b/src/installer-lib/packagecreator_p.h index fd324602..305bfec6 100644 --- a/src/installer-lib/packagecreator_p.h +++ b/src/installer-lib/packagecreator_p.h @@ -45,6 +45,7 @@ #include <archive.h> +AM_BEGIN_NAMESPACE class PackageCreatorPrivate { @@ -72,3 +73,5 @@ private: friend class PackageCreator; }; + +AM_END_NAMESPACE diff --git a/src/installer-lib/packageextractor.cpp b/src/installer-lib/packageextractor.cpp index ef35f812..d3080012 100644 --- a/src/installer-lib/packageextractor.cpp +++ b/src/installer-lib/packageextractor.cpp @@ -70,6 +70,7 @@ # define S_IEXEC S_IXUSR #endif +AM_BEGIN_NAMESPACE PackageExtractor::PackageExtractor(const QUrl &downloadUrl, const QDir &destinationDir, QObject *parent) : QObject(parent) @@ -554,3 +555,4 @@ void PackageExtractorPrivate::downloadProgressChanged(qint64 downloaded, qint64 m_downloadTotal = total; } +AM_END_NAMESPACE diff --git a/src/installer-lib/packageextractor.h b/src/installer-lib/packageextractor.h index 6ed5d10a..814dd407 100644 --- a/src/installer-lib/packageextractor.h +++ b/src/installer-lib/packageextractor.h @@ -50,6 +50,8 @@ QT_FORWARD_DECLARE_CLASS(QUrl) QT_FORWARD_DECLARE_CLASS(QDir) +AM_BEGIN_NAMESPACE + class PackageExtractorPrivate; class InstallationReport; @@ -87,3 +89,5 @@ private: friend class PackageExtractorPrivate; }; + +AM_END_NAMESPACE diff --git a/src/installer-lib/packageextractor_p.h b/src/installer-lib/packageextractor_p.h index 2fb3ad9b..813a664f 100644 --- a/src/installer-lib/packageextractor_p.h +++ b/src/installer-lib/packageextractor_p.h @@ -45,15 +45,16 @@ #include <QNetworkReply> #include <QEventLoop> +#include <archive.h> + #include "packageextractor.h" #include "installationreport.h" #include "exception.h" -#include <archive.h> +AM_BEGIN_NAMESPACE class DigestFilter; - class PackageExtractorPrivate : public QObject { Q_OBJECT @@ -100,3 +101,5 @@ private: friend class PackageExtractor; }; +AM_END_NAMESPACE + diff --git a/src/installer-lib/scopeutilities.cpp b/src/installer-lib/scopeutilities.cpp index bde59952..a0b0f82a 100644 --- a/src/installer-lib/scopeutilities.cpp +++ b/src/installer-lib/scopeutilities.cpp @@ -43,6 +43,7 @@ #include "applicationinstaller_p.h" #include "utilities.h" +AM_BEGIN_NAMESPACE ScopedDirectoryCreator::ScopedDirectoryCreator() { } @@ -341,4 +342,4 @@ QString ScopedRenamer::baseName() const return m_basePath.absoluteFilePath(m_name); } - +AM_END_NAMESPACE diff --git a/src/installer-lib/scopeutilities.h b/src/installer-lib/scopeutilities.h index 8ce164fe..3e4ecd9e 100644 --- a/src/installer-lib/scopeutilities.h +++ b/src/installer-lib/scopeutilities.h @@ -45,6 +45,9 @@ #include <QDir> #include <QFile> +#include "global.h" + +AM_BEGIN_NAMESPACE class ScopedDirectoryCreator { @@ -153,4 +156,6 @@ private: bool m_taken = false; }; -Q_DECLARE_OPERATORS_FOR_FLAGS(ScopedRenamer::Modes) +AM_END_NAMESPACE + +Q_DECLARE_OPERATORS_FOR_FLAGS(AM_PREPEND_NAMESPACE(ScopedRenamer::Modes)) diff --git a/src/installer-lib/sudo.cpp b/src/installer-lib/sudo.cpp index b9aa2aaf..32c73c15 100644 --- a/src/installer-lib/sudo.cpp +++ b/src/installer-lib/sudo.cpp @@ -56,19 +56,18 @@ #include <errno.h> -#ifdef Q_OS_LINUX - -#include <fcntl.h> -#include <unistd.h> -#include <sys/socket.h> -#include <sys/errno.h> -#include <sys/mount.h> -#include <sys/ioctl.h> -#include <sys/stat.h> -#include <mntent.h> -#include <linux/loop.h> -#include <sys/prctl.h> -#include <linux/capability.h> +#if defined(Q_OS_LINUX) +# include <fcntl.h> +# include <unistd.h> +# include <sys/socket.h> +# include <sys/errno.h> +# include <sys/mount.h> +# include <sys/ioctl.h> +# include <sys/stat.h> +# include <mntent.h> +# include <linux/loop.h> +# include <sys/prctl.h> +# include <linux/capability.h> // These two functions are implemented in glibc, but the header file is // in the separate libcap-dev package. Since we want to avoid unnecessary @@ -77,34 +76,40 @@ extern "C" int capset(cap_user_header_t header, cap_user_data_t data); extern "C" int capget(cap_user_header_t header, const cap_user_data_t data); // Support for old/broken C libraries -#if defined(_LINUX_CAPABILITY_VERSION) && !defined(_LINUX_CAPABILITY_VERSION_1) -# define _LINUX_CAPABILITY_VERSION_1 _LINUX_CAPABILITY_VERSION -#endif +# if defined(_LINUX_CAPABILITY_VERSION) && !defined(_LINUX_CAPABILITY_VERSION_1) +# define _LINUX_CAPABILITY_VERSION_1 _LINUX_CAPABILITY_VERSION +# endif // Missing support for dynamic loop device management -#if !defined(LOOP_CTL_REMOVE) -# define LOOP_CTL_REMOVE 0x4C81 -#endif -#if !defined(LOOP_CTL_GET_FREE) -# define LOOP_CTL_GET_FREE 0x4C82 -#endif +# if !defined(LOOP_CTL_REMOVE) +# define LOOP_CTL_REMOVE 0x4C81 +# endif +# if !defined(LOOP_CTL_GET_FREE) +# define LOOP_CTL_GET_FREE 0x4C82 +# endif // Convenient way to ignore EINTR on any system call -#define EINTR_LOOP(cmd) __extension__ ({auto res = 0; do { res = cmd; } while (res == -1 && errno == EINTR); res; }) +# define EINTR_LOOP(cmd) __extension__ ({auto res = 0; do { res = cmd; } while (res == -1 && errno == EINTR); res; }) // Declared as weak symbol here, so we can check at runtime if we were compiled against libgcov extern "C" void __gcov_init() __attribute__((weak)); +AM_BEGIN_NAMESPACE + static void sigHupHandler(int sig) { if (sig == SIGHUP) abort(); } +AM_END_NAMESPACE + #endif // Q_OS_LINUX +AM_BEGIN_NAMESPACE + bool forkSudoServer(SudoDropPrivileges dropPrivileges, QString *errorString) { bool canSudo = false; @@ -771,3 +776,5 @@ bool SudoServer::setOwnerAndPermissionsRecursive(const QString &fileOrDir, uid_t #endif // Q_OS_LINUX return false; } + +AM_END_NAMESPACE diff --git a/src/installer-lib/sudo.h b/src/installer-lib/sudo.h index 2a664197..43942b6a 100644 --- a/src/installer-lib/sudo.h +++ b/src/installer-lib/sudo.h @@ -54,6 +54,9 @@ typedef uint gid_t; //typedef uint mode_t; // already typedef'ed in qplatformdefs.h #endif +#include "global.h" + +AM_BEGIN_NAMESPACE enum SudoDropPrivileges { DropPrivilegesPermanently, @@ -156,3 +159,4 @@ private: static SudoServer *s_instance; }; +AM_END_NAMESPACE diff --git a/src/launchers/qml/applicationmanagerwindow.cpp b/src/launchers/qml/applicationmanagerwindow.cpp index 8d5642f0..37d7fc7c 100644 --- a/src/launchers/qml/applicationmanagerwindow.cpp +++ b/src/launchers/qml/applicationmanagerwindow.cpp @@ -46,6 +46,7 @@ #include "applicationmanagerwindow.h" +AM_BEGIN_NAMESPACE class ApplicationManagerWindowPrivate { @@ -246,3 +247,4 @@ void ApplicationManagerWindow::onFrameSwapped() d->frameCount++; } +AM_END_NAMESPACE diff --git a/src/launchers/qml/applicationmanagerwindow.h b/src/launchers/qml/applicationmanagerwindow.h index 3d316d16..dc70b139 100644 --- a/src/launchers/qml/applicationmanagerwindow.h +++ b/src/launchers/qml/applicationmanagerwindow.h @@ -43,9 +43,11 @@ #include <private/qquickwindowmodule_p.h> #include <QTime> +#include "global.h" QT_FORWARD_DECLARE_CLASS(QPlatformWindow) +AM_BEGIN_NAMESPACE class ApplicationManagerWindowPrivate; @@ -74,3 +76,5 @@ private slots: private: ApplicationManagerWindowPrivate *d; }; + +AM_END_NAMESPACE diff --git a/src/launchers/qml/ipcwrapperobject.cpp b/src/launchers/qml/ipcwrapperobject.cpp index 5cfea166..9f1a075b 100644 --- a/src/launchers/qml/ipcwrapperobject.cpp +++ b/src/launchers/qml/ipcwrapperobject.cpp @@ -168,7 +168,7 @@ static QString stringify(const QVariant &value, int level, bool indentFirstLine) #endif // debug only - +AM_BEGIN_NAMESPACE IpcWrapperObject::IpcWrapperObject(const QString &service, const QString &path, const QString &interface, const QDBusConnection &connection, QObject *parent) : QObject(parent) @@ -358,3 +358,5 @@ void IpcWrapperSignalRelay::onPropertiesChanged(const QString &interfaceName, co { m_wrapperObject->onPropertiesChanged(interfaceName, changed, invalidated); } + +AM_END_NAMESPACE diff --git a/src/launchers/qml/ipcwrapperobject.h b/src/launchers/qml/ipcwrapperobject.h index 809d893a..2a6ecd03 100644 --- a/src/launchers/qml/ipcwrapperobject.h +++ b/src/launchers/qml/ipcwrapperobject.h @@ -43,11 +43,14 @@ #include <QObject> #include <QDBusError> +#include "global.h" QT_FORWARD_DECLARE_CLASS(QDBusInterface) QT_FORWARD_DECLARE_CLASS(QDBusConnection) -class IpcWrapperSignalRelay; +AM_BEGIN_NAMESPACE + +class IpcWrapperSignalRelay; class IpcWrapperObject : public QObject { @@ -73,3 +76,5 @@ private: IpcWrapperSignalRelay *m_wrapperHelper; QDBusInterface *m_dbusInterface; }; + +AM_END_NAMESPACE diff --git a/src/launchers/qml/ipcwrapperobject_p.h b/src/launchers/qml/ipcwrapperobject_p.h index 99fe2c5c..fc2eb248 100644 --- a/src/launchers/qml/ipcwrapperobject_p.h +++ b/src/launchers/qml/ipcwrapperobject_p.h @@ -43,8 +43,11 @@ #include <QObject> -class IpcWrapperObject; +#include "global.h" + +AM_BEGIN_NAMESPACE +class IpcWrapperObject; class IpcWrapperSignalRelay : public QObject { @@ -59,3 +62,5 @@ public slots: private: IpcWrapperObject *m_wrapperObject; }; + +AM_END_NAMESPACE diff --git a/src/launchers/qml/main.cpp b/src/launchers/qml/main.cpp index d24b4dd8..ceb68080 100644 --- a/src/launchers/qml/main.cpp +++ b/src/launchers/qml/main.cpp @@ -76,6 +76,7 @@ #include "global.h" #include "utilities.h" +AM_BEGIN_NAMESPACE // maybe make this configurable for specific workloads? class HeadlessIncubationController : public QObject, public QQmlIncubationController @@ -141,7 +142,9 @@ private: #endif }; +AM_END_NAMESPACE +AM_USE_NAMESPACE int main(int argc, char *argv[]) { diff --git a/src/launchers/qml/qmlapplicationinterface.cpp b/src/launchers/qml/qmlapplicationinterface.cpp index 4309f610..7a27ab97 100644 --- a/src/launchers/qml/qmlapplicationinterface.cpp +++ b/src/launchers/qml/qmlapplicationinterface.cpp @@ -53,6 +53,8 @@ #include "notification.h" #include "ipcwrapperobject.h" +AM_BEGIN_NAMESPACE + QmlApplicationInterface *QmlApplicationInterface::s_instance = 0; QmlApplicationInterface::QmlApplicationInterface(const QVariantMap &additionalConfiguration, const QString &dbusConnectionName, QObject *parent) @@ -315,3 +317,4 @@ void QmlApplicationInterfaceExtension::setName(const QString &name) qWarning("Cannot change the name property of an ApplicationInterfaceExtension after creation."); } +AM_END_NAMESPACE diff --git a/src/launchers/qml/qmlapplicationinterface.h b/src/launchers/qml/qmlapplicationinterface.h index 64fd1467..63f119d5 100644 --- a/src/launchers/qml/qmlapplicationinterface.h +++ b/src/launchers/qml/qmlapplicationinterface.h @@ -52,6 +52,8 @@ QT_FORWARD_DECLARE_CLASS(QDBusInterface) +AM_BEGIN_NAMESPACE + class QmlNotification : public Notification { public: @@ -136,3 +138,5 @@ private: QObject *m_object = nullptr; bool m_complete = false; }; + +AM_END_NAMESPACE diff --git a/src/manager-lib/abstractcontainer.cpp b/src/manager-lib/abstractcontainer.cpp index 038a0649..dbfb5467 100644 --- a/src/manager-lib/abstractcontainer.cpp +++ b/src/manager-lib/abstractcontainer.cpp @@ -44,6 +44,8 @@ #include "application.h" #include "abstractcontainer.h" +AM_BEGIN_NAMESPACE + AbstractContainer::~AbstractContainer() { } @@ -222,3 +224,5 @@ void ContainerDebugWrapper::resolveParameters(const QString &program, const QStr } m_command = args; } + +AM_END_NAMESPACE diff --git a/src/manager-lib/abstractcontainer.h b/src/manager-lib/abstractcontainer.h index 2f4289c8..8dded8d0 100644 --- a/src/manager-lib/abstractcontainer.h +++ b/src/manager-lib/abstractcontainer.h @@ -48,6 +48,8 @@ #include "global.h" +AM_BEGIN_NAMESPACE + class Application; class AbstractContainer; @@ -161,4 +163,6 @@ protected: AbstractContainerProcess *m_process = nullptr; }; -Q_DECLARE_METATYPE(AbstractContainer *) +AM_END_NAMESPACE + +Q_DECLARE_METATYPE(AM_PREPEND_NAMESPACE(AbstractContainer *)) diff --git a/src/manager-lib/abstractruntime.cpp b/src/manager-lib/abstractruntime.cpp index dddaee13..df36f463 100644 --- a/src/manager-lib/abstractruntime.cpp +++ b/src/manager-lib/abstractruntime.cpp @@ -46,6 +46,7 @@ #include "cryptography.h" #include "exception.h" +AM_BEGIN_NAMESPACE AbstractRuntime::AbstractRuntime(AbstractContainer *container, const Application *app, AbstractRuntimeManager *manager) : QObject(manager) @@ -171,3 +172,5 @@ void AbstractRuntimeManager::setAdditionalConfiguration(const QVariantMap &addit { m_additionalConfiguration = additionalConfiguration; } + +AM_END_NAMESPACE diff --git a/src/manager-lib/abstractruntime.h b/src/manager-lib/abstractruntime.h index 5513cbdf..1e307bf5 100644 --- a/src/manager-lib/abstractruntime.h +++ b/src/manager-lib/abstractruntime.h @@ -50,6 +50,8 @@ QT_FORWARD_DECLARE_CLASS(QQmlEngine) QT_FORWARD_DECLARE_CLASS(QQuickItem) +AM_BEGIN_NAMESPACE + class Application; class AbstractContainer; class AbstractRuntime; @@ -124,7 +126,7 @@ public slots: virtual void stop(bool forceKill = false) = 0; signals: - void stateChanged(State newState); + void stateChanged(AM_PREPEND_NAMESPACE(AbstractRuntime::State) newState); void finished(int exitCode, QProcess::ExitStatus status); #if !defined(AM_HEADLESS) @@ -149,4 +151,6 @@ protected: friend class AbstractRuntimeManager; }; -Q_DECLARE_METATYPE(AbstractRuntime *) +AM_END_NAMESPACE + +Q_DECLARE_METATYPE(AM_PREPEND_NAMESPACE(AbstractRuntime *)) diff --git a/src/manager-lib/application.cpp b/src/manager-lib/application.cpp index 1274485c..46a98690 100644 --- a/src/manager-lib/application.cpp +++ b/src/manager-lib/application.cpp @@ -49,6 +49,7 @@ #include "installationreport.h" #include "yamlapplicationscanner.h" +AM_BEGIN_NAMESPACE Application::Application() { } @@ -404,8 +405,9 @@ void Application::writeToDataStream(QDataStream &ds, const QVector<const Applica << serializedReport; } +AM_END_NAMESPACE -QDebug operator<<(QDebug debug, const Application *app) +QDebug operator<<(QDebug debug, const AM_PREPEND_NAMESPACE(Application) *app) { debug << "App Object:"; if (app) @@ -414,3 +416,4 @@ QDebug operator<<(QDebug debug, const Application *app) debug << "(null)"; return debug; } + diff --git a/src/manager-lib/application.h b/src/manager-lib/application.h index 20a27dea..7789d74c 100644 --- a/src/manager-lib/application.h +++ b/src/manager-lib/application.h @@ -51,6 +51,8 @@ #include "installationreport.h" #include "exception.h" +AM_BEGIN_NAMESPACE + class AbstractRuntime; class ApplicationManager; class JsonApplicationScanner; @@ -68,11 +70,11 @@ class AM_EXPORT Application : public QObject Q_PROPERTY(qreal importance READ importance) Q_PROPERTY(bool builtIn READ isBuiltIn) Q_PROPERTY(bool alias READ isAlias) - Q_PROPERTY(const Application *nonAliased READ nonAliased) + 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(AbstractRuntime *runtime READ currentRuntime) + Q_PROPERTY(AM_PREPEND_NAMESPACE(AbstractRuntime) *runtime READ currentRuntime) public: enum Type { Gui, Headless }; @@ -190,6 +192,8 @@ private: Q_DISABLE_COPY(Application) }; -Q_DECLARE_METATYPE(const Application *) +AM_END_NAMESPACE + +Q_DECLARE_METATYPE(const AM_PREPEND_NAMESPACE(Application *)) -QDebug operator<<(QDebug debug, const Application *app); +QDebug operator<<(QDebug debug, const AM_PREPEND_NAMESPACE(Application) *app); diff --git a/src/manager-lib/applicationdatabase.cpp b/src/manager-lib/applicationdatabase.cpp index 111bb40d..a25e0796 100644 --- a/src/manager-lib/applicationdatabase.cpp +++ b/src/manager-lib/applicationdatabase.cpp @@ -46,6 +46,8 @@ #include "application.h" #include "applicationdatabase.h" +AM_BEGIN_NAMESPACE + class ApplicationDatabasePrivate { public: @@ -134,3 +136,5 @@ void ApplicationDatabase::write(const QVector<const Application *> &apps) throw if (ds.status() != QDataStream::Ok) throw Exception(*d->file, "could not write to application database"); } + +AM_END_NAMESPACE diff --git a/src/manager-lib/applicationdatabase.h b/src/manager-lib/applicationdatabase.h index 5a3721f7..a4748083 100644 --- a/src/manager-lib/applicationdatabase.h +++ b/src/manager-lib/applicationdatabase.h @@ -46,6 +46,8 @@ #include "exception.h" +AM_BEGIN_NAMESPACE + class Application; class ApplicationDatabasePrivate; @@ -68,3 +70,5 @@ private: ApplicationDatabasePrivate *d; Q_DISABLE_COPY(ApplicationDatabase) }; + +AM_END_NAMESPACE diff --git a/src/manager-lib/applicationinterface.h b/src/manager-lib/applicationinterface.h index cbf25d64..df09cdbc 100644 --- a/src/manager-lib/applicationinterface.h +++ b/src/manager-lib/applicationinterface.h @@ -44,6 +44,9 @@ #include <QObject> #include <QUrl> #include <QVariantMap> +#include "global.h" + +AM_BEGIN_NAMESPACE class ApplicationInterface : public QObject { @@ -74,3 +77,5 @@ protected: private: Q_DISABLE_COPY(ApplicationInterface) }; + +AM_END_NAMESPACE diff --git a/src/manager-lib/applicationipcinterface.cpp b/src/manager-lib/applicationipcinterface.cpp index c6d5cebe..a5c137d1 100644 --- a/src/manager-lib/applicationipcinterface.cpp +++ b/src/manager-lib/applicationipcinterface.cpp @@ -59,6 +59,7 @@ #include "applicationipcinterface.h" #include "applicationipcinterface_p.h" +AM_BEGIN_NAMESPACE ApplicationIPCInterface::ApplicationIPCInterface(QObject *parent) : QObject(parent) @@ -705,3 +706,5 @@ bool ApplicationIPCInterfaceAttached::resolveProxy() const } return (m_proxy); } + +AM_END_NAMESPACE diff --git a/src/manager-lib/applicationipcinterface.h b/src/manager-lib/applicationipcinterface.h index 27e3b79f..935cf6f5 100644 --- a/src/manager-lib/applicationipcinterface.h +++ b/src/manager-lib/applicationipcinterface.h @@ -46,12 +46,14 @@ #if defined(QT_DBUS_LIB) # include <QDBusConnection> #endif +#include "global.h" + +AM_BEGIN_NAMESPACE class Application; class ApplicationIPCInterfaceAttached; class IpcProxyObject; - class ApplicationIPCInterface : public QObject { Q_OBJECT @@ -76,4 +78,6 @@ private: friend class ApplicationIPCManager; }; -QML_DECLARE_TYPEINFO(ApplicationIPCInterface, QML_HAS_ATTACHED_PROPERTIES) +AM_END_NAMESPACE + +QML_DECLARE_TYPEINFO(AM_PREPEND_NAMESPACE(ApplicationIPCInterface), QML_HAS_ATTACHED_PROPERTIES) diff --git a/src/manager-lib/applicationipcinterface_p.h b/src/manager-lib/applicationipcinterface_p.h index 1d100f22..9bfc2b3f 100644 --- a/src/manager-lib/applicationipcinterface_p.h +++ b/src/manager-lib/applicationipcinterface_p.h @@ -48,6 +48,9 @@ #if defined(QT_DBUS_LIB) # include <QDBusVirtualObject> #endif +#include "global.h" + +AM_BEGIN_NAMESPACE class Application; class IpcProxySignalRelay; @@ -147,3 +150,5 @@ private: QObject *m_object; mutable IpcProxyObject *m_proxy = nullptr; }; + +AM_END_NAMESPACE diff --git a/src/manager-lib/applicationipcmanager.cpp b/src/manager-lib/applicationipcmanager.cpp index 3ddfa7a7..67956140 100644 --- a/src/manager-lib/applicationipcmanager.cpp +++ b/src/manager-lib/applicationipcmanager.cpp @@ -64,6 +64,7 @@ the client (application) side. */ +AM_BEGIN_NAMESPACE ApplicationIPCManager *ApplicationIPCManager::s_instance = 0; @@ -257,4 +258,4 @@ QVector<ApplicationIPCInterface *> ApplicationIPCManager::interfaces() const return m_interfaces; } - +AM_END_NAMESPACE diff --git a/src/manager-lib/applicationipcmanager.h b/src/manager-lib/applicationipcmanager.h index a71573e5..92f8e3c1 100644 --- a/src/manager-lib/applicationipcmanager.h +++ b/src/manager-lib/applicationipcmanager.h @@ -45,6 +45,9 @@ #include <QVariantMap> #include <QVector> #include <qqml.h> +#include "global.h" + +AM_BEGIN_NAMESPACE class ApplicationIPCManagerAttached; class ApplicationIPCInterface; @@ -59,7 +62,7 @@ public: static ApplicationIPCManager *instance(); static QObject *instanceForQml(QQmlEngine *qmlEngine, QJSEngine *); - Q_INVOKABLE bool registerInterface(ApplicationIPCInterface *interface, const QString &name, const QVariantMap &filter); + Q_INVOKABLE bool registerInterface(AM_PREPEND_NAMESPACE(ApplicationIPCInterface) *interface, const QString &name, const QVariantMap &filter); QVector<ApplicationIPCInterface *> interfaces() const; private: @@ -70,3 +73,5 @@ private: QVector<ApplicationIPCInterface *> m_interfaces; static ApplicationIPCManager *s_instance; }; + +AM_END_NAMESPACE diff --git a/src/manager-lib/applicationmanager.cpp b/src/manager-lib/applicationmanager.cpp index 3389e745..84adb656 100644 --- a/src/manager-lib/applicationmanager.cpp +++ b/src/manager-lib/applicationmanager.cpp @@ -259,6 +259,7 @@ enum Roles ApplicationItem }; +AM_BEGIN_NAMESPACE class ApplicationManagerPrivate { @@ -1348,3 +1349,5 @@ ApplicationManager::RunState ApplicationManager::applicationRunState(const QStri default: return NotRunning; } } + +AM_END_NAMESPACE diff --git a/src/manager-lib/applicationmanager.h b/src/manager-lib/applicationmanager.h index b7ef857c..94e5488a 100644 --- a/src/manager-lib/applicationmanager.h +++ b/src/manager-lib/applicationmanager.h @@ -50,11 +50,14 @@ # include <QDBusConnectionInterface> # include "dbus-utilities.h" #endif +#include "global.h" QT_FORWARD_DECLARE_CLASS(QDir) QT_FORWARD_DECLARE_CLASS(QQmlEngine) QT_FORWARD_DECLARE_CLASS(QJSEngine) +AM_BEGIN_NAMESPACE + class Application; class ApplicationDatabase; class ApplicationManagerPrivate; @@ -131,7 +134,7 @@ public: Q_SCRIPTABLE bool startApplication(const QString &id, const QString &documentUrl = QString()); Q_SCRIPTABLE bool debugApplication(const QString &id, const QString &debugWrapper, const QString &documentUrl = QString()); #if defined(QT_DBUS_LIB) - Q_SCRIPTABLE bool debugApplication(const QString &id, const QString &debugWrapper, const UnixFdMap &redirections, const QString &documentUrl = QString()); + Q_SCRIPTABLE bool debugApplication(const QString &id, const QString &debugWrapper, const AM_PREPEND_NAMESPACE(UnixFdMap) &redirections, const QString &documentUrl = QString()); #endif Q_SCRIPTABLE void stopApplication(const QString &id, bool forceKill = false); Q_SCRIPTABLE bool openUrl(const QString &url); @@ -140,7 +143,7 @@ public: Q_SCRIPTABLE RunState applicationRunState(const QString &id) const; signals: - Q_SCRIPTABLE void applicationRunStateChanged(const QString &id, RunState runState); + Q_SCRIPTABLE void applicationRunStateChanged(const QString &id, AM_PREPEND_NAMESPACE(ApplicationManager::RunState) runState); Q_SCRIPTABLE void applicationWasActivated(const QString &id, const QString &aliasId); Q_SCRIPTABLE void countChanged(); @@ -148,7 +151,7 @@ signals: Q_SCRIPTABLE void applicationAboutToBeRemoved(const QString &id); Q_SCRIPTABLE void applicationChanged(const QString &id, const QStringList &changedRoles); - void inProcessRuntimeCreated(AbstractRuntime *runtime); // evil hook to support in-process runtimes + void inProcessRuntimeCreated(AM_PREPEND_NAMESPACE(AbstractRuntime) *runtime); // evil hook to support in-process runtimes void memoryLowWarning(); @@ -162,7 +165,7 @@ private slots: // need to use BlockingQueuedConnections bool lockApplication(const QString &id); bool unlockApplication(const QString &id); - bool startingApplicationInstallation(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); @@ -183,3 +186,5 @@ private: ApplicationManagerPrivate *d; }; + +AM_END_NAMESPACE diff --git a/src/manager-lib/applicationscanner.h b/src/manager-lib/applicationscanner.h index df11ca60..8a50dea0 100644 --- a/src/manager-lib/applicationscanner.h +++ b/src/manager-lib/applicationscanner.h @@ -45,6 +45,8 @@ #include "exception.h" +AM_BEGIN_NAMESPACE + class Application; class ApplicationScanner @@ -64,3 +66,5 @@ protected: private: Q_DISABLE_COPY(ApplicationScanner) }; + +AM_END_NAMESPACE diff --git a/src/manager-lib/containerfactory.cpp b/src/manager-lib/containerfactory.cpp index 93722e05..c9f671b7 100644 --- a/src/manager-lib/containerfactory.cpp +++ b/src/manager-lib/containerfactory.cpp @@ -48,6 +48,7 @@ #include "abstractcontainer.h" #include "containerfactory.h" +AM_BEGIN_NAMESPACE ContainerFactory *ContainerFactory::s_instance = nullptr; @@ -114,3 +115,5 @@ bool ContainerFactory::registerContainer(AbstractContainerManager *manager, cons return true; } + +AM_END_NAMESPACE diff --git a/src/manager-lib/containerfactory.h b/src/manager-lib/containerfactory.h index 32961230..dea2e66d 100644 --- a/src/manager-lib/containerfactory.h +++ b/src/manager-lib/containerfactory.h @@ -46,13 +46,13 @@ #include "global.h" +AM_BEGIN_NAMESPACE + class Application; class AbstractContainer; class AbstractContainerManager; class ContainerDebugWrapper; - - class ContainerFactory : public QObject { Q_OBJECT @@ -81,3 +81,4 @@ private: QMap<QString, AbstractContainerManager *> m_containers; }; +AM_END_NAMESPACE diff --git a/src/manager-lib/dbus-policy.cpp b/src/manager-lib/dbus-policy.cpp index d0f9fd40..1a77b752 100644 --- a/src/manager-lib/dbus-policy.cpp +++ b/src/manager-lib/dbus-policy.cpp @@ -45,6 +45,7 @@ #include "application.h" #include "dbus-policy.h" +AM_BEGIN_NAMESPACE QMap<QByteArray, DBusPolicy> parseDBusPolicy(const QVariantMap &yamlFragment) { @@ -136,3 +137,5 @@ bool checkDBusPolicy(const QDBusContext *dbusContext, const QMap<QByteArray, DBu } #endif } + +AM_END_NAMESPACE diff --git a/src/manager-lib/dbus-policy.h b/src/manager-lib/dbus-policy.h index 4ae6f231..36e8eba9 100644 --- a/src/manager-lib/dbus-policy.h +++ b/src/manager-lib/dbus-policy.h @@ -41,6 +41,16 @@ #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<uint> m_uids; @@ -50,10 +60,7 @@ struct DBusPolicy QMap<QByteArray, DBusPolicy> parseDBusPolicy(const QVariantMap &yamlFragment); -#if defined(QT_DBUS_LIB) -QT_FORWARD_DECLARE_CLASS(QDBusContext) -#else -typedef QObject QDBusContext; // evil hack :) -#endif - bool checkDBusPolicy(const QDBusContext *dbusContext, const QMap<QByteArray, DBusPolicy> &dbusPolicy, const QByteArray &function); + +AM_END_NAMESPACE + diff --git a/src/manager-lib/fakeapplicationmanagerwindow.cpp b/src/manager-lib/fakeapplicationmanagerwindow.cpp index 2454c5ff..70353857 100644 --- a/src/manager-lib/fakeapplicationmanagerwindow.cpp +++ b/src/manager-lib/fakeapplicationmanagerwindow.cpp @@ -38,10 +38,12 @@ ** SPDX-License-Identifier: LGPL-3.0 ** ****************************************************************************/ + #include "fakeapplicationmanagerwindow.h" #include "qmlinprocessruntime.h" #include <QSGSimpleRectNode> +AM_BEGIN_NAMESPACE FakeApplicationManagerWindow::FakeApplicationManagerWindow(QQuickItem *parent) : QQuickItem(parent) @@ -192,3 +194,5 @@ void FakeApplicationManagerWindow::onVisibleChanged() if (m_runtime && isVisible() && this->parent()) m_runtime->addWindow(this); } + +AM_END_NAMESPACE diff --git a/src/manager-lib/fakeapplicationmanagerwindow.h b/src/manager-lib/fakeapplicationmanagerwindow.h index eb6fd32e..b09d59b8 100644 --- a/src/manager-lib/fakeapplicationmanagerwindow.h +++ b/src/manager-lib/fakeapplicationmanagerwindow.h @@ -45,8 +45,9 @@ #include <QQuickItem> #include "global.h" -class QmlInProcessRuntime; +AM_BEGIN_NAMESPACE +class QmlInProcessRuntime; class FakeApplicationManagerWindow : public QQuickItem { @@ -123,3 +124,4 @@ private: friend class QmlInProcessRuntime; // for setting the m_runtime member }; +AM_END_NAMESPACE diff --git a/src/manager-lib/fpsmonitor.cpp b/src/manager-lib/fpsmonitor.cpp index 45dd0d0e..8194f76a 100644 --- a/src/manager-lib/fpsmonitor.cpp +++ b/src/manager-lib/fpsmonitor.cpp @@ -41,7 +41,9 @@ #include "fpsmonitor.h" +AM_BEGIN_NAMESPACE + FpsMonitor::FpsMonitor() -{ +{ } -} +AM_END_NAMESPACE diff --git a/src/manager-lib/fpsmonitor.h b/src/manager-lib/fpsmonitor.h index f6c12d11..325f06b9 100644 --- a/src/manager-lib/fpsmonitor.h +++ b/src/manager-lib/fpsmonitor.h @@ -39,10 +39,12 @@ ** ****************************************************************************/ -#ifndef FPSMONITOR_H -#define FPSMONITOR_H +#pragma once #include <QAbstractListModel> +#include "global.h" + +AM_BEGIN_NAMESPACE class FpsMonitor : public QAbstractListModel { @@ -51,4 +53,4 @@ public: FpsMonitor(); }; -#endif // FPSMONITOR_H +AM_END_NAMESPACE diff --git a/src/manager-lib/installationlocation.cpp b/src/manager-lib/installationlocation.cpp index 5e5b5ff2..cdad40d1 100644 --- a/src/manager-lib/installationlocation.cpp +++ b/src/manager-lib/installationlocation.cpp @@ -46,6 +46,7 @@ #include "utilities.h" #include "exception.h" +AM_BEGIN_NAMESPACE static QString fixPath(const QString &path) { @@ -225,3 +226,5 @@ QVector<InstallationLocation> InstallationLocation::parseInstallationLocations(c return locations; } + +AM_END_NAMESPACE diff --git a/src/manager-lib/installationlocation.h b/src/manager-lib/installationlocation.h index 63c5b71f..478e38e9 100644 --- a/src/manager-lib/installationlocation.h +++ b/src/manager-lib/installationlocation.h @@ -46,6 +46,7 @@ #include "exception.h" +AM_BEGIN_NAMESPACE class InstallationLocation { @@ -90,3 +91,5 @@ private: QString m_documentPath; QString m_mountPoint; }; + +AM_END_NAMESPACE diff --git a/src/manager-lib/installationreport.cpp b/src/manager-lib/installationreport.cpp index f7ef78ad..22f9486d 100644 --- a/src/manager-lib/installationreport.cpp +++ b/src/manager-lib/installationreport.cpp @@ -52,6 +52,8 @@ #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] = { @@ -256,3 +258,5 @@ bool InstallationReport::serialize(QIODevice *to) const return (to->write(out) == out.size()); } + +AM_END_NAMESPACE diff --git a/src/manager-lib/installationreport.h b/src/manager-lib/installationreport.h index 9ce0e4a6..f22ab355 100644 --- a/src/manager-lib/installationreport.h +++ b/src/manager-lib/installationreport.h @@ -44,9 +44,12 @@ #include <QString> #include <QStringList> #include <QByteArray> +#include "global.h" QT_FORWARD_DECLARE_CLASS(QIODevice) +AM_BEGIN_NAMESPACE + class InstallationReport { public: @@ -88,3 +91,5 @@ private: QByteArray m_developerSignature; QByteArray m_storeSignature; }; + +AM_END_NAMESPACE diff --git a/src/manager-lib/memorymonitor.cpp b/src/manager-lib/memorymonitor.cpp index 71949a03..7b6c4475 100644 --- a/src/manager-lib/memorymonitor.cpp +++ b/src/manager-lib/memorymonitor.cpp @@ -46,11 +46,13 @@ #include "memorymonitor.h" #if defined(Q_OS_OSX) -#include <mach/mach.h> +# include <mach/mach.h> #elif defined(Q_OS_LINUX) -#include "sysfsreader.h" +# include "sysfsreader.h" #endif +AM_BEGIN_NAMESPACE + namespace { // Sizes are in bytes enum Type { @@ -471,4 +473,4 @@ QList<QVariant> MemoryMonitor::getLibraryList() return d->libraries; } - +AM_END_NAMESPACE diff --git a/src/manager-lib/memorymonitor.h b/src/manager-lib/memorymonitor.h index 12f2d086..8b6eed06 100644 --- a/src/manager-lib/memorymonitor.h +++ b/src/manager-lib/memorymonitor.h @@ -39,14 +39,15 @@ ** ****************************************************************************/ -#ifndef MEMORYMONITOR_H -#define MEMORYMONITOR_H +#pragma once #include <QAbstractListModel> #include <QObject> #include <QFile> #include "processmonitor.h" +AM_BEGIN_NAMESPACE + class MemoryMonitorPrivate; class MemoryMonitor : public QAbstractListModel @@ -81,4 +82,4 @@ private: }; -#endif // MEMORYMONITOR_H +AM_END_NAMESPACE diff --git a/src/manager-lib/nativeruntime.cpp b/src/manager-lib/nativeruntime.cpp index b56b933f..b898909d 100644 --- a/src/manager-lib/nativeruntime.cpp +++ b/src/manager-lib/nativeruntime.cpp @@ -57,15 +57,18 @@ #include "applicationipcinterface.h" #include "utilities.h" +AM_BEGIN_NAMESPACE + // You can enable this define to get all P2P-bus objects onto the session bus // within io.qt.ApplicationManager, /Application<pid>/... // #define EXPORT_P2PBUS_OBJECTS_TO_SESSION_BUS 1 - #if defined(AM_MULTI_PROCESS) +AM_END_NAMESPACE # include <dbus/dbus.h> # include <sys/socket.h> +AM_BEGIN_NAMESPACE static qint64 getDBusPeerPid(const QDBusConnection &conn) { @@ -89,7 +92,6 @@ static qint64 getDBusPeerPid(const QDBusConnection &conn) #endif - NativeRuntime::NativeRuntime(AbstractContainer *container, const Application *app, NativeRuntimeManager *manager) : AbstractRuntime(container, app, manager) , m_isQuickLauncher(app == nullptr) @@ -451,3 +453,5 @@ QDBusServer *NativeRuntimeManager::applicationInterfaceServer() const { return m_applicationInterfaceServer; } + +AM_END_NAMESPACE diff --git a/src/manager-lib/nativeruntime.h b/src/manager-lib/nativeruntime.h index 152a3f2b..a540f23b 100644 --- a/src/manager-lib/nativeruntime.h +++ b/src/manager-lib/nativeruntime.h @@ -53,15 +53,16 @@ #define AM_NATIVE_RUNTIME_AVAILABLE +QT_FORWARD_DECLARE_CLASS(QDBusConnection) +QT_FORWARD_DECLARE_CLASS(QDBusServer) + +AM_BEGIN_NAMESPACE + class Notification; class NativeRuntime; class NativeRuntimeInterface; class NativeRuntimeApplicationInterface; -QT_FORWARD_DECLARE_CLASS(QDBusConnection) -QT_FORWARD_DECLARE_CLASS(QDBusServer) - - class NativeRuntimeManager : public AbstractRuntimeManager { Q_OBJECT @@ -136,4 +137,6 @@ private: friend class NativeRuntimeManager; }; +AM_END_NAMESPACE + #endif //defined(QT_DBUS_LIB) diff --git a/src/manager-lib/nativeruntime_p.h b/src/manager-lib/nativeruntime_p.h index e8d18cb8..080e6ed9 100644 --- a/src/manager-lib/nativeruntime_p.h +++ b/src/manager-lib/nativeruntime_p.h @@ -43,6 +43,8 @@ #include "applicationinterface.h" +AM_BEGIN_NAMESPACE + class NativeRuntime; class NativeRuntimeApplicationInterface : public ApplicationInterface @@ -79,4 +81,4 @@ private: NativeRuntime *m_runtime; }; - +AM_END_NAMESPACE diff --git a/src/manager-lib/notificationmanager.cpp b/src/manager-lib/notificationmanager.cpp index 44a3f056..7a276d8f 100644 --- a/src/manager-lib/notificationmanager.cpp +++ b/src/manager-lib/notificationmanager.cpp @@ -173,6 +173,8 @@ */ +AM_BEGIN_NAMESPACE + namespace { enum Roles { @@ -202,6 +204,7 @@ enum Roles Extended // QVariantMap }; +} struct NotificationData { @@ -234,7 +237,6 @@ enum CloseReason CloseNotificationCalled = 3 }; -} class NotificationManagerPrivate { @@ -636,3 +638,5 @@ void NotificationManagerPrivate::closeNotification(uint id, CloseReason reason) emit q->NotificationClosed(id, int(reason)); } } + +AM_END_NAMESPACE diff --git a/src/manager-lib/notificationmanager.h b/src/manager-lib/notificationmanager.h index 1c0dd372..cd7f6e89 100644 --- a/src/manager-lib/notificationmanager.h +++ b/src/manager-lib/notificationmanager.h @@ -43,10 +43,12 @@ #include <QObject> #include <QAbstractListModel> +#include "global.h" QT_FORWARD_DECLARE_CLASS(QQmlEngine) QT_FORWARD_DECLARE_CLASS(QJSEngine) +AM_BEGIN_NAMESPACE class NotificationManagerPrivate; @@ -104,3 +106,5 @@ private: NotificationManagerPrivate *d; friend class NotificationManagerPrivate; }; + +AM_END_NAMESPACE diff --git a/src/manager-lib/plugincontainer.cpp b/src/manager-lib/plugincontainer.cpp index 4f5feb3f..f7a664b3 100644 --- a/src/manager-lib/plugincontainer.cpp +++ b/src/manager-lib/plugincontainer.cpp @@ -42,6 +42,7 @@ #include <functional> #include "plugincontainer.h" +AM_BEGIN_NAMESPACE PluginContainerManager::PluginContainerManager(ContainerManagerInterface *managerInterface, QObject *parent) : AbstractContainerManager(managerInterface->identifier(), parent) @@ -183,3 +184,5 @@ void PluginContainerProcess::terminate() { m_container->m_interface->terminate(); } + +AM_END_NAMESPACE diff --git a/src/manager-lib/plugincontainer.h b/src/manager-lib/plugincontainer.h index d9a34a45..ecc14173 100644 --- a/src/manager-lib/plugincontainer.h +++ b/src/manager-lib/plugincontainer.h @@ -44,6 +44,8 @@ #include "abstractcontainer.h" #include "../plugin-interfaces/containerinterface.h" +AM_BEGIN_NAMESPACE + class PluginContainerManager : public AbstractContainerManager { Q_OBJECT @@ -113,3 +115,5 @@ protected: friend class PluginContainerProcess; friend class PluginContainerManager; }; + +AM_END_NAMESPACE diff --git a/src/manager-lib/processcontainer.cpp b/src/manager-lib/processcontainer.cpp index 510906a1..42a7fa6c 100644 --- a/src/manager-lib/processcontainer.cpp +++ b/src/manager-lib/processcontainer.cpp @@ -50,6 +50,7 @@ # include <fcntl.h> #endif +AM_BEGIN_NAMESPACE HostProcess::HostProcess() { @@ -257,3 +258,6 @@ void HostProcess::MyQProcess::setupChildProcess() } #endif } + +AM_END_NAMESPACE + diff --git a/src/manager-lib/processcontainer.h b/src/manager-lib/processcontainer.h index a7431f63..a9a94277 100644 --- a/src/manager-lib/processcontainer.h +++ b/src/manager-lib/processcontainer.h @@ -45,6 +45,8 @@ #define AM_HOST_CONTAINER_AVAILABLE +AM_BEGIN_NAMESPACE + class ProcessContainerManager : public AbstractContainerManager { Q_OBJECT @@ -114,3 +116,5 @@ private: bool m_useDebugWrapper = false; ContainerDebugWrapper m_debugWrapper; }; + +AM_END_NAMESPACE diff --git a/src/manager-lib/processmonitor.cpp b/src/manager-lib/processmonitor.cpp index 13bcfb4e..67bda5cb 100644 --- a/src/manager-lib/processmonitor.cpp +++ b/src/manager-lib/processmonitor.cpp @@ -48,9 +48,11 @@ #include "abstractruntime.h" #if defined(Q_OS_UNIX) -#include <unistd.h> +# include <unistd.h> #endif +AM_BEGIN_NAMESPACE + ProcessMonitor::ProcessMonitor(const QString &appId, QObject *parent) : QObject(parent) , m_memoryMonitor(nullptr) @@ -159,3 +161,5 @@ void ProcessMonitor::obtainPid() m_pid = 0; } } + +AM_END_NAMESPACE diff --git a/src/manager-lib/processmonitor.h b/src/manager-lib/processmonitor.h index 6dae1fd6..f9297305 100644 --- a/src/manager-lib/processmonitor.h +++ b/src/manager-lib/processmonitor.h @@ -39,14 +39,15 @@ ** ****************************************************************************/ -#ifndef PROCESSMONITOR_H -#define PROCESSMONITOR_H +#pragma once #include <QAbstractListModel> #include <QObject> #include "fpsmonitor.h" #include "systemmonitor.h" +AM_BEGIN_NAMESPACE + class MemoryMonitor; class ProcessMonitor : public QObject @@ -95,4 +96,5 @@ private: quint64 m_pid; }; -#endif // PROCESSMONITOR_H +AM_END_NAMESPACE + diff --git a/src/manager-lib/qml-utilities.cpp b/src/manager-lib/qml-utilities.cpp index 00e3316e..f418a152 100644 --- a/src/manager-lib/qml-utilities.cpp +++ b/src/manager-lib/qml-utilities.cpp @@ -44,6 +44,8 @@ #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 @@ -64,3 +66,5 @@ void retakeSingletonOwnershipFromQmlEngine(QQmlEngine *qmlEngine, QObject *singl 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 index 3e6c1d03..ac14474f 100644 --- a/src/manager-lib/qml-utilities.h +++ b/src/manager-lib/qml-utilities.h @@ -43,5 +43,10 @@ #include <QQmlEngine> #include <qqml.h> +#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.cpp b/src/manager-lib/qmlinprocessapplicationinterface.cpp index 00ca80e7..9c27adde 100644 --- a/src/manager-lib/qmlinprocessapplicationinterface.cpp +++ b/src/manager-lib/qmlinprocessapplicationinterface.cpp @@ -51,6 +51,7 @@ #include "applicationipcmanager.h" #include "applicationipcinterface.h" +AM_BEGIN_NAMESPACE QmlInProcessApplicationInterface::QmlInProcessApplicationInterface(QmlInProcessRuntime *runtime) : ApplicationInterface(runtime) @@ -261,3 +262,4 @@ void QmlInProcessApplicationInterfaceExtension::setName(const QString &name) qWarning("Cannot change the name property of an ApplicationInterfaceExtension after creation."); } +AM_END_NAMESPACE diff --git a/src/manager-lib/qmlinprocessapplicationinterface.h b/src/manager-lib/qmlinprocessapplicationinterface.h index 58d433f4..ac608ebb 100644 --- a/src/manager-lib/qmlinprocessapplicationinterface.h +++ b/src/manager-lib/qmlinprocessapplicationinterface.h @@ -47,6 +47,8 @@ #include "applicationinterface.h" #include "notification.h" +AM_BEGIN_NAMESPACE + class QmlInProcessRuntime; class QmlInProcessNotification : public Notification @@ -121,3 +123,5 @@ private: QObject *m_object = nullptr; bool m_complete = false; }; + +AM_END_NAMESPACE diff --git a/src/manager-lib/qmlinprocessruntime.cpp b/src/manager-lib/qmlinprocessruntime.cpp index 530d787c..bb8a644f 100644 --- a/src/manager-lib/qmlinprocessruntime.cpp +++ b/src/manager-lib/qmlinprocessruntime.cpp @@ -57,6 +57,8 @@ #include "global.h" #include "runtimefactory.h" +AM_BEGIN_NAMESPACE + // copied straight from Qt 5.1.0 qmlscene/main.cpp for now - needs to be revised static void loadDummyDataFiles(QQmlEngine &engine, const QString& directory) { @@ -86,6 +88,7 @@ static void loadDummyDataFiles(QQmlEngine &engine, const QString& directory) } } + QmlInProcessRuntime::QmlInProcessRuntime(const Application *app, QmlInProcessRuntimeManager *manager) : AbstractRuntime(nullptr, app, manager) { } @@ -298,3 +301,5 @@ AbstractRuntime *QmlInProcessRuntimeManager::create(AbstractContainer *container } return new QmlInProcessRuntime(app, this); } + +AM_END_NAMESPACE diff --git a/src/manager-lib/qmlinprocessruntime.h b/src/manager-lib/qmlinprocessruntime.h index 04f3c525..b09642bf 100644 --- a/src/manager-lib/qmlinprocessruntime.h +++ b/src/manager-lib/qmlinprocessruntime.h @@ -43,6 +43,8 @@ #include "abstractruntime.h" +AM_BEGIN_NAMESPACE + class FakeApplicationManagerWindow; class QmlInProcessApplicationInterface; @@ -102,3 +104,5 @@ private: friend class FakeApplicationManagerWindow; // for emitting signals on behalf of this class in onComplete #endif }; + +AM_END_NAMESPACE diff --git a/src/manager-lib/quicklauncher.cpp b/src/manager-lib/quicklauncher.cpp index 56efd23e..d62977ca 100644 --- a/src/manager-lib/quicklauncher.cpp +++ b/src/manager-lib/quicklauncher.cpp @@ -49,6 +49,7 @@ #include "quicklauncher.h" #include "systemmonitor.h" +AM_BEGIN_NAMESPACE QuickLauncher *QuickLauncher::s_instance = nullptr; @@ -199,3 +200,5 @@ QPair<AbstractContainer *, AbstractRuntime *> QuickLauncher::take(const QString return result; } + +AM_END_NAMESPACE diff --git a/src/manager-lib/quicklauncher.h b/src/manager-lib/quicklauncher.h index 04c85863..2b8e97d2 100644 --- a/src/manager-lib/quicklauncher.h +++ b/src/manager-lib/quicklauncher.h @@ -44,11 +44,13 @@ #include <QObject> #include <QPair> #include <QVector> +#include "global.h" + +AM_BEGIN_NAMESPACE class AbstractContainer; class AbstractRuntime; - class QuickLauncher : public QObject { Q_OBJECT @@ -84,3 +86,5 @@ private: QVector<QuickLaunchEntry> m_quickLaunchPool; bool m_onlyRebuildWhenIdle = false; }; + +AM_END_NAMESPACE diff --git a/src/manager-lib/runtimefactory.cpp b/src/manager-lib/runtimefactory.cpp index ea7e381a..960fb1aa 100644 --- a/src/manager-lib/runtimefactory.cpp +++ b/src/manager-lib/runtimefactory.cpp @@ -47,6 +47,7 @@ #include "abstractcontainer.h" #include "runtimefactory.h" +AM_BEGIN_NAMESPACE RuntimeFactory *RuntimeFactory::s_instance = nullptr; @@ -136,4 +137,4 @@ bool RuntimeFactory::registerRuntime(AbstractRuntimeManager *manager, const QStr return true; } - +AM_END_NAMESPACE diff --git a/src/manager-lib/runtimefactory.h b/src/manager-lib/runtimefactory.h index e19c8ade..edc36a02 100644 --- a/src/manager-lib/runtimefactory.h +++ b/src/manager-lib/runtimefactory.h @@ -46,6 +46,8 @@ #include "global.h" +AM_BEGIN_NAMESPACE + class Application; class AbstractRuntime; class AbstractRuntimeManager; @@ -80,3 +82,4 @@ private: QHash<QString, AbstractRuntimeManager *> m_runtimes; }; +AM_END_NAMESPACE diff --git a/src/manager-lib/sysfsreader.cpp b/src/manager-lib/sysfsreader.cpp index 61b44305..0eb5587c 100644 --- a/src/manager-lib/sysfsreader.cpp +++ b/src/manager-lib/sysfsreader.cpp @@ -58,6 +58,8 @@ static inline int qt_safe_open(const char *pathname, int flags, mode_t mode = 07 # undef QT_OPEN # define QT_OPEN qt_safe_open +AM_BEGIN_NAMESPACE + SysFsReader::SysFsReader(const char *path, int maxRead) : m_path(path) { @@ -100,3 +102,5 @@ QByteArray SysFsReader::readValue() const } while (read > 0 && offset < m_buffer.size()); return m_buffer; } + +AM_END_NAMESPACE diff --git a/src/manager-lib/sysfsreader.h b/src/manager-lib/sysfsreader.h index a05e7489..7356bdc0 100644 --- a/src/manager-lib/sysfsreader.h +++ b/src/manager-lib/sysfsreader.h @@ -39,11 +39,12 @@ ** ****************************************************************************/ -#ifndef SYSFSREADER_H -#define SYSFSREADER_H +#pragma once #include <QByteArray> +#include "global.h" +AM_BEGIN_NAMESPACE class SysFsReader { @@ -62,4 +63,4 @@ private: Q_DISABLE_COPY(SysFsReader) }; -#endif // SYSFSREADER_H +AM_END_NAMESPACE diff --git a/src/manager-lib/systemmonitor.cpp b/src/manager-lib/systemmonitor.cpp index 81603f7d..b28ab92b 100644 --- a/src/manager-lib/systemmonitor.cpp +++ b/src/manager-lib/systemmonitor.cpp @@ -56,6 +56,8 @@ #include "qml-utilities.h" +AM_BEGIN_NAMESPACE + namespace { enum Roles { @@ -69,7 +71,7 @@ enum Roles MaximumFps, FpsJitter }; -} + class FrameTimer { public: @@ -126,7 +128,7 @@ private: static const int IdealFrameTime = 16666; // usec - could be made configurable via an env variable }; - +} class SystemMonitorPrivate : public QObject { @@ -683,3 +685,5 @@ QObject *SystemMonitor::getProcessMonitor(const QString &appId) Q_D(SystemMonitor); return d->getProcess(appId); } + +AM_END_NAMESPACE diff --git a/src/manager-lib/systemmonitor.h b/src/manager-lib/systemmonitor.h index 849dc65c..a7624e1f 100644 --- a/src/manager-lib/systemmonitor.h +++ b/src/manager-lib/systemmonitor.h @@ -42,10 +42,13 @@ #pragma once #include <QAbstractListModel> +#include "global.h" QT_FORWARD_DECLARE_CLASS(QQmlEngine) QT_FORWARD_DECLARE_CLASS(QJSEngine) +AM_BEGIN_NAMESPACE + class SystemMonitorPrivate; class ProcessMonitor; @@ -136,3 +139,5 @@ private: SystemMonitorPrivate *d_ptr; Q_DECLARE_PRIVATE(SystemMonitor) }; + +AM_END_NAMESPACE diff --git a/src/manager-lib/systemmonitor_p.cpp b/src/manager-lib/systemmonitor_p.cpp index 67d7f1dc..2a619432 100644 --- a/src/manager-lib/systemmonitor_p.cpp +++ b/src/manager-lib/systemmonitor_p.cpp @@ -44,6 +44,7 @@ #include "systemmonitor_p.h" #include "global.h" +AM_BEGIN_NAMESPACE quint64 MemoryReader::s_totalValue = 0; @@ -52,6 +53,7 @@ quint64 MemoryReader::totalValue() const return s_totalValue; } +AM_END_NAMESPACE #if defined(Q_OS_LINUX) # include "sysfsreader.h" @@ -65,6 +67,7 @@ quint64 MemoryReader::totalValue() const # include <sys/ioctl.h> # include <errno.h> +AM_BEGIN_NAMESPACE QScopedPointer<SysFsReader> CpuReader::s_sysFs; @@ -290,10 +293,14 @@ void MemoryThreshold::readEventFd() } } +AM_END_NAMESPACE + #elif defined(Q_OS_WIN) #include <windows.h> +AM_BEGIN_NAMESPACE + CpuReader::CpuReader() { } @@ -338,11 +345,15 @@ quint64 MemoryReader::readUsedValue() const return mem.ullTotalPhys - mem.ullAvailPhys; } +AM_END_NAMESPACE + #elif defined(Q_OS_OSX) #include <mach/mach.h> #include <sys/sysctl.h> +AM_BEGIN_NAMESPACE + CpuReader::CpuReader() { } @@ -413,8 +424,13 @@ quint64 MemoryReader::readUsedValue() const } } + +AM_END_NAMESPACE + #else // Q_OS_... +AM_BEGIN_NAMESPACE + CpuReader::CpuReader() { } @@ -431,10 +447,14 @@ quint64 MemoryReader::readUsedValue() const return 0; } +AM_END_NAMESPACE + #endif // defined(Q_OS_...) #if !defined(Q_OS_LINUX) +AM_BEGIN_NAMESPACE + IoReader::IoReader(const char *device) { Q_UNUSED(device) @@ -472,4 +492,6 @@ bool MemoryThreshold::setEnabled(bool enabled) return false; } +AM_END_NAMESPACE + #endif // !defined(Q_OS_LINUX) diff --git a/src/manager-lib/systemmonitor_p.h b/src/manager-lib/systemmonitor_p.h index d359824c..01cbb2b0 100644 --- a/src/manager-lib/systemmonitor_p.h +++ b/src/manager-lib/systemmonitor_p.h @@ -45,13 +45,18 @@ #include <QPair> #include <QElapsedTimer> #include <QObject> +#include "global.h" #if defined(Q_OS_LINUX) -#include <QScopedPointer> +# include <QScopedPointer> QT_FORWARD_DECLARE_CLASS(QSocketNotifier) +AM_BEGIN_NAMESPACE class SysFsReader; +AM_END_NAMESPACE #endif +AM_BEGIN_NAMESPACE + class CpuReader { public: @@ -134,3 +139,5 @@ private: QSocketNotifier *m_notifier = 0; #endif }; + +AM_END_NAMESPACE diff --git a/src/manager-lib/window.cpp b/src/manager-lib/window.cpp index 6b7708b9..93abb0b9 100644 --- a/src/manager-lib/window.cpp +++ b/src/manager-lib/window.cpp @@ -41,6 +41,8 @@ #include "window.h" +AM_BEGIN_NAMESPACE + Window::Window(const Application *app, QQuickItem *surfaceItem) : QObject(0) , m_application(app) @@ -72,3 +74,5 @@ QQuickItem *Window::windowItem() const { return m_windowItem.data(); } + +AM_END_NAMESPACE diff --git a/src/manager-lib/window.h b/src/manager-lib/window.h index 5f377c21..2a05378c 100644 --- a/src/manager-lib/window.h +++ b/src/manager-lib/window.h @@ -45,6 +45,9 @@ #include <QVariantMap> #include <QPointer> #include <QQuickItem> +#include "global.h" + +AM_BEGIN_NAMESPACE class Application; class WindowPrivate; @@ -81,3 +84,4 @@ protected: bool m_isClosing = false; }; +AM_END_NAMESPACE diff --git a/src/manager-lib/yamlapplicationscanner.cpp b/src/manager-lib/yamlapplicationscanner.cpp index 7d4aeae7..99d0286c 100644 --- a/src/manager-lib/yamlapplicationscanner.cpp +++ b/src/manager-lib/yamlapplicationscanner.cpp @@ -53,6 +53,7 @@ #include "application.h" #include "yamlapplicationscanner.h" +AM_BEGIN_NAMESPACE YamlApplicationScanner::YamlApplicationScanner() { @@ -204,3 +205,4 @@ 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 index 42d4ab88..0850a1aa 100644 --- a/src/manager-lib/yamlapplicationscanner.h +++ b/src/manager-lib/yamlapplicationscanner.h @@ -43,6 +43,8 @@ #include "applicationscanner.h" +AM_BEGIN_NAMESPACE + class YamlApplicationScanner : public ApplicationScanner { public: @@ -56,3 +58,5 @@ public: private: Application *scanInternal(const QString &filePath, bool scanAlias, const Application *application) throw (Exception); }; + +AM_END_NAMESPACE diff --git a/src/manager/configuration.cpp b/src/manager/configuration.cpp index 013de86c..a679adbc 100644 --- a/src/manager/configuration.cpp +++ b/src/manager/configuration.cpp @@ -54,6 +54,7 @@ # define AM_CONFIG_FILE "/opt/am/config.yaml" #endif +AM_BEGIN_NAMESPACE class ConfigurationPrivate { @@ -531,3 +532,5 @@ QStringList Configuration::pluginFilePaths(const char *type) const { return d->findInConfigFile({ qSL("plugins"), qL1S(type) }).toStringList(); } + +AM_END_NAMESPACE diff --git a/src/manager/configuration.h b/src/manager/configuration.h index 7947ab98..a212fecc 100644 --- a/src/manager/configuration.h +++ b/src/manager/configuration.h @@ -43,6 +43,9 @@ #include <QStringList> #include <QVariantMap> +#include "global.h" + +AM_BEGIN_NAMESPACE class ConfigurationPrivate; @@ -108,3 +111,5 @@ private: ConfigurationPrivate *d; }; +AM_END_NAMESPACE + diff --git a/src/manager/inprocesswindow.cpp b/src/manager/inprocesswindow.cpp index 63552be7..a4269869 100644 --- a/src/manager/inprocesswindow.cpp +++ b/src/manager/inprocesswindow.cpp @@ -41,6 +41,8 @@ #include "inprocesswindow.h" +AM_BEGIN_NAMESPACE + static QByteArray nameToKey(const QString &name) { return QByteArray("_am_") + name.toUtf8(); @@ -113,3 +115,5 @@ bool InProcessWindow::eventFilter(QObject *o, QEvent *e) return Window::eventFilter(o, e); } + +AM_END_NAMESPACE diff --git a/src/manager/inprocesswindow.h b/src/manager/inprocesswindow.h index 8ceb221e..7af361f6 100644 --- a/src/manager/inprocesswindow.h +++ b/src/manager/inprocesswindow.h @@ -46,6 +46,8 @@ #include <QObject> #include <QPointer> +AM_BEGIN_NAMESPACE + class InProcessWindow : public Window { Q_OBJECT @@ -67,3 +69,5 @@ protected: private: QVariantMap m_windowProperties; }; + +AM_END_NAMESPACE diff --git a/src/manager/main.cpp b/src/manager/main.cpp index 023b3e41..3eed620c 100644 --- a/src/manager/main.cpp +++ b/src/manager/main.cpp @@ -126,6 +126,7 @@ #include "../plugin-interfaces/startupinterface.h" +AM_BEGIN_NAMESPACE static Configuration *configuration = 0; @@ -423,6 +424,9 @@ static QVector<T *> loadPlugins(const char *type) throw (Exception) return interfaces; } +AM_END_NAMESPACE + +AM_USE_NAMESPACE int main(int argc, char *argv[]) { diff --git a/src/manager/manager.pro b/src/manager/manager.pro index 525b10db..d276deae 100644 --- a/src/manager/manager.pro +++ b/src/manager/manager.pro @@ -76,11 +76,12 @@ DBUS_ADAPTORS += \ # cope with more than 1 out value out of the box # http://lists.qt-project.org/pipermail/interest/2013-July/008011.html dbus-notifications.files = ../dbus/org.freedesktop.notifications.xml -dbus-notifications.source_flags = -l NotificationManager -dbus-notifications.header_flags = -l NotificationManager -i notificationmanager.h +dbus-notifications.source_flags = -l QtAM::NotificationManager +dbus-notifications.header_flags = -l QtAM::NotificationManager -i notificationmanager.h dbus-appman.files = ../dbus/io.qt.applicationmanager.xml -dbus-appman.header_flags = -i dbus-utilities.h +dbus-appman.source_flags = -l QtAM::ApplicationManager +dbus-appman.header_flags = -l QtAM::ApplicationManager -i applicationmanager.h DBUS_ADAPTORS += dbus-notifications dbus-appman diff --git a/src/manager/qmllogger.cpp b/src/manager/qmllogger.cpp index 7aa26c9d..a0374f35 100644 --- a/src/manager/qmllogger.cpp +++ b/src/manager/qmllogger.cpp @@ -44,6 +44,8 @@ #include "qmllogger.h" #include "global.h" +AM_BEGIN_NAMESPACE + QmlLogger::QmlLogger(QQmlEngine *engine) : QObject(engine) { @@ -69,3 +71,5 @@ void QmlLogger::warnings(const QList<QQmlError> &list) ml.warning().nospace() << qPrintable(err.description()); } } + +AM_END_NAMESPACE diff --git a/src/manager/qmllogger.h b/src/manager/qmllogger.h index 4291a9ef..46747564 100644 --- a/src/manager/qmllogger.h +++ b/src/manager/qmllogger.h @@ -43,6 +43,9 @@ #include <QObject> #include <QQmlEngine> +#include "global.h" + +AM_BEGIN_NAMESPACE class QmlLogger : public QObject { @@ -54,3 +57,5 @@ public: private slots: void warnings(const QList<QQmlError> &list); }; + +AM_END_NAMESPACE diff --git a/src/manager/waylandcompositor-old.cpp b/src/manager/waylandcompositor-old.cpp index 06a9fb38..1c36b009 100644 --- a/src/manager/waylandcompositor-old.cpp +++ b/src/manager/waylandcompositor-old.cpp @@ -53,6 +53,7 @@ #include "applicationmanager.h" #include "waylandcompositor-old.h" +AM_BEGIN_NAMESPACE Surface::Surface(QWaylandSurface *s) : m_item(0) @@ -186,3 +187,5 @@ void WaylandCompositor::sendCallbacks() sendFrameCallbacks(listToSend); } } + +AM_END_NAMESPACE diff --git a/src/manager/waylandcompositor-old.h b/src/manager/waylandcompositor-old.h index 8dbfbd6a..7f0ceb1f 100644 --- a/src/manager/waylandcompositor-old.h +++ b/src/manager/waylandcompositor-old.h @@ -48,6 +48,7 @@ QT_FORWARD_DECLARE_CLASS(QWaylandSurfaceItem) +AM_BEGIN_NAMESPACE class SurfaceQuickItem; @@ -95,3 +96,5 @@ public: private: WindowManager *m_manager; }; + +AM_END_NAMESPACE diff --git a/src/manager/waylandcompositor.cpp b/src/manager/waylandcompositor.cpp index 11ccb29e..ce195d4c 100644 --- a/src/manager/waylandcompositor.cpp +++ b/src/manager/waylandcompositor.cpp @@ -58,6 +58,7 @@ typedef QWaylandWindowManagerExtension QWaylandQtWindowManager; #include "global.h" #include "waylandcompositor.h" +AM_BEGIN_NAMESPACE void Surface::setShellSurface(QWaylandWlShellSurface *ss) { @@ -224,3 +225,5 @@ QWaylandSurface *WaylandCompositor::waylandSurfaceFromItem(QQuickItem *surfaceIt return item->m_surface->surface(); return nullptr; } + +AM_END_NAMESPACE diff --git a/src/manager/waylandcompositor.h b/src/manager/waylandcompositor.h index e00447dc..c059e099 100644 --- a/src/manager/waylandcompositor.h +++ b/src/manager/waylandcompositor.h @@ -59,8 +59,9 @@ class SurfaceExtensionGlobal; } QT_END_NAMESPACE -class SurfaceQuickItem; +AM_BEGIN_NAMESPACE +class SurfaceQuickItem; class Surface : public QWaylandQuickSurface, public WindowSurface { @@ -125,3 +126,5 @@ private: QtWayland::SurfaceExtensionGlobal *m_surfExt; QWaylandTextInputManager *m_textInputManager; }; + +AM_END_NAMESPACE diff --git a/src/manager/waylandwindow.cpp b/src/manager/waylandwindow.cpp index 75466452..55015c99 100644 --- a/src/manager/waylandwindow.cpp +++ b/src/manager/waylandwindow.cpp @@ -47,6 +47,8 @@ #include "global.h" #include "windowmanager.h" +AM_BEGIN_NAMESPACE + WaylandWindow::WaylandWindow(const Application *app, WindowSurface *surf) : Window(app, surf->item()) , m_pingTimer(new QTimer(this)) @@ -133,4 +135,6 @@ QVariantMap WaylandWindow::windowProperties() const return QVariantMap(); } +AM_END_NAMESPACE + #endif // AM_MULTI_PROCESS diff --git a/src/manager/waylandwindow.h b/src/manager/waylandwindow.h index 41269703..a7098861 100644 --- a/src/manager/waylandwindow.h +++ b/src/manager/waylandwindow.h @@ -48,6 +48,8 @@ #include <QWaylandSurface> #include <QTimer> +AM_BEGIN_NAMESPACE + class WindowSurface; class WaylandWindow : public Window @@ -79,4 +81,6 @@ private: WindowSurface *m_surface; }; +AM_END_NAMESPACE + #endif // AM_MULTI_PROCESS diff --git a/src/manager/windowmanager.cpp b/src/manager/windowmanager.cpp index bd6f51af..d512392c 100644 --- a/src/manager/windowmanager.cpp +++ b/src/manager/windowmanager.cpp @@ -274,6 +274,7 @@ identified by \a applicationId via the ApplicationManager. */ +AM_BEGIN_NAMESPACE namespace { enum Roles @@ -285,10 +286,8 @@ enum Roles }; } - WindowManager *WindowManager::s_instance = 0; - WindowManager *WindowManager::createInstance(QQmlEngine *qmlEngine, const QString &waylandSocketName) { if (s_instance) @@ -1034,3 +1033,4 @@ int WindowManagerPrivate::findWindowByWaylandSurface(QWaylandSurface *waylandSur #endif // defined(AM_MULTI_PROCESS) +AM_END_NAMESPACE diff --git a/src/manager/windowmanager.h b/src/manager/windowmanager.h index 5c9e4f2b..d5ed3baa 100644 --- a/src/manager/windowmanager.h +++ b/src/manager/windowmanager.h @@ -42,13 +42,13 @@ #pragma once #include <functional> - #include <QAbstractListModel> #if defined(QT_DBUS_LIB) # include <QDBusContext> # include <QDBusConnectionInterface> #endif +#include "global.h" #if defined(AM_MULTI_PROCESS) QT_FORWARD_DECLARE_CLASS(QWaylandSurface) @@ -60,6 +60,8 @@ QT_FORWARD_DECLARE_CLASS(QQmlEngine) QT_FORWARD_DECLARE_CLASS(QJSEngine) QT_FORWARD_DECLARE_CLASS(QWindow) +AM_BEGIN_NAMESPACE + class Window; class WindowManagerPrivate; class Application; @@ -144,7 +146,7 @@ private slots: void inProcessSurfaceItemCreated(QQuickItem *surfaceItem); void inProcessSurfaceItemClosing(QQuickItem *surfaceItem); - void setupWindow(Window *window); + void setupWindow(AM_PREPEND_NAMESPACE(Window) *window); public: Q_INVOKABLE bool setWindowProperty(QQuickItem *window, const QString &name, const QVariant &value); @@ -156,17 +158,17 @@ public: bool setDBusPolicy(const QVariantMap &yamlFragment); public slots: - void setupInProcessRuntime(AbstractRuntime *runtime); // evil hook to support in-process runtimes + void setupInProcessRuntime(AM_PREPEND_NAMESPACE(AbstractRuntime) *runtime); // evil hook to support in-process runtimes private slots: void reportFps(); #if defined(AM_MULTI_PROCESS) private slots: - void waylandSurfaceCreated(WindowSurface *surface); - void waylandSurfaceMapped(WindowSurface *surface); - void waylandSurfaceUnmapped(WindowSurface *surface); - void waylandSurfaceDestroyed(WindowSurface *surface); + void waylandSurfaceCreated(AM_PREPEND_NAMESPACE(WindowSurface) *surface); + void waylandSurfaceMapped(AM_PREPEND_NAMESPACE(WindowSurface) *surface); + void waylandSurfaceUnmapped(AM_PREPEND_NAMESPACE(WindowSurface) *surface); + void waylandSurfaceDestroyed(AM_PREPEND_NAMESPACE(WindowSurface) *surface); void resize(); @@ -184,3 +186,5 @@ private: friend class WaylandCompositor; }; + +AM_END_NAMESPACE diff --git a/src/manager/windowmanager_p.h b/src/manager/windowmanager_p.h index 8c3d885c..c59e4bfc 100644 --- a/src/manager/windowmanager_p.h +++ b/src/manager/windowmanager_p.h @@ -49,6 +49,8 @@ QT_FORWARD_DECLARE_CLASS(QQmlEngine) +AM_BEGIN_NAMESPACE + class WindowManagerPrivate { public: @@ -71,3 +73,5 @@ public: QString waylandSocketName; QQmlEngine *qmlEngine; }; + +AM_END_NAMESPACE diff --git a/src/notification-lib/notification.cpp b/src/notification-lib/notification.cpp index 0f81ff9e..7cd853c8 100644 --- a/src/notification-lib/notification.cpp +++ b/src/notification-lib/notification.cpp @@ -78,6 +78,8 @@ registered \l actions, and needs to be explicitly checked. */ +AM_BEGIN_NAMESPACE + Notification::Notification(QObject *parent, Notification::ConstructionMode mode) : QObject(parent) { @@ -609,3 +611,4 @@ void Notification::libnotifyNotificationClosed(uint reason) setId(0); } +AM_END_NAMESPACE diff --git a/src/notification-lib/notification.h b/src/notification-lib/notification.h index a9c07301..b7bed682 100644 --- a/src/notification-lib/notification.h +++ b/src/notification-lib/notification.h @@ -45,7 +45,9 @@ #include <QUrl> #include <QVariantMap> #include <QQmlParserStatus> +#include "global.h" +AM_BEGIN_NAMESPACE class Notification : public QObject, public QQmlParserStatus { @@ -182,3 +184,5 @@ private: private: Q_DISABLE_COPY(Notification) }; + +AM_END_NAMESPACE diff --git a/src/tools/controller/main.cpp b/src/tools/controller/main.cpp index 0a64e8e6..79e442d7 100644 --- a/src/tools/controller/main.cpp +++ b/src/tools/controller/main.cpp @@ -44,6 +44,7 @@ #include "qtyaml.h" #include "dbus-utilities.h" +AM_USE_NAMESPACE class DBus : public QObject { public: diff --git a/src/tools/packager/main.cpp b/src/tools/packager/main.cpp index 5bd4ed1c..b9f1b0c0 100644 --- a/src/tools/packager/main.cpp +++ b/src/tools/packager/main.cpp @@ -36,6 +36,7 @@ #include "utilities.h" #include "packager.h" +AM_USE_NAMESPACE enum Command { NoCommand, diff --git a/src/tools/packager/packager.cpp b/src/tools/packager/packager.cpp index 7d026c23..39760207 100644 --- a/src/tools/packager/packager.cpp +++ b/src/tools/packager/packager.cpp @@ -46,6 +46,7 @@ #include "utilities.h" #include "packager.h" +AM_USE_NAMESPACE // this corresponds to the -b parameter for mkfs.ext2 in sudo.cpp static const int Ext2BlockSize = 1024; diff --git a/src/tools/packager/packager.h b/src/tools/packager/packager.h index c87ad613..f5ab28d3 100644 --- a/src/tools/packager/packager.h +++ b/src/tools/packager/packager.h @@ -48,7 +48,7 @@ public: static Packager *storeVerify(const QString &sourceName, const QStringList &certificateFiles, const QString &hardwareId); - void execute() throw (Exception); + void execute() throw (AM_PREPEND_NAMESPACE(Exception)); QByteArray packageDigest() const; QString output() const; |