mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 00:54:53 -07:00
* move message_log_widget to game * move files * update headers * fix cmakelists * oracle fixes * split implementation out to cpp * fix recursive import * fix main file * format
This commit is contained in:
parent
f484c98152
commit
17dcaf9afa
337 changed files with 728 additions and 721 deletions
62
cockatrice/src/interface/theme_manager.h
Normal file
62
cockatrice/src/interface/theme_manager.h
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
#ifndef THEMEMANAGER_H
|
||||
#define THEMEMANAGER_H
|
||||
|
||||
#include <QBrush>
|
||||
#include <QDir>
|
||||
#include <QLoggingCategory>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QPixmap>
|
||||
#include <QString>
|
||||
#include <array>
|
||||
|
||||
inline Q_LOGGING_CATEGORY(ThemeManagerLog, "theme_manager");
|
||||
|
||||
typedef QMap<QString, QString> QStringMap;
|
||||
typedef QMap<int, QBrush> 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:
|
||||
std::array<QBrush, Role::MaxRole + 1> brushes;
|
||||
QStringMap availableThemes;
|
||||
/*
|
||||
Internal cache for multiple backgrounds
|
||||
*/
|
||||
std::array<QBrushMap, Role::MaxRole + 1> brushesCache;
|
||||
|
||||
protected:
|
||||
void ensureThemeDirectoryExists();
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue