From 46f91f69c4aecbd3fee3b252d4db228ff77690a0 Mon Sep 17 00:00:00 2001 From: Max-Wilhelm Bruker Date: Sat, 4 Apr 2009 01:54:20 +0200 Subject: [PATCH] foo --- cockatrice/src/game.cpp | 8 +++----- cockatrice/src/handzone.cpp | 2 +- cockatrice/src/tablezone.cpp | 2 +- cockatrice/src/window.cpp | 17 ++++++++++++----- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/cockatrice/src/game.cpp b/cockatrice/src/game.cpp index 9ef604ce..f3db3107 100644 --- a/cockatrice/src/game.cpp +++ b/cockatrice/src/game.cpp @@ -250,7 +250,8 @@ void Game::actSetLife() { bool ok; int life = QInputDialog::getInteger(0, tr("Set life"), tr("New life total:"), localPlayer->getCounters()->findCounter("life")->getValue(), 0, 2000000000, 1, &ok); - client->setCounter("life", life); + if (ok) + client->setCounter("life", life); } void Game::actShuffle() @@ -281,10 +282,7 @@ void Game::actDrawCards() void Game::actCreateToken() { QString cardname = QInputDialog::getText(0, tr("Create token"), tr("Name:")); - if (!db->getCard(cardname)) - QMessageBox::critical(0, "Error", "No such card"); - else - client->createToken("table", cardname, QString(), 0, 0); + client->createToken("table", cardname, QString(), 0, 0); } void Game::showCardMenu(QPoint p) diff --git a/cockatrice/src/handzone.cpp b/cockatrice/src/handzone.cpp index c90ea7eb..abc43d41 100644 --- a/cockatrice/src/handzone.cpp +++ b/cockatrice/src/handzone.cpp @@ -11,7 +11,7 @@ HandZone::HandZone(Player *_p, QGraphicsItem *parent) QRectF HandZone::boundingRect() const { - return QRectF(0, 0, 100, 500); + return QRectF(0, 0, 100, 510); } void HandZone::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) diff --git a/cockatrice/src/tablezone.cpp b/cockatrice/src/tablezone.cpp index 2576315b..2b732515 100644 --- a/cockatrice/src/tablezone.cpp +++ b/cockatrice/src/tablezone.cpp @@ -4,7 +4,7 @@ #include "client.h" TableZone::TableZone(Player *_p, QGraphicsItem *parent) - : CardZone(_p, "table", parent), width(700), height(500) + : CardZone(_p, "table", parent), width(720), height(510) { cards = new CardList(true); hasCardAttr = true; diff --git a/cockatrice/src/window.cpp b/cockatrice/src/window.cpp index cc72b68c..d36b8e6c 100644 --- a/cockatrice/src/window.cpp +++ b/cockatrice/src/window.cpp @@ -114,11 +114,16 @@ void MainWindow::updateSceneSize() { QRectF sr = scene->sceneRect(); QSizeF zoneSize = zoneLayout->size(); - qDebug(QString("updateSceneSize: width=%1").arg(912 + zoneSize.width()).toLatin1()); - scene->setSceneRect(sr.x(), sr.y(), 912 + zoneSize.width(), sr.height()); + qDebug(QString("updateSceneSize: width=%1").arg(932 + zoneSize.width()).toLatin1()); + scene->setSceneRect(sr.x(), sr.y(), 932 + zoneSize.width(), sr.height()); view->scaleToScene(); } +void MainWindow::textChanged(const QString &text) +{ + sayButton->setEnabled(!text.isEmpty()); +} + // Knöpfe void MainWindow::buttonSay() @@ -199,13 +204,13 @@ MainWindow::MainWindow(QWidget *parent) int cardCount = db->loadFromFile("../cards.dat"); qDebug(QString("%1 cards loaded").arg(cardCount).toLatin1()); - scene = new QGraphicsScene(0, 0, 912, 1000, this); + scene = new QGraphicsScene(0, 0, 932, 1020, this); view = new GameView(scene); // view->setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers))); zoneLayout = new ZoneViewLayout(db); - zoneLayout->setPos(912, 0); + zoneLayout->setPos(932, 0); scene->addItem(zoneLayout); connect(zoneLayout, SIGNAL(sizeChanged()), this, SLOT(updateSceneSize())); @@ -213,6 +218,7 @@ MainWindow::MainWindow(QWidget *parent) messageLog = new MessageLogWidget; sayEdit = new QLineEdit; sayButton = new QPushButton(tr("&Say")); + sayButton->setEnabled(false); QHBoxLayout *hLayout = new QHBoxLayout; hLayout->addWidget(sayEdit); @@ -232,7 +238,8 @@ MainWindow::MainWindow(QWidget *parent) centralWidget->setLayout(mainLayout); setCentralWidget(centralWidget); - connect(sayEdit, SIGNAL(returnPressed()), this, SLOT(buttonSay())); + connect(sayEdit, SIGNAL(returnPressed()), sayButton, SLOT(click())); + connect(sayEdit, SIGNAL(textChanged(const QString &)), this, SLOT(textChanged(const QString &))); connect(sayButton, SIGNAL(clicked()), this, SLOT(buttonSay())); client = new Client(this);