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

@ -3,17 +3,23 @@
#include "player.h"
#include "client.h"
#include "protocol_items.h"
#include "settingscache.h"
HandZone::HandZone(Player *_p, int _zoneHeight, QGraphicsItem *parent)
: CardZone(_p, "hand", false, false, _p->getLocal(), parent), zoneHeight(_zoneHeight)
{
QSettings settings;
QString bgPath = settings.value("zonebg/hand").toString();
if (!bgPath.isEmpty())
bgPixmap.load(bgPath);
connect(settingsCache, SIGNAL(handBgPathChanged()), this, SLOT(updateBgPixmap()));
updateBgPixmap();
setCacheMode(DeviceCoordinateCache);
setAcceptsHoverEvents(true); // Awkwardly, this is needed to repaint the cached item after it has been corrupted by buggy rubberband drag.
}
void HandZone::updateBgPixmap()
{
QString bgPath = settingsCache->getHandBgPath();
if (!bgPath.isEmpty())
bgPixmap.load(bgPath);
update();
}
QRectF HandZone::boundingRect() const