File indexing completed on 2025-04-20 04:59:09
0001 /* 0002 KWin - the KDE window manager 0003 This file is part of the KDE project. 0004 0005 SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org> 0006 SPDX-FileCopyrightText: 2014 Hugo Pereira Da Costa <hugo.pereira@free.fr> 0007 SPDX-FileCopyrightText: 2015 Mika Allan Rauhala <mika.allan.rauhala@gmail.com> 0008 0009 SPDX-License-Identifier: GPL-2.0-or-later 0010 */ 0011 0012 #pragma once 0013 0014 #include <KColorScheme> 0015 #include <KConfigWatcher> 0016 #include <KDecoration2/DecorationSettings> 0017 #include <KSharedConfig> 0018 #include <QFileSystemWatcher> 0019 #include <QPalette> 0020 0021 #include <optional> 0022 0023 namespace KWin 0024 { 0025 namespace Decoration 0026 { 0027 0028 class DecorationPalette : public QObject 0029 { 0030 Q_OBJECT 0031 public: 0032 DecorationPalette(const QString &colorScheme); 0033 0034 bool isValid() const; 0035 0036 QColor color(KDecoration2::ColorGroup group, KDecoration2::ColorRole role) const; 0037 QPalette palette() const; 0038 0039 Q_SIGNALS: 0040 void changed(); 0041 0042 private: 0043 void update(); 0044 0045 QString m_colorScheme; 0046 KConfigWatcher::Ptr m_watcher; 0047 0048 struct LegacyColors 0049 { 0050 QColor activeTitleBarColor; 0051 QColor inactiveTitleBarColor; 0052 0053 QColor activeFrameColor; 0054 QColor inactiveFrameColor; 0055 0056 QColor activeForegroundColor; 0057 QColor inactiveForegroundColor; 0058 QColor warningForegroundColor; 0059 }; 0060 0061 struct ModernColors 0062 { 0063 KColorScheme active; 0064 KColorScheme inactive; 0065 }; 0066 0067 KSharedConfig::Ptr m_colorSchemeConfig; 0068 QPalette m_palette; 0069 ModernColors m_colors; 0070 std::optional<LegacyColors> m_legacyColors; 0071 }; 0072 0073 } 0074 }