make more use of SettingsCache

This commit is contained in:
Max-Wilhelm Bruker 2010-03-06 23:02:45 +01:00
parent 2c9a8c2b57
commit e9a0203880
10 changed files with 106 additions and 48 deletions

View file

@ -12,6 +12,7 @@
#include "tab_game.h"
#include "protocol_items.h"
#include "gamescene.h"
#include "settingscache.h"
#include <QSettings>
#include <QPainter>
#include <QMenu>
@ -19,12 +20,11 @@
Player::Player(const QString &_name, int _id, bool _local, Client *_client, TabGame *_parent)
: QObject(_parent), defaultNumberTopCards(3), name(_name), id(_id), active(false), local(_local), client(_client)
{
QSettings settings;
QString bgPath = settings.value("zonebg/playerarea").toString();
if (!bgPath.isEmpty())
bgPixmap.load(bgPath);
setCacheMode(DeviceCoordinateCache);
connect(settingsCache, SIGNAL(playerBgPathChanged()), this, SLOT(updateBgPixmap()));
updateBgPixmap();
QPointF base = QPointF(counterAreaWidth, 50);
PileZone *deck = new PileZone(this, "deck", true, false, this);
@ -265,6 +265,16 @@ Player::~Player()
delete cardMenu;
}
void Player::updateBgPixmap()
{
QString bgPath = settingsCache->getPlayerBgPath();
if (!bgPath.isEmpty()) {
qDebug() << "loading" << bgPath;
bgPixmap.load(bgPath);
}
update();
}
void Player::updateBoundingRect()
{
prepareGeometryChange();