From 954f997bcfbe816f430fb2f9df6420b5234eabc2 Mon Sep 17 00:00:00 2001 From: doitux Date: Thu, 22 Feb 2007 22:59:42 +0000 Subject: [PATCH] networksettings configurable --- src/config/configfile.cpp | 97 ++++++++++++------- src/gui/qt/settingsdialog.ui | 2 +- .../qt/settingsdialog/settingsdialogimpl.cpp | 20 +++- 3 files changed, 79 insertions(+), 40 deletions(-) diff --git a/src/config/configfile.cpp b/src/config/configfile.cpp index a1c0fc57..ebb98d39 100644 --- a/src/config/configfile.cpp +++ b/src/config/configfile.cpp @@ -34,7 +34,7 @@ using namespace std; ConfigFile::ConfigFile() { // !!!! Revisionsnummer der Configdefaults !!!!! - configRev = 6; + configRev = 7; // Pfad und Dateinamen setzen #ifdef _WIN32 @@ -98,45 +98,10 @@ void ConfigFile::createDefaultConfig() { config = new TiXmlElement( "Configuration" ); root->LinkEndChild( config ); + TiXmlElement * confElement0 = new TiXmlElement( "ConfigRevision" ); config->LinkEndChild( confElement0 ); confElement0->SetAttribute("value", configRev); - TiXmlElement * confElement1 = new TiXmlElement( "NumberOfPlayers" ); - config->LinkEndChild( confElement1 ); - confElement1->SetAttribute("value", 5); - TiXmlElement * confElement2 = new TiXmlElement( "StartCash" ); - config->LinkEndChild( confElement2 ); - confElement2->SetAttribute("value", 2000); - TiXmlElement * confElement3 = new TiXmlElement( "SmallBlind" ); - config->LinkEndChild( confElement3 ); - confElement3->SetAttribute("value", 10); - TiXmlElement * confElement12 = new TiXmlElement( "HandsBeforeRaiseSmallBlind" ); - config->LinkEndChild( confElement12 ); - confElement12->SetAttribute("value", 9); - TiXmlElement * confElement4 = new TiXmlElement( "GameSpeed" ); - config->LinkEndChild( confElement4 ); - confElement4->SetAttribute("value", 4); - TiXmlElement * confElement14 = new TiXmlElement( "PauseBetweenHands" ); - config->LinkEndChild( confElement14 ); - confElement14->SetAttribute("value", 0); - TiXmlElement * confElement5 = new TiXmlElement( "ShowGameSettingsDialogOnNewGame" ); - config->LinkEndChild( confElement5 ); - confElement5->SetAttribute("value", 1); - TiXmlElement * confElement6 = new TiXmlElement( "MyName" ); - config->LinkEndChild( confElement6 ); - confElement6->SetAttribute("value", "Human Player"); - TiXmlElement * confElement7 = new TiXmlElement( "Opponent1Name" ); - config->LinkEndChild( confElement7 ); - confElement7->SetAttribute("value", "Player 1"); - TiXmlElement * confElement8 = new TiXmlElement( "Opponent2Name" ); - config->LinkEndChild( confElement8 ); - confElement8->SetAttribute("value", "Player 2"); - TiXmlElement * confElement9 = new TiXmlElement( "Opponent3Name" ); - config->LinkEndChild( confElement9 ); - confElement9->SetAttribute("value", "Player 3"); - TiXmlElement * confElement10 = new TiXmlElement( "Opponent4Name" ); - config->LinkEndChild( confElement10 ); - confElement10->SetAttribute("value", "Player 4"); TiXmlElement * confElement11 = new TiXmlElement( "ShowLeftToolBox" ); config->LinkEndChild( confElement11 ); confElement11->SetAttribute("value", 1); @@ -161,6 +126,64 @@ void ConfigFile::createDefaultConfig() { TiXmlElement * confElement18 = new TiXmlElement( "FlipsideOwnFile" ); config->LinkEndChild( confElement18 ); confElement18->SetAttribute("value", ""); + + TiXmlElement * confElement1 = new TiXmlElement( "NumberOfPlayers" ); + config->LinkEndChild( confElement1 ); + confElement1->SetAttribute("value", 5); + TiXmlElement * confElement2 = new TiXmlElement( "StartCash" ); + config->LinkEndChild( confElement2 ); + confElement2->SetAttribute("value", 2000); + TiXmlElement * confElement3 = new TiXmlElement( "SmallBlind" ); + config->LinkEndChild( confElement3 ); + confElement3->SetAttribute("value", 10); + TiXmlElement * confElement12 = new TiXmlElement( "HandsBeforeRaiseSmallBlind" ); + config->LinkEndChild( confElement12 ); + confElement12->SetAttribute("value", 9); + TiXmlElement * confElement4 = new TiXmlElement( "GameSpeed" ); + config->LinkEndChild( confElement4 ); + confElement4->SetAttribute("value", 4); + TiXmlElement * confElement14 = new TiXmlElement( "PauseBetweenHands" ); + config->LinkEndChild( confElement14 ); + confElement14->SetAttribute("value", 0); + TiXmlElement * confElement5 = new TiXmlElement( "ShowGameSettingsDialogOnNewGame" ); + config->LinkEndChild( confElement5 ); + confElement5->SetAttribute("value", 1); + + TiXmlElement * confElement23 = new TiXmlElement( "NetNumberOfPlayers" ); + config->LinkEndChild( confElement23 ); + confElement23->SetAttribute("value", 5); + TiXmlElement * confElement24 = new TiXmlElement( "NetStartCash" ); + config->LinkEndChild( confElement24 ); + confElement24->SetAttribute("value", 2000); + TiXmlElement * confElement25 = new TiXmlElement( "NetSmallBlind" ); + config->LinkEndChild( confElement25 ); + confElement25->SetAttribute("value", 10); + TiXmlElement * confElement26 = new TiXmlElement( "NetHandsBeforeRaiseSmallBlind" ); + config->LinkEndChild( confElement26 ); + confElement26->SetAttribute("value", 9); + TiXmlElement * confElement27 = new TiXmlElement( "NetGameSpeed" ); + config->LinkEndChild( confElement27 ); + confElement27->SetAttribute("value", 4); + TiXmlElement * confElement28 = new TiXmlElement( "ServerPassword" ); + config->LinkEndChild( confElement28 ); + confElement28->SetAttribute("value", ""); + + TiXmlElement * confElement6 = new TiXmlElement( "MyName" ); + config->LinkEndChild( confElement6 ); + confElement6->SetAttribute("value", "Human Player"); + TiXmlElement * confElement7 = new TiXmlElement( "Opponent1Name" ); + config->LinkEndChild( confElement7 ); + confElement7->SetAttribute("value", "Player 1"); + TiXmlElement * confElement8 = new TiXmlElement( "Opponent2Name" ); + config->LinkEndChild( confElement8 ); + confElement8->SetAttribute("value", "Player 2"); + TiXmlElement * confElement9 = new TiXmlElement( "Opponent3Name" ); + config->LinkEndChild( confElement9 ); + confElement9->SetAttribute("value", "Player 3"); + TiXmlElement * confElement10 = new TiXmlElement( "Opponent4Name" ); + config->LinkEndChild( confElement10 ); + confElement10->SetAttribute("value", "Player 4"); + TiXmlElement * confElement20 = new TiXmlElement( "LogDir" ); config->LinkEndChild( confElement20 ); confElement20->SetAttribute("value", logDir); diff --git a/src/gui/qt/settingsdialog.ui b/src/gui/qt/settingsdialog.ui index 2eccdd3e..662b2502 100644 --- a/src/gui/qt/settingsdialog.ui +++ b/src/gui/qt/settingsdialog.ui @@ -427,7 +427,7 @@ p, li { white-space: pre-wrap; } 6 - + QLineEdit::Password diff --git a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp index a13720f1..ee933b9c 100644 --- a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp +++ b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp @@ -40,7 +40,7 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent) lineEdit_Opponent3Name->setText(QString::fromStdString(myConfig.readConfigString("Opponent3Name"))); lineEdit_Opponent4Name->setText(QString::fromStdString(myConfig.readConfigString("Opponent4Name"))); - //Game Settings + //Local Game Settings spinBox_quantityPlayers->setValue(myConfig.readConfigInt("NumberOfPlayers")); spinBox_startCash->setValue(myConfig.readConfigInt("StartCash")); spinBox_smallBlind->setValue(myConfig.readConfigInt("SmallBlind")); @@ -49,6 +49,14 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent) checkBox_pauseBetweenHands->setChecked(myConfig.readConfigInt("PauseBetweenHands")); checkBox_showGameSettingsDialogOnNewGame->setChecked(myConfig.readConfigInt("ShowGameSettingsDialogOnNewGame")); + //Network Game Settings + spinBox_netQuantityPlayers->setValue(myConfig.readConfigInt("NetNumberOfPlayers")); + spinBox_netStartCash->setValue(myConfig.readConfigInt("NetStartCash")); + spinBox_netSmallBlind->setValue(myConfig.readConfigInt("NetSmallBlind")); + spinBox_netHandsBeforeRaiseSmallBlind->setValue(myConfig.readConfigInt("NetHandsBeforeRaiseSmallBlind")); + spinBox_netGameSpeed->setValue(myConfig.readConfigInt("NetGameSpeed")); + lineEdit_serverPassword->setText(QString::fromStdString(myConfig.readConfigString("ServerPassword"))); + //Interface checkBox_showLeftToolbox->setChecked(myConfig.readConfigInt("ShowLeftToolBox")); checkBox_showRightToolbox->setChecked(myConfig.readConfigInt("ShowRightToolBox")); @@ -94,7 +102,7 @@ void settingsDialogImpl::isAccepted() { myConfig.writeConfigString("Opponent3Name", lineEdit_Opponent3Name->text().toStdString()); myConfig.writeConfigString("Opponent4Name", lineEdit_Opponent4Name->text().toStdString()); -// Game Settings +// Local Game Settings myConfig.writeConfigInt("NumberOfPlayers", spinBox_quantityPlayers->value()); myConfig.writeConfigInt("StartCash", spinBox_startCash->value()); myConfig.writeConfigInt("SmallBlind", spinBox_smallBlind->value()); @@ -103,6 +111,14 @@ void settingsDialogImpl::isAccepted() { myConfig.writeConfigInt("PauseBetweenHands", checkBox_pauseBetweenHands->isChecked()); myConfig.writeConfigInt("ShowGameSettingsDialogOnNewGame", checkBox_showGameSettingsDialogOnNewGame->isChecked()); + //Network Game Settings + myConfig.writeConfigInt("NetNumberOfPlayers", spinBox_netQuantityPlayers->value()); + myConfig.writeConfigInt("NetStartCash", spinBox_netStartCash->value()); + myConfig.writeConfigInt("NetSmallBlind", spinBox_netSmallBlind->value()); + myConfig.writeConfigInt("NetHandsBeforeRaiseSmallBlind", spinBox_netHandsBeforeRaiseSmallBlind->value()); + myConfig.writeConfigInt("NetGameSpeed", spinBox_netGameSpeed->value()); + myConfig.writeConfigString("ServerPassword", lineEdit_serverPassword->text().toStdString()); + // Interface myConfig.writeConfigInt("ShowLeftToolBox", checkBox_showLeftToolbox->isChecked()); myConfig.writeConfigInt("ShowRightToolBox", checkBox_showRightToolbox->isChecked());