diff options
author | Robert Griebl <robert.griebl@qt.io> | 2023-08-12 01:58:20 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-08-16 21:02:56 +0000 |
commit | 7615b6e7b6eed5f78bf838bcc216424a75fd32f4 (patch) | |
tree | 1e9bae0985e1b8f120709574f16658f7fe4b71f0 | |
parent | d486d676bb12cb65321a0dde68df7d08fffef57d (diff) |
cmake: add support for Unity builds
Change-Id: I5304ef97f051844a26e7e277a34e4bc790543647
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 4e70e84f0ef8150d10c3e942998e6b73d04b2c34)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/application-lib/packagedatabase.cpp | 2 | ||||
-rw-r--r-- | src/common-lib/filesystemmountwatcher.cpp | 2 | ||||
-rw-r--r-- | src/manager-lib/applicationmanager.cpp | 83 | ||||
-rw-r--r-- | src/manager-lib/notificationmanager.cpp | 78 | ||||
-rw-r--r-- | src/manager-lib/packagemanager.cpp | 48 | ||||
-rw-r--r-- | src/window-lib/windowmanager.cpp | 18 |
6 files changed, 117 insertions, 114 deletions
diff --git a/src/application-lib/packagedatabase.cpp b/src/application-lib/packagedatabase.cpp index bbb8ba08..459f7f9a 100644 --- a/src/application-lib/packagedatabase.cpp +++ b/src/application-lib/packagedatabase.cpp @@ -313,3 +313,5 @@ QVector<PackageInfo *> PackageDatabase::builtInPackages() const } QT_END_NAMESPACE_AM + +#include "moc_packagedatabase.cpp" diff --git a/src/common-lib/filesystemmountwatcher.cpp b/src/common-lib/filesystemmountwatcher.cpp index 9a33f443..1e3531e3 100644 --- a/src/common-lib/filesystemmountwatcher.cpp +++ b/src/common-lib/filesystemmountwatcher.cpp @@ -211,3 +211,5 @@ bool FileSystemMountWatcher::setMountTabFileForTesting(const QString &mtabFile) } QT_END_NAMESPACE_AM + +#include "moc_filesystemmountwatcher.cpp" diff --git a/src/manager-lib/applicationmanager.cpp b/src/manager-lib/applicationmanager.cpp index a36eb70b..49e578a0 100644 --- a/src/manager-lib/applicationmanager.cpp +++ b/src/manager-lib/applicationmanager.cpp @@ -289,7 +289,7 @@ happens implicitly after the System UI's main QML has been loaded. */ -enum Roles +enum AMRoles { Id = Qt::UserRole, Name, @@ -321,25 +321,25 @@ ApplicationManagerPrivate::ApplicationManagerPrivate() { currentLocale = QLocale::system().name(); //TODO: language changes - roleNames.insert(Id, "applicationId"); - roleNames.insert(Name, "name"); - roleNames.insert(Icon, "icon"); - roleNames.insert(IsRunning, "isRunning"); - roleNames.insert(IsStartingUp, "isStartingUp"); - roleNames.insert(IsShuttingDown, "isShuttingDown"); - roleNames.insert(IsBlocked, "isBlocked"); - roleNames.insert(IsUpdating, "isUpdating"); - roleNames.insert(IsRemovable, "isRemovable"); - roleNames.insert(UpdateProgress, "updateProgress"); - roleNames.insert(CodeFilePath, "codeFilePath"); - roleNames.insert(RuntimeName, "runtimeName"); - roleNames.insert(RuntimeParameters, "runtimeParameters"); - roleNames.insert(Capabilities, "capabilities"); - roleNames.insert(Categories, "categories"); - roleNames.insert(Version, "version"); - roleNames.insert(ApplicationItem, "application"); - roleNames.insert(LastExitCode, "lastExitCode"); - roleNames.insert(LastExitStatus, "lastExitStatus"); + roleNames.insert(AMRoles::Id, "applicationId"); + roleNames.insert(AMRoles::Name, "name"); + roleNames.insert(AMRoles::Icon, "icon"); + roleNames.insert(AMRoles::IsRunning, "isRunning"); + roleNames.insert(AMRoles::IsStartingUp, "isStartingUp"); + roleNames.insert(AMRoles::IsShuttingDown, "isShuttingDown"); + roleNames.insert(AMRoles::IsBlocked, "isBlocked"); + roleNames.insert(AMRoles::IsUpdating, "isUpdating"); + roleNames.insert(AMRoles::IsRemovable, "isRemovable"); + roleNames.insert(AMRoles::UpdateProgress, "updateProgress"); + roleNames.insert(AMRoles::CodeFilePath, "codeFilePath"); + roleNames.insert(AMRoles::RuntimeName, "runtimeName"); + roleNames.insert(AMRoles::RuntimeParameters, "runtimeParameters"); + roleNames.insert(AMRoles::Capabilities, "capabilities"); + roleNames.insert(AMRoles::Categories, "categories"); + roleNames.insert(AMRoles::Version, "version"); + roleNames.insert(AMRoles::ApplicationItem, "application"); + roleNames.insert(AMRoles::LastExitCode, "lastExitCode"); + roleNames.insert(AMRoles::LastExitStatus, "lastExitStatus"); } ApplicationManagerPrivate::~ApplicationManagerPrivate() @@ -802,7 +802,7 @@ bool ApplicationManager::startApplicationInternal(const QString &appId, const QS app->setRunState(newRuntimeState); emit applicationRunStateChanged(appId, newRuntimeState); if (app) - emitDataChanged(app, QVector<int> { IsRunning, IsStartingUp, IsShuttingDown }); + emitDataChanged(app, QVector<int> { AMRoles::IsRunning, AMRoles::IsStartingUp, AMRoles::IsShuttingDown }); }); if (!documentUrl.isNull()) @@ -1256,43 +1256,43 @@ QVariant ApplicationManager::data(const QModelIndex &index, int role) const Application *app = d->apps.at(index.row()); switch (role) { - case Id: + case AMRoles::Id: return app->id(); - case Name: + case AMRoles::Name: return app->name(); - case Icon: + case AMRoles::Icon: return app->icon(); - case IsRunning: + case AMRoles::IsRunning: return app->currentRuntime() ? (app->currentRuntime()->state() == Am::Running) : false; - case IsStartingUp: + case AMRoles::IsStartingUp: return app->currentRuntime() ? (app->currentRuntime()->state() == Am::StartingUp) : false; - case IsShuttingDown: + case AMRoles::IsShuttingDown: return app->currentRuntime() ? (app->currentRuntime()->state() == Am::ShuttingDown) : false; - case IsBlocked: + case AMRoles::IsBlocked: return app->isBlocked(); - case IsUpdating: + case AMRoles::IsUpdating: return app->state() != Application::Installed; - case UpdateProgress: + case AMRoles::UpdateProgress: return app->progress(); - case IsRemovable: + case AMRoles::IsRemovable: return !app->isBuiltIn(); - case CodeFilePath: + case AMRoles::CodeFilePath: return app->info()->absoluteCodeFilePath(); - case RuntimeName: + case AMRoles::RuntimeName: return app->runtimeName(); - case RuntimeParameters: + case AMRoles::RuntimeParameters: return app->runtimeParameters(); - case Capabilities: + case AMRoles::Capabilities: return app->capabilities(); - case Categories: + case AMRoles::Categories: return app->categories(); - case Version: + case AMRoles::Version: return app->version(); - case ApplicationItem: + case AMRoles::ApplicationItem: return QVariant::fromValue(app); - case LastExitCode: + case AMRoles::LastExitCode: return app->lastExitCode(); - case LastExitStatus: + case AMRoles::LastExitStatus: return app->lastExitStatus(); } return QVariant(); @@ -1459,7 +1459,7 @@ void ApplicationManager::addApplication(ApplicationInfo *appInfo, Package *packa connect(app, &Application::blockedChanged, this, [this, app]() { - emitDataChanged(app, QVector<int> { IsBlocked }); + emitDataChanged(app, QVector<int> { AMRoles::IsBlocked }); }); connect(app, &Application::bulkChange, this, [this, app]() { @@ -1509,3 +1509,4 @@ void ApplicationManager::removeApplication(ApplicationInfo *appInfo, Package *pa QT_END_NAMESPACE_AM #include "moc_applicationmanager.cpp" +#include "moc_amnamespace.cpp" // amnamespace is header only, so we include it here diff --git a/src/manager-lib/notificationmanager.cpp b/src/manager-lib/notificationmanager.cpp index 667b64bc..df1a7f7c 100644 --- a/src/manager-lib/notificationmanager.cpp +++ b/src/manager-lib/notificationmanager.cpp @@ -135,7 +135,7 @@ QT_BEGIN_NAMESPACE_AM namespace { -enum Roles +enum NMRoles { Id = Qt::UserRole + 2000, @@ -258,25 +258,25 @@ NotificationManager::NotificationManager(QObject *parent) connect(this, &QAbstractItemModel::modelReset, this, &NotificationManager::countChanged); d->q = this; - d->roleNames.insert(Id, "id"); - d->roleNames.insert(ApplicationId, "applicationId"); - d->roleNames.insert(Priority, "priority"); - d->roleNames.insert(Summary, "summary"); - d->roleNames.insert(Body, "body"); - d->roleNames.insert(Category, "category"); - d->roleNames.insert(Icon, "icon"); - d->roleNames.insert(Image, "image"); - d->roleNames.insert(ShowActionsAsIcons, "showActionsAsIcons"); - d->roleNames.insert(Actions, "actions"); - d->roleNames.insert(DismissOnAction, "dismissOnAction"); - d->roleNames.insert(IsAcknowledgeable, "isAcknowledgeable"); - d->roleNames.insert(IsClickable, "isClickable"); - d->roleNames.insert(IsSystemNotification, "isSytemNotification"); - d->roleNames.insert(IsShowingProgress, "isShowingProgress"); - d->roleNames.insert(Progress, "progress"); - d->roleNames.insert(IsSticky, "isSticky"); - d->roleNames.insert(Timeout, "timeout"); - d->roleNames.insert(Extended, "extended"); + d->roleNames.insert(NMRoles::Id, "id"); + d->roleNames.insert(NMRoles::ApplicationId, "applicationId"); + d->roleNames.insert(NMRoles::Priority, "priority"); + d->roleNames.insert(NMRoles::Summary, "summary"); + d->roleNames.insert(NMRoles::Body, "body"); + d->roleNames.insert(NMRoles::Category, "category"); + d->roleNames.insert(NMRoles::Icon, "icon"); + d->roleNames.insert(NMRoles::Image, "image"); + d->roleNames.insert(NMRoles::ShowActionsAsIcons, "showActionsAsIcons"); + d->roleNames.insert(NMRoles::Actions, "actions"); + d->roleNames.insert(NMRoles::DismissOnAction, "dismissOnAction"); + d->roleNames.insert(NMRoles::IsAcknowledgeable, "isAcknowledgeable"); + d->roleNames.insert(NMRoles::IsClickable, "isClickable"); + d->roleNames.insert(NMRoles::IsSystemNotification, "isSytemNotification"); + d->roleNames.insert(NMRoles::IsShowingProgress, "isShowingProgress"); + d->roleNames.insert(NMRoles::Progress, "progress"); + d->roleNames.insert(NMRoles::IsSticky, "isSticky"); + d->roleNames.insert(NMRoles::Timeout, "timeout"); + d->roleNames.insert(NMRoles::Extended, "extended"); } NotificationManager::~NotificationManager() @@ -300,48 +300,48 @@ QVariant NotificationManager::data(const QModelIndex &index, int role) const const NotificationData *n = d->notifications.at(index.row()); switch (role) { - case Id: + case NMRoles::Id: return n->id; - case ApplicationId: + case NMRoles::ApplicationId: return n->application ? n->application->id() : QString(); - case Priority: + case NMRoles::Priority: return n->priority; - case Summary: + case NMRoles::Summary: return n->summary; - case Body: + case NMRoles::Body: return n->body; - case Category: + case NMRoles::Category: return n->category; - case Icon: + case NMRoles::Icon: if (!n->iconUrl.isEmpty()) return n->iconUrl; return n->application && n->application->package() ? n->application->package()->icon() : QString(); - case Image: + case NMRoles::Image: return n->imageUrl; - case ShowActionsAsIcons: + case NMRoles::ShowActionsAsIcons: return n->showActionIcons; - case Actions: { + case NMRoles::Actions: { QVariantList actions = n->actions; actions.removeAll(QVariantMap { { qSL("default"), QString() } }); return actions; } - case DismissOnAction: + case NMRoles::DismissOnAction: return n->dismissOnAction; - case IsClickable: // legacy - case IsAcknowledgeable: + case NMRoles::IsClickable: // legacy + case NMRoles::IsAcknowledgeable: return n->actions.contains(QVariantMap { { qSL("default"), QString() } }); - case IsSystemNotification: + case NMRoles::IsSystemNotification: return n->isSystemNotification; - case IsShowingProgress: + case NMRoles::IsShowingProgress: return n->isShowingProgress; - case Progress: + case NMRoles::Progress: return n->isShowingProgress ? n->progress : -1; - case IsSticky: + case NMRoles::IsSticky: return n->timeout == 0; - case Timeout: + case NMRoles::Timeout: return n->timeout; - case Extended: + case NMRoles::Extended: return n->extended; } return { }; diff --git a/src/manager-lib/packagemanager.cpp b/src/manager-lib/packagemanager.cpp index 2b75c0dc..c889b7ea 100644 --- a/src/manager-lib/packagemanager.cpp +++ b/src/manager-lib/packagemanager.cpp @@ -244,7 +244,7 @@ QT_BEGIN_NAMESPACE_AM -enum Roles +enum PMRoles { Id = Qt::UserRole, Name, @@ -451,16 +451,16 @@ void PackageManager::registerQmlTypes() qSL("Cannot create objects of type PackageObject")); qRegisterMetaType<Package *>("Package*"); - s_roleNames.insert(Id, "packageId"); - s_roleNames.insert(Name, "name"); - s_roleNames.insert(Description, "description"); - s_roleNames.insert(Icon, "icon"); - s_roleNames.insert(IsBlocked, "isBlocked"); - s_roleNames.insert(IsUpdating, "isUpdating"); - s_roleNames.insert(IsRemovable, "isRemovable"); - s_roleNames.insert(UpdateProgress, "updateProgress"); - s_roleNames.insert(Version, "version"); - s_roleNames.insert(PackageItem, "package"); + s_roleNames.insert(PMRoles::Id, "packageId"); + s_roleNames.insert(PMRoles::Name, "name"); + s_roleNames.insert(PMRoles::Description, "description"); + s_roleNames.insert(PMRoles::Icon, "icon"); + s_roleNames.insert(PMRoles::IsBlocked, "isBlocked"); + s_roleNames.insert(PMRoles::IsUpdating, "isUpdating"); + s_roleNames.insert(PMRoles::IsRemovable, "isRemovable"); + s_roleNames.insert(PMRoles::UpdateProgress, "updateProgress"); + s_roleNames.insert(PMRoles::Version, "version"); + s_roleNames.insert(PMRoles::PackageItem, "package"); } PackageManager::PackageManager(PackageDatabase *packageDatabase, @@ -538,25 +538,25 @@ QVariant PackageManager::data(const QModelIndex &index, int role) const QVariant PackageManager::dataForRole(Package *package, int role) const { switch (role) { - case Id: + case PMRoles::Id: return package->id(); - case Name: + case PMRoles::Name: return package->name(); - case Description: + case PMRoles::Description: return package->description(); - case Icon: + case PMRoles::Icon: return package->icon(); - case IsBlocked: + case PMRoles::IsBlocked: return package->isBlocked(); - case IsUpdating: + case PMRoles::IsUpdating: return package->state() != Package::Installed; - case UpdateProgress: + case PMRoles::UpdateProgress: return package->progress(); - case IsRemovable: + case PMRoles::IsRemovable: return !package->isBuiltIn(); - case Version: + case PMRoles::Version: return package->version(); - case PackageItem: + case PMRoles::PackageItem: return QVariant::fromValue(package); default: return QVariant(); @@ -1299,7 +1299,7 @@ void PackageManager::executeNextTask() package->setProgress(p); // Icon will be in a "+" suffixed directory during installation. So notify about a change on its // location as well. - emitDataChanged(package, QVector<int> { Icon, UpdateProgress }); + emitDataChanged(package, QVector<int> { PMRoles::Icon, PMRoles::UpdateProgress }); } }); @@ -1398,7 +1398,7 @@ bool PackageManager::startingPackageRemoval(const QString &id) : Package::BeingRemoved); package->setProgress(0); - emitDataChanged(package, QVector<int> { IsUpdating }); + emitDataChanged(package, QVector<int> { PMRoles::IsUpdating }); return true; } @@ -1537,7 +1537,7 @@ bool PackageManager::canceledPackageInstall(const QString &id) package->setState(Package::Installed); package->setProgress(0); - emitDataChanged(package, QVector<int> { IsUpdating }); + emitDataChanged(package, QVector<int> { PMRoles::IsUpdating }); package->unblock(); break; diff --git a/src/window-lib/windowmanager.cpp b/src/window-lib/windowmanager.cpp index 09df36a7..bffbda08 100644 --- a/src/window-lib/windowmanager.cpp +++ b/src/window-lib/windowmanager.cpp @@ -203,14 +203,12 @@ QT_BEGIN_NAMESPACE_AM -namespace { -enum Roles +enum WMRoles { Id = Qt::UserRole + 1000, WindowRole, ContentState }; -} WindowManager *WindowManager::s_instance = nullptr; @@ -352,9 +350,9 @@ WindowManager::WindowManager(QQmlEngine *qmlEngine, const QString &waylandSocket Q_UNUSED(waylandSocketName) #endif - d->roleNames.insert(Id, "applicationId"); - d->roleNames.insert(WindowRole, "window"); - d->roleNames.insert(ContentState, "contentState"); + d->roleNames.insert(WMRoles::Id, "applicationId"); + d->roleNames.insert(WMRoles::WindowRole, "window"); + d->roleNames.insert(WMRoles::ContentState, "contentState"); d->qmlEngine = qmlEngine; @@ -423,15 +421,15 @@ QVariant WindowManager::data(const QModelIndex &index, int role) const Window *win = d->windowsInModel.at(index.row()); switch (role) { - case Id: + case WMRoles::Id: if (win->application()) { return win->application()->nonAliased()->id(); } else { return QString(); } - case WindowRole: + case WMRoles::WindowRole: return QVariant::fromValue(win); - case ContentState: + case WMRoles::ContentState: return win->contentState(); } return QVariant(); @@ -763,7 +761,7 @@ void WindowManager::setupWindow(Window *window) QModelIndex modelIndex = QAbstractListModel::index(index); qCDebug(LogGraphics).nospace() << "emitting dataChanged, index: " << modelIndex.row() << ", contentState: " << window->contentState(); - emit dataChanged(modelIndex, modelIndex, QVector<int>() << ContentState); + emit dataChanged(modelIndex, modelIndex, QVector<int>() << WMRoles::ContentState); } if (contentState == Window::NoSurface) { |