From 4647ceb452bc37e22652e387f63cec8176f1ab5c Mon Sep 17 00:00:00 2001 From: doitux Date: Thu, 24 Oct 2013 09:12:51 +0200 Subject: [PATCH] gui preparation for allow spectators flag #215 --- src/config/configfile.cpp | 3 +- src/gui/qt/aboutpokerth/aboutpokerthimpl.cpp | 2 +- src/gui/qt/createinternetgamedialog.ui | 53 +++- .../createinternetgamedialogimpl.cpp | 10 +- .../gamelobbydialog/gamelobbydialogimpl.cpp | 3 +- .../createinternetgamedialog_800x480.ui | 241 ++++++++++-------- .../qt/gui_800x480/settingsdialog_800x480.ui | 27 +- src/gui/qt/settingsdialog.ui | 9 +- .../qt/settingsdialog/settingsdialogimpl.cpp | 3 +- src/gui/qt/startwindow/startwindowimpl.cpp | 2 +- 10 files changed, 212 insertions(+), 141 deletions(-) diff --git a/src/config/configfile.cpp b/src/config/configfile.cpp index f6285dbe..3d9d1e74 100644 --- a/src/config/configfile.cpp +++ b/src/config/configfile.cpp @@ -64,7 +64,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly) myConfigState = OK; // !!!! Revisionsnummer der Configdefaults !!!!! - configRev = 102; + configRev = 103; //standard defaults logOnOffDefault = "1"; @@ -242,6 +242,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly) configList.push_back(ConfigInfo("InternetGamePassword", CONFIG_TYPE_STRING, "")); configList.push_back(ConfigInfo("InternetGameType", CONFIG_TYPE_INT, "0")); configList.push_back(ConfigInfo("InternetGameName", CONFIG_TYPE_STRING, "My Online Game")); + configList.push_back(ConfigInfo("InternetGameAllowSpectators", CONFIG_TYPE_INT, "1")); configList.push_back(ConfigInfo("UseLobbyChat", CONFIG_TYPE_INT, "1")); configList.push_back(ConfigInfo("UseAdminIRC", CONFIG_TYPE_INT, "0")); configList.push_back(ConfigInfo("AdminIRCServerAddress", CONFIG_TYPE_STRING, "chat.freenode.net")); diff --git a/src/gui/qt/aboutpokerth/aboutpokerthimpl.cpp b/src/gui/qt/aboutpokerth/aboutpokerthimpl.cpp index d342c14e..71f38cdd 100755 --- a/src/gui/qt/aboutpokerth/aboutpokerthimpl.cpp +++ b/src/gui/qt/aboutpokerth/aboutpokerthimpl.cpp @@ -35,7 +35,7 @@ #ifdef ANDROID #ifndef ANDROID_TEST -#include "QtGui/5.1.1/QtGui/qpa/qplatformnativeinterface.h" +#include "QtGui/5.2.0/QtGui/qpa/qplatformnativeinterface.h" #include #endif #endif diff --git a/src/gui/qt/createinternetgamedialog.ui b/src/gui/qt/createinternetgamedialog.ui index f676c8f3..1fa3d32e 100644 --- a/src/gui/qt/createinternetgamedialog.ui +++ b/src/gui/qt/createinternetgamedialog.ui @@ -6,8 +6,8 @@ 0 0 - 303 - 390 + 293 + 410 @@ -100,7 +100,16 @@ 6 - + + 0 + + + 0 + + + 0 + + 0 @@ -126,14 +135,14 @@ - + Qt::Horizontal - + Maximum number of players: @@ -143,7 +152,7 @@ - + 2 @@ -156,7 +165,7 @@ - + Start Cash: @@ -166,7 +175,7 @@ - + @@ -188,7 +197,7 @@ - + Blinds @@ -217,7 +226,7 @@ - + @@ -233,7 +242,7 @@ - + s @@ -249,7 +258,7 @@ - + Delay between hands: @@ -259,7 +268,7 @@ - + @@ -281,6 +290,13 @@ + + + + Allow spectators to watch the game + + + @@ -289,7 +305,16 @@ 6 - + + 0 + + + 0 + + + 0 + + 0 diff --git a/src/gui/qt/createinternetgamedialog/createinternetgamedialogimpl.cpp b/src/gui/qt/createinternetgamedialog/createinternetgamedialogimpl.cpp index 0ae6fe04..7254ab23 100644 --- a/src/gui/qt/createinternetgamedialog/createinternetgamedialogimpl.cpp +++ b/src/gui/qt/createinternetgamedialog/createinternetgamedialogimpl.cpp @@ -164,6 +164,8 @@ void createInternetGameDialogImpl::gameTypeChanged() radioButton_changeBlindsSettings->show(); startBlind->hide(); raiseMode->hide(); + checkBox_allowSpectators->setEnabled(true); + checkBox_allowSpectators->setChecked(myConfig->readConfigInt("InternetGameAllowSpectators")); } break; @@ -177,6 +179,8 @@ void createInternetGameDialogImpl::gameTypeChanged() radioButton_changeBlindsSettings->show(); startBlind->hide(); raiseMode->hide(); + checkBox_allowSpectators->setEnabled(true); + checkBox_allowSpectators->setChecked(myConfig->readConfigInt("InternetGameAllowSpectators")); } break; case GAME_TYPE_INVITE_ONLY-1: { @@ -190,7 +194,8 @@ void createInternetGameDialogImpl::gameTypeChanged() radioButton_changeBlindsSettings->show(); startBlind->hide(); raiseMode->hide(); - + checkBox_allowSpectators->setEnabled(true); + checkBox_allowSpectators->setChecked(myConfig->readConfigInt("InternetGameAllowSpectators")); } break; case GAME_TYPE_RANKING-1: { @@ -205,7 +210,8 @@ void createInternetGameDialogImpl::gameTypeChanged() radioButton_changeBlindsSettings->hide(); startBlind->show(); raiseMode->show(); - + checkBox_allowSpectators->setDisabled(true); + checkBox_allowSpectators->setChecked(true); } break; } diff --git a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp index 0b9ab25e..5e55f775 100644 --- a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp +++ b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp @@ -382,10 +382,9 @@ void gameLobbyDialogImpl::createGame() label_SmallBlind->setText(QString("%L1").arg(gameData.firstSmallBlind)); label_StartCash->setText(QString("%L1").arg(gameData.startMoney)); - updateDialogBlinds(gameData); - label_GameTiming->setText(QString::number(gameData.playerActionTimeoutSec)+" "+tr("sec (action)")+"\n"+QString::number(gameData.delayBetweenHandsSec)+" "+tr("sec (hand delay)")); +// TODO gameData.allowSpectators = myCreateInternetGameDialog->checkBox_allowSpectators->isChecked(); mySession->clientCreateGame(gameData, currentGameName.toUtf8().constData(), myCreateInternetGameDialog->lineEdit_Password->text().toUtf8().constData()); diff --git a/src/gui/qt/gui_800x480/createinternetgamedialog_800x480.ui b/src/gui/qt/gui_800x480/createinternetgamedialog_800x480.ui index dac0424f..6b6d395f 100644 --- a/src/gui/qt/gui_800x480/createinternetgamedialog_800x480.ui +++ b/src/gui/qt/gui_800x480/createinternetgamedialog_800x480.ui @@ -85,45 +85,45 @@ 0 - 7 + 4 - - + + - + 0 0 - - - - Default game name: + Maximum number of players: - + + + + 0 + 0 + + - 400 + 150 0 - - - 16777215 - 16777215 - + + 2 - - Qt::ImhNoPredictiveText + + 10 - - 48 + + 10 @@ -198,7 +198,7 @@ - + Blinds @@ -233,7 +233,7 @@ - + 10 @@ -298,7 +298,103 @@ - + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + Password: + + + + 32 + 32 + + + + + + + + false + + + + 400 + 0 + + + + QLineEdit::Password + + + + + + + + + + + + 0 + 0 + + + + + + + Default game name: + + + + + + + + 400 + 0 + + + + + 16777215 + 16777215 + + + + Qt::ImhNoPredictiveText + + + 48 + + + + + + @@ -349,92 +445,12 @@ - - - - 6 - - - 0 - - - - - - 0 - 0 - - - - Password: - - - - 32 - 32 - - - - - - - - false - - - - 400 - 0 - - - - QLineEdit::Password - - - - - - - - - - - 0 - 0 - - - - Maximum number of players: - - - - - - - - 0 - 0 - - - - - 150 - 0 - - - - 2 - - - 10 - - - 10 - - - - + + + Allow spectators to watch the game + + @@ -472,7 +488,16 @@ 0 - + + 0 + + + 0 + + + 0 + + 0 diff --git a/src/gui/qt/gui_800x480/settingsdialog_800x480.ui b/src/gui/qt/gui_800x480/settingsdialog_800x480.ui index 80b45ad0..54a1f2d5 100644 --- a/src/gui/qt/gui_800x480/settingsdialog_800x480.ui +++ b/src/gui/qt/gui_800x480/settingsdialog_800x480.ui @@ -1835,7 +1835,7 @@ p, li { white-space: pre-wrap; } - 1 + 0 @@ -2075,6 +2075,20 @@ p, li { white-space: pre-wrap; } + + + + Show lobby chat + + + + + + + Automatically leave the table after the game finished + + + @@ -2161,16 +2175,9 @@ p, li { white-space: pre-wrap; } - + - Show lobby chat - - - - - - - Automatically leave the table after the game finished + Allow spectators to watch the game diff --git a/src/gui/qt/settingsdialog.ui b/src/gui/qt/settingsdialog.ui index a6626c07..71067bcb 100644 --- a/src/gui/qt/settingsdialog.ui +++ b/src/gui/qt/settingsdialog.ui @@ -1885,7 +1885,7 @@ p, li { white-space: pre-wrap; } - + Qt::Vertical @@ -1905,6 +1905,13 @@ p, li { white-space: pre-wrap; } + + + + Allow spectators to watch the game + + + diff --git a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp index f764530a..27f4c528 100644 --- a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp +++ b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp @@ -273,6 +273,7 @@ void settingsDialogImpl::prepareDialog() QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget_internetGameIgnoredPlayers); item->setText(0, QString::fromUtf8(it5->c_str())); } + checkBox_allowSpectators->setChecked(myConfig->readConfigInt("InternetGameAllowSpectators")); //Interface comboBox_switchLanguage->setCurrentIndex(comboBox_switchLanguage->findData(QString::fromUtf8(myConfig->readConfigString("Language").c_str()).section('_', 0, 0))); @@ -721,7 +722,7 @@ void settingsDialogImpl::isAccepted() playerIgnoreList.push_back(QString("%1").arg(treeWidget_internetGameIgnoredPlayers->topLevelItem(k)->text(0)).toUtf8().constData()); } myConfig->writeConfigStringList("PlayerIgnoreList", playerIgnoreList); - + myConfig->writeConfigInt("InternetGameAllowSpectators", checkBox_allowSpectators->isChecked()); // Interface myConfig->writeConfigString("Language", comboBox_switchLanguage->itemData(comboBox_switchLanguage->currentIndex()).toString().toUtf8().constData()); diff --git a/src/gui/qt/startwindow/startwindowimpl.cpp b/src/gui/qt/startwindow/startwindowimpl.cpp index 41004c23..8c4149dc 100644 --- a/src/gui/qt/startwindow/startwindowimpl.cpp +++ b/src/gui/qt/startwindow/startwindowimpl.cpp @@ -61,7 +61,7 @@ #ifdef ANDROID #ifndef ANDROID_TEST -#include "QtGui/5.1.1/QtGui/qpa/qplatformnativeinterface.h" +#include "QtGui/5.2.0/QtGui/qpa/qplatformnativeinterface.h" #include #endif #endif