Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwindecoration/kcm.cpp
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | |||||
56 | static const QString s_pluginName = QStringLiteral("org.kde.kdecoration2"); | 56 | static const QString s_pluginName = QStringLiteral("org.kde.kdecoration2"); | ||
57 | #if HAVE_BREEZE_DECO | 57 | #if HAVE_BREEZE_DECO | ||
58 | static const QString s_defaultPlugin = QStringLiteral(BREEZE_KDECORATION_PLUGIN_ID); | 58 | static const QString s_defaultPlugin = QStringLiteral(BREEZE_KDECORATION_PLUGIN_ID); | ||
59 | static const QString s_defaultTheme; | 59 | static const QString s_defaultTheme; | ||
60 | #else | 60 | #else | ||
61 | static const QString s_defaultPlugin = QStringLiteral("org.kde.kwin.aurorae"); | 61 | static const QString s_defaultPlugin = QStringLiteral("org.kde.kwin.aurorae"); | ||
62 | static const QString s_defaultTheme = QStringLiteral("kwin4_decoration_qml_plastik"); | 62 | static const QString s_defaultTheme = QStringLiteral("kwin4_decoration_qml_plastik"); | ||
63 | #endif | 63 | #endif | ||
64 | static const QString s_borderSizeNormal = QStringLiteral("Normal"); | 64 | static const QString s_borderSizeNormal = QStringLiteral("None"); | ||
davidedmundson: That variable name is misleading. Especially on line 224.
Renaming as border size default… | |||||
65 | static const QString s_ghnsIcon = QStringLiteral("get-hot-new-stuff"); | 65 | static const QString s_ghnsIcon = QStringLiteral("get-hot-new-stuff"); | ||
66 | 66 | | |||
67 | ConfigurationForm::ConfigurationForm(QWidget *parent) | 67 | ConfigurationForm::ConfigurationForm(QWidget *parent) | ||
68 | : QWidget(parent) | 68 | : QWidget(parent) | ||
69 | { | 69 | { | ||
70 | setupUi(this); | 70 | setupUi(this); | ||
71 | } | 71 | } | ||
72 | 72 | | |||
Show All 23 Lines | 83 | { | |||
96 | qmlRegisterType<QAbstractItemModel>(); | 96 | qmlRegisterType<QAbstractItemModel>(); | ||
97 | QWidget *widget = QWidget::createWindowContainer(m_quickView, this); | 97 | QWidget *widget = QWidget::createWindowContainer(m_quickView, this); | ||
98 | QVBoxLayout* layout = new QVBoxLayout(m_ui->view); | 98 | QVBoxLayout* layout = new QVBoxLayout(m_ui->view); | ||
99 | layout->setContentsMargins(0,0,0,0); | 99 | layout->setContentsMargins(0,0,0,0); | ||
100 | layout->addWidget(widget); | 100 | layout->addWidget(widget); | ||
101 | 101 | | |||
102 | m_quickView->rootContext()->setContextProperty(QStringLiteral("decorationsModel"), m_proxyModel); | 102 | m_quickView->rootContext()->setContextProperty(QStringLiteral("decorationsModel"), m_proxyModel); | ||
103 | updateColors(); | 103 | updateColors(); | ||
104 | m_quickView->rootContext()->setContextProperty("_borderSizesIndex", 3); // 3 is normal | 104 | m_quickView->rootContext()->setContextProperty("_borderSizesIndex", 0); // 0 is none | ||
105 | m_quickView->rootContext()->setContextProperty("leftButtons", m_leftButtons); | 105 | m_quickView->rootContext()->setContextProperty("leftButtons", m_leftButtons); | ||
106 | m_quickView->rootContext()->setContextProperty("rightButtons", m_rightButtons); | 106 | m_quickView->rootContext()->setContextProperty("rightButtons", m_rightButtons); | ||
107 | m_quickView->rootContext()->setContextProperty("availableButtons", m_availableButtons); | 107 | m_quickView->rootContext()->setContextProperty("availableButtons", m_availableButtons); | ||
108 | 108 | | |||
109 | m_quickView->rootContext()->setContextProperty("titleFont", QFontDatabase::systemFont(QFontDatabase::TitleFont)); | 109 | m_quickView->rootContext()->setContextProperty("titleFont", QFontDatabase::systemFont(QFontDatabase::TitleFont)); | ||
110 | m_quickView->setResizeMode(QQuickView::SizeRootObjectToView); | 110 | m_quickView->setResizeMode(QQuickView::SizeRootObjectToView); | ||
111 | m_quickView->setSource(QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kwin/kcm_kwindecoration/main.qml")))); | 111 | m_quickView->setSource(QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kwin/kcm_kwindecoration/main.qml")))); | ||
112 | if (m_quickView->status() == QQuickView::Ready) { | 112 | if (m_quickView->status() == QQuickView::Ready) { | ||
▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Line(s) | |||||
216 | ConfigurationModule::~ConfigurationModule() = default; | 216 | ConfigurationModule::~ConfigurationModule() = default; | ||
217 | 217 | | |||
218 | void ConfigurationModule::showEvent(QShowEvent *ev) | 218 | void ConfigurationModule::showEvent(QShowEvent *ev) | ||
219 | { | 219 | { | ||
220 | KCModule::showEvent(ev); | 220 | KCModule::showEvent(ev); | ||
221 | } | 221 | } | ||
222 | 222 | | |||
223 | static const QMap<QString, KDecoration2::BorderSize> s_sizes = QMap<QString, KDecoration2::BorderSize>({ | 223 | static const QMap<QString, KDecoration2::BorderSize> s_sizes = QMap<QString, KDecoration2::BorderSize>({ | ||
224 | {QStringLiteral("None"), BorderSize::None}, | 224 | {s_borderSizeNormal, BorderSize::None}, | ||
225 | {QStringLiteral("NoSides"), BorderSize::NoSides}, | 225 | {QStringLiteral("NoSides"), BorderSize::NoSides}, | ||
226 | {QStringLiteral("Tiny"), BorderSize::Tiny}, | 226 | {QStringLiteral("Tiny"), BorderSize::Tiny}, | ||
227 | {s_borderSizeNormal, BorderSize::Normal}, | 227 | {QStringLiteral("Normal"), BorderSize::Normal}, | ||
228 | {QStringLiteral("Large"), BorderSize::Large}, | 228 | {QStringLiteral("Large"), BorderSize::Large}, | ||
229 | {QStringLiteral("VeryLarge"), BorderSize::VeryLarge}, | 229 | {QStringLiteral("VeryLarge"), BorderSize::VeryLarge}, | ||
230 | {QStringLiteral("Huge"), BorderSize::Huge}, | 230 | {QStringLiteral("Huge"), BorderSize::Huge}, | ||
231 | {QStringLiteral("VeryHuge"), BorderSize::VeryHuge}, | 231 | {QStringLiteral("VeryHuge"), BorderSize::VeryHuge}, | ||
232 | {QStringLiteral("Oversized"), BorderSize::Oversized} | 232 | {QStringLiteral("Oversized"), BorderSize::Oversized} | ||
233 | }); | 233 | }); | ||
234 | 234 | | |||
235 | static BorderSize stringToSize(const QString &name) | 235 | static BorderSize stringToSize(const QString &name) | ||
236 | { | 236 | { | ||
237 | auto it = s_sizes.constFind(name); | 237 | auto it = s_sizes.constFind(name); | ||
238 | if (it == s_sizes.constEnd()) { | 238 | if (it == s_sizes.constEnd()) { | ||
239 | // non sense values are interpreted just like normal | 239 | // nonsense values are interpreted just like none | ||
240 | return BorderSize::Normal; | 240 | return BorderSize::None; | ||
241 | } | 241 | } | ||
242 | return it.value(); | 242 | return it.value(); | ||
243 | } | 243 | } | ||
244 | 244 | | |||
245 | static QString sizeToString(BorderSize size) | 245 | static QString sizeToString(BorderSize size) | ||
246 | { | 246 | { | ||
247 | return s_sizes.key(size, s_borderSizeNormal); | 247 | return s_sizes.key(size, s_borderSizeNormal); | ||
248 | } | 248 | } | ||
▲ Show 20 Lines • Show All 186 Lines • Show Last 20 Lines |
That variable name is misleading. Especially on line 224.
Renaming as border size default might be better