1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-03 09:17:50 +03:00

provide schemeFile for layout

This commit is contained in:
Michail Vourlakos 2021-06-16 09:42:36 +03:00
parent 6444cc6e2d
commit a9ed71b837
2 changed files with 27 additions and 0 deletions

View File

@ -59,6 +59,7 @@ void AbstractLayout::init()
connect(this, &AbstractLayout::launchersChanged, this, &AbstractLayout::saveConfig);
connect(this, &AbstractLayout::preferredForShortcutsTouchedChanged, this, &AbstractLayout::saveConfig);
connect(this, &AbstractLayout::popUpMarginChanged, this, &AbstractLayout::saveConfig);
connect(this, &AbstractLayout::schemeFileChanged, this, &AbstractLayout::saveConfig);
connect(this, &AbstractLayout::versionChanged, this, &AbstractLayout::saveConfig);
}
@ -118,6 +119,21 @@ QString AbstractLayout::background() const
}
}
QString AbstractLayout::schemeFile() const
{
return m_schemeFile;
}
void AbstractLayout::setSchemeFile(const QString &file)
{
if (m_schemeFile == file) {
return;
}
m_schemeFile = file;
emit schemeFileChanged();
}
QString AbstractLayout::textColor() const
{
if (m_backgroundStyle == ColorBackgroundStyle) {
@ -363,6 +379,8 @@ void AbstractLayout::loadConfig()
m_color = m_layoutGroup.readEntry("color", QString("blue"));
m_backgroundStyle = static_cast<BackgroundStyle>(m_layoutGroup.readEntry("backgroundStyle", (int)ColorBackgroundStyle));
m_schemeFile = m_layoutGroup.readEntry("schemeFile", QString("kdeglobals"));
QString deprecatedTextColor = m_layoutGroup.readEntry("textColor", QString());
QString deprecatedBackground = m_layoutGroup.readEntry("background", QString());
@ -396,6 +414,8 @@ void AbstractLayout::saveConfig()
m_layoutGroup.writeEntry("lastUsedActivity", m_lastUsedActivity);
m_layoutGroup.writeEntry("popUpMargin", m_popUpMargin);
m_layoutGroup.writeEntry("preferredForShortcutsTouched", m_preferredForShortcutsTouched);
m_layoutGroup.writeEntry("schemeFile", m_schemeFile == QLatin1String("kdeglobals") ? "" : m_schemeFile);
m_layoutGroup.sync();
}

View File

@ -59,6 +59,8 @@ class AbstractLayout : public QObject
Q_PROPERTY(QString background READ background NOTIFY backgroundChanged)
Q_PROPERTY(QString textColor READ textColor NOTIFY textColorChanged)
Q_PROPERTY(QString schemeFile READ schemeFile WRITE setSchemeFile NOTIFY schemeFileChanged)
Q_PROPERTY(QStringList launchers READ launchers WRITE setLaunchers NOTIFY launchersChanged)
Q_PROPERTY(QString lastUsedActivity READ lastUsedActivity NOTIFY lastUsedActivityChanged)
@ -97,6 +99,9 @@ public:
QString predefinedTextColor() const;
QString schemeFile() const;
void setSchemeFile(const QString &file);
virtual QString textColor() const;
void setTextColor(QString color);
@ -131,6 +136,7 @@ signals:
void nameChanged();
void popUpMarginChanged();
void preferredForShortcutsTouchedChanged();
void schemeFileChanged();
void textColorChanged();
void versionChanged();
@ -157,6 +163,7 @@ protected:
QString m_color;
QString m_lastUsedActivity; //the last used activity for this layout
QString m_icon;
QString m_schemeFile;
BackgroundStyle m_backgroundStyle{ColorBackgroundStyle};