Changeset View
Changeset View
Standalone View
Standalone View
kded/kwin_bridge/decorationpainter.cpp
- This file was copied from kded/configvalueprovider.h.
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | * Copyright (C) 2019 Mikhail Zolotukhin <zomial@protonmail.com> | 2 | * Copyright 2020 Mikhail Zolotukhin <zomial@protonmail.com> | ||
3 | * | 3 | * | ||
4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License as | 5 | * modify it under the terms of the GNU General Public License as | ||
6 | * published by the Free Software Foundation; either version 2 of | 6 | * published by the Free Software Foundation; either version 2 of | ||
7 | * the License or (at your option) version 3 or any later version | 7 | * the License or (at your option) version 3 or any later version | ||
8 | * accepted by the membership of KDE e.V. (or its successor approved | 8 | * accepted by the membership of KDE e.V. (or its successor approved | ||
9 | * by the membership of KDE e.V.), which shall act as a proxy | 9 | * by the membership of KDE e.V.), which shall act as a proxy | ||
10 | * defined in Section 14 of version 3 of the license. | 10 | * defined in Section 14 of version 3 of the license. | ||
11 | * | 11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | 12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. | ||
16 | * | 16 | * | ||
17 | * You should have received a copy of the GNU General Public License | 17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #pragma once | 21 | #include "decorationpainter.h" | ||
22 | 22 | | |||
23 | #include <KSharedConfig> | 23 | #include <QString> | ||
24 | #include <QRect> | ||||
24 | 25 | | |||
25 | class QString; | 26 | #include "standarddecorationpainter.h" | ||
26 | class QFont; | 27 | #include "auroraedecorationpainter.h" | ||
27 | 28 | | |||
28 | class ConfigValueProvider | 29 | constexpr const QRect DecorationPainter::ButtonGeometry {0, 0, 50, 50}; | ||
30 | | ||||
31 | std::unique_ptr<DecorationPainter> DecorationPainter::fromThemeName(const QString& themeName) | ||||
29 | { | 32 | { | ||
30 | public: | 33 | static const QString auroraeThemePrefix = QStringLiteral("__aurorae__svg__"); | ||
31 | ConfigValueProvider(); | 34 | if (themeName.startsWith(auroraeThemePrefix)) { | ||
35 | QString prefixlessThemeName = themeName.mid(auroraeThemePrefix.size()); | ||||
36 | return std::unique_ptr<AuroraeDecorationPainter>{new AuroraeDecorationPainter(prefixlessThemeName)}; | ||||
37 | } else { | ||||
38 | return std::unique_ptr<StandardDecorationPainter>{new StandardDecorationPainter(themeName)}; | ||||
39 | } | ||||
40 | } | ||||
32 | 41 | | |||
33 | QString fontName() const; | | |||
34 | QString iconThemeName() const; | | |||
35 | QString cursorThemeName() const; | | |||
36 | bool iconsOnButtons() const; | | |||
37 | bool iconsInMenus() const; | | |||
38 | int toolbarStyle() const; | | |||
39 | bool scrollbarBehavior() const; | | |||
40 | bool preferDarkTheme() const; | | |||
41 | QString windowDecorationsButtonsOrder() const; | | |||
42 | bool enableAnimations() const; | | |||
43 | QMap<QString, QColor> colors() const; | | |||
44 | | ||||
45 | private: | | |||
46 | QString fontStyleHelper(const QFont &font) const; | | |||
47 | QString windowDecorationButtonsOrderInGtkNotation(const QString &kdeConfigValue) const; | | |||
48 | | ||||
49 | KSharedConfigPtr kdeglobalsConfig; | | |||
50 | KSharedConfigPtr inputConfig; | | |||
51 | KSharedConfigPtr kwinConfig; | | |||
52 | }; | |