| 1 |
// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-3.0-or-later |
| 4 |
|
| 5 |
#ifndef DPLATFORMTHEME_P_H |
| 6 |
#define DPLATFORMTHEME_P_H |
| 7 |
|
| 8 |
#include "private/dplatforminterface_p.h" |
| 9 |
#include "dplatformtheme.h" |
| 10 |
#include "dnativesettings_p.h" |
| 11 |
|
| 12 |
#include <DConfig> |
| 13 |
#include <dguiapplicationhelper.h> |
| 14 |
|
| 15 |
DCORE_USE_NAMESPACE |
| 16 |
DGUI_BEGIN_NAMESPACE |
| 17 |
|
| 18 |
class DPlatformThemePrivate : public DNativeSettingsPrivate |
| 19 |
{ |
| 20 |
public: |
| 21 |
D_DECLARE_PUBLIC(DPlatformTheme) |
| 22 |
DPlatformThemePrivate(DPlatformTheme *qq); |
| 23 |
|
| 24 |
// 接收parent主题或非调色板DNativeSettings对象(theme对象)的属性变化通知 |
| 25 |
// 调色板相关的属性变化与此无关 |
| 26 |
void onQtColorChanged(QPalette::ColorRole role, const QColor &color); |
| 27 |
void onDtkColorChanged(DPalette::ColorType type, const QColor &color); |
| 28 |
void notifyPaletteChanged(); |
| 29 |
|
| 30 |
// 父主题,可以从其继承除调色板之外的所有窗口设置 |
| 31 |
DPlatformTheme *parent = nullptr; |
| 32 |
// 用于控制是否fallback到父主题中获取属性 |
| 33 |
bool fallbackProperty = true; |
| 34 |
// 默认时,DPlatformTheme会从/deepin/palette域下获取调色板相关的属性值 |
| 35 |
// 此处的DNativeSettings用于获取除调色板之外的属性设置 |
| 36 |
DNativeSettings *theme; |
| 37 |
// 缓存的调色板数据 |
| 38 |
DPalette *palette = nullptr; |
| 39 |
// 减少调色板changed信号的通知频率 |
| 40 |
QTimer *notifyPaletteChangeTimer = nullptr; |
| 41 |
DConfig *dtkPreferenceConfig = nullptr; |
| 42 |
|
| 43 |
DPlatformInterface *platformInterface = nullptr; |
| 44 |
|
| 45 |
DGuiApplicationHelper::SizeMode sizeMode = DGuiApplicationHelper::NormalMode; |
| 46 |
Qt::ScrollBarPolicy scrollBarPolicy = Qt::ScrollBarAsNeeded; |
| 47 |
|
| 48 |
public slots: |
| 49 |
void onDtkPreferenceDConfigChanged(const QString &key); |
| 50 |
}; |
| 51 |
|
| 52 |
DGUI_END_NAMESPACE |
| 53 |
|
| 54 |
#endif // DPLATFORMTHEME_P_H |