From 69df6400f2536f529f5118937ee73c665181cab3 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Thu, 14 Jan 2021 20:21:12 +0200 Subject: [PATCH] rename launchersignals to syncedLaunchers --that is more appropriate name for synced launchers latte launchers handler --- app/lattecorona.cpp | 1 - app/lattecorona.h | 2 - app/layouts/CMakeLists.txt | 2 +- app/layouts/manager.cpp | 10 ++-- app/layouts/manager.h | 12 ++--- ...uncherssignals.cpp => syncedlaunchers.cpp} | 33 +++++++------ .../{launcherssignals.h => syncedlaunchers.h} | 13 +++--- .../contents/ui/abilities/Launchers.qml | 46 +++++++++---------- 8 files changed, 57 insertions(+), 62 deletions(-) rename app/layouts/{launcherssignals.cpp => syncedlaunchers.cpp} (84%) rename app/layouts/{launcherssignals.h => syncedlaunchers.h} (89%) diff --git a/app/lattecorona.cpp b/app/lattecorona.cpp index b6cdacc96..2741a72cd 100644 --- a/app/lattecorona.cpp +++ b/app/lattecorona.cpp @@ -34,7 +34,6 @@ #include "layouts/importer.h" #include "layouts/manager.h" #include "layouts/synchronizer.h" -#include "layouts/launcherssignals.h" #include "shortcuts/globalshortcuts.h" #include "package/lattepackage.h" #include "plasma/extended/backgroundcache.h" diff --git a/app/lattecorona.h b/app/lattecorona.h index 3e9ebcd85..7c738b7f6 100644 --- a/app/lattecorona.h +++ b/app/lattecorona.h @@ -75,7 +75,6 @@ namespace Layout{ class GenericLayout; } namespace Layouts{ -class LaunchersSignals; class Manager; } namespace PlasmaExtended{ @@ -254,7 +253,6 @@ private: KWayland::Client::PlasmaShell *m_waylandCorona{nullptr}; friend class GlobalShortcuts; - friend class Layouts::LaunchersSignals; friend class Layouts::Manager; friend class Layouts::Storage; }; diff --git a/app/layouts/CMakeLists.txt b/app/layouts/CMakeLists.txt index 17bba951a..3a26ca7f3 100644 --- a/app/layouts/CMakeLists.txt +++ b/app/layouts/CMakeLists.txt @@ -1,9 +1,9 @@ set(lattedock-app_SRCS ${lattedock-app_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/importer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/launcherssignals.cpp ${CMAKE_CURRENT_SOURCE_DIR}/manager.cpp ${CMAKE_CURRENT_SOURCE_DIR}/storage.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/syncedlaunchers.cpp ${CMAKE_CURRENT_SOURCE_DIR}/synchronizer.cpp PARENT_SCOPE ) diff --git a/app/layouts/manager.cpp b/app/layouts/manager.cpp index 294313b41..f606d38d3 100644 --- a/app/layouts/manager.cpp +++ b/app/layouts/manager.cpp @@ -24,7 +24,7 @@ // local #include "importer.h" -#include "launcherssignals.h" +#include "syncedlaunchers.h" #include "../infoview.h" #include "../screenpool.h" #include "../data/layoutdata.h" @@ -49,7 +49,7 @@ namespace Layouts { Manager::Manager(QObject *parent) : QObject(parent), m_importer(new Importer(this)), - m_launchersSignals(new LaunchersSignals(this)) + m_syncedLaunchers(new SyncedLaunchers(this)) { m_corona = qobject_cast(parent); //! needs to be created AFTER corona assignment @@ -65,7 +65,7 @@ Manager::Manager(QObject *parent) Manager::~Manager() { m_importer->deleteLater(); - m_launchersSignals->deleteLater(); + m_syncedLaunchers->deleteLater(); //! no needed because Latte:Corona is calling it at better place // unload(); @@ -131,9 +131,9 @@ Importer *Manager::importer() return m_importer; } -LaunchersSignals *Manager::launchersSignals() const +SyncedLaunchers *Manager::syncedLaunchers() const { - return m_launchersSignals; + return m_syncedLaunchers; } Synchronizer *Manager::synchronizer() const diff --git a/app/layouts/manager.h b/app/layouts/manager.h index ff2d5b3d2..8e8d053c0 100644 --- a/app/layouts/manager.h +++ b/app/layouts/manager.h @@ -22,7 +22,7 @@ #define LAYOUTSMANAGER_H // local -#include "launcherssignals.h" +#include "syncedlaunchers.h" #include "synchronizer.h" #include "../apptypes.h" #include "../settings/dialogs/settingsdialog.h" @@ -45,7 +45,7 @@ class Corona; class CentralLayout; namespace Layouts { class Importer; -class LaunchersSignals; +class SyncedLaunchers; class Synchronizer; } } @@ -69,7 +69,7 @@ namespace Layouts { class Manager : public QObject { Q_OBJECT - Q_PROPERTY(LaunchersSignals *launchersSignals READ launchersSignals NOTIFY launchersSignalsChanged) + Q_PROPERTY(SyncedLaunchers *syncedLaunchers READ syncedLaunchers NOTIFY syncedLaunchersChanged) public: Manager(QObject *parent = nullptr); @@ -95,7 +95,7 @@ public: //! returns the current and central layout based on activities and user preferences QListcurrentLayouts() const; - LaunchersSignals *launchersSignals() const; + SyncedLaunchers *syncedLaunchers() const; Synchronizer *synchronizer() const; public slots: @@ -107,7 +107,7 @@ public slots: signals: void centralLayoutsChanged(); - void launchersSignalsChanged(); + void syncedLaunchersChanged(); void currentLayoutIsSwitching(QString layoutName); @@ -127,7 +127,7 @@ private: Latte::Corona *m_corona{nullptr}; Importer *m_importer{nullptr}; - LaunchersSignals *m_launchersSignals{nullptr}; + SyncedLaunchers *m_syncedLaunchers{nullptr}; Synchronizer *m_synchronizer{nullptr}; friend class Latte::Settings::Dialog::SettingsDialog; diff --git a/app/layouts/launcherssignals.cpp b/app/layouts/syncedlaunchers.cpp similarity index 84% rename from app/layouts/launcherssignals.cpp rename to app/layouts/syncedlaunchers.cpp index 1cda151ea..30c78c84f 100644 --- a/app/layouts/launcherssignals.cpp +++ b/app/layouts/syncedlaunchers.cpp @@ -1,6 +1,5 @@ /* -* Copyright 2017 Smith AR -* Michail Vourlakos +* Copyright 2021 Michail Vourlakos * * This file is part of Latte-Dock * @@ -18,7 +17,7 @@ * along with this program. If not, see . */ -#include "launcherssignals.h" +#include "syncedlaunchers.h" // local #include @@ -38,17 +37,17 @@ namespace Latte { namespace Layouts { -LaunchersSignals::LaunchersSignals(QObject *parent) +SyncedLaunchers::SyncedLaunchers(QObject *parent) : QObject(parent) { m_manager = qobject_cast(parent); } -LaunchersSignals::~LaunchersSignals() +SyncedLaunchers::~SyncedLaunchers() { } -void LaunchersSignals::addAbilityClient(QQuickItem *client) +void SyncedLaunchers::addAbilityClient(QQuickItem *client) { if (m_clients.contains(client)) { return; @@ -56,20 +55,20 @@ void LaunchersSignals::addAbilityClient(QQuickItem *client) m_clients << client; - connect(client, &QObject::destroyed, this, &LaunchersSignals::removeClientObject); + connect(client, &QObject::destroyed, this, &SyncedLaunchers::removeClientObject); } -void LaunchersSignals::removeAbilityClient(QQuickItem *client) +void SyncedLaunchers::removeAbilityClient(QQuickItem *client) { if (!m_clients.contains(client)) { return; } - disconnect(client, &QObject::destroyed, this, &LaunchersSignals::removeClientObject); + disconnect(client, &QObject::destroyed, this, &SyncedLaunchers::removeClientObject); m_clients.removeAll(client); } -void LaunchersSignals::removeClientObject(QObject *obj) +void SyncedLaunchers::removeClientObject(QObject *obj) { QQuickItem *item = qobject_cast(obj); @@ -78,7 +77,7 @@ void LaunchersSignals::removeClientObject(QObject *obj) } } -QList LaunchersSignals::clients(QString layoutName) +QList SyncedLaunchers::clients(QString layoutName) { QList items; @@ -96,7 +95,7 @@ QList LaunchersSignals::clients(QString layoutName) return items; } -void LaunchersSignals::addLauncher(QString layoutName, int launcherGroup, QString launcher) +void SyncedLaunchers::addLauncher(QString layoutName, int launcherGroup, QString launcher) { Types::LaunchersGroup group = static_cast(launcherGroup); @@ -121,7 +120,7 @@ void LaunchersSignals::addLauncher(QString layoutName, int launcherGroup, QStrin } } -void LaunchersSignals::removeLauncher(QString layoutName, int launcherGroup, QString launcher) +void SyncedLaunchers::removeLauncher(QString layoutName, int launcherGroup, QString launcher) { Types::LaunchersGroup group = static_cast(launcherGroup); @@ -146,7 +145,7 @@ void LaunchersSignals::removeLauncher(QString layoutName, int launcherGroup, QSt } } -void LaunchersSignals::addLauncherToActivity(QString layoutName, int launcherGroup, QString launcher, QString activity) +void SyncedLaunchers::addLauncherToActivity(QString layoutName, int launcherGroup, QString launcher, QString activity) { Types::LaunchersGroup group = static_cast(launcherGroup); @@ -171,7 +170,7 @@ void LaunchersSignals::addLauncherToActivity(QString layoutName, int launcherGro } } -void LaunchersSignals::removeLauncherFromActivity(QString layoutName, int launcherGroup, QString launcher, QString activity) +void SyncedLaunchers::removeLauncherFromActivity(QString layoutName, int launcherGroup, QString launcher, QString activity) { Types::LaunchersGroup group = static_cast(launcherGroup); @@ -196,7 +195,7 @@ void LaunchersSignals::removeLauncherFromActivity(QString layoutName, int launch } } -void LaunchersSignals::urlsDropped(QString layoutName, int launcherGroup, QStringList urls) +void SyncedLaunchers::urlsDropped(QString layoutName, int launcherGroup, QStringList urls) { Types::LaunchersGroup group = static_cast(launcherGroup); @@ -221,7 +220,7 @@ void LaunchersSignals::urlsDropped(QString layoutName, int launcherGroup, QStrin } } -void LaunchersSignals::validateLaunchersOrder(QString layoutName, uint senderId, int launcherGroup, QStringList launchers) +void SyncedLaunchers::validateLaunchersOrder(QString layoutName, uint senderId, int launcherGroup, QStringList launchers) { Types::LaunchersGroup group = static_cast(launcherGroup); diff --git a/app/layouts/launcherssignals.h b/app/layouts/syncedlaunchers.h similarity index 89% rename from app/layouts/launcherssignals.h rename to app/layouts/syncedlaunchers.h index d5ab41336..8b48b0226 100644 --- a/app/layouts/launcherssignals.h +++ b/app/layouts/syncedlaunchers.h @@ -1,6 +1,5 @@ /* -* Copyright 2017 Smith AR -* Michail Vourlakos +* Copyright 2021 Michail Vourlakos * * This file is part of Latte-Dock * @@ -18,8 +17,8 @@ * along with this program. If not, see . */ -#ifndef LAUNCHERSSIGNALS_H -#define LAUNCHERSSIGNALS_H +#ifndef SYNCEDLAUNCHERS_H +#define SYNCEDLAUNCHERS_H // Qt #include @@ -45,13 +44,13 @@ namespace Layouts { //! crashes that occur by setting the launcherList of the tasksModel so //! often. The plasma devs of libtaskmanager have designed the launchers //! model to be initialized only once during startup -class LaunchersSignals : public QObject +class SyncedLaunchers : public QObject { Q_OBJECT public: - LaunchersSignals(QObject *parent); - ~LaunchersSignals() override; + SyncedLaunchers(QObject *parent); + ~SyncedLaunchers() override; public slots: Q_INVOKABLE void addAbilityClient(QQuickItem *client); diff --git a/containment/package/contents/ui/abilities/Launchers.qml b/containment/package/contents/ui/abilities/Launchers.qml index 5778f77d7..9d998f0a7 100644 --- a/containment/package/contents/ui/abilities/Launchers.qml +++ b/containment/package/contents/ui/abilities/Launchers.qml @@ -26,49 +26,49 @@ Item { property string layoutName: "" function addAbilityClient(client) { - layoutsManager.launchersSignals.addAbilityClient(client); + layoutsManager.syncedLaunchers.addAbilityClient(client); } function removeAbilityClient(client) { - layoutsManager.launchersSignals.removeAbilityClient(client); + layoutsManager.syncedLaunchers.removeAbilityClient(client); } function addSyncedLauncher(group, launcherUrl) { - layoutsManager.launchersSignals.addLauncher(layoutName, - group, - launcherUrl); + layoutsManager.syncedLaunchers.addLauncher(layoutName, + group, + launcherUrl); } function removeSyncedLauncher(group, launcherUrl) { - layoutsManager.launchersSignals.removeLauncher(layoutName, - group, - launcherUrl); + layoutsManager.syncedLaunchers.removeLauncher(layoutName, + group, + launcherUrl); } function addSyncedLauncherToActivity(group, launcherUrl, activityId) { - layoutsManager.launchersSignals.addLauncherToActivity(layoutName, - group, - launcherUrl, - activityId); + layoutsManager.syncedLaunchers.addLauncherToActivity(layoutName, + group, + launcherUrl, + activityId); } function removeSyncedLauncherFromActivity(group, launcherUrl, activityId) { - layoutsManager.launchersSignals.removeLauncherFromActivity(layoutName, - group, - launcherUrl, - activityId); + layoutsManager.syncedLaunchers.removeLauncherFromActivity(layoutName, + group, + launcherUrl, + activityId); } function addDroppedLaunchers(group, urls) { - layoutsManager.launchersSignals.urlsDropped(layoutName, - group, - urls); + layoutsManager.syncedLaunchers.urlsDropped(layoutName, + group, + urls); } function validateSyncedLaunchersOrder(senderId, group, orderedlaunchers) { - layoutsManager.launchersSignals.validateLaunchersOrder(layoutName, - senderId, - group, - orderedlaunchers); + layoutsManager.syncedLaunchers.validateLaunchersOrder(layoutName, + senderId, + group, + orderedlaunchers); } }