adds two new config variables for automatic server configuration (serverlist)

This commit is contained in:
doitux
2008-04-23 23:15:12 +00:00
parent 431576436f
commit 1d5aa18b1b
4 changed files with 541 additions and 278 deletions
+7 -5
View File
@@ -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") {
File diff suppressed because it is too large Load Diff
@@ -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); }
@@ -73,6 +73,9 @@ public slots:
void setFirstSmallBlindMargin() ;
void setLanguageChanged(int);
void toggleGroupBoxAutomaticServerConfig(bool /*toggleState*/);
void toggleGroupBoxManualServerConfig(bool /*toggleState*/);
private: