From 1d5aa18b1b6a2afb7e0e5ee230afa6edc59b5b73 Mon Sep 17 00:00:00 2001 From: doitux Date: Wed, 23 Apr 2008 23:15:12 +0000 Subject: [PATCH] adds two new config variables for automatic server configuration (serverlist) --- src/config/configfile.cpp | 12 +- src/gui/qt/settingsdialog.ui | 789 ++++++++++++------ .../qt/settingsdialog/settingsdialogimpl.cpp | 15 + .../qt/settingsdialog/settingsdialogimpl.h | 3 + 4 files changed, 541 insertions(+), 278 deletions(-) diff --git a/src/config/configfile.cpp b/src/config/configfile.cpp index d4c20da9..004dd1eb 100644 --- a/src/config/configfile.cpp +++ b/src/config/configfile.cpp @@ -48,7 +48,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly) myQtToolsInterface = CreateQtToolsWrapper(); // !!!! Revisionsnummer der Configdefaults !!!!! - configRev = 52; + configRev = 54; //standard defaults logOnOffDefault = "1"; @@ -132,7 +132,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly) configList.push_back(ConfigInfo("ConfigRevision", CONFIG_TYPE_INT, tempIntToString.str())); configList.push_back(ConfigInfo("AppDataDir", CONFIG_TYPE_STRING, myQtToolsInterface->getDataPathStdString(myArgv0))); configList.push_back(ConfigInfo("Language", CONFIG_TYPE_INT, myQtToolsInterface->getDefaultLanguage())); - configList.push_back(ConfigInfo("InternetServerAddressIRCChannelUpdateDone", CONFIG_TYPE_INT, "1")); //HACK + /*configList.push_back(ConfigInfo("InternetServerAddressIRCChannelUpdateDone", CONFIG_TYPE_INT, "1"));*/ //HACK configList.push_back(ConfigInfo("ShowLeftToolBox", CONFIG_TYPE_INT, "1")); configList.push_back(ConfigInfo("ShowRightToolBox", CONFIG_TYPE_INT, "1")); configList.push_back(ConfigInfo("ShowStatusbarMessages", CONFIG_TYPE_INT, "1")); @@ -188,6 +188,8 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly) configList.push_back(ConfigInfo("ServerUseIpv6", CONFIG_TYPE_INT, "0")); configList.push_back(ConfigInfo("ServerUseSctp", CONFIG_TYPE_INT, "0")); configList.push_back(ConfigInfo("ServerPort", CONFIG_TYPE_INT, "7234")); + configList.push_back(ConfigInfo("InternetServerConfigMode", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("InternetServerListAddress", CONFIG_TYPE_STRING, "pokerth.net/serverlist.xml.z")); configList.push_back(ConfigInfo("InternetServerAddress", CONFIG_TYPE_STRING, "pokerth.6dns.org")); configList.push_back(ConfigInfo("InternetServerPort", CONFIG_TYPE_INT, "7234")); configList.push_back(ConfigInfo("InternetServerPassword", CONFIG_TYPE_STRING, "")); @@ -453,10 +455,10 @@ void ConfigFile::updateConfig(ConfigState myConfigState) { TiXmlElement* oldConf = oldDocHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( configList[i].name ).ToElement(); - //HACK remove after 0.6 - TiXmlElement* ISAIRCChannelUpdateDone = oldDocHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( "InternetServerAddressIRCChannelUpdateDone" ).ToElement(); +// //HACK remove after 0.6 +// TiXmlElement* ISAIRCChannelUpdateDone = oldDocHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( "InternetServerAddressIRCChannelUpdateDone" ).ToElement(); - if ( oldConf && (ISAIRCChannelUpdateDone || !(configList[i].name == "IRCChannel" || (configList[i].name == "InternetServerAddress" ))) /*HACK remove after 0.6*/ ) { + if ( oldConf /*&& (ISAIRCChannelUpdateDone || !(configList[i].name == "IRCChannel" || (configList[i].name == "InternetServerAddress" )))*/ /*HACK remove after 0.6*/ ) { // if element is already there --> take over the saved values if(configList[i].name != "ConfigRevision" && configList[i].name != "AppDataDir") { diff --git a/src/gui/qt/settingsdialog.ui b/src/gui/qt/settingsdialog.ui index 6b4e9cb2..aafdb352 100644 --- a/src/gui/qt/settingsdialog.ui +++ b/src/gui/qt/settingsdialog.ui @@ -6,7 +6,7 @@ 0 0 671 - 572 + 688 @@ -18,9 +18,9 @@ Settings - + - + @@ -78,19 +78,11 @@ 0 - - - 0 - 0 - 455 - 511 - - - QLabel { font-weight: bold; } + QLabel { font-weight: bold; } Interface @@ -124,7 +116,7 @@ Qt::Horizontal - + 40 20 @@ -231,7 +223,10 @@ 9 - + + 6 + + 6 @@ -239,7 +234,16 @@ 0 - + + 0 + + + 0 + + + 0 + + 0 @@ -247,7 +251,16 @@ 2 - + + 0 + + + 0 + + + 0 + + 0 @@ -318,7 +331,7 @@ p, li { white-space: pre-wrap; } Qt::Vertical - + 400 111 @@ -329,19 +342,11 @@ p, li { white-space: pre-wrap; } - - - 0 - 0 - 455 - 511 - - - QLabel { font-weight: bold; } + QLabel { font-weight: bold; } Sound @@ -372,7 +377,16 @@ p, li { white-space: pre-wrap; } 6 - + + 0 + + + 0 + + + 0 + + 0 @@ -457,7 +471,7 @@ p, li { white-space: pre-wrap; } Qt::Vertical - + 400 321 @@ -468,33 +482,25 @@ p, li { white-space: pre-wrap; } - - - 0 - 0 - 455 - 511 - - - - + + - QLabel { font-weight: bold; } + QLabel { font-weight: bold; } Local Game Settings - + Qt::Horizontal - + @@ -521,7 +527,7 @@ p, li { white-space: pre-wrap; } - + @@ -551,7 +557,7 @@ p, li { white-space: pre-wrap; } - + @@ -578,7 +584,7 @@ p, li { white-space: pre-wrap; } - + @@ -657,7 +663,7 @@ p, li { white-space: pre-wrap; } Qt::Vertical - + 20 5 @@ -715,7 +721,7 @@ p, li { white-space: pre-wrap; } - + @@ -742,29 +748,29 @@ p, li { white-space: pre-wrap; } - + Pause between hands (press "start" button to go on) - + Show game settings dialog on every new game - + Qt::Vertical - + - 400 - 231 + 437 + 285 @@ -772,19 +778,11 @@ p, li { white-space: pre-wrap; } - - - 0 - 0 - 455 - 511 - - - + - QLabel { font-weight: bold; } + QLabel { font-weight: bold; } Network Game Settings @@ -955,7 +953,7 @@ p, li { white-space: pre-wrap; } Qt::Vertical - + 20 10 @@ -1071,14 +1069,17 @@ p, li { white-space: pre-wrap; } - + Qt::Vertical - + + QSizePolicy::Fixed + + 20 - 40 + 14 @@ -1101,7 +1102,10 @@ p, li { white-space: pre-wrap; } 9 - + + 6 + + 6 @@ -1189,10 +1193,10 @@ p, li { white-space: pre-wrap; } Qt::Vertical - + 400 - 41 + 216 @@ -1200,33 +1204,25 @@ p, li { white-space: pre-wrap; } - - - 0 - 0 - 419 - 574 - - - - + + - QLabel { font-weight: bold; } + QLabel { font-weight: bold; } Internet Game Settings - + Qt::Horizontal - + <html><head><meta name="qrichtext" content="1" /><style type="text/css"> @@ -1239,50 +1235,139 @@ p, li { white-space: pre-wrap; } - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 400 - 16 - - - - - + Internet Server Settings (Dedicated Server) - - 9 + + 5 - - 6 + + 4 - - - - Use SCTP + + + + Automatic Server Configuration URL + + true + + + + 5 + + + + + Serverlist Address: + + + + + + + - + + + + + 0 + 116 + + + + Manual Server Configuration + + + true + + + false + + + + 4 + + + + + Server Address: + + + lineEdit_InternetServerAddress + + + + + + + 60 + + + + + + + Server Port: + + + spinBox_InternetServerPort + + + + + + + 80 + + + 65535 + + + 7234 + + + + + + + Server Password: + + + lineEdit_InternetServerPassword + + + + + + + QLineEdit::Password + + + + + + + Use IPv6 - + + + + 299 + 0 + + <a href="http://en.wikipedia.org/wiki/Ipv6">What is this?</a> @@ -1291,17 +1376,14 @@ p, li { white-space: pre-wrap; } - - + + - Server Port: - - - spinBox_InternetServerPort + Use SCTP - + <a href="http://en.wikipedia.org/wiki/Stream_Control_Transmission_Protocol">What is this?</a> @@ -1311,62 +1393,24 @@ p, li { white-space: pre-wrap; } - - - - 80 - - - 65535 - - - 7234 - - - - - - - Server Address: - - - lineEdit_InternetServerAddress - - - - - - - 60 - - - - - - - Server Password: - - - lineEdit_InternetServerPassword - - - - - - - QLineEdit::Password - - - - + 6 - + + 0 + + + 0 + + + 0 + + 0 @@ -1388,7 +1432,7 @@ p, li { white-space: pre-wrap; } - + Enable/Disable Lobby Chat (IRC Server) @@ -1397,6 +1441,12 @@ p, li { white-space: pre-wrap; } true + + 5 + + + 4 + @@ -1494,15 +1544,15 @@ p, li { white-space: pre-wrap; } - + Qt::Vertical - + - 400 - 51 + 437 + 16 @@ -1510,19 +1560,23 @@ p, li { white-space: pre-wrap; } - - - 0 - 0 - 419 - 574 - - - + 9 - + + 9 + + + 9 + + + 9 + + + 6 + + 6 @@ -1530,7 +1584,7 @@ p, li { white-space: pre-wrap; } Qt::Vertical - + 20 40 @@ -1541,7 +1595,7 @@ p, li { white-space: pre-wrap; } - QLabel { font-weight: bold; } + QLabel { font-weight: bold; } Player Nicks @@ -1554,18 +1608,42 @@ p, li { white-space: pre-wrap; } Computer Engine - + 7 - + + 7 + + + 7 + + + 7 + + + 10 + + 10 - + 0 - + + 0 + + + 0 + + + 0 + + + 4 + + 4 @@ -1601,7 +1679,16 @@ p, li { white-space: pre-wrap; } 6 - + + 0 + + + 0 + + + 0 + + 0 @@ -1612,7 +1699,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -1656,7 +1743,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -1695,10 +1782,22 @@ p, li { white-space: pre-wrap; } - + 0 - + + 0 + + + 0 + + + 0 + + + 4 + + 4 @@ -1734,7 +1833,16 @@ p, li { white-space: pre-wrap; } 6 - + + 0 + + + 0 + + + 0 + + 0 @@ -1745,7 +1853,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -1789,7 +1897,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -1828,10 +1936,22 @@ p, li { white-space: pre-wrap; } - + 0 - + + 0 + + + 0 + + + 0 + + + 4 + + 4 @@ -1892,7 +2012,16 @@ p, li { white-space: pre-wrap; } 6 - + + 0 + + + 0 + + + 0 + + 0 @@ -1903,7 +2032,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -1947,7 +2076,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -1961,10 +2090,22 @@ p, li { white-space: pre-wrap; } - + 0 - + + 0 + + + 0 + + + 0 + + + 4 + + 4 @@ -2025,7 +2166,16 @@ p, li { white-space: pre-wrap; } 6 - + + 0 + + + 0 + + + 0 + + 0 @@ -2036,7 +2186,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -2080,7 +2230,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -2094,10 +2244,22 @@ p, li { white-space: pre-wrap; } - + 0 - + + 0 + + + 0 + + + 0 + + + 4 + + 4 @@ -2158,7 +2320,16 @@ p, li { white-space: pre-wrap; } 6 - + + 0 + + + 0 + + + 0 + + 0 @@ -2169,7 +2340,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -2213,7 +2384,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -2227,10 +2398,22 @@ p, li { white-space: pre-wrap; } - + 0 - + + 0 + + + 0 + + + 0 + + + 4 + + 4 @@ -2291,7 +2474,16 @@ p, li { white-space: pre-wrap; } 6 - + + 0 + + + 0 + + + 0 + + 0 @@ -2302,7 +2494,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -2346,7 +2538,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -2383,10 +2575,22 @@ p, li { white-space: pre-wrap; } - + 0 - + + 0 + + + 0 + + + 0 + + + 0 + + 0 @@ -2394,7 +2598,16 @@ p, li { white-space: pre-wrap; } 6 - + + 0 + + + 0 + + + 0 + + 0 @@ -2402,7 +2615,7 @@ p, li { white-space: pre-wrap; } Qt::Horizontal - + 40 20 @@ -2443,7 +2656,7 @@ p, li { white-space: pre-wrap; } Qt::Horizontal - + 40 20 @@ -2458,7 +2671,16 @@ p, li { white-space: pre-wrap; } 6 - + + 6 + + + 6 + + + 6 + + 6 @@ -2466,7 +2688,7 @@ p, li { white-space: pre-wrap; } Qt::Horizontal - + 40 20 @@ -2504,7 +2726,7 @@ p, li { white-space: pre-wrap; } Qt::Horizontal - + 40 20 @@ -2519,7 +2741,16 @@ p, li { white-space: pre-wrap; } 6 - + + 0 + + + 0 + + + 0 + + 0 @@ -2527,7 +2758,7 @@ p, li { white-space: pre-wrap; } Qt::Horizontal - + 20 40 @@ -2540,7 +2771,16 @@ p, li { white-space: pre-wrap; } 6 - + + 0 + + + 0 + + + 0 + + 0 @@ -2551,7 +2791,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -2595,7 +2835,7 @@ p, li { white-space: pre-wrap; } QSizePolicy::Fixed - + 3 20 @@ -2610,7 +2850,7 @@ p, li { white-space: pre-wrap; } Qt::Horizontal - + 20 40 @@ -2625,19 +2865,23 @@ p, li { white-space: pre-wrap; } - - - 0 - 0 - 455 - 511 - - - + 9 - + + 9 + + + 9 + + + 9 + + + 6 + + 6 @@ -2651,7 +2895,7 @@ p, li { white-space: pre-wrap; } true - + @@ -2663,7 +2907,7 @@ p, li { white-space: pre-wrap; } - + @@ -2682,8 +2926,7 @@ p, li { white-space: pre-wrap; } - - ../../../../../../.designer/backup../../../../../../.designer/backup + ../../../../../../.designer/backup @@ -2759,7 +3002,7 @@ p, li { white-space: pre-wrap; } - QLabel { font-weight: bold; } + QLabel { font-weight: bold; } Log Messages @@ -2778,7 +3021,7 @@ p, li { white-space: pre-wrap; } Qt::Vertical - + 20 40 @@ -2805,7 +3048,7 @@ p, li { white-space: pre-wrap; } Qt::Horizontal - QDialogButtonBox::Cancel|QDialogButtonBox::Ok + QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok @@ -2933,12 +3176,12 @@ p, li { white-space: pre-wrap; } setEnabled(bool) - 361 - 366 + 362 + 426 - 571 - 366 + 609 + 426 @@ -2949,12 +3192,12 @@ p, li { white-space: pre-wrap; } setEnabled(bool) - 361 - 366 + 362 + 426 - 600 - 368 + 638 + 426 @@ -2965,8 +3208,8 @@ p, li { white-space: pre-wrap; } accept() - 489 - 596 + 498 + 678 354 @@ -2981,8 +3224,8 @@ p, li { white-space: pre-wrap; } reject() - 577 - 596 + 586 + 678 599 @@ -2997,12 +3240,12 @@ p, li { white-space: pre-wrap; } setEnabled(bool) - 304 - 38 + 413 + 425 - 304 - 38 + 650 + 426 @@ -3013,12 +3256,12 @@ p, li { white-space: pre-wrap; } setNum(int) - 304 - 38 + 639 + 96 - 304 - 38 + 335 + 97 @@ -3029,12 +3272,12 @@ p, li { white-space: pre-wrap; } setEnabled(bool) - 304 - 38 + 639 + 200 - 304 - 38 + 639 + 235 @@ -3045,12 +3288,12 @@ p, li { white-space: pre-wrap; } setEnabled(bool) - 304 - 38 + 639 + 200 - 304 - 38 + 639 + 235 diff --git a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp index 54e68e23..90a1285e 100644 --- a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp +++ b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp @@ -92,6 +92,10 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, ConfigFile *c, selectAva connect( radioButton_manualBlindsOrder, SIGNAL( toggled(bool) ), this, SLOT( setFirstSmallBlindMargin() )); //temporarely unused until ai is enabled in network connect( comboBox_switchLanguage, SIGNAL( currentIndexChanged (int) ), this, SLOT ( setLanguageChanged(int) )); + + connect(groupBox_automaticServerConfig, SIGNAL(toggled(bool)), this, SLOT(toggleGroupBoxAutomaticServerConfig(bool))); + connect(groupBox_manualServerConfig, SIGNAL(toggled(bool)), this, SLOT(toggleGroupBoxManualServerConfig(bool))); + // label_36->hide(); // spinBox_netGameSpeed->hide(); // @@ -163,6 +167,9 @@ void settingsDialogImpl::exec() { checkBox_useSctp->setChecked(myConfig->readConfigInt("ServerUseSctp")); //Internet Game Settings + if(myConfig->readConfigInt("InternetServerConfigMode")) { groupBox_manualServerConfig->setChecked(TRUE); } + else { groupBox_automaticServerConfig->setChecked(TRUE); } + lineEdit_InternetServerListAddress->setText(QString::fromUtf8(myConfig->readConfigString("InternetServerListAddress").c_str())); lineEdit_InternetServerAddress->setText(QString::fromUtf8(myConfig->readConfigString("InternetServerAddress").c_str())); spinBox_InternetServerPort->setValue(myConfig->readConfigInt("InternetServerPort")); lineEdit_InternetServerPassword->setText(QString::fromUtf8(myConfig->readConfigString("InternetServerPassword").c_str())); @@ -303,6 +310,9 @@ void settingsDialogImpl::isAccepted() { myConfig->writeConfigInt("ServerUseSctp", checkBox_useSctp->isChecked()); //Internet Game Settings + if(groupBox_automaticServerConfig->isChecked()) { myConfig->writeConfigInt("InternetServerConfigMode", 0); } + if(groupBox_manualServerConfig->isChecked()) { myConfig->writeConfigInt("InternetServerConfigMode", 1); } + myConfig->writeConfigString("InternetServerListAddress", lineEdit_InternetServerListAddress->text().toUtf8().constData()); myConfig->writeConfigString("InternetServerAddress", lineEdit_InternetServerAddress->text().toUtf8().constData()); myConfig->writeConfigInt("InternetServerPort", spinBox_InternetServerPort->value()); myConfig->writeConfigString("InternetServerPassword", lineEdit_InternetServerPassword->text().toUtf8().constData()); @@ -603,3 +613,8 @@ void settingsDialogImpl::setLanguageChanged(int index) { changedLanguageIndex = index; } + +void settingsDialogImpl::toggleGroupBoxAutomaticServerConfig(bool /*toggleState*/) { if(groupBox_automaticServerConfig->isChecked()) groupBox_manualServerConfig->setChecked(FALSE); } + +void settingsDialogImpl::toggleGroupBoxManualServerConfig(bool /*toggleState*/) { if(groupBox_manualServerConfig->isChecked()) groupBox_automaticServerConfig->setChecked(FALSE); } + diff --git a/src/gui/qt/settingsdialog/settingsdialogimpl.h b/src/gui/qt/settingsdialog/settingsdialogimpl.h index 23191114..bc96fefd 100644 --- a/src/gui/qt/settingsdialog/settingsdialogimpl.h +++ b/src/gui/qt/settingsdialog/settingsdialogimpl.h @@ -73,6 +73,9 @@ public slots: void setFirstSmallBlindMargin() ; void setLanguageChanged(int); + + void toggleGroupBoxAutomaticServerConfig(bool /*toggleState*/); + void toggleGroupBoxManualServerConfig(bool /*toggleState*/); private: