This commit is contained in:
Max-Wilhelm Bruker 2009-04-04 01:54:20 +02:00
parent 16631712c7
commit 46f91f69c4
4 changed files with 17 additions and 12 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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;

View file

@ -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);