Kylin/Fluent/Theme.h

70 lines
2.4 KiB
C
Raw Normal View History

2024-08-21 23:26:43 +08:00
#ifndef THEME_H
#define THEME_H
#include <QColor>
#include <QObject>
#include <QQmlEngine>
class Theme : public QObject {
Q_OBJECT
QML_ELEMENT
QML_SINGLETON
Q_PROPERTY(QColor fontPrimaryColor READ fontPrimaryColor WRITE setFontPrimaryColor NOTIFY fontPrimaryColorChanged)
Q_PROPERTY(QColor itemNormalColor READ itemNormalColor WRITE setItemNormalColor NOTIFY itemNormalColorChanged)
2024-08-23 00:04:16 +08:00
Q_PROPERTY(QColor itemHoverColor READ itemHoverColor WRITE setItemHoverColor NOTIFY itemHoverColorChanged)
Q_PROPERTY(QColor windowBackgroundColor READ windowBackgroundColor WRITE setWindowBackgroundColor NOTIFY
windowBackgroundColorChanged)
Q_PROPERTY(QColor windowActiveBackgroundColor READ windowActiveBackgroundColor WRITE setWindowActiveBackgroundColor
NOTIFY windowActiveBackgroundColorChanged)
Q_PROPERTY(QString desktopImagePath READ desktopImagePath WRITE setDesktopImagePath NOTIFY desktopImagePathChanged)
Q_PROPERTY(bool blurBehindWindowEnabled READ blurBehindWindowEnabled WRITE setBlurBehindWindowEnabled NOTIFY
blurBehindWindowEnabledChanged)
2024-08-21 23:26:43 +08:00
public:
Theme(QObject *parent = nullptr);
QColor fontPrimaryColor() const;
void setFontPrimaryColor(const QColor &color);
QColor itemNormalColor() const;
void setItemNormalColor(const QColor &color);
2024-08-23 00:04:16 +08:00
QColor itemHoverColor() const;
void setItemHoverColor(const QColor &color);
QColor windowBackgroundColor() const;
void setWindowBackgroundColor(const QColor &color);
QColor windowActiveBackgroundColor() const;
void setWindowActiveBackgroundColor(const QColor &color);
QString desktopImagePath() const;
void setDesktopImagePath(const QString &path);
bool blurBehindWindowEnabled() const;
void setBlurBehindWindowEnabled(bool enabled);
2024-08-21 23:26:43 +08:00
signals:
void fontPrimaryColorChanged();
void itemNormalColorChanged();
2024-08-23 00:04:16 +08:00
void windowBackgroundColorChanged();
void windowActiveBackgroundColorChanged();
void desktopImagePathChanged();
void blurBehindWindowEnabledChanged();
void itemHoverColorChanged();
2024-08-21 23:26:43 +08:00
private:
QColor m_fontPrimaryColor;
QColor m_itemNormalColor;
2024-08-23 00:04:16 +08:00
QColor m_itemHoverColor;
QColor m_windowBackgroundColor;
QColor m_windowActiveBackgroundColor;
QString m_desktopImagePath;
bool m_blurBehindWindowEnabled;
2024-08-21 23:26:43 +08:00
};
#endif // THEME_H