support Layout::BackgroundStyle

pull/15/head
Michail Vourlakos 5 years ago
parent beeb1445ff
commit 552216d4d3

@ -109,7 +109,7 @@ void AbstractLayout::setPreferredForShortcutsTouched(bool touched)
QString AbstractLayout::background() const QString AbstractLayout::background() const
{ {
if (m_backgroundStyle == Types::ColorStyle) { if (m_backgroundStyle == ColorBackgroundStyle) {
return m_color; return m_color;
} else { } else {
return m_customBackground; return m_customBackground;
@ -118,19 +118,19 @@ QString AbstractLayout::background() const
QString AbstractLayout::textColor() const QString AbstractLayout::textColor() const
{ {
if (m_backgroundStyle == Types::ColorStyle) { if (m_backgroundStyle == ColorBackgroundStyle) {
return predefinedTextColor(); return predefinedTextColor();
} else { } else {
return m_customTextColor; return m_customTextColor;
} }
} }
Types::BackgroundStyle AbstractLayout::backgroundStyle() const BackgroundStyle AbstractLayout::backgroundStyle() const
{ {
return m_backgroundStyle; return m_backgroundStyle;
} }
void AbstractLayout::setBackgroundStyle(const Types::BackgroundStyle &style) void AbstractLayout::setBackgroundStyle(const BackgroundStyle &style)
{ {
if (m_backgroundStyle == style) { if (m_backgroundStyle == style) {
return; return;
@ -333,7 +333,7 @@ void AbstractLayout::loadConfig()
m_preferredForShortcutsTouched = m_layoutGroup.readEntry("preferredForShortcutsTouched", false); m_preferredForShortcutsTouched = m_layoutGroup.readEntry("preferredForShortcutsTouched", false);
m_color = m_layoutGroup.readEntry("color", QString("blue")); m_color = m_layoutGroup.readEntry("color", QString("blue"));
m_backgroundStyle = static_cast<Types::BackgroundStyle>(m_layoutGroup.readEntry("backgroundStyle", (int)Types::ColorStyle)); m_backgroundStyle = static_cast<BackgroundStyle>(m_layoutGroup.readEntry("backgroundStyle", (int)ColorBackgroundStyle));
QString deprecatedTextColor = m_layoutGroup.readEntry("textColor", QString("fcfcfc")); QString deprecatedTextColor = m_layoutGroup.readEntry("textColor", QString("fcfcfc"));
QString deprecatedBackground = m_layoutGroup.readEntry("background", QString()); QString deprecatedBackground = m_layoutGroup.readEntry("background", QString());
@ -341,7 +341,7 @@ void AbstractLayout::loadConfig()
if (deprecatedBackground.startsWith("/")) { if (deprecatedBackground.startsWith("/")) {
m_customBackground = deprecatedBackground; m_customBackground = deprecatedBackground;
m_customTextColor = deprecatedTextColor; m_customTextColor = deprecatedTextColor;
setBackgroundStyle(Types::CustomBackgroundStyle); setBackgroundStyle(PatternBackgroundStyle);
m_layoutGroup.writeEntry("background", QString()); m_layoutGroup.writeEntry("background", QString());
m_layoutGroup.writeEntry("textColor", QString()); m_layoutGroup.writeEntry("textColor", QString());

@ -29,9 +29,6 @@
// Plasma // Plasma
#include <Plasma> #include <Plasma>
// Latte
#include <Latte>
namespace Plasma { namespace Plasma {
class Types; class Types;
} }
@ -48,6 +45,13 @@ enum Type {
}; };
Q_ENUM_NS(Type); Q_ENUM_NS(Type);
enum BackgroundStyle
{
ColorBackgroundStyle = 0,
PatternBackgroundStyle
};
Q_ENUM_NS(BackgroundStyle);
} }
} }
@ -101,8 +105,8 @@ public:
QString textColor() const; QString textColor() const;
void setTextColor(QString color); void setTextColor(QString color);
Types::BackgroundStyle backgroundStyle() const; BackgroundStyle backgroundStyle() const;
void setBackgroundStyle(const Types::BackgroundStyle &style); void setBackgroundStyle(const BackgroundStyle &style);
QStringList launchers() const; QStringList launchers() const;
void setLaunchers(QStringList launcherList); void setLaunchers(QStringList launcherList);
@ -151,7 +155,7 @@ protected:
QString m_lastUsedActivity; //the last used activity for this layout 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_layoutFile;
QString m_layoutName; QString m_layoutName;

@ -21,14 +21,14 @@
#ifndef SETTINGSDATALAYOUT_H #ifndef SETTINGSDATALAYOUT_H
#define SETTINGSDATALAYOUT_H #define SETTINGSDATALAYOUT_H
// local
#include "../../layout/abstractlayout.h"
//Qt //Qt
#include <QMetaType> #include <QMetaType>
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
// Latte
#include <Latte>
namespace Latte { namespace Latte {
namespace Settings { namespace Settings {
namespace Data { namespace Data {
@ -55,7 +55,7 @@ public:
QStringList activities; QStringList activities;
QStringList shares; QStringList shares;
Types::BackgroundStyle backgroundStyle{Types::ColorStyle}; Latte::Layout::BackgroundStyle backgroundStyle{Latte::Layout::ColorBackgroundStyle};
//! Functionality //! Functionality
bool isShared() const; bool isShared() const;

@ -27,8 +27,6 @@
#include "../widgets/patternwidget.h" #include "../widgets/patternwidget.h"
#include "../../layout/abstractlayout.h" #include "../../layout/abstractlayout.h"
// Latte
#include <Latte>
namespace Latte { namespace Latte {
namespace Settings { namespace Settings {
@ -50,8 +48,8 @@ DetailsInfoHandler::~DetailsInfoHandler()
void DetailsInfoHandler::init() void DetailsInfoHandler::init()
{ {
m_backButtonsGroup = new QButtonGroup(this); m_backButtonsGroup = new QButtonGroup(this);
m_backButtonsGroup->addButton(m_ui->colorRadioBtn, Types::ColorStyle); m_backButtonsGroup->addButton(m_ui->colorRadioBtn, Latte::Layout::ColorBackgroundStyle);
m_backButtonsGroup->addButton(m_ui->backRadioBtn, Types::CustomBackgroundStyle); m_backButtonsGroup->addButton(m_ui->backRadioBtn, Latte::Layout::PatternBackgroundStyle);
m_backButtonsGroup->setExclusive(true); m_backButtonsGroup->setExclusive(true);
connect(m_backButtonsGroup, static_cast<void(QButtonGroup::*)(int, bool)>(&QButtonGroup::buttonToggled), connect(m_backButtonsGroup, static_cast<void(QButtonGroup::*)(int, bool)>(&QButtonGroup::buttonToggled),
@ -82,7 +80,7 @@ void DetailsInfoHandler::reload()
void DetailsInfoHandler::loadLayout(const Data::Layout &data) void DetailsInfoHandler::loadLayout(const Data::Layout &data)
{ {
if (data.backgroundStyle == Types::ColorStyle) { if (data.backgroundStyle == Latte::Layout::ColorBackgroundStyle) {
m_ui->colorRadioBtn->setChecked(true); m_ui->colorRadioBtn->setChecked(true);
} else { } else {
m_ui->backRadioBtn->setChecked(true); m_ui->backRadioBtn->setChecked(true);

Loading…
Cancel
Save