Changeset View
Changeset View
Standalone View
Standalone View
kded/gtkconfig.cpp
Show All 32 Lines | |||||
33 | #include "themepreviewer.h" | 33 | #include "themepreviewer.h" | ||
34 | 34 | | |||
35 | K_PLUGIN_CLASS_WITH_JSON(GtkConfig, "gtkconfig.json") | 35 | K_PLUGIN_CLASS_WITH_JSON(GtkConfig, "gtkconfig.json") | ||
36 | 36 | | |||
37 | GtkConfig::GtkConfig(QObject *parent, const QVariantList&) : | 37 | GtkConfig::GtkConfig(QObject *parent, const QVariantList&) : | ||
38 | KDEDModule(parent), | 38 | KDEDModule(parent), | ||
39 | configValueProvider(new ConfigValueProvider()), | 39 | configValueProvider(new ConfigValueProvider()), | ||
40 | themePreviewer(new ThemePreviewer(this)), | 40 | themePreviewer(new ThemePreviewer(this)), | ||
41 | kwinConfigWatcher(KConfigWatcher::create(KSharedConfig::openConfig(QStringLiteral("kwinrc")))) | 41 | kwinConfigWatcher(KConfigWatcher::create(KSharedConfig::openConfig(QStringLiteral("kwinrc")))), | ||
42 | ownConfigWatcher(KConfigWatcher::create(KSharedConfig::openConfig())) | ||||
42 | { | 43 | { | ||
43 | QDBusConnection dbus = QDBusConnection::sessionBus(); | 44 | QDBusConnection dbus = QDBusConnection::sessionBus(); | ||
44 | dbus.registerService(QStringLiteral("org.kde.GtkConfig")); | 45 | dbus.registerService(QStringLiteral("org.kde.GtkConfig")); | ||
45 | dbus.registerObject(QStringLiteral("/GtkConfig"), this, QDBusConnection::ExportScriptableSlots); | 46 | dbus.registerObject(QStringLiteral("/GtkConfig"), this, QDBusConnection::ExportScriptableSlots); | ||
46 | 47 | | |||
47 | connect(qGuiApp, &QGuiApplication::fontChanged, this, &GtkConfig::setFont); | 48 | connect(qGuiApp, &QGuiApplication::fontChanged, this, &GtkConfig::setFont); | ||
48 | connect(KIconLoader::global(), &KIconLoader::iconChanged, this, &GtkConfig::setIconTheme); | 49 | connect(KIconLoader::global(), &KIconLoader::iconChanged, this, &GtkConfig::setIconTheme); | ||
49 | connect(kwinConfigWatcher.data(), &KConfigWatcher::configChanged, this, &GtkConfig::onKWinSettingsChange); | 50 | connect(kwinConfigWatcher.data(), &KConfigWatcher::configChanged, this, &GtkConfig::onKWinSettingsChange); | ||
51 | connect(ownConfigWatcher.data(), &KConfigWatcher::configChanged, this, &GtkConfig::onOwnSettingsChange); | ||||
50 | dbus.connect( | 52 | dbus.connect( | ||
51 | QString(), | 53 | QString(), | ||
52 | QStringLiteral("/KGlobalSettings"), | 54 | QStringLiteral("/KGlobalSettings"), | ||
53 | QStringLiteral("org.kde.KGlobalSettings"), | 55 | QStringLiteral("org.kde.KGlobalSettings"), | ||
54 | QStringLiteral("notifyChange"), | 56 | QStringLiteral("notifyChange"), | ||
55 | this, | 57 | this, | ||
56 | SLOT(onGlobalSettingsChange(int,int)) | 58 | SLOT(onGlobalSettingsChange(int,int)) | ||
57 | ); | 59 | ); | ||
▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Line(s) | |||||
175 | void GtkConfig::setWindowDecorationsButtonsOrder() const | 177 | void GtkConfig::setWindowDecorationsButtonsOrder() const | ||
176 | { | 178 | { | ||
177 | const QString windowDecorationsButtonOrder = configValueProvider->windowDecorationsButtonsOrder(); | 179 | const QString windowDecorationsButtonOrder = configValueProvider->windowDecorationsButtonsOrder(); | ||
178 | ConfigEditor::setGtk3ConfigValueDconf(QStringLiteral("button-layout"), windowDecorationsButtonOrder, QStringLiteral("org.gnome.desktop.wm.preferences")); | 180 | ConfigEditor::setGtk3ConfigValueDconf(QStringLiteral("button-layout"), windowDecorationsButtonOrder, QStringLiteral("org.gnome.desktop.wm.preferences")); | ||
179 | ConfigEditor::setGtk3ConfigValueSettingsIni(QStringLiteral("gtk-decoration-layout"), windowDecorationsButtonOrder); | 181 | ConfigEditor::setGtk3ConfigValueSettingsIni(QStringLiteral("gtk-decoration-layout"), windowDecorationsButtonOrder); | ||
180 | ConfigEditor::setGtk3ConfigValueXSettingsd(QStringLiteral("Gtk/DecorationLayout"), windowDecorationsButtonOrder); | 182 | ConfigEditor::setGtk3ConfigValueXSettingsd(QStringLiteral("Gtk/DecorationLayout"), windowDecorationsButtonOrder); | ||
181 | } | 183 | } | ||
182 | 184 | | |||
185 | void GtkConfig::setEnableAnimations() const | ||||
186 | { | ||||
187 | const QString enableAnimations = configValueProvider->enableAnimations(); | ||||
188 | ConfigEditor::setGtk2ConfigValue(QStringLiteral("gtk-button-images"), enableAnimations); | ||||
gikari: Wrong settings key | |||||
189 | ConfigEditor::setGtk3ConfigValueDconf(QStringLiteral("enable-animations"), enableAnimations, QStringLiteral("org.gnome.desktop.interface")); | ||||
org.gnome.desktop.interface param is not necessary - it is the default. Most of the settings are in this category in dconf. gikari: `org.gnome.desktop.interface` param is not necessary - it is the default. Most of the settings… | |||||
190 | ConfigEditor::setGtk3ConfigValueSettingsIni(QStringLiteral("gtk-enable-animations"), enableAnimations); | ||||
191 | ConfigEditor::setGtk3ConfigValueXSettingsd(QStringLiteral("Gtk/EnableAnimations"), enableAnimations); | ||||
192 | } | ||||
193 | | ||||
183 | void GtkConfig::applyAllSettings() const | 194 | void GtkConfig::applyAllSettings() const | ||
184 | { | 195 | { | ||
185 | setFont(); | 196 | setFont(); | ||
186 | setIconTheme(KIconLoader::Group::Desktop); | 197 | setIconTheme(KIconLoader::Group::Desktop); | ||
187 | setCursorTheme(); | 198 | setCursorTheme(); | ||
188 | setIconsOnButtons(); | 199 | setIconsOnButtons(); | ||
189 | setIconsInMenus(); | 200 | setIconsInMenus(); | ||
190 | setToolbarStyle(); | 201 | setToolbarStyle(); | ||
191 | setScrollbarBehavior(); | 202 | setScrollbarBehavior(); | ||
192 | setDarkThemePreference(); | 203 | setDarkThemePreference(); | ||
193 | setWindowDecorationsButtonsOrder(); | 204 | setWindowDecorationsButtonsOrder(); | ||
205 | setEnableAnimations(); | ||||
194 | } | 206 | } | ||
195 | 207 | | |||
196 | void GtkConfig::onGlobalSettingsChange(int settingsChangeType, int arg) const | 208 | void GtkConfig::onGlobalSettingsChange(int settingsChangeType, int arg) const | ||
197 | { | 209 | { | ||
198 | SettingsChangeType changeType = static_cast<SettingsChangeType>(settingsChangeType); | 210 | SettingsChangeType changeType = static_cast<SettingsChangeType>(settingsChangeType); | ||
199 | SettingsCategory settingsCategory = static_cast<SettingsCategory>(arg); | 211 | SettingsCategory settingsCategory = static_cast<SettingsCategory>(arg); | ||
200 | 212 | | |||
201 | if (changeType == SettingsChangeType::Cursor) { | 213 | if (changeType == SettingsChangeType::Cursor) { | ||
Show All 12 Lines | |||||
214 | void GtkConfig::onKWinSettingsChange(const KConfigGroup &group, const QByteArrayList &names) const | 226 | void GtkConfig::onKWinSettingsChange(const KConfigGroup &group, const QByteArrayList &names) const | ||
215 | { | 227 | { | ||
216 | if (group.name() == QStringLiteral("org.kde.kdecoration2") | 228 | if (group.name() == QStringLiteral("org.kde.kdecoration2") | ||
217 | && (names.contains("ButtonsOnRight") || names.contains("ButtonsOnLeft"))) { | 229 | && (names.contains("ButtonsOnRight") || names.contains("ButtonsOnLeft"))) { | ||
218 | setWindowDecorationsButtonsOrder(); | 230 | setWindowDecorationsButtonsOrder(); | ||
219 | } | 231 | } | ||
220 | } | 232 | } | ||
221 | 233 | | |||
234 | void GtkConfig::onOwnSettingsChange(const KConfigGroup &group, const QByteArrayList &names) const | ||||
235 | { | ||||
236 | if (group.name() == QLatin1String("KDE") | ||||
237 | && names.contains(QByteArrayLiteral("AnimationDurationFactor"))) { | ||||
238 | setEnableAnimations(); | ||||
239 | } | ||||
240 | } | ||||
241 | | ||||
222 | #include "gtkconfig.moc" | 242 | #include "gtkconfig.moc" |
Wrong settings key