add changeInternetGame dialog

This commit is contained in:
doitux
2010-07-14 08:43:51 +00:00
parent 7899f66cf6
commit 7625279035
6 changed files with 200 additions and 31 deletions
+19 -10
View File
@@ -42,7 +42,7 @@
#include "connecttoserverdialogimpl.h"
#include "createnetworkgamedialogimpl.h"
#include "startnetworkgamedialogimpl.h"
#include "changehumanplayernamedialogimpl.h"
#include "changecontentdialogimpl.h"
#include "changecompleteblindsdialogimpl.h"
#include "gamelobbydialogimpl.h"
#include "timeoutmsgboximpl.h"
@@ -83,7 +83,6 @@ startWindowImpl::startWindowImpl(ConfigFile *c)
myNewGameDialog = new newGameDialogImpl(this, myConfig);
mySelectAvatarDialog = new selectAvatarDialogImpl(this, myConfig);
mySettingsDialog = new settingsDialogImpl(this, myConfig, mySelectAvatarDialog);
myChangeHumanPlayerNameDialog = new changeHumanPlayerNameDialogImpl(this, myConfig);
myJoinNetworkGameDialog = new joinNetworkGameDialogImpl(this, myConfig);
myConnectToServerDialog = new connectToServerDialogImpl(this);
myStartNetworkGameDialog = new startNetworkGameDialogImpl(this, myConfig);
@@ -299,10 +298,9 @@ void startWindowImpl::callGameLobbyDialog() {
//Avoid join Lobby with "Human Player" nick
if(QString::fromUtf8(myConfig->readConfigString("MyName").c_str()) == QString("Human Player")) {
myChangeHumanPlayerNameDialog->label_Message->setText(tr("You cannot join Internet-Game-Lobby with \"Human Player\" as nickname.\nPlease choose another one."));
myChangeHumanPlayerNameDialog->exec();
if(myChangeHumanPlayerNameDialog->result() == QDialog::Accepted) {
changeContentDialogImpl dialog(this, myConfig, CHANGE_HUMAN_PLAYER_NAME);
dialog.exec();
if(dialog.result() == QDialog::Accepted) {
joinGameLobby();
}
}
@@ -716,12 +714,10 @@ void startWindowImpl::networkError(int errorID, int /*osErrorID*/) {
QMessageBox::Close); }
break;
case ERR_NET_PLAYER_NAME_IN_USE:
{ myChangeHumanPlayerNameDialog->label_Message->setText(tr("Your player name is already used by another player.\nPlease choose a different name."));
myChangeHumanPlayerNameDialog->exec(); }
{ changeContentDialogImpl dialog(this, myConfig, CHANGE_NICK_ALREADY_IN_USE); dialog.exec(); }
break;
case ERR_NET_INVALID_PLAYER_NAME:
{ myChangeHumanPlayerNameDialog->label_Message->setText(tr("The player name is too short, too long or invalid. Please choose another one."));
myChangeHumanPlayerNameDialog->exec(); }
{ changeContentDialogImpl dialog(this, myConfig, CHANGE_NICK_INVALID); dialog.exec(); }
break;
case ERR_NET_INVALID_GAME_NAME:
{ QMessageBox::warning(this, tr("Network Error"),
@@ -845,6 +841,19 @@ void startWindowImpl::networkNotification(int notificationId)
tr("Unable to join - the server has already started the game."),
QMessageBox::Close); }
break;
case NTF_NET_JOIN_NOT_INVITED:
{ QMessageBox::warning(this, tr("Network Notification"),
tr("This game is invite-only. You cannot join this game without being invited."),
QMessageBox::Close); }
break;
case NTF_NET_JOIN_GAME_NAME_IN_USE:
{ changeContentDialogImpl dialog(this, myConfig, CHANGE_INET_GAME_NAME);
dialog.exec();
if(dialog.result() == QDialog::Accepted) {
myGameLobbyDialog->pushButton_CreateGame->click();
}
}
break;
case NTF_NET_REMOVED_TIMEOUT:
{ QMessageBox::warning(this, tr("Network Notification"),
tr("Your admin state timed out due to inactivity. Feel free to create a new game!"),