KWin
Loading...
Searching...
No Matches
decorationpalette.h
Go to the documentation of this file.
1/*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
6 SPDX-FileCopyrightText: 2014 Hugo Pereira Da Costa <hugo.pereira@free.fr>
7 SPDX-FileCopyrightText: 2015 Mika Allan Rauhala <mika.allan.rauhala@gmail.com>
8
9 SPDX-License-Identifier: GPL-2.0-or-later
10*/
11
12#pragma once
13
14#include <KColorScheme>
15#include <KConfigWatcher>
16#include <KDecoration2/DecorationSettings>
17#include <KSharedConfig>
18#include <QFileSystemWatcher>
19#include <QPalette>
20
21#include <optional>
22
23namespace KWin
24{
25namespace Decoration
26{
27
28class DecorationPalette : public QObject
29{
30 Q_OBJECT
31public:
32 DecorationPalette(const QString &colorScheme);
33
34 bool isValid() const;
35
36 QColor color(KDecoration2::ColorGroup group, KDecoration2::ColorRole role) const;
37 QPalette palette() const;
38
39Q_SIGNALS:
40 void changed();
41
42private:
43 void update();
44
45 QString m_colorScheme;
46 KConfigWatcher::Ptr m_watcher;
47
48 struct LegacyColors
49 {
50 QColor activeTitleBarColor;
51 QColor inactiveTitleBarColor;
52
53 QColor activeFrameColor;
54 QColor inactiveFrameColor;
55
56 QColor activeForegroundColor;
57 QColor inactiveForegroundColor;
58 QColor warningForegroundColor;
59 };
60
61 struct ModernColors
62 {
63 KColorScheme active;
64 KColorScheme inactive;
65 };
66
67 KSharedConfig::Ptr m_colorSchemeConfig;
68 QPalette m_palette;
69 ModernColors m_colors;
70 std::optional<LegacyColors> m_legacyColors;
71};
72
73}
74}
DecorationPalette(const QString &colorScheme)
QColor color(KDecoration2::ColorGroup group, KDecoration2::ColorRole role) const