Changeset View
Changeset View
Standalone View
Standalone View
decorations/settings.cpp
Show All 31 Lines | |||||
32 | 32 | | |||
33 | namespace KWin | 33 | namespace KWin | ||
34 | { | 34 | { | ||
35 | namespace Decoration | 35 | namespace Decoration | ||
36 | { | 36 | { | ||
37 | SettingsImpl::SettingsImpl(KDecoration2::DecorationSettings *parent) | 37 | SettingsImpl::SettingsImpl(KDecoration2::DecorationSettings *parent) | ||
38 | : QObject() | 38 | : QObject() | ||
39 | , DecorationSettingsPrivate(parent) | 39 | , DecorationSettingsPrivate(parent) | ||
40 | , m_borderSize(KDecoration2::BorderSize::Normal) | 40 | , m_borderSize(KDecoration2::BorderSize::None) | ||
41 | { | 41 | { | ||
42 | readSettings(); | 42 | readSettings(); | ||
43 | 43 | | |||
44 | auto c = connect(Compositor::self(), &Compositor::compositingToggled, | 44 | auto c = connect(Compositor::self(), &Compositor::compositingToggled, | ||
45 | parent, &KDecoration2::DecorationSettings::alphaChannelSupportedChanged); | 45 | parent, &KDecoration2::DecorationSettings::alphaChannelSupportedChanged); | ||
46 | connect(VirtualDesktopManager::self(), &VirtualDesktopManager::countChanged, this, | 46 | connect(VirtualDesktopManager::self(), &VirtualDesktopManager::countChanged, this, | ||
47 | [parent](uint previous, uint current) { | 47 | [parent](uint previous, uint current) { | ||
48 | if (previous != 1 && current != 1) { | 48 | if (previous != 1 && current != 1) { | ||
▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Line(s) | 135 | static const QMap<QString, KDecoration2::BorderSize> s_sizes = QMap<QString, KDecoration2::BorderSize>({ | |||
140 | {QStringLiteral("Large"), KDecoration2::BorderSize::Large}, | 140 | {QStringLiteral("Large"), KDecoration2::BorderSize::Large}, | ||
141 | {QStringLiteral("VeryLarge"), KDecoration2::BorderSize::VeryLarge}, | 141 | {QStringLiteral("VeryLarge"), KDecoration2::BorderSize::VeryLarge}, | ||
142 | {QStringLiteral("Huge"), KDecoration2::BorderSize::Huge}, | 142 | {QStringLiteral("Huge"), KDecoration2::BorderSize::Huge}, | ||
143 | {QStringLiteral("VeryHuge"), KDecoration2::BorderSize::VeryHuge}, | 143 | {QStringLiteral("VeryHuge"), KDecoration2::BorderSize::VeryHuge}, | ||
144 | {QStringLiteral("Oversized"), KDecoration2::BorderSize::Oversized} | 144 | {QStringLiteral("Oversized"), KDecoration2::BorderSize::Oversized} | ||
145 | }); | 145 | }); | ||
146 | auto it = s_sizes.constFind(name); | 146 | auto it = s_sizes.constFind(name); | ||
147 | if (it == s_sizes.constEnd()) { | 147 | if (it == s_sizes.constEnd()) { | ||
148 | // non sense values are interpreted just like normal | 148 | // nonsense values are interpreted just like none | ||
149 | return KDecoration2::BorderSize::Normal; | 149 | return KDecoration2::BorderSize::None; | ||
150 | } | 150 | } | ||
151 | return it.value(); | 151 | return it.value(); | ||
152 | } | 152 | } | ||
153 | 153 | | |||
154 | void SettingsImpl::readSettings() | 154 | void SettingsImpl::readSettings() | ||
155 | { | 155 | { | ||
156 | KConfigGroup config = kwinApp()->config()->group(QStringLiteral("org.kde.kdecoration2")); | 156 | KConfigGroup config = kwinApp()->config()->group(QStringLiteral("org.kde.kdecoration2")); | ||
157 | const auto &left = readDecorationButtons(config, "ButtonsOnLeft", QVector<KDecoration2::DecorationButtonType >({ | 157 | const auto &left = readDecorationButtons(config, "ButtonsOnLeft", QVector<KDecoration2::DecorationButtonType >({ | ||
Show All 15 Lines | 171 | if (right != m_rightButtons) { | |||
173 | emit decorationSettings()->decorationButtonsRightChanged(m_rightButtons); | 173 | emit decorationSettings()->decorationButtonsRightChanged(m_rightButtons); | ||
174 | } | 174 | } | ||
175 | ApplicationMenu::self()->setViewEnabled(left.contains(KDecoration2::DecorationButtonType::ApplicationMenu) || right.contains(KDecoration2::DecorationButtonType::ApplicationMenu)); | 175 | ApplicationMenu::self()->setViewEnabled(left.contains(KDecoration2::DecorationButtonType::ApplicationMenu) || right.contains(KDecoration2::DecorationButtonType::ApplicationMenu)); | ||
176 | const bool close = config.readEntry("CloseOnDoubleClickOnMenu", false); | 176 | const bool close = config.readEntry("CloseOnDoubleClickOnMenu", false); | ||
177 | if (close != m_closeDoubleClickMenu) { | 177 | if (close != m_closeDoubleClickMenu) { | ||
178 | m_closeDoubleClickMenu = close; | 178 | m_closeDoubleClickMenu = close; | ||
179 | emit decorationSettings()->closeOnDoubleClickOnMenuChanged(m_closeDoubleClickMenu); | 179 | emit decorationSettings()->closeOnDoubleClickOnMenuChanged(m_closeDoubleClickMenu); | ||
180 | } | 180 | } | ||
181 | const auto size = stringToSize(config.readEntry("BorderSize", QStringLiteral("Normal"))); | 181 | const auto size = stringToSize(config.readEntry("BorderSize", QStringLiteral("None"))); | ||
182 | if (size != m_borderSize) { | 182 | if (size != m_borderSize) { | ||
183 | m_borderSize = size; | 183 | m_borderSize = size; | ||
184 | emit decorationSettings()->borderSizeChanged(m_borderSize); | 184 | emit decorationSettings()->borderSizeChanged(m_borderSize); | ||
185 | } | 185 | } | ||
186 | 186 | | |||
187 | emit decorationSettings()->reconfigured(); | 187 | emit decorationSettings()->reconfigured(); | ||
188 | } | 188 | } | ||
189 | 189 | | |||
190 | } | 190 | } | ||
191 | } | 191 | } |