From 5ed3f111e3b7a9d1131b9940d444484fb9277726 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Fri, 14 Aug 2020 09:08:01 +0300 Subject: [PATCH] update Layout::MULTIPLELAYOUTSHIDDENNAME which is used to identify multiple layouts hidden base layout --- app/layout/abstractlayout.cpp | 2 -- app/layout/abstractlayout.h | 4 ++-- app/layout/storage.cpp | 2 +- app/layouts/importer.cpp | 4 ++-- app/layouts/manager.cpp | 2 +- app/layouts/synchronizer.cpp | 8 ++++---- app/templates/templatesmanager.cpp | 3 ++- app/templates/templatesmanager.h | 1 - .../templates/multiple-layouts_hidden.layout.latte | 4 ---- 9 files changed, 12 insertions(+), 18 deletions(-) delete mode 100644 shell/package/contents/templates/multiple-layouts_hidden.layout.latte diff --git a/app/layout/abstractlayout.cpp b/app/layout/abstractlayout.cpp index f6e57f6df..1df97bfc0 100644 --- a/app/layout/abstractlayout.cpp +++ b/app/layout/abstractlayout.cpp @@ -30,8 +30,6 @@ namespace Latte { namespace Layout { -const QString AbstractLayout::MultipleLayoutsName = ".multiple-layouts_hidden"; - AbstractLayout::AbstractLayout(QObject *parent, QString layoutFile, QString assignedName) : QObject(parent) { diff --git a/app/layout/abstractlayout.h b/app/layout/abstractlayout.h index 79ff29b90..76f51d663 100644 --- a/app/layout/abstractlayout.h +++ b/app/layout/abstractlayout.h @@ -58,6 +58,8 @@ Q_ENUM_NS(BackgroundStyle); namespace Latte { namespace Layout { +const char MULTIPLELAYOUTSHIDDENNAME[] = ".multiple-layouts_hidden"; + class AbstractLayout : public QObject { Q_OBJECT @@ -76,8 +78,6 @@ public: AbstractLayout(QObject *parent, QString layoutFile, QString assignedName = QString()); ~AbstractLayout() override; - static const QString MultipleLayoutsName; - int version() const; void setVersion(int ver); diff --git a/app/layout/storage.cpp b/app/layout/storage.cpp index d0259e129..4b800ff92 100644 --- a/app/layout/storage.cpp +++ b/app/layout/storage.cpp @@ -716,7 +716,7 @@ bool Storage::layoutIsBroken(QStringList &errors) const qDebug() << " --- storaged file : " << m_layout->file(); } else { if (m_layout->corona()->layoutsManager()->memoryUsage() == MemoryUsage::MultipleLayouts) { - qDebug() << " --- in multiple layouts hidden file : " << Layouts::Importer::layoutFilePath(AbstractLayout::MultipleLayoutsName); + qDebug() << " --- in multiple layouts hidden file : " << Layouts::Importer::layoutFilePath(MULTIPLELAYOUTSHIDDENNAME); } else { qDebug() << " --- in active layout file : " << m_layout->file(); } diff --git a/app/layouts/importer.cpp b/app/layouts/importer.cpp index 2dd6ef408..66e32d7e3 100644 --- a/app/layouts/importer.cpp +++ b/app/layouts/importer.cpp @@ -609,7 +609,7 @@ QString Importer::uniqueLayoutName(QString name) QStringList Importer::checkRepairMultipleLayoutsLinkedFile() { - QString linkedFilePath = QDir::homePath() + "/.config/latte/" + Layout::AbstractLayout::MultipleLayoutsName + ".layout.latte"; + QString linkedFilePath = QDir::homePath() + "/.config/latte/" + Layout::MULTIPLELAYOUTSHIDDENNAME + ".layout.latte"; KSharedConfigPtr filePtr = KSharedConfig::openConfig(linkedFilePath); KConfigGroup linkedContainments = KConfigGroup(filePtr, "Containments"); @@ -629,7 +629,7 @@ QStringList Importer::checkRepairMultipleLayoutsLinkedFile() QStringList updatedLayouts; for(const auto &layoutName : linkedLayoutContainmentGroups.uniqueKeys()) { - if (layoutName != Layout::AbstractLayout::MultipleLayoutsName && layoutExists(layoutName)) { + if (layoutName != Layout::MULTIPLELAYOUTSHIDDENNAME && layoutExists(layoutName)) { updatedLayouts << layoutName; KSharedConfigPtr layoutFilePtr = KSharedConfig::openConfig(layoutFilePath(layoutName)); KConfigGroup origLayoutContainments = KConfigGroup(layoutFilePtr, "Containments"); diff --git a/app/layouts/manager.cpp b/app/layouts/manager.cpp index 0e2db39ae..1224fbcf0 100644 --- a/app/layouts/manager.cpp +++ b/app/layouts/manager.cpp @@ -111,7 +111,7 @@ void Manager::load() } //! Check if the multiple-layouts hidden file is present, add it if it isnt - if (!QFile(QDir::homePath() + "/.config/latte/" + Layout::AbstractLayout::MultipleLayoutsName + ".layout.latte").exists()) { + if (!QFile(QDir::homePath() + "/.config/latte/" + Layout::MULTIPLELAYOUTSHIDDENNAME + ".layout.latte").exists()) { importPreset(MultipleLayoutsPresetId, false); } diff --git a/app/layouts/synchronizer.cpp b/app/layouts/synchronizer.cpp index 7b6117ed7..67390ee6d 100644 --- a/app/layouts/synchronizer.cpp +++ b/app/layouts/synchronizer.cpp @@ -564,7 +564,7 @@ void Synchronizer::loadLayouts() QStringList files = layoutDir.entryList(filter, QDir::Files | QDir::NoSymLinks); for (const auto &layout : files) { - if (layout.contains(Layout::AbstractLayout::MultipleLayoutsName)) { + if (layout.contains(Layout::MULTIPLELAYOUTSHIDDENNAME)) { //! IMPORTANT: DON'T ADD MultipleLayouts hidden file in layouts list continue; } @@ -697,7 +697,7 @@ bool Synchronizer::switchToLayout(QString layoutName, int previousMemoryUsage) if (!lPath.isEmpty()) { if (m_manager->memoryUsage() == MemoryUsage::SingleLayout) { // emit currentLayoutIsSwitching(currentLayoutName()); - } else if (m_manager->memoryUsage() == MemoryUsage::MultipleLayouts && layoutName != Layout::AbstractLayout::MultipleLayoutsName) { + } else if (m_manager->memoryUsage() == MemoryUsage::MultipleLayouts && layoutName != Layout::MULTIPLELAYOUTSHIDDENNAME) { CentralLayout toLayout(this, lPath); QStringList toActivities = toLayout.activities(); @@ -736,11 +736,11 @@ bool Synchronizer::switchToLayout(QString layoutName, int previousMemoryUsage) unloadLayouts(); if (initializingMultipleLayouts) { - fixedLayoutName = QString(Layout::AbstractLayout::MultipleLayoutsName); + fixedLayoutName = QString(Layout::MULTIPLELAYOUTSHIDDENNAME); fixedLPath = layoutPath(fixedLayoutName); } - if (fixedLayoutName != Layout::AbstractLayout::MultipleLayoutsName) { + if (fixedLayoutName != Layout::MULTIPLELAYOUTSHIDDENNAME) { CentralLayout *newLayout = new CentralLayout(this, fixedLPath, fixedLayoutName); addLayout(newLayout); } diff --git a/app/templates/templatesmanager.cpp b/app/templates/templatesmanager.cpp index abf0bc672..e3dfcba60 100644 --- a/app/templates/templatesmanager.cpp +++ b/app/templates/templatesmanager.cpp @@ -20,6 +20,7 @@ #include "templatesmanager.h" // local +#include "../layout/abstractlayout.h" #include "../layout/centrallayout.h" #include "../layouts/importer.h" @@ -89,7 +90,7 @@ Data::LayoutsTable Manager::systemLayoutTemplates() for (int i=0; i