Changeset View
Changeset View
Standalone View
Standalone View
kcms/lookandfeel/kcm.cpp
Show All 15 Lines | 1 | /* This file is part of the KDE Project | |||
---|---|---|---|---|---|
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
17 | Boston, MA 02110-1301, USA. | 17 | Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #include "kcm.h" | 20 | #include "kcm.h" | ||
21 | #include "../krdb/krdb.h" | 21 | #include "../krdb/krdb.h" | ||
22 | #include "../cursortheme/xcursor/xcursortheme.h" | 22 | #include "../cursortheme/xcursor/xcursortheme.h" | ||
23 | #include "config-kcm.h" | 23 | #include "config-kcm.h" | ||
24 | #include "config-workspace.h" | ||||
24 | #include <klauncher_iface.h> | 25 | #include <klauncher_iface.h> | ||
25 | 26 | | |||
26 | #include <KPluginFactory> | 27 | #include <KPluginFactory> | ||
27 | #include <KPluginLoader> | 28 | #include <KPluginLoader> | ||
28 | #include <KAboutData> | 29 | #include <KAboutData> | ||
29 | #include <KSharedConfig> | 30 | #include <KSharedConfig> | ||
30 | #include <QDebug> | 31 | #include <QDebug> | ||
31 | #include <QStandardPaths> | 32 | #include <QStandardPaths> | ||
Show All 31 Lines | 60 | KCMLookandFeel::KCMLookandFeel(QObject* parent, const QVariantList& args) | |||
63 | , m_applyColors(true) | 64 | , m_applyColors(true) | ||
64 | , m_applyWidgetStyle(true) | 65 | , m_applyWidgetStyle(true) | ||
65 | , m_applyIcons(true) | 66 | , m_applyIcons(true) | ||
66 | , m_applyPlasmaTheme(true) | 67 | , m_applyPlasmaTheme(true) | ||
67 | , m_applyCursors(true) | 68 | , m_applyCursors(true) | ||
68 | , m_applyWindowSwitcher(true) | 69 | , m_applyWindowSwitcher(true) | ||
69 | , m_applyDesktopSwitcher(true) | 70 | , m_applyDesktopSwitcher(true) | ||
70 | , m_resetDefaultLayout(false) | 71 | , m_resetDefaultLayout(false) | ||
72 | , m_applyWindowDecoration(true) | ||||
71 | { | 73 | { | ||
72 | //This flag seems to be needed in order for QQuickWidget to work | 74 | //This flag seems to be needed in order for QQuickWidget to work | ||
73 | //see https://bugreports.qt-project.org/browse/QTBUG-40765 | 75 | //see https://bugreports.qt-project.org/browse/QTBUG-40765 | ||
74 | //also, it seems to work only if set in the kcm, not in the systemsettings' main | 76 | //also, it seems to work only if set in the kcm, not in the systemsettings' main | ||
75 | qApp->setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); | 77 | qApp->setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); | ||
76 | qmlRegisterType<QStandardItemModel>(); | 78 | qmlRegisterType<QStandardItemModel>(); | ||
77 | qmlRegisterType<KCMLookandFeel>(); | 79 | qmlRegisterType<KCMLookandFeel>(); | ||
78 | KAboutData* about = new KAboutData(QStringLiteral("kcm_lookandfeel"), i18n("Configure Look and Feel details"), | 80 | KAboutData* about = new KAboutData(QStringLiteral("kcm_lookandfeel"), i18n("Configure Look and Feel details"), | ||
▲ Show 20 Lines • Show All 245 Lines • ▼ Show 20 Line(s) | 323 | if (m_applyWindowSwitcher) { | |||
324 | setWindowSwitcher(cg.readEntry("LayoutName", QString())); | 326 | setWindowSwitcher(cg.readEntry("LayoutName", QString())); | ||
325 | } | 327 | } | ||
326 | 328 | | |||
327 | if (m_applyDesktopSwitcher) { | 329 | if (m_applyDesktopSwitcher) { | ||
328 | cg = KConfigGroup(conf, "kwinrc"); | 330 | cg = KConfigGroup(conf, "kwinrc"); | ||
329 | cg = KConfigGroup(&cg, "DesktopSwitcher"); | 331 | cg = KConfigGroup(&cg, "DesktopSwitcher"); | ||
330 | setDesktopSwitcher(cg.readEntry("LayoutName", QString())); | 332 | setDesktopSwitcher(cg.readEntry("LayoutName", QString())); | ||
331 | } | 333 | } | ||
334 | | ||||
335 | if (m_applyWindowDecoration) { | ||||
336 | cg = KConfigGroup(conf, "kwinrc"); | ||||
337 | cg = KConfigGroup(&cg, "org.kde.kdecoration2"); | ||||
338 | #if HAVE_BREEZE_DECO | ||||
graesslin: what remains is that this is not the default used in KWin.
In KWin it's:
static const… | |||||
problem is that HAVE_BREEZE_DECO and BREEZE_KDECORATION_PLUGIN_ID are not things i could have access frmo plasma-desktop? mart: problem is that HAVE_BREEZE_DECO and BREEZE_KDECORATION_PLUGIN_ID are not things i could have… | |||||
but does aurorae work if no theme is speacified? does it have a safe fallback hardcoded one? mart: but does aurorae work if no theme is speacified? does it have a safe fallback hardcoded one? | |||||
339 | setWindowDecoration(cg.readEntry("library", QStringLiteral(BREEZE_KDECORATION_PLUGIN_ID)), cg.readEntry("theme", QString())); | ||||
340 | #else | ||||
341 | setWindowDecoration(cg.readEntry("library", QStringLiteral("org.kde.kwin.aurorae")), cg.readEntry("theme", QString())); | ||||
342 | #endif | ||||
I think you got that part wrong. The difference is the value passed to library. graesslin: I think you got that part wrong. The difference is the value passed to library. | |||||
mart: eew, sorry, that's what you get for writing that before cofee :/ | |||||
343 | } | ||||
344 | | ||||
345 | // Reload KWin if something changed, but only once. | ||||
346 | if (m_applyWindowSwitcher || m_applyDesktopSwitcher || m_applyWindowDecoration) { | ||||
347 | QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KWin"), | ||||
348 | QStringLiteral("org.kde.KWin"), | ||||
349 | QStringLiteral("reloadConfig")); | ||||
350 | QDBusConnection::sessionBus().send(message); | ||||
351 | } | ||||
332 | } | 352 | } | ||
333 | 353 | | |||
334 | //TODO: option to enable/disable apply? they don't seem required by UI design | 354 | //TODO: option to enable/disable apply? they don't seem required by UI design | ||
335 | setSplashScreen(m_selectedPlugin); | 355 | setSplashScreen(m_selectedPlugin); | ||
336 | setLockScreen(m_selectedPlugin); | 356 | setLockScreen(m_selectedPlugin); | ||
337 | 357 | | |||
338 | m_configGroup.sync(); | 358 | m_configGroup.sync(); | ||
339 | runRdb(KRdbExportQtColors | KRdbExportGtkTheme | KRdbExportColors | KRdbExportQtSettings | KRdbExportXftSettings); | 359 | runRdb(KRdbExportQtColors | KRdbExportGtkTheme | KRdbExportColors | KRdbExportQtSettings | KRdbExportXftSettings); | ||
▲ Show 20 Lines • Show All 250 Lines • ▼ Show 20 Line(s) | 609 | { | |||
590 | if (theme.isEmpty()) { | 610 | if (theme.isEmpty()) { | ||
591 | return; | 611 | return; | ||
592 | } | 612 | } | ||
593 | 613 | | |||
594 | KConfig config(QStringLiteral("kwinrc")); | 614 | KConfig config(QStringLiteral("kwinrc")); | ||
595 | KConfigGroup cg(&config, "TabBox"); | 615 | KConfigGroup cg(&config, "TabBox"); | ||
596 | cg.writeEntry("LayoutName", theme); | 616 | cg.writeEntry("LayoutName", theme); | ||
597 | cg.sync(); | 617 | cg.sync(); | ||
598 | // Reload KWin. | | |||
599 | QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KWin"), | | |||
600 | QStringLiteral("org.kde.KWin"), | | |||
601 | QStringLiteral("reloadConfig")); | | |||
602 | QDBusConnection::sessionBus().send(message); | | |||
603 | } | 618 | } | ||
604 | 619 | | |||
605 | void KCMLookandFeel::setDesktopSwitcher(const QString &theme) | 620 | void KCMLookandFeel::setDesktopSwitcher(const QString &theme) | ||
606 | { | 621 | { | ||
607 | if (theme.isEmpty()) { | 622 | if (theme.isEmpty()) { | ||
608 | return; | 623 | return; | ||
609 | } | 624 | } | ||
610 | 625 | | |||
611 | KConfig config(QStringLiteral("kwinrc")); | 626 | KConfig config(QStringLiteral("kwinrc")); | ||
612 | KConfigGroup cg(&config, "TabBox"); | 627 | KConfigGroup cg(&config, "TabBox"); | ||
613 | cg.writeEntry("DesktopLayout", theme); | 628 | cg.writeEntry("DesktopLayout", theme); | ||
614 | cg.writeEntry("DesktopListLayout", theme); | 629 | cg.writeEntry("DesktopListLayout", theme); | ||
615 | cg.sync(); | 630 | cg.sync(); | ||
631 | } | ||||
632 | | ||||
633 | void KCMLookandFeel::setWindowDecoration(const QString &library, const QString &theme) | ||||
634 | { | ||||
635 | if (library.isEmpty()) { | ||||
636 | return; | ||||
637 | } | ||||
638 | | ||||
639 | KConfig config(QStringLiteral("kwinrc")); | ||||
640 | KConfigGroup cg(&config, "org.kde.kdecoration2"); | ||||
641 | cg.writeEntry("library", library); | ||||
642 | cg.writeEntry("theme", theme); | ||||
643 | | ||||
644 | cg.sync(); | ||||
616 | // Reload KWin. | 645 | // Reload KWin. | ||
617 | QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KWin"), | 646 | QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KWin"), | ||
618 | QStringLiteral("org.kde.KWin"), | 647 | QStringLiteral("org.kde.KWin"), | ||
619 | QStringLiteral("reloadConfig")); | 648 | QStringLiteral("reloadConfig")); | ||
620 | QDBusConnection::sessionBus().send(message); | 649 | QDBusConnection::sessionBus().send(message); | ||
621 | } | 650 | } | ||
622 | 651 | | |||
623 | | ||||
624 | void KCMLookandFeel::setApplyColors(bool apply) | 652 | void KCMLookandFeel::setApplyColors(bool apply) | ||
625 | { | 653 | { | ||
626 | if (m_applyColors == apply) { | 654 | if (m_applyColors == apply) { | ||
627 | return; | 655 | return; | ||
628 | } | 656 | } | ||
629 | 657 | | |||
630 | m_applyColors = apply; | 658 | m_applyColors = apply; | ||
631 | emit applyColorsChanged(); | 659 | emit applyColorsChanged(); | ||
632 | } | 660 | } | ||
633 | 661 | | |||
634 | bool KCMLookandFeel::applyColors() const | 662 | bool KCMLookandFeel::applyColors() const | ||
635 | { | 663 | { | ||
636 | return m_applyColors; | 664 | return m_applyColors; | ||
637 | } | 665 | } | ||
638 | 666 | | |||
639 | void KCMLookandFeel::setApplyWidgetStyle(bool apply) | 667 | void KCMLookandFeel::setApplyWidgetStyle(bool apply) | ||
640 | { | 668 | { | ||
now we have two sections which will reload KWin's config. Can we merge that? A reload of KWin's config can be really expensive and we don't want to do that twice. graesslin: now we have two sections which will reload KWin's config. Can we merge that? A reload of KWin's… | |||||
mart: maybe an even compression with a timer? | |||||
graesslin: in KWin? eh, no, please not. | |||||
mart: nono, i meant in the kcm :) | |||||
ok :-) yeah that could be neat as it also allows to unstress the system a bit. graesslin: ok :-) yeah that could be neat as it also allows to unstress the system a bit. | |||||
641 | if (m_applyWidgetStyle == apply) { | 669 | if (m_applyWidgetStyle == apply) { | ||
642 | return; | 670 | return; | ||
643 | } | 671 | } | ||
644 | 672 | | |||
645 | m_applyWidgetStyle = apply; | 673 | m_applyWidgetStyle = apply; | ||
646 | emit applyWidgetStyleChanged(); | 674 | emit applyWidgetStyleChanged(); | ||
647 | } | 675 | } | ||
648 | 676 | | |||
▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines |
what remains is that this is not the default used in KWin.
In KWin it's: