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

@ -15,6 +15,7 @@
#include "tab_game.h"
#include "gamescene.h"
#include "settingscache.h"
#include "thememanager.h"
#include "dlg_create_token.h"
#include "carddatabase.h"
#include "color.h"
@ -69,25 +70,18 @@ PlayerArea::PlayerArea(QGraphicsItem *parentItem)
: QObject(), QGraphicsItem(parentItem)
{
setCacheMode(DeviceCoordinateCache);
connect(settingsCache, SIGNAL(playerBgPathChanged()), this, SLOT(updateBgPixmap()));
updateBgPixmap();
connect(themeManager, SIGNAL(themeChanged()), this, SLOT(updateBg()));
updateBg();
}
void PlayerArea::updateBgPixmap()
void PlayerArea::updateBg()
{
QString bgPath = settingsCache->getPlayerBgPath();
if (bgPath.isEmpty())
bgPixmapBrush = QBrush(QColor(200, 200, 200));
else {
qDebug() << "loading" << bgPath;
bgPixmapBrush = QBrush(QPixmap(bgPath));
}
update();
}
void PlayerArea::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
{
painter->fillRect(bRect, bgPixmapBrush);
painter->fillRect(bRect, themeManager->getPlayerBgBrush());
}
void PlayerArea::setSize(qreal width, qreal height)