mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-23 01:33:50 +03:00
support Layout::BackgroundStyle
This commit is contained in:
parent
beeb1445ff
commit
552216d4d3
@ -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<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 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());
|
||||
|
@ -29,9 +29,6 @@
|
||||
// Plasma
|
||||
#include <Plasma>
|
||||
|
||||
// Latte
|
||||
#include <Latte>
|
||||
|
||||
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;
|
||||
|
@ -21,14 +21,14 @@
|
||||
#ifndef SETTINGSDATALAYOUT_H
|
||||
#define SETTINGSDATALAYOUT_H
|
||||
|
||||
// local
|
||||
#include "../../layout/abstractlayout.h"
|
||||
|
||||
//Qt
|
||||
#include <QMetaType>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
// Latte
|
||||
#include <Latte>
|
||||
|
||||
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;
|
||||
|
@ -27,8 +27,6 @@
|
||||
#include "../widgets/patternwidget.h"
|
||||
#include "../../layout/abstractlayout.h"
|
||||
|
||||
// Latte
|
||||
#include <Latte>
|
||||
|
||||
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<void(QButtonGroup::*)(int, bool)>(&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);
|
||||
|
Loading…
Reference in New Issue
Block a user