diff --git a/src/config/configfile.cpp b/src/config/configfile.cpp index 75fa1f7a..9d72cc73 100644 --- a/src/config/configfile.cpp +++ b/src/config/configfile.cpp @@ -255,6 +255,33 @@ void ConfigFile::fillBuffer() { myQtToolsInterface = 0; } +void ConfigFile::writeBuffer() { + + //write buffer to disc if enabled + if(!noWriteAccess) { + TiXmlDocument doc; + TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", ""); + doc.LinkEndChild( decl ); + + TiXmlElement * root = new TiXmlElement( "PokerTH" ); + doc.LinkEndChild( root ); + + TiXmlElement * config; + config = new TiXmlElement( "Configuration" ); + root->LinkEndChild( config ); + + size_t i; + + for (i=0; iLinkEndChild( tmpElement ); + tmpElement->SetAttribute("value", configBufferList[i].defaultValue); + } + + doc.SaveFile( configFileName ); + } +} + void ConfigFile::updateConfig(ConfigState myConfigState) { size_t i; @@ -427,81 +454,24 @@ int ConfigFile::readConfigInt(string varName) void ConfigFile::writeConfigInt(string varName, int varCont) { - if(!noWriteAccess) { - //writeaccess - TiXmlDocument doc(configFileName); - if(!doc.LoadFile()) { cout << "Could Not Load Config-File!!! " << configFileName << "\n"; } - TiXmlHandle docHandle( &doc ); - - TiXmlElement* conf = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( varName ).ToElement(); - if ( conf ) { - conf->SetAttribute("value", varCont ); - if(!doc.SaveFile()) { cout << "Could Not Save Config-File!!! " << configFileName << "\n"; } - } else { - //Wenn nicht gefunden eines neues Anlegen - TiXmlElement* config = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).ToElement(); - - if ( config ) { - - TiXmlElement * confElement1 = new TiXmlElement( varName ); - config->LinkEndChild( confElement1 ); - confElement1->SetAttribute("value", varCont); - - if(!doc.SaveFile()) { cout << "Could Not Save Config-File!!! " << configFileName << "\n"; } - } - } - if(!doc.SaveFile()) { cout << "Could Not Save Config-File!!! " << configFileName << "\n"; } - - fillBuffer(); - } - else { - //no writeaccess - size_t i; - string tempString; - ostringstream intToString; + size_t i; + string tempString; + ostringstream intToString; - for (i=0; iSetAttribute("value", varCont ); - } else { - //Wenn nicht gefunden eines neues Anlegen - TiXmlElement* config = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).ToElement(); - if ( config ) { - TiXmlElement * confElement1 = new TiXmlElement( varName ); - config->LinkEndChild( confElement1 ); - confElement1->SetAttribute("value", varCont); - if(!doc.SaveFile()) { cout << "Could Not Save Config-File!!! " << configFileName << "\n"; } - } - } - if(!doc.SaveFile()) { cout << "Could Not Save Config-File!!! " << configFileName << "\n"; } - - fillBuffer(); + size_t i; + for (i=0; iwriteConfigString("MyName", lineEdit->text().toUtf8().constData()); -} \ No newline at end of file + //write buffer to disc + myConfig->writeBuffer(); +} diff --git a/src/gui/qt/mainwindow/mainwindowimpl.cpp b/src/gui/qt/mainwindow/mainwindowimpl.cpp index de9bc60f..98bee831 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindow/mainwindowimpl.cpp @@ -2513,7 +2513,7 @@ void mainWindowImpl::keyPressEvent ( QKeyEvent * event ) { if (event->key() == Qt::Key_F3) { pushButton_BetRaise->click(); } if (event->key() == Qt::Key_F10) { switchLeftToolBox(); } if (event->key() == Qt::Key_F11) { switchRightToolBox(); } -// if (event->key() == Qt::Key_W) { qApp->quit(); } //s + if (event->key() == Qt::Key_S) {} //s if (event->key() == 16777249) { pushButton_break->click(); ctrlPressed = TRUE; @@ -2588,6 +2588,10 @@ void mainWindowImpl::localGameModification() { tabWidget_Left->setCurrentIndex(0); tabWidget_Left->disableTab(1, TRUE); + int i; + for (i=0; istopTimeOutAnimation(); + } } void mainWindowImpl::networkGameModification() { diff --git a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp index fb4a7950..6ec862fe 100644 --- a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp +++ b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp @@ -240,6 +240,9 @@ void settingsDialogImpl::isAccepted() { myConfig->writeConfigInt("LogInterval", comboBox_logInterval->currentIndex()); } + //write buffer to disc + myConfig->writeBuffer(); + //Wenn alles richtig eingegeben wurde --> Dialog schließen if(settingsCorrect) { this->hide(); } }