File indexing completed on 2024-04-21 16:17:20

0001 /*
0002  * Copyright 2018  Michail Vourlakos <mvourlakos@gmail.com>
0003  *
0004  * This file is part of Latte-Dock
0005  *
0006  * Latte-Dock is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU General Public License as
0008  * published by the Free Software Foundation; either version 2 of
0009  * the License, or (at your option) any later version.
0010  *
0011  * Latte-Dock is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  * GNU General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU General Public License
0017  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0018  *
0019  */
0020 
0021 #ifndef SCHEMECOLORS_H
0022 #define SCHEMECOLORS_H
0023 
0024 // Qt
0025 #include <QObject>
0026 #include <QColor>
0027 
0028 namespace Latte {
0029 namespace WindowSystem {
0030 
0031 class SchemeColors: public QObject
0032 {
0033     Q_OBJECT
0034     Q_PROPERTY(QString schemeFile READ schemeFile NOTIFY schemeFileChanged)
0035 
0036     Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY colorsChanged)
0037     Q_PROPERTY(QColor textColor READ textColor NOTIFY colorsChanged)
0038     Q_PROPERTY(QColor inactiveBackgroundColor READ inactiveBackgroundColor NOTIFY colorsChanged)
0039     Q_PROPERTY(QColor inactiveTextColor READ inactiveTextColor NOTIFY colorsChanged)
0040 
0041     Q_PROPERTY(QColor highlightColor READ highlightColor NOTIFY colorsChanged)
0042     Q_PROPERTY(QColor highlightedTextColor READ highlightedTextColor NOTIFY colorsChanged)
0043     Q_PROPERTY(QColor positiveTextColor READ positiveTextColor NOTIFY colorsChanged)
0044     Q_PROPERTY(QColor neutralTextColor READ neutralTextColor NOTIFY colorsChanged)
0045     Q_PROPERTY(QColor negativeTextColor READ negativeTextColor NOTIFY colorsChanged)
0046 
0047     Q_PROPERTY(QColor buttonTextColor READ buttonTextColor NOTIFY colorsChanged)
0048     Q_PROPERTY(QColor buttonBackgroundColor READ buttonBackgroundColor NOTIFY colorsChanged)
0049     Q_PROPERTY(QColor buttonHoverColor READ buttonHoverColor NOTIFY colorsChanged)
0050     Q_PROPERTY(QColor buttonFocusColor READ buttonFocusColor NOTIFY colorsChanged)
0051 
0052 public:
0053     SchemeColors(QObject *parent, QString scheme, bool plasmaTheme = false);
0054     ~SchemeColors() override;
0055 
0056     QString schemeName() const;
0057 
0058     QString schemeFile() const;
0059     void setSchemeFile(QString file);
0060 
0061     QColor backgroundColor() const;
0062     QColor textColor() const;
0063     QColor inactiveBackgroundColor() const;
0064     QColor inactiveTextColor() const;
0065     QColor highlightColor() const;
0066     QColor highlightedTextColor() const;
0067     QColor positiveTextColor() const;
0068     QColor neutralTextColor() const;
0069     QColor negativeTextColor() const;
0070 
0071     QColor buttonTextColor() const;
0072     QColor buttonBackgroundColor() const;
0073     QColor buttonHoverColor() const;
0074     QColor buttonFocusColor() const;
0075 
0076     static QString possibleSchemeFile(QString scheme);
0077     static QString schemeName(QString originalFile);
0078 
0079 signals:
0080     void colorsChanged();
0081     void schemeFileChanged();
0082 
0083 private slots:
0084     void updateScheme();
0085 
0086 private:
0087     bool m_basedOnPlasmaTheme{false};
0088 
0089     QString m_schemeName;
0090     QString m_schemeFile;
0091 
0092     QColor m_activeBackgroundColor;
0093     QColor m_activeTextColor;
0094 
0095     QColor m_inactiveBackgroundColor;
0096     QColor m_inactiveTextColor;
0097 
0098     QColor m_highlightColor;
0099     QColor m_highlightedTextColor;
0100     QColor m_positiveTextColor;
0101     QColor m_neutralTextColor;
0102     QColor m_negativeTextColor;
0103 
0104     QColor m_buttonTextColor;
0105     QColor m_buttonBackgroundColor;
0106     QColor m_buttonHoverColor;
0107     QColor m_buttonFocusColor;
0108 };
0109 
0110 }
0111 }
0112 
0113 #endif