Changeset View
Changeset View
Standalone View
Standalone View
kcms/lookandfeel/kcm.cpp
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 59 | KCMLookandFeel::KCMLookandFeel(QObject* parent, const QVariantList& args) | |||
---|---|---|---|---|---|
63 | , m_applyColors(true) | 63 | , m_applyColors(true) | ||
64 | , m_applyWidgetStyle(true) | 64 | , m_applyWidgetStyle(true) | ||
65 | , m_applyIcons(true) | 65 | , m_applyIcons(true) | ||
66 | , m_applyPlasmaTheme(true) | 66 | , m_applyPlasmaTheme(true) | ||
67 | , m_applyCursors(true) | 67 | , m_applyCursors(true) | ||
68 | , m_applyWindowSwitcher(true) | 68 | , m_applyWindowSwitcher(true) | ||
69 | , m_applyDesktopSwitcher(true) | 69 | , m_applyDesktopSwitcher(true) | ||
70 | , m_resetDefaultLayout(false) | 70 | , m_resetDefaultLayout(false) | ||
71 | , m_applyWindowDecoration(true) | ||||
71 | { | 72 | { | ||
72 | //This flag seems to be needed in order for QQuickWidget to work | 73 | //This flag seems to be needed in order for QQuickWidget to work | ||
73 | //see https://bugreports.qt-project.org/browse/QTBUG-40765 | 74 | //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 | 75 | //also, it seems to work only if set in the kcm, not in the systemsettings' main | ||
75 | qApp->setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); | 76 | qApp->setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); | ||
76 | qmlRegisterType<QStandardItemModel>(); | 77 | qmlRegisterType<QStandardItemModel>(); | ||
77 | qmlRegisterType<KCMLookandFeel>(); | 78 | qmlRegisterType<KCMLookandFeel>(); | ||
78 | KAboutData* about = new KAboutData(QStringLiteral("kcm_lookandfeel"), i18n("Configure Look and Feel details"), | 79 | KAboutData* about = new KAboutData(QStringLiteral("kcm_lookandfeel"), i18n("Configure Look and Feel details"), | ||
▲ Show 20 Lines • Show All 245 Lines • ▼ Show 20 Line(s) | 322 | if (m_applyWindowSwitcher) { | |||
324 | setWindowSwitcher(cg.readEntry("LayoutName", QString())); | 325 | setWindowSwitcher(cg.readEntry("LayoutName", QString())); | ||
325 | } | 326 | } | ||
326 | 327 | | |||
327 | if (m_applyDesktopSwitcher) { | 328 | if (m_applyDesktopSwitcher) { | ||
328 | cg = KConfigGroup(conf, "kwinrc"); | 329 | cg = KConfigGroup(conf, "kwinrc"); | ||
329 | cg = KConfigGroup(&cg, "DesktopSwitcher"); | 330 | cg = KConfigGroup(&cg, "DesktopSwitcher"); | ||
330 | setDesktopSwitcher(cg.readEntry("LayoutName", QString())); | 331 | setDesktopSwitcher(cg.readEntry("LayoutName", QString())); | ||
331 | } | 332 | } | ||
333 | | ||||
334 | if (m_applyWindowDecoration) { | ||||
335 | cg = KConfigGroup(conf, "kwinrc"); | ||||
336 | cg = KConfigGroup(&cg, "org.kde.kdecoration2"); | ||||
337 | setWindowDecoration(cg.readEntry("library", QStringLiteral("org.kde.breeze")), cg.readEntry("theme", QString())); | ||||
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? | |||||
338 | } | ||||
339 | | ||||
340 | // Reload KWin if something changed, but only once. | ||||
341 | if (m_applyWindowSwitcher || m_applyDesktopSwitcher || m_applyWindowDecoration) { | ||||
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 :/ | |||||
342 | QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KWin"), | ||||
343 | QStringLiteral("org.kde.KWin"), | ||||
344 | QStringLiteral("reloadConfig")); | ||||
345 | QDBusConnection::sessionBus().send(message); | ||||
346 | } | ||||
332 | } | 347 | } | ||
333 | 348 | | |||
334 | //TODO: option to enable/disable apply? they don't seem required by UI design | 349 | //TODO: option to enable/disable apply? they don't seem required by UI design | ||
335 | setSplashScreen(m_selectedPlugin); | 350 | setSplashScreen(m_selectedPlugin); | ||
336 | setLockScreen(m_selectedPlugin); | 351 | setLockScreen(m_selectedPlugin); | ||
337 | 352 | | |||
338 | m_configGroup.sync(); | 353 | m_configGroup.sync(); | ||
339 | runRdb(KRdbExportQtColors | KRdbExportGtkTheme | KRdbExportColors | KRdbExportQtSettings | KRdbExportXftSettings); | 354 | runRdb(KRdbExportQtColors | KRdbExportGtkTheme | KRdbExportColors | KRdbExportQtSettings | KRdbExportXftSettings); | ||
▲ Show 20 Lines • Show All 250 Lines • ▼ Show 20 Line(s) | 604 | { | |||
590 | if (theme.isEmpty()) { | 605 | if (theme.isEmpty()) { | ||
591 | return; | 606 | return; | ||
592 | } | 607 | } | ||
593 | 608 | | |||
594 | KConfig config(QStringLiteral("kwinrc")); | 609 | KConfig config(QStringLiteral("kwinrc")); | ||
595 | KConfigGroup cg(&config, "TabBox"); | 610 | KConfigGroup cg(&config, "TabBox"); | ||
596 | cg.writeEntry("LayoutName", theme); | 611 | cg.writeEntry("LayoutName", theme); | ||
597 | cg.sync(); | 612 | 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 | } | 613 | } | ||
604 | 614 | | |||
605 | void KCMLookandFeel::setDesktopSwitcher(const QString &theme) | 615 | void KCMLookandFeel::setDesktopSwitcher(const QString &theme) | ||
606 | { | 616 | { | ||
607 | if (theme.isEmpty()) { | 617 | if (theme.isEmpty()) { | ||
608 | return; | 618 | return; | ||
609 | } | 619 | } | ||
610 | 620 | | |||
611 | KConfig config(QStringLiteral("kwinrc")); | 621 | KConfig config(QStringLiteral("kwinrc")); | ||
612 | KConfigGroup cg(&config, "TabBox"); | 622 | KConfigGroup cg(&config, "TabBox"); | ||
613 | cg.writeEntry("DesktopLayout", theme); | 623 | cg.writeEntry("DesktopLayout", theme); | ||
614 | cg.writeEntry("DesktopListLayout", theme); | 624 | cg.writeEntry("DesktopListLayout", theme); | ||
615 | cg.sync(); | 625 | cg.sync(); | ||
626 | } | ||||
627 | | ||||
628 | void KCMLookandFeel::setWindowDecoration(const QString &library, const QString &theme) | ||||
629 | { | ||||
630 | if (library.isEmpty()) { | ||||
631 | return; | ||||
632 | } | ||||
633 | | ||||
634 | KConfig config(QStringLiteral("kwinrc")); | ||||
635 | KConfigGroup cg(&config, "org.kde.kdecoration2"); | ||||
636 | cg.writeEntry("library", library); | ||||
637 | cg.writeEntry("theme", theme); | ||||
638 | | ||||
639 | cg.sync(); | ||||
616 | // Reload KWin. | 640 | // Reload KWin. | ||
617 | QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KWin"), | 641 | QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KWin"), | ||
618 | QStringLiteral("org.kde.KWin"), | 642 | QStringLiteral("org.kde.KWin"), | ||
619 | QStringLiteral("reloadConfig")); | 643 | QStringLiteral("reloadConfig")); | ||
620 | QDBusConnection::sessionBus().send(message); | 644 | QDBusConnection::sessionBus().send(message); | ||
621 | } | 645 | } | ||
622 | 646 | | |||
623 | | ||||
624 | void KCMLookandFeel::setApplyColors(bool apply) | 647 | void KCMLookandFeel::setApplyColors(bool apply) | ||
625 | { | 648 | { | ||
626 | if (m_applyColors == apply) { | 649 | if (m_applyColors == apply) { | ||
627 | return; | 650 | return; | ||
628 | } | 651 | } | ||
629 | 652 | | |||
630 | m_applyColors = apply; | 653 | m_applyColors = apply; | ||
631 | emit applyColorsChanged(); | 654 | emit applyColorsChanged(); | ||
632 | } | 655 | } | ||
633 | 656 | | |||
634 | bool KCMLookandFeel::applyColors() const | 657 | bool KCMLookandFeel::applyColors() const | ||
635 | { | 658 | { | ||
636 | return m_applyColors; | 659 | return m_applyColors; | ||
637 | } | 660 | } | ||
638 | 661 | | |||
639 | void KCMLookandFeel::setApplyWidgetStyle(bool apply) | 662 | void KCMLookandFeel::setApplyWidgetStyle(bool apply) | ||
640 | { | 663 | { | ||
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) { | 664 | if (m_applyWidgetStyle == apply) { | ||
642 | return; | 665 | return; | ||
643 | } | 666 | } | ||
644 | 667 | | |||
645 | m_applyWidgetStyle = apply; | 668 | m_applyWidgetStyle = apply; | ||
646 | emit applyWidgetStyleChanged(); | 669 | emit applyWidgetStyleChanged(); | ||
647 | } | 670 | } | ||
648 | 671 | | |||
▲ 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: