diff --git a/cockatrice/src/game.cpp b/cockatrice/src/game.cpp index 2c00603d..93c7ddf9 100644 --- a/cockatrice/src/game.cpp +++ b/cockatrice/src/game.cpp @@ -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)), this, SLOT(playerListReceived(QList))); @@ -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())); diff --git a/cockatrice/src/handzone.cpp b/cockatrice/src/handzone.cpp index c153d1ba..89a9529a 100644 --- a/cockatrice/src/handzone.cpp +++ b/cockatrice/src/handzone.cpp @@ -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(); diff --git a/cockatrice/src/playerarea.cpp b/cockatrice/src/playerarea.cpp index 76f7e61b..1b52b330 100644 --- a/cockatrice/src/playerarea.cpp +++ b/cockatrice/src/playerarea.cpp @@ -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(); diff --git a/cockatrice/src/window_main.cpp b/cockatrice/src/window_main.cpp index 2de1de6c..4fd36867 100644 --- a/cockatrice/src/window_main.cpp +++ b/cockatrice/src/window_main.cpp @@ -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)));