initial commit for chat channels

This commit is contained in:
Max-Wilhelm Bruker 2009-08-22 19:34:48 +02:00
parent 0d84de2384
commit 947cd1736c
23 changed files with 408 additions and 66 deletions

View file

@ -27,18 +27,13 @@ GameSelector::GameSelector(Client *_client, QWidget *parent)
connect(createButton, SIGNAL(clicked()), this, SLOT(actCreate()));
connect(joinButton, SIGNAL(clicked()), this, SLOT(actJoin()));
connect(client, SIGNAL(gameListEvent(ServerGame *)), gameListModel, SLOT(updateGameList(ServerGame *)));
connect(client, SIGNAL(statusChanged(ProtocolStatus)), this, SLOT(statusChanged(ProtocolStatus)));
client->listGames();
}
void GameSelector::actCreate()
{
DlgCreateGame dlg(client, this);
if (dlg.exec())
deleteLater();
disableGameList();
}
void GameSelector::actRefresh()
@ -49,7 +44,7 @@ void GameSelector::actRefresh()
void GameSelector::statusChanged(ProtocolStatus status)
{
if (status == StatusDisconnected)
deleteLater();
disableGameList();
}
void GameSelector::checkResponse(ServerResponse response)
@ -58,7 +53,7 @@ void GameSelector::checkResponse(ServerResponse response)
joinButton->setEnabled(true);
if (response == RespOk)
deleteLater();
disableGameList();
else {
QMessageBox::critical(this, tr("Error"), tr("XXX"));
return;
@ -84,3 +79,18 @@ void GameSelector::actJoin()
createButton->setEnabled(false);
joinButton->setEnabled(false);
}
void GameSelector::enableGameList()
{
connect(client, SIGNAL(gameListEvent(ServerGame *)), gameListModel, SLOT(updateGameList(ServerGame *)));
connect(client, SIGNAL(statusChanged(ProtocolStatus)), this, SLOT(statusChanged(ProtocolStatus)));
client->listGames();
show();
}
void GameSelector::disableGameList()
{
disconnect(client, 0, this, 0);
hide();
gameListModel->cleanList();
}