From 552216d4d34bff5ae4fdefb657d6d002eb7caae1 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Thu, 23 Apr 2020 19:35:26 +0300 Subject: [PATCH] support Layout::BackgroundStyle --- app/layout/abstractlayout.cpp | 12 ++++++------ app/layout/abstractlayout.h | 16 ++++++++++------ app/settings/data/layoutdata.h | 8 ++++---- app/settings/handlers/detailsinfohandler.cpp | 8 +++----- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/app/layout/abstractlayout.cpp b/app/layout/abstractlayout.cpp index ad68ea02d..8d83ebbe5 100644 --- a/app/layout/abstractlayout.cpp +++ b/app/layout/abstractlayout.cpp @@ -109,7 +109,7 @@ void AbstractLayout::setPreferredForShortcutsTouched(bool touched) QString AbstractLayout::background() const { - if (m_backgroundStyle == Types::ColorStyle) { + if (m_backgroundStyle == ColorBackgroundStyle) { return m_color; } else { return m_customBackground; @@ -118,19 +118,19 @@ QString AbstractLayout::background() const QString AbstractLayout::textColor() const { - if (m_backgroundStyle == Types::ColorStyle) { + if (m_backgroundStyle == ColorBackgroundStyle) { return predefinedTextColor(); } else { return m_customTextColor; } } -Types::BackgroundStyle AbstractLayout::backgroundStyle() const +BackgroundStyle AbstractLayout::backgroundStyle() const { return m_backgroundStyle; } -void AbstractLayout::setBackgroundStyle(const Types::BackgroundStyle &style) +void AbstractLayout::setBackgroundStyle(const BackgroundStyle &style) { if (m_backgroundStyle == style) { return; @@ -333,7 +333,7 @@ void AbstractLayout::loadConfig() m_preferredForShortcutsTouched = m_layoutGroup.readEntry("preferredForShortcutsTouched", false); m_color = m_layoutGroup.readEntry("color", QString("blue")); - m_backgroundStyle = static_cast(m_layoutGroup.readEntry("backgroundStyle", (int)Types::ColorStyle)); + m_backgroundStyle = static_cast(m_layoutGroup.readEntry("backgroundStyle", (int)ColorBackgroundStyle)); QString deprecatedTextColor = m_layoutGroup.readEntry("textColor", QString("fcfcfc")); QString deprecatedBackground = m_layoutGroup.readEntry("background", QString()); @@ -341,7 +341,7 @@ void AbstractLayout::loadConfig() if (deprecatedBackground.startsWith("/")) { m_customBackground = deprecatedBackground; m_customTextColor = deprecatedTextColor; - setBackgroundStyle(Types::CustomBackgroundStyle); + setBackgroundStyle(PatternBackgroundStyle); m_layoutGroup.writeEntry("background", QString()); m_layoutGroup.writeEntry("textColor", QString()); diff --git a/app/layout/abstractlayout.h b/app/layout/abstractlayout.h index c6c003786..80f5b294a 100644 --- a/app/layout/abstractlayout.h +++ b/app/layout/abstractlayout.h @@ -29,9 +29,6 @@ // Plasma #include -// Latte -#include - namespace Plasma { class Types; } @@ -48,6 +45,13 @@ enum Type { }; Q_ENUM_NS(Type); +enum BackgroundStyle +{ + ColorBackgroundStyle = 0, + PatternBackgroundStyle +}; +Q_ENUM_NS(BackgroundStyle); + } } @@ -101,8 +105,8 @@ public: QString textColor() const; void setTextColor(QString color); - Types::BackgroundStyle backgroundStyle() const; - void setBackgroundStyle(const Types::BackgroundStyle &style); + BackgroundStyle backgroundStyle() const; + void setBackgroundStyle(const BackgroundStyle &style); QStringList launchers() const; void setLaunchers(QStringList launcherList); @@ -151,7 +155,7 @@ protected: QString m_lastUsedActivity; //the last used activity for this layout - Types::BackgroundStyle m_backgroundStyle{Types::ColorStyle}; + BackgroundStyle m_backgroundStyle{ColorBackgroundStyle}; QString m_layoutFile; QString m_layoutName; diff --git a/app/settings/data/layoutdata.h b/app/settings/data/layoutdata.h index 2c3f2ad28..6c61cc14f 100644 --- a/app/settings/data/layoutdata.h +++ b/app/settings/data/layoutdata.h @@ -21,14 +21,14 @@ #ifndef SETTINGSDATALAYOUT_H #define SETTINGSDATALAYOUT_H +// local +#include "../../layout/abstractlayout.h" + //Qt #include #include #include -// Latte -#include - namespace Latte { namespace Settings { namespace Data { @@ -55,7 +55,7 @@ public: QStringList activities; QStringList shares; - Types::BackgroundStyle backgroundStyle{Types::ColorStyle}; + Latte::Layout::BackgroundStyle backgroundStyle{Latte::Layout::ColorBackgroundStyle}; //! Functionality bool isShared() const; diff --git a/app/settings/handlers/detailsinfohandler.cpp b/app/settings/handlers/detailsinfohandler.cpp index 8af36c444..1d20e5916 100644 --- a/app/settings/handlers/detailsinfohandler.cpp +++ b/app/settings/handlers/detailsinfohandler.cpp @@ -27,8 +27,6 @@ #include "../widgets/patternwidget.h" #include "../../layout/abstractlayout.h" -// Latte -#include namespace Latte { namespace Settings { @@ -50,8 +48,8 @@ DetailsInfoHandler::~DetailsInfoHandler() void DetailsInfoHandler::init() { m_backButtonsGroup = new QButtonGroup(this); - m_backButtonsGroup->addButton(m_ui->colorRadioBtn, Types::ColorStyle); - m_backButtonsGroup->addButton(m_ui->backRadioBtn, Types::CustomBackgroundStyle); + m_backButtonsGroup->addButton(m_ui->colorRadioBtn, Latte::Layout::ColorBackgroundStyle); + m_backButtonsGroup->addButton(m_ui->backRadioBtn, Latte::Layout::PatternBackgroundStyle); m_backButtonsGroup->setExclusive(true); connect(m_backButtonsGroup, static_cast(&QButtonGroup::buttonToggled), @@ -82,7 +80,7 @@ void DetailsInfoHandler::reload() void DetailsInfoHandler::loadLayout(const Data::Layout &data) { - if (data.backgroundStyle == Types::ColorStyle) { + if (data.backgroundStyle == Latte::Layout::ColorBackgroundStyle) { m_ui->colorRadioBtn->setChecked(true); } else { m_ui->backRadioBtn->setChecked(true);