cosmetic improvements
This commit is contained in:
parent
1e702642a4
commit
748d9bb603
4 changed files with 19 additions and 18 deletions
|
@ -16,7 +16,7 @@ Game::Game(CardDatabase *_db, Client *_client, QGraphicsScene *_scene, QMenu *_a
|
|||
: QObject(), actionsMenu(_actionsMenu), cardMenu(_cardMenu), db(_db), client(_client), scene(_scene), started(false)
|
||||
{
|
||||
QRectF sr = scene->sceneRect();
|
||||
localPlayer = addPlayer(playerId, playerName, QPointF(0, sr.y() + sr.height() / 2), true);
|
||||
localPlayer = addPlayer(playerId, playerName, QPointF(0, sr.y() + sr.height() / 2 + 2), true);
|
||||
|
||||
connect(client, SIGNAL(gameEvent(ServerEventData *)), this, SLOT(gameEvent(ServerEventData *)));
|
||||
connect(client, SIGNAL(playerListReceived(QList<ServerPlayer *>)), this, SLOT(playerListReceived(QList<ServerPlayer *>)));
|
||||
|
@ -92,7 +92,7 @@ Game::Game(CardDatabase *_db, Client *_client, QGraphicsScene *_scene, QMenu *_a
|
|||
cardMenu->addAction(aSetCounters);
|
||||
cardMenu->addSeparator();
|
||||
cardMenu->addAction(aRearrange);
|
||||
|
||||
|
||||
dlgStartGame = new DlgStartGame(db);
|
||||
connect(dlgStartGame, SIGNAL(newDeckLoaded(const QStringList &)), client, SLOT(submitDeck(const QStringList &)));
|
||||
connect(dlgStartGame, SIGNAL(finished(int)), this, SLOT(readyStart()));
|
||||
|
|
|
@ -14,27 +14,28 @@ QRectF HandZone::boundingRect() const
|
|||
return QRectF(0, 0, 100, 510);
|
||||
}
|
||||
|
||||
void HandZone::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
void HandZone::paint(QPainter *painter, const QStyleOptionGraphicsItem */*option*/, QWidget */*widget*/)
|
||||
{
|
||||
Q_UNUSED(option);
|
||||
Q_UNUSED(widget);
|
||||
painter->fillRect(boundingRect(), QColor("green"));
|
||||
painter->fillRect(boundingRect(), Qt::darkGreen);
|
||||
}
|
||||
|
||||
void HandZone::reorganizeCards()
|
||||
{
|
||||
if (cards->isEmpty())
|
||||
return;
|
||||
|
||||
|
||||
int cardCount = cards->size();
|
||||
qreal totalWidth = boundingRect().width();
|
||||
qreal totalHeight = boundingRect().height();
|
||||
qreal cardWidth = cards->at(0)->boundingRect().width();
|
||||
qreal cardHeight = cards->at(0)->boundingRect().height();
|
||||
qreal x = (totalWidth - cardWidth) / 2;
|
||||
|
||||
qreal xspace = 5;
|
||||
qreal x1 = xspace;
|
||||
qreal x2 = totalWidth - xspace - cardWidth;
|
||||
|
||||
for (int i = 0; i < cardCount; i++) {
|
||||
CardItem *c = cards->at(i);
|
||||
qreal x = i % 2 ? x2 : x1;
|
||||
// If the total height of the cards is smaller than the available height,
|
||||
// the cards do not need to overlap and are displayed in the center of the area.
|
||||
if (cardHeight * cardCount > totalHeight)
|
||||
|
@ -50,7 +51,7 @@ void HandZone::addCardImpl(CardItem *card, int x, int /*y*/)
|
|||
if (x == -1)
|
||||
x = cards->size();
|
||||
cards->insert(x, card);
|
||||
|
||||
|
||||
if (!cards->getContentsKnown()) {
|
||||
card->setId(-1);
|
||||
card->setName();
|
||||
|
|
|
@ -13,7 +13,7 @@ PlayerArea::PlayerArea(Player *_player, QGraphicsItem *parent)
|
|||
: QGraphicsItem(parent), player(_player)
|
||||
{
|
||||
QPointF base = QPointF(55, 50);
|
||||
|
||||
|
||||
LibraryZone *deck = new LibraryZone(_player, this);
|
||||
deck->setPos(base);
|
||||
|
||||
|
@ -36,7 +36,7 @@ PlayerArea::PlayerArea(Player *_player, QGraphicsItem *parent)
|
|||
|
||||
CardZone *table = new TableZone(_player, this);
|
||||
table->setPos(base);
|
||||
|
||||
|
||||
bRect = QRectF(0, 0, base.x() + table->boundingRect().width(), base.y() + table->boundingRect().height());
|
||||
qDebug(QString("%1").arg(bRect.width()).toLatin1());
|
||||
}
|
||||
|
@ -51,14 +51,14 @@ QRectF PlayerArea::boundingRect() const
|
|||
return bRect;
|
||||
}
|
||||
|
||||
void PlayerArea::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
void PlayerArea::paint(QPainter *painter, const QStyleOptionGraphicsItem */*option*/, QWidget */*widget*/)
|
||||
{
|
||||
painter->save();
|
||||
|
||||
painter->fillRect(boundingRect(), QColor(200, 200, 200));
|
||||
|
||||
|
||||
painter->setFont(QFont("Times", 16, QFont::Bold));
|
||||
painter->setPen(QPen(QColor("black")));
|
||||
painter->setPen(QPen(Qt::black));
|
||||
painter->drawText(QRectF(0, 0, CARD_WIDTH + 60, 40), Qt::AlignCenter, player->getName());
|
||||
|
||||
painter->restore();
|
||||
|
@ -99,7 +99,7 @@ void PlayerArea::clearCounters()
|
|||
void PlayerArea::rearrangeCounters()
|
||||
{
|
||||
const int counterAreaWidth = 55;
|
||||
int y = 50;
|
||||
qreal y = 50;
|
||||
for (int i = 0; i < counterList.size(); i++) {
|
||||
Counter *temp = counterList.at(i);
|
||||
QRectF br = temp->boundingRect();
|
||||
|
|
|
@ -188,7 +188,7 @@ void MainWindow::createActions()
|
|||
connect(aDeckEditor, SIGNAL(triggered()), this, SLOT(actDeckEditor()));
|
||||
aExit = new QAction(tr("&Exit"), this);
|
||||
connect(aExit, SIGNAL(triggered()), this, SLOT(actExit()));
|
||||
|
||||
|
||||
aCloseMostRecentZoneView = new QAction(tr("Close most recent zone view"), this);
|
||||
aCloseMostRecentZoneView->setShortcut(tr("Esc"));
|
||||
connect(aCloseMostRecentZoneView, SIGNAL(triggered()), zoneLayout, SLOT(closeMostRecentZoneView()));
|
||||
|
@ -225,7 +225,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
int cardCount = db->loadFromFile("../cards.dat");
|
||||
qDebug(QString("%1 cards loaded").arg(cardCount).toLatin1());
|
||||
|
||||
scene = new QGraphicsScene(0, 0, 952, 1020, this);
|
||||
scene = new QGraphicsScene(0, 0, 952, 1024, this);
|
||||
view = new GameView(scene);
|
||||
|
||||
// view->setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
|
||||
|
|
Loading…
Reference in a new issue