mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-03 20:13:56 -07:00
Theme manager
This is the first implementation of a theme manager. It’s a rebased and revisited version of #792.
This commit is contained in:
parent
48c3e64ef5
commit
6b8ebe54e9
64 changed files with 360 additions and 388 deletions
42
cockatrice/src/thememanager.h
Normal file
42
cockatrice/src/thememanager.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#ifndef THEMEMANAGER_H
|
||||
#define THEMEMANAGER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QBrush>
|
||||
#include <QPixmap>
|
||||
#include <QMap>
|
||||
#include <QDir>
|
||||
#include <QString>
|
||||
|
||||
typedef QMap<QString, QString> QStringMap;
|
||||
|
||||
class QApplication;
|
||||
|
||||
class ThemeManager : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ThemeManager(QObject *parent = 0);
|
||||
private:
|
||||
QBrush handBgBrush, stackBgBrush, tableBgBrush, playerBgBrush;
|
||||
QPixmap cardBackPixmap;
|
||||
QStringMap availableThemes;
|
||||
protected:
|
||||
void ensureThemeDirectoryExists();
|
||||
QBrush loadBrush(QDir dir, QString fileName, QColor fallbackColor);
|
||||
QPixmap loadPixmap(QDir dir, QString fileName);
|
||||
public:
|
||||
QBrush &getHandBgBrush() { return handBgBrush; }
|
||||
QBrush &getStackBgBrush() { return stackBgBrush; }
|
||||
QBrush &getTableBgBrush() { return tableBgBrush; }
|
||||
QBrush &getPlayerBgBrush() { return playerBgBrush; }
|
||||
QPixmap &getCardBackPixmap() { return cardBackPixmap; }
|
||||
QStringMap &getAvailableThemes();
|
||||
protected slots:
|
||||
void themeChangedSlot();
|
||||
signals:
|
||||
void themeChanged();
|
||||
};
|
||||
|
||||
extern ThemeManager * themeManager;
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue