GUI: guest restrictions and gametype settings in
createinternetgamedialog
This commit is contained in:
@@ -34,12 +34,12 @@ createInternetGameDialogImpl::createInternetGameDialogImpl(QWidget *parent, Conf
|
||||
|
||||
myChangeCompleteBlindsDialog = new changeCompleteBlindsDialogImpl;
|
||||
|
||||
fillFormular();
|
||||
|
||||
connect( radioButton_changeBlindsSettings, SIGNAL( clicked(bool) ), this, SLOT( callChangeBlindsDialog(bool) ) );
|
||||
connect( pushButton_cancel, SIGNAL( clicked() ), this, SLOT( cancel() ) );
|
||||
connect( pushButton_createGame, SIGNAL( clicked() ), this, SLOT( createGame() ) );
|
||||
connect( checkBox_Password, SIGNAL( toggled(bool) ), this, SLOT( clearGamePassword(bool)) );
|
||||
connect( comboBox_gameType, SIGNAL(currentIndexChanged(int)), this, SLOT( gameTypeChanged() ) );
|
||||
|
||||
//temporarely unused until ai is enabled in network
|
||||
// label_5->hide();
|
||||
// spinBox_gameSpeed->hide();
|
||||
@@ -48,9 +48,9 @@ createInternetGameDialogImpl::createInternetGameDialogImpl(QWidget *parent, Conf
|
||||
}
|
||||
|
||||
|
||||
void createInternetGameDialogImpl::exec() {
|
||||
void createInternetGameDialogImpl::exec(bool guestMode, QString playerName) {
|
||||
|
||||
fillFormular();
|
||||
fillFormular(guestMode, playerName);
|
||||
QDialog::exec();
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ void createInternetGameDialogImpl::cancel() {
|
||||
|
||||
}
|
||||
|
||||
void createInternetGameDialogImpl::fillFormular() {
|
||||
void createInternetGameDialogImpl::fillFormular(bool guestMode, QString playerName) {
|
||||
|
||||
//Network Game Settings
|
||||
spinBox_quantityPlayers->setValue(myConfig->readConfigInt("NetNumberOfPlayers"));
|
||||
@@ -99,14 +99,21 @@ void createInternetGameDialogImpl::fillFormular() {
|
||||
myChangeCompleteBlindsDialog->spinBox_afterThisAlwaysRaiseValue->setValue(myConfig->readConfigInt("NetAfterMBAlwaysRaiseValue"));
|
||||
myChangeCompleteBlindsDialog->radioButton_afterThisStayAtLastBlind->setChecked(myConfig->readConfigInt("NetAfterMBStayAtLastBlind"));
|
||||
|
||||
comboBox_gameType->setCurrentIndex(myConfig->readConfigInt("InternetGameType"));
|
||||
lineEdit_gameName->setText(QString::fromUtf8(myConfig->readConfigString("InternetGameName").c_str()));
|
||||
}
|
||||
if(guestMode) {
|
||||
comboBox_gameType->setCurrentIndex(0);
|
||||
comboBox_gameType->setDisabled(true);
|
||||
lineEdit_gameName->setText(tr("%1's game").arg(playerName));
|
||||
lineEdit_gameName->setDisabled(true);
|
||||
|
||||
void createInternetGameDialogImpl::showDialog() {
|
||||
|
||||
fillFormular();
|
||||
exec();
|
||||
}
|
||||
else {
|
||||
comboBox_gameType->setDisabled(false);
|
||||
comboBox_gameType->setCurrentIndex(myConfig->readConfigInt("InternetGameType"));
|
||||
lineEdit_gameName->setDisabled(false);
|
||||
lineEdit_gameName->setText(QString::fromUtf8(myConfig->readConfigString("InternetGameName").c_str()));
|
||||
}
|
||||
|
||||
gameTypeChanged();
|
||||
}
|
||||
|
||||
void createInternetGameDialogImpl::keyPressEvent ( QKeyEvent * event ) {
|
||||
@@ -132,3 +139,23 @@ void createInternetGameDialogImpl::callChangeBlindsDialog(bool show) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void createInternetGameDialogImpl::gameTypeChanged() {
|
||||
|
||||
switch (comboBox_gameType->currentIndex()) {
|
||||
|
||||
case 0: { checkBox_Password->setDisabled(FALSE); }
|
||||
break;
|
||||
case 1: { checkBox_Password->setDisabled(FALSE); }
|
||||
break;
|
||||
case 2: { checkBox_Password->setChecked(FALSE);
|
||||
checkBox_Password->setDisabled(TRUE);
|
||||
}
|
||||
break;
|
||||
case 3: { checkBox_Password->setChecked(FALSE);
|
||||
checkBox_Password->setDisabled(TRUE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,17 +34,17 @@ Q_OBJECT
|
||||
public:
|
||||
createInternetGameDialogImpl(QWidget *parent = 0, ConfigFile *c = 0);
|
||||
|
||||
void exec();
|
||||
void exec(bool guestMode, QString playerName);
|
||||
changeCompleteBlindsDialogImpl* getChangeCompleteBlindsDialog() { return myChangeCompleteBlindsDialog; }
|
||||
|
||||
public slots:
|
||||
|
||||
void createGame();
|
||||
void cancel();
|
||||
void fillFormular();
|
||||
void showDialog();
|
||||
void fillFormular(bool guestMode, QString playerName);
|
||||
void keyPressEvent ( QKeyEvent * event );
|
||||
void clearGamePassword(bool);
|
||||
void gameTypeChanged();
|
||||
|
||||
void callChangeBlindsDialog(bool);
|
||||
private:
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <net/socket_msg.h>
|
||||
|
||||
gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
|
||||
: QDialog(parent), myW(NULL), myStartWindow(parent), myConfig(c), currentGameName(""), myPlayerId(0), myCurrentGameId(0), isAdmin(false), inGame(false), blinkingButtonAnimationState(true), myChat(NULL), keyUpCounter(0)
|
||||
: QDialog(parent), myW(NULL), myStartWindow(parent), myConfig(c), currentGameName(""), myPlayerId(0), myCurrentGameId(0), isAdmin(false), inGame(false), guestMode(false), blinkingButtonAnimationState(true), myChat(NULL), keyUpCounter(0)
|
||||
{
|
||||
|
||||
#ifdef __APPLE__
|
||||
@@ -145,7 +145,8 @@ void gameLobbyDialogImpl::createGame()
|
||||
assert(mySession);
|
||||
|
||||
myCreateInternetGameDialog = new createInternetGameDialogImpl(this, myConfig);
|
||||
myCreateInternetGameDialog->exec();
|
||||
PlayerInfo playerInfo(mySession->getClientPlayerInfo(mySession->getClientUniquePlayerId()));
|
||||
myCreateInternetGameDialog->exec(guestMode, QString::fromUtf8(playerInfo.playerName.c_str()));
|
||||
|
||||
if (myCreateInternetGameDialog->result() == QDialog::Accepted ) {
|
||||
|
||||
@@ -1188,6 +1189,7 @@ void gameLobbyDialogImpl::registeredUserMode()
|
||||
{
|
||||
lineEdit_ChatInput->clear();
|
||||
lineEdit_ChatInput->setEnabled(true);
|
||||
guestMode = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1195,4 +1197,5 @@ void gameLobbyDialogImpl::guestUserMode()
|
||||
{
|
||||
lineEdit_ChatInput->setText("Chat is avaiable only for registered members");
|
||||
lineEdit_ChatInput->setDisabled(true);
|
||||
guestMode = true;
|
||||
}
|
||||
|
||||
@@ -130,6 +130,7 @@ private:
|
||||
unsigned myCurrentGameId;
|
||||
bool isAdmin;
|
||||
bool inGame;
|
||||
bool guestMode;
|
||||
|
||||
QString myAppDataPath;
|
||||
QMessageBox *waitStartGameMsgBox;
|
||||
|
||||
Reference in New Issue
Block a user