2021-09-16 16:05:46 +08:00
|
|
|
|
#ifndef GSETTINGSWRAPPER_H
|
|
|
|
|
#define GSETTINGSWRAPPER_H
|
|
|
|
|
|
|
|
|
|
#include <QHash>
|
|
|
|
|
#include <QSize>
|
2022-02-15 16:51:03 +08:00
|
|
|
|
#include <QColor>
|
|
|
|
|
#include <QGSettings/qgsettings.h>
|
|
|
|
|
#include "../common/singleton.h"
|
|
|
|
|
|
2021-09-16 16:05:46 +08:00
|
|
|
|
class QWidget;
|
|
|
|
|
|
2022-02-15 16:51:03 +08:00
|
|
|
|
// 主题key
|
|
|
|
|
#define ORG_UKUI_STYLE "org.ukui.style"
|
|
|
|
|
#define STYLE_NAME "styleName"
|
|
|
|
|
#define STYLE_NAME_VALUE_DEFAULT "ukui-default"
|
|
|
|
|
#define STYLE_NAME_VALUE_DARK "ukui-dark"
|
|
|
|
|
#define STYLE_NAME_VALUE_BLACK "ukui-black"
|
|
|
|
|
#define STYLE_NAME_VALUE_LIGHT "ukui-light"
|
|
|
|
|
#define STYLE_NAME_VALUE_WHITE "ukui-white"
|
|
|
|
|
#define ICON_THEME_NAME "iconThemeName"
|
|
|
|
|
#define TRANSPARENCY_NAME "transparency"
|
2022-06-27 15:57:16 +08:00
|
|
|
|
#define COLOR_QT_KEY "themeColor"
|
2022-02-15 16:51:03 +08:00
|
|
|
|
|
|
|
|
|
// 颜色
|
|
|
|
|
// 浅灰
|
|
|
|
|
#define COLOR_WINDOW_LIGHT_LEFT "#FAFAFA"
|
|
|
|
|
// 深灰
|
|
|
|
|
#define COLOR_WINDOW_DARK_LEFT "#232426"
|
|
|
|
|
// #define COLOR_WINDOW_DARK_LEFT "#242424"
|
|
|
|
|
// 白色
|
|
|
|
|
#define COLOR_WINDOW_LIGHT_RIGHT "#FFFFFF"
|
|
|
|
|
// 黑色
|
|
|
|
|
#define COLOR_WINDOW_DARK_RIGHT "#121212"
|
|
|
|
|
|
2021-09-16 16:05:46 +08:00
|
|
|
|
/**
|
|
|
|
|
* @brief 由于当前仅用于主题变化时,备份还原工具的一些图标跟随变化,此处暂时先简单封装。后续根据使用情况另行优化。
|
|
|
|
|
*/
|
2022-02-15 16:51:03 +08:00
|
|
|
|
class GSettingsWrapper : public Singleton<GSettingsWrapper>
|
2021-09-16 16:05:46 +08:00
|
|
|
|
{
|
|
|
|
|
public:
|
2022-02-15 16:51:03 +08:00
|
|
|
|
GSettingsWrapper(token);
|
|
|
|
|
virtual ~GSettingsWrapper();
|
|
|
|
|
|
2022-02-21 11:04:44 +08:00
|
|
|
|
/**
|
|
|
|
|
* @brief 是否深色主题
|
|
|
|
|
* @return true-深色主题;false-浅色主题
|
|
|
|
|
*/
|
|
|
|
|
bool isDarkTheme() {
|
|
|
|
|
return m_isDarkTheme;
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-15 16:51:03 +08:00
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
QGSettings *m_pGsettingThemeData;
|
2022-02-21 11:04:44 +08:00
|
|
|
|
bool m_isDarkTheme;
|
2021-09-16 16:05:46 +08:00
|
|
|
|
};
|
|
|
|
|
|
2023-03-17 17:59:26 +08:00
|
|
|
|
#define g_GSettingWrapper GSettingsWrapper::instance()
|
2022-02-15 16:51:03 +08:00
|
|
|
|
|
2021-09-16 16:05:46 +08:00
|
|
|
|
#endif // GSETTINGSWRAPPER_H
|