Changeset View
Changeset View
Standalone View
Standalone View
decorations/decorationbridge.cpp
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | |||||
63 | 63 | | |||
64 | DecorationBridge::DecorationBridge(QObject *parent) | 64 | DecorationBridge::DecorationBridge(QObject *parent) | ||
65 | : KDecoration2::DecorationBridge(parent) | 65 | : KDecoration2::DecorationBridge(parent) | ||
66 | , m_factory(nullptr) | 66 | , m_factory(nullptr) | ||
67 | , m_blur(false) | 67 | , m_blur(false) | ||
68 | , m_settings() | 68 | , m_settings() | ||
69 | , m_noPlugin(false) | 69 | , m_noPlugin(false) | ||
70 | { | 70 | { | ||
71 | KConfigGroup cg(KSharedConfig::openConfig(), "KDE"); | ||||
72 | | ||||
73 | // try to extract the proper defaults file from a lookandfeel package | ||||
74 | const QString looknfeel = cg.readEntry(QStringLiteral("LookAndFeelPackage"), "org.kde.breeze.desktop"); | ||||
75 | m_lnfConfig = KSharedConfig::openConfig(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("plasma/look-and-feel/") + looknfeel + QStringLiteral("/contents/defaults"))); | ||||
71 | } | 76 | } | ||
72 | 77 | | |||
73 | DecorationBridge::~DecorationBridge() | 78 | DecorationBridge::~DecorationBridge() | ||
74 | { | 79 | { | ||
75 | s_self = nullptr; | 80 | s_self = nullptr; | ||
76 | } | 81 | } | ||
77 | 82 | | |||
78 | static QString readPlugin() | 83 | QString DecorationBridge::readPlugin() | ||
79 | { | 84 | { | ||
80 | return kwinApp()->config()->group(s_pluginName).readEntry("library", s_defaultPlugin); | 85 | //Try to get a default from look and feel | ||
86 | KConfigGroup cg(m_lnfConfig, "kwinrc"); | ||||
87 | cg = KConfigGroup(&cg, "org.kde.kdecoration2"); | ||||
88 | return kwinApp()->config()->group(s_pluginName).readEntry("library", cg.readEntry("library", s_defaultPlugin)); | ||||
davidedmundson: This local var is effectively unused.
"plugin" isn't a very helpful name as there are 3… | |||||
mart: maybe by rewriting s_defaultTheme in the DecorationBridge ctor? | |||||
81 | } | 89 | } | ||
82 | 90 | | |||
83 | static bool readNoPlugin() | 91 | static bool readNoPlugin() | ||
84 | { | 92 | { | ||
85 | return kwinApp()->config()->group(s_pluginName).readEntry("NoPlugin", false); | 93 | return kwinApp()->config()->group(s_pluginName).readEntry("NoPlugin", false); | ||
86 | } | 94 | } | ||
87 | 95 | | |||
88 | QString DecorationBridge::readTheme() const | 96 | QString DecorationBridge::readTheme() const | ||
89 | { | 97 | { | ||
90 | return kwinApp()->config()->group(s_pluginName).readEntry("theme", m_defaultTheme); | 98 | //Try to get a default from look and feel | ||
99 | KConfigGroup cg(m_lnfConfig, "kwinrc"); | ||||
100 | cg = KConfigGroup(&cg, "org.kde.kdecoration2"); | ||||
101 | return kwinApp()->config()->group(s_pluginName).readEntry("theme", cg.readEntry("theme", m_defaultTheme)); | ||||
91 | } | 102 | } | ||
92 | 103 | | |||
93 | void DecorationBridge::init() | 104 | void DecorationBridge::init() | ||
94 | { | 105 | { | ||
95 | using namespace KWayland::Server; | 106 | using namespace KWayland::Server; | ||
96 | m_noPlugin = readNoPlugin(); | 107 | m_noPlugin = readNoPlugin(); | ||
97 | if (m_noPlugin) { | 108 | if (m_noPlugin) { | ||
98 | if (waylandServer()) { | 109 | if (waylandServer()) { | ||
▲ Show 20 Lines • Show All 203 Lines • Show Last 20 Lines |
This local var is effectively unused.
"plugin" isn't a very helpful name as there are 3 potential plugins mentioned in this method.
It'll be clearer if the last line just uses s_defaultPlugin directly
I would also avoid "cg" because kwinApp->config() is also a cg.
This also applies for readTheme