changed some hotkeys
This commit is contained in:
parent
6a537979d0
commit
7f0f6c6212
3 changed files with 20 additions and 24 deletions
|
@ -9,7 +9,7 @@ GameSelector::GameSelector(Client *_client, QWidget *parent)
|
||||||
gameListModel = new GamesModel(this);
|
gameListModel = new GamesModel(this);
|
||||||
gameListView->setModel(gameListModel);
|
gameListView->setModel(gameListModel);
|
||||||
|
|
||||||
createButton = new QPushButton(tr("&Create"));
|
createButton = new QPushButton(tr("C&reate"));
|
||||||
joinButton = new QPushButton(tr("&Join"));
|
joinButton = new QPushButton(tr("&Join"));
|
||||||
QHBoxLayout *buttonLayout = new QHBoxLayout;
|
QHBoxLayout *buttonLayout = new QHBoxLayout;
|
||||||
buttonLayout->addStretch();
|
buttonLayout->addStretch();
|
||||||
|
|
|
@ -60,6 +60,7 @@ void MainWindow::statusChanged(ProtocolStatus _status)
|
||||||
break;
|
break;
|
||||||
case StatusDisconnected:
|
case StatusDisconnected:
|
||||||
if (game) {
|
if (game) {
|
||||||
|
zoneLayout->clear();
|
||||||
delete game;
|
delete game;
|
||||||
game = 0;
|
game = 0;
|
||||||
}
|
}
|
||||||
|
@ -72,6 +73,14 @@ void MainWindow::statusChanged(ProtocolStatus _status)
|
||||||
aDisconnect->setEnabled(true);
|
aDisconnect->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case StatusIdle: {
|
case StatusIdle: {
|
||||||
|
if (game) {
|
||||||
|
zoneLayout->clear();
|
||||||
|
delete game;
|
||||||
|
game = 0;
|
||||||
|
}
|
||||||
|
aRestartGame->setEnabled(false);
|
||||||
|
aLeaveGame->setEnabled(false);
|
||||||
|
|
||||||
GameSelector *gameSelector = new GameSelector(client);
|
GameSelector *gameSelector = new GameSelector(client);
|
||||||
viewLayout->insertWidget(0, gameSelector);
|
viewLayout->insertWidget(0, gameSelector);
|
||||||
}
|
}
|
||||||
|
@ -104,12 +113,7 @@ void MainWindow::actRestartGame()
|
||||||
|
|
||||||
void MainWindow::actLeaveGame()
|
void MainWindow::actLeaveGame()
|
||||||
{
|
{
|
||||||
zoneLayout->clear();
|
|
||||||
client->leaveGame();
|
client->leaveGame();
|
||||||
delete game;
|
|
||||||
game = 0;
|
|
||||||
aRestartGame->setEnabled(false);
|
|
||||||
aLeaveGame->setEnabled(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::actDeckEditor()
|
void MainWindow::actDeckEditor()
|
||||||
|
@ -140,15 +144,11 @@ void MainWindow::updateSceneSize()
|
||||||
view->fitInView(scene->sceneRect(), Qt::KeepAspectRatio);
|
view->fitInView(scene->sceneRect(), Qt::KeepAspectRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::textChanged(const QString &text)
|
void MainWindow::actSay()
|
||||||
{
|
|
||||||
sayButton->setEnabled(!text.isEmpty());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Knöpfe
|
|
||||||
|
|
||||||
void MainWindow::buttonSay()
|
|
||||||
{
|
{
|
||||||
|
if (sayEdit->text().isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
client->say(sayEdit->text());
|
client->say(sayEdit->text());
|
||||||
sayEdit->clear();
|
sayEdit->clear();
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ void MainWindow::createActions()
|
||||||
aDeckEditor = new QAction(tr("&Deck editor"), this);
|
aDeckEditor = new QAction(tr("&Deck editor"), this);
|
||||||
connect(aDeckEditor, SIGNAL(triggered()), this, SLOT(actDeckEditor()));
|
connect(aDeckEditor, SIGNAL(triggered()), this, SLOT(actDeckEditor()));
|
||||||
aFullScreen = new QAction(tr("&Full screen"), this);
|
aFullScreen = new QAction(tr("&Full screen"), this);
|
||||||
aFullScreen->setShortcut(tr("Ctrl+F4"));
|
aFullScreen->setShortcut(tr("Ctrl+F"));
|
||||||
aFullScreen->setCheckable(true);
|
aFullScreen->setCheckable(true);
|
||||||
connect(aFullScreen, SIGNAL(toggled(bool)), this, SLOT(actFullScreen(bool)));
|
connect(aFullScreen, SIGNAL(toggled(bool)), this, SLOT(actFullScreen(bool)));
|
||||||
aExit = new QAction(tr("&Exit"), this);
|
aExit = new QAction(tr("&Exit"), this);
|
||||||
|
@ -244,13 +244,13 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
|
|
||||||
cardInfo = new CardInfoWidget(db);
|
cardInfo = new CardInfoWidget(db);
|
||||||
messageLog = new MessageLogWidget;
|
messageLog = new MessageLogWidget;
|
||||||
|
QLabel *sayLabel = new QLabel(tr("&Say:"));
|
||||||
sayEdit = new QLineEdit;
|
sayEdit = new QLineEdit;
|
||||||
sayButton = new QPushButton(tr("&Say"));
|
sayLabel->setBuddy(sayEdit);
|
||||||
sayButton->setEnabled(false);
|
|
||||||
|
|
||||||
QHBoxLayout *hLayout = new QHBoxLayout;
|
QHBoxLayout *hLayout = new QHBoxLayout;
|
||||||
|
hLayout->addWidget(sayLabel);
|
||||||
hLayout->addWidget(sayEdit);
|
hLayout->addWidget(sayEdit);
|
||||||
hLayout->addWidget(sayButton);
|
|
||||||
|
|
||||||
QVBoxLayout *verticalLayout = new QVBoxLayout;
|
QVBoxLayout *verticalLayout = new QVBoxLayout;
|
||||||
verticalLayout->addWidget(cardInfo);
|
verticalLayout->addWidget(cardInfo);
|
||||||
|
@ -268,9 +268,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
centralWidget->setLayout(mainLayout);
|
centralWidget->setLayout(mainLayout);
|
||||||
setCentralWidget(centralWidget);
|
setCentralWidget(centralWidget);
|
||||||
|
|
||||||
connect(sayEdit, SIGNAL(returnPressed()), sayButton, SLOT(click()));
|
connect(sayEdit, SIGNAL(returnPressed()), this, SLOT(actSay()));
|
||||||
connect(sayEdit, SIGNAL(textChanged(const QString &)), this, SLOT(textChanged(const QString &)));
|
|
||||||
connect(sayButton, SIGNAL(clicked()), this, SLOT(buttonSay()));
|
|
||||||
|
|
||||||
client = new Client(this);
|
client = new Client(this);
|
||||||
connect(client, SIGNAL(serverTimeout()), this, SLOT(serverTimeout()));
|
connect(client, SIGNAL(serverTimeout()), this, SLOT(serverTimeout()));
|
||||||
|
|
|
@ -48,8 +48,7 @@ private slots:
|
||||||
void playerIdReceived(int id, QString name);
|
void playerIdReceived(int id, QString name);
|
||||||
void serverTimeout();
|
void serverTimeout();
|
||||||
|
|
||||||
void textChanged(const QString &text);
|
void actSay();
|
||||||
void buttonSay();
|
|
||||||
|
|
||||||
void actConnect();
|
void actConnect();
|
||||||
void actDisconnect();
|
void actDisconnect();
|
||||||
|
@ -74,7 +73,6 @@ private:
|
||||||
CardInfoWidget *cardInfo;
|
CardInfoWidget *cardInfo;
|
||||||
MessageLogWidget *messageLog;
|
MessageLogWidget *messageLog;
|
||||||
QLineEdit *sayEdit;
|
QLineEdit *sayEdit;
|
||||||
QPushButton *sayButton;
|
|
||||||
|
|
||||||
Client *client;
|
Client *client;
|
||||||
QGraphicsScene *scene;
|
QGraphicsScene *scene;
|
||||||
|
|
Loading…
Reference in a new issue