mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-16 20:17:45 -07:00
make more use of SettingsCache
This commit is contained in:
parent
2c9a8c2b57
commit
e9a0203880
10 changed files with 106 additions and 48 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue