Kylin/Fluent/Theme.h
2024-08-23 00:04:16 +08:00

70 lines
2.4 KiB
C++

#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)
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)
public:
Theme(QObject *parent = nullptr);
QColor fontPrimaryColor() const;
void setFontPrimaryColor(const QColor &color);
QColor itemNormalColor() const;
void setItemNormalColor(const QColor &color);
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);
signals:
void fontPrimaryColorChanged();
void itemNormalColorChanged();
void windowBackgroundColorChanged();
void windowActiveBackgroundColorChanged();
void desktopImagePathChanged();
void blurBehindWindowEnabledChanged();
void itemHoverColorChanged();
private:
QColor m_fontPrimaryColor;
QColor m_itemNormalColor;
QColor m_itemHoverColor;
QColor m_windowBackgroundColor;
QColor m_windowActiveBackgroundColor;
QString m_desktopImagePath;
bool m_blurBehindWindowEnabled;
};
#endif // THEME_H