Changeset View
Changeset View
Standalone View
Standalone View
kded/configvalueprovider.cpp
Show All 26 Lines | |||||
27 | #include <KSharedConfig> | 27 | #include <KSharedConfig> | ||
28 | #include <KConfigGroup> | 28 | #include <KConfigGroup> | ||
29 | 29 | | |||
30 | #include "configvalueprovider.h" | 30 | #include "configvalueprovider.h" | ||
31 | 31 | | |||
32 | ConfigValueProvider::ConfigValueProvider() : | 32 | ConfigValueProvider::ConfigValueProvider() : | ||
33 | kdeglobalsConfig(KSharedConfig::openConfig(QStringLiteral("kdeglobals"))), | 33 | kdeglobalsConfig(KSharedConfig::openConfig(QStringLiteral("kdeglobals"))), | ||
34 | inputConfig(KSharedConfig::openConfig(QStringLiteral("kcminputrc"))), | 34 | inputConfig(KSharedConfig::openConfig(QStringLiteral("kcminputrc"))), | ||
35 | kwinConfig(KSharedConfig::openConfig(QStringLiteral("kwinrc"))) | 35 | kwinConfig(KSharedConfig::openConfig(QStringLiteral("kwinrc"))), | ||
36 | ownConfig(KSharedConfig::openConfig()) | ||||
36 | { | 37 | { | ||
37 | 38 | | |||
38 | } | 39 | } | ||
39 | 40 | | |||
40 | QString ConfigValueProvider::fontName() const | 41 | QString ConfigValueProvider::fontName() const | ||
41 | { | 42 | { | ||
42 | static const QFont defaultFont(QStringLiteral("Noto Sans"), 10); | 43 | static const QFont defaultFont(QStringLiteral("Noto Sans"), 10); | ||
43 | 44 | | |||
▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Line(s) | 132 | { | |||
135 | QString buttonsOnRightKdeConfigValue = configGroup.readEntry(QStringLiteral("ButtonsOnRight"), "HIAX"); | 136 | QString buttonsOnRightKdeConfigValue = configGroup.readEntry(QStringLiteral("ButtonsOnRight"), "HIAX"); | ||
136 | 137 | | |||
137 | QString buttonsOnLeftInGtkNotation = windowDecorationButtonsOrderInGtkNotation(buttonsOnLeftKdeConfigValue); | 138 | QString buttonsOnLeftInGtkNotation = windowDecorationButtonsOrderInGtkNotation(buttonsOnLeftKdeConfigValue); | ||
138 | QString buttonsOnRightInGtkNotation = windowDecorationButtonsOrderInGtkNotation(buttonsOnRightKdeConfigValue); | 139 | QString buttonsOnRightInGtkNotation = windowDecorationButtonsOrderInGtkNotation(buttonsOnRightKdeConfigValue); | ||
139 | 140 | | |||
140 | return buttonsOnLeftInGtkNotation + QStringLiteral(":") + buttonsOnRightInGtkNotation; | 141 | return buttonsOnLeftInGtkNotation + QStringLiteral(":") + buttonsOnRightInGtkNotation; | ||
141 | } | 142 | } | ||
142 | 143 | | |||
144 | QString ConfigValueProvider::enableAnimations() const | ||||
145 | { | ||||
146 | KConfigGroup generalCfg = ownConfig->group(QStringLiteral("KDE")); | ||||
davidedmundson: You don't need this.
KConfigWatcher does it automagically on change.
I did that because I… | |||||
I know, I just kept it consistent with the other code. Let's clean up this everywhere else above separately? broulik: I know, I just kept it consistent with the other code. Let's clean up this everywhere else… | |||||
147 | const qreal animationSpeedModifier = qMax(0.0, generalCfg.readEntry("AnimationDurationFactor", 1.0)); | ||||
148 | | ||||
149 | const bool enableAnimations = !qFuzzyIsNull(animationSpeedModifier); | ||||
150 | | ||||
151 | if (enableAnimations) { | ||||
152 | return QStringLiteral("1"); | ||||
153 | } else { | ||||
154 | return QStringLiteral("0"); | ||||
155 | } | ||||
156 | } | ||||
157 | | ||||
143 | QString ConfigValueProvider::toolbarStyleInDesiredNotation(const QString &kdeConfigValue, ConfigValueProvider::ToolbarStyleNotation notation) const | 158 | QString ConfigValueProvider::toolbarStyleInDesiredNotation(const QString &kdeConfigValue, ConfigValueProvider::ToolbarStyleNotation notation) const | ||
144 | { | 159 | { | ||
145 | QStringList toolbarStyles {}; | 160 | QStringList toolbarStyles {}; | ||
146 | if (notation == ToolbarStyleNotation::SettingsIni) { | 161 | if (notation == ToolbarStyleNotation::SettingsIni) { | ||
147 | toolbarStyles.append({ | 162 | toolbarStyles.append({ | ||
148 | QStringLiteral("GTK_TOOLBAR_ICONS"), | 163 | QStringLiteral("GTK_TOOLBAR_ICONS"), | ||
149 | QStringLiteral("GTK_TOOLBAR_TEXT"), | 164 | QStringLiteral("GTK_TOOLBAR_TEXT"), | ||
150 | QStringLiteral("GTK_TOOLBAR_BOTH_HORIZ"), | 165 | QStringLiteral("GTK_TOOLBAR_BOTH_HORIZ"), | ||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |
You don't need this.
KConfigWatcher does it automagically on change.
I did that because I wanted a way for N connections to only reparse the file once. It also means you can use the config watcher with no signal handling, just install and you get the correct values on the next read. Amazing.
My fault for not having enough docs