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:
Fabio Bas 2015-05-17 23:30:14 +02:00
parent 48c3e64ef5
commit 6b8ebe54e9
64 changed files with 360 additions and 388 deletions

View 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