Support folder based UI Themes

Support folder based Themes in UIThemeManager.
Add option to select config.json as them file.

PR #15888.
This commit is contained in:
Prince Gupta
2022-01-03 11:41:12 +05:30
committed by GitHub
parent 61504ae3b1
commit 7e8a176751
3 changed files with 121 additions and 29 deletions

View File

@@ -36,6 +36,16 @@
#include <QObject>
#include <QString>
class UIThemeSource
{
public:
virtual ~UIThemeSource() = default;
virtual QByteArray readStyleSheet() = 0;
virtual QByteArray readConfig() = 0;
virtual QString iconPath(const QString &iconId) const = 0;
};
class UIThemeManager : public QObject
{
Q_OBJECT
@@ -64,10 +74,11 @@ private:
void applyStyleSheet() const;
static UIThemeManager *m_instance;
const bool m_useCustomTheme;
std::unique_ptr<UIThemeSource> m_themeSource;
QHash<QString, QColor> m_colors;
mutable QHash<QString, QIcon> m_iconCache;
mutable QHash<QString, QIcon> m_flagCache;
const bool m_useCustomTheme;
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
const bool m_useSystemTheme;
#endif