| 1 |
/* |
| 2 |
* libkysdk-thememanager's Library |
| 3 |
* |
| 4 |
* Copyright (C) 2025, KylinSoft Co., Ltd. |
| 5 |
* |
| 6 |
* This library is free software; you can redistribute it and/or |
| 7 |
* modify it under the terms of the GNU Lesser General Public |
| 8 |
* License as published by the Free Software Foundation; either |
| 9 |
* version 3 of the License, or (at your option) any later version. |
| 10 |
* |
| 11 |
* This library is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
* Lesser General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU General Public License |
| 17 |
* along with this library. If not, see <https://www.gnu.org/licenses/>. |
| 18 |
* |
| 19 |
* Authors: ShaoShuai Tian <[email protected]> |
| 20 |
* |
| 21 |
*/ |
| 22 |
|
| 23 |
#ifndef KTHEMEMANAGER_H |
| 24 |
#define KTHEMEMANAGER_H |
| 25 |
|
| 26 |
#include <QObject> |
| 27 |
#include <memory> |
| 28 |
|
| 29 |
namespace kdk { |
| 30 |
|
| 31 |
class KThemeManagerPrivate; |
| 32 |
|
| 33 |
/** |
| 34 |
* @defgroup ThemeModule |
| 35 |
*/ |
| 36 |
|
| 37 |
/** |
| 38 |
* @brief 主题控制类, 提供对主题的设置和获取功能 |
| 39 |
* @since 3.0.1.0 |
| 40 |
*/ |
| 41 |
|
| 42 |
class KThemeManager : public QObject |
| 43 |
{ |
| 44 |
Q_OBJECT |
| 45 |
|
| 46 |
public: |
| 47 |
KThemeManager(QObject *parent = nullptr); |
| 48 |
virtual ~KThemeManager(); |
| 49 |
|
| 50 |
public: |
| 51 |
|
| 52 |
/** |
| 53 |
* @brief getUkccGlobalTheme 获取控制面板当前的公共主题类型 |
| 54 |
* @return 控制面板的公共主题类型,如Light-Seeking、Heyin、custom |
| 55 |
* @since 3.0.1.0 |
| 56 |
*/ |
| 57 |
QString getUkccGlobalTheme(); |
| 58 |
|
| 59 |
/** |
| 60 |
* @brief getSupportSystemStyle 获取系统支持的主题列表 |
| 61 |
* @return 主题列表 |
| 62 |
* @since 3.0.1.0 |
| 63 |
*/ |
| 64 |
QStringList getSupportSystemStyle(); |
| 65 |
|
| 66 |
/** |
| 67 |
* @brief getSystemThemeColor 获取当前系统强调色 |
| 68 |
* @return 当前系统强调色。 |
| 69 |
* @since 3.0.1.0 |
| 70 |
*/ |
| 71 |
QString getSystemThemeColor(); |
| 72 |
|
| 73 |
/** |
| 74 |
* @brief getSystemFont 获取系统当前字体类型 |
| 75 |
* @return 系统当前字体类型 |
| 76 |
* @since 3.0.1.0 |
| 77 |
*/ |
| 78 |
QString getSystemFont(); |
| 79 |
|
| 80 |
/** |
| 81 |
* @brief getSystemFontSize 获取系统当前字体大小 |
| 82 |
* @return 字体大小 |
| 83 |
* @since 3.0.1.0 |
| 84 |
*/ |
| 85 |
int getSystemFontSize(); |
| 86 |
|
| 87 |
/** |
| 88 |
* @brief setSystemStyle 设置系统主题 |
| 89 |
* @param style 系统主题,getSupportSystemStyle返回值之一 |
| 90 |
* @return 成功返回true;失败返回false |
| 91 |
* @since 3.0.1.0 |
| 92 |
*/ |
| 93 |
bool setSystemStyle(const QString &style); |
| 94 |
|
| 95 |
/** |
| 96 |
* @brief setSystemFont 设置系统字体 |
| 97 |
* @param font 字体全名,如"Noto Sans CJK SC" |
| 98 |
* @return 成功返回true;失败返回false |
| 99 |
* @since 3.0.1.0 |
| 100 |
*/ |
| 101 |
bool setSystemFont(const QString &font); |
| 102 |
|
| 103 |
/** |
| 104 |
* @brief setSystemFontSize 设置系统字体大小 |
| 105 |
* @param size 字体大小 |
| 106 |
* @return 成功返回true;失败返回false |
| 107 |
* @since 3.0.1.0 |
| 108 |
*/ |
| 109 |
bool setSystemFontSize(int size); |
| 110 |
|
| 111 |
/** |
| 112 |
* @brief setSystemThemeColor 设置系统强调色 |
| 113 |
* @param color 系统强调色,从以下选项中选择一个 |
| 114 |
* {"default","daybreakBlue","jamPurple","magenta","sunRed","sunsetOrange","dustGold","polarGreen"} |
| 115 |
* @return 成功返回true;失败返回false |
| 116 |
* @since 3.0.1.0 |
| 117 |
*/ |
| 118 |
bool setSystemThemeColor(const QString &color); |
| 119 |
|
| 120 |
/** |
| 121 |
* @brief setPanelSpecialEffect 设置窗口特效模式 |
| 122 |
* @param effect true打开;false关闭 |
| 123 |
* @return 成功返回true;失败返回false |
| 124 |
* @since 3.0.1.0 |
| 125 |
*/ |
| 126 |
bool setPanelSpecialEffect(bool effect); |
| 127 |
|
| 128 |
/** |
| 129 |
* @brief setTransparency 设置窗口透明度 |
| 130 |
* @param tran 透明度 |
| 131 |
* @return 成功返回true;失败返回false |
| 132 |
* @since 3.0.1.0 |
| 133 |
*/ |
| 134 |
bool setTransparency(double tran); |
| 135 |
|
| 136 |
signals: |
| 137 |
void changed(const QString property, const QVariant value); |
| 138 |
|
| 139 |
private: |
| 140 |
Q_DECLARE_PRIVATE(KThemeManager) |
| 141 |
std::unique_ptr<KThemeManagerPrivate> const d_ptr; |
| 142 |
}; |
| 143 |
|
| 144 |
} |
| 145 |
#endif // KTHEMEMANAGER_H |