/** * @file theme_manager.h * @ingroup CoreSettings * @brief TODO: Document this. */ #ifndef THEMEMANAGER_H #define THEMEMANAGER_H #include #include #include #include #include #include #include #include inline Q_LOGGING_CATEGORY(ThemeManagerLog, "theme_manager"); typedef QMap QStringMap; typedef QMap QBrushMap; class QApplication; class ThemeManager : public QObject { Q_OBJECT public: ThemeManager(QObject *parent = nullptr); enum Role { MinRole = 0, Hand = MinRole, Stack, Table, Player, MaxRole = Player, }; private: QString defaultStyleName; std::array brushes; QStringMap availableThemes; /* Internal cache for multiple backgrounds */ std::array brushesCache; protected: void ensureThemeDirectoryExists(); bool isDarkMode(); QBrush loadBrush(QString fileName, QColor fallbackColor); QBrush loadExtraBrush(QString fileName, QBrush &fallbackBrush); public: QStringMap &getAvailableThemes(); QBrush &getBgBrush(Role zone); QBrush getExtraBgBrush(Role zone, int zoneId = 0); protected slots: void themeChangedSlot(); signals: void themeChanged(); }; extern ThemeManager *themeManager; #endif