foo
This commit is contained in:
parent
16631712c7
commit
46f91f69c4
4 changed files with 17 additions and 12 deletions
|
@ -250,7 +250,8 @@ void Game::actSetLife()
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
int life = QInputDialog::getInteger(0, tr("Set life"), tr("New life total:"), localPlayer->getCounters()->findCounter("life")->getValue(), 0, 2000000000, 1, &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()
|
void Game::actShuffle()
|
||||||
|
@ -281,10 +282,7 @@ void Game::actDrawCards()
|
||||||
void Game::actCreateToken()
|
void Game::actCreateToken()
|
||||||
{
|
{
|
||||||
QString cardname = QInputDialog::getText(0, tr("Create token"), tr("Name:"));
|
QString cardname = QInputDialog::getText(0, tr("Create token"), tr("Name:"));
|
||||||
if (!db->getCard(cardname))
|
client->createToken("table", cardname, QString(), 0, 0);
|
||||||
QMessageBox::critical(0, "Error", "No such card");
|
|
||||||
else
|
|
||||||
client->createToken("table", cardname, QString(), 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::showCardMenu(QPoint p)
|
void Game::showCardMenu(QPoint p)
|
||||||
|
|
|
@ -11,7 +11,7 @@ HandZone::HandZone(Player *_p, QGraphicsItem *parent)
|
||||||
|
|
||||||
QRectF HandZone::boundingRect() const
|
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)
|
void HandZone::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
|
||||||
TableZone::TableZone(Player *_p, QGraphicsItem *parent)
|
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);
|
cards = new CardList(true);
|
||||||
hasCardAttr = true;
|
hasCardAttr = true;
|
||||||
|
|
|
@ -114,11 +114,16 @@ void MainWindow::updateSceneSize()
|
||||||
{
|
{
|
||||||
QRectF sr = scene->sceneRect();
|
QRectF sr = scene->sceneRect();
|
||||||
QSizeF zoneSize = zoneLayout->size();
|
QSizeF zoneSize = zoneLayout->size();
|
||||||
qDebug(QString("updateSceneSize: width=%1").arg(912 + zoneSize.width()).toLatin1());
|
qDebug(QString("updateSceneSize: width=%1").arg(932 + zoneSize.width()).toLatin1());
|
||||||
scene->setSceneRect(sr.x(), sr.y(), 912 + zoneSize.width(), sr.height());
|
scene->setSceneRect(sr.x(), sr.y(), 932 + zoneSize.width(), sr.height());
|
||||||
view->scaleToScene();
|
view->scaleToScene();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::textChanged(const QString &text)
|
||||||
|
{
|
||||||
|
sayButton->setEnabled(!text.isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
// Knöpfe
|
// Knöpfe
|
||||||
|
|
||||||
void MainWindow::buttonSay()
|
void MainWindow::buttonSay()
|
||||||
|
@ -199,13 +204,13 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
int cardCount = db->loadFromFile("../cards.dat");
|
int cardCount = db->loadFromFile("../cards.dat");
|
||||||
qDebug(QString("%1 cards loaded").arg(cardCount).toLatin1());
|
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 = new GameView(scene);
|
||||||
|
|
||||||
// view->setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
|
// view->setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
|
||||||
|
|
||||||
zoneLayout = new ZoneViewLayout(db);
|
zoneLayout = new ZoneViewLayout(db);
|
||||||
zoneLayout->setPos(912, 0);
|
zoneLayout->setPos(932, 0);
|
||||||
scene->addItem(zoneLayout);
|
scene->addItem(zoneLayout);
|
||||||
connect(zoneLayout, SIGNAL(sizeChanged()), this, SLOT(updateSceneSize()));
|
connect(zoneLayout, SIGNAL(sizeChanged()), this, SLOT(updateSceneSize()));
|
||||||
|
|
||||||
|
@ -213,6 +218,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
messageLog = new MessageLogWidget;
|
messageLog = new MessageLogWidget;
|
||||||
sayEdit = new QLineEdit;
|
sayEdit = new QLineEdit;
|
||||||
sayButton = new QPushButton(tr("&Say"));
|
sayButton = new QPushButton(tr("&Say"));
|
||||||
|
sayButton->setEnabled(false);
|
||||||
|
|
||||||
QHBoxLayout *hLayout = new QHBoxLayout;
|
QHBoxLayout *hLayout = new QHBoxLayout;
|
||||||
hLayout->addWidget(sayEdit);
|
hLayout->addWidget(sayEdit);
|
||||||
|
@ -232,7 +238,8 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
centralWidget->setLayout(mainLayout);
|
centralWidget->setLayout(mainLayout);
|
||||||
setCentralWidget(centralWidget);
|
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()));
|
connect(sayButton, SIGNAL(clicked()), this, SLOT(buttonSay()));
|
||||||
|
|
||||||
client = new Client(this);
|
client = new Client(this);
|
||||||
|
|
Loading…
Reference in a new issue