configfile minimize disc-access
timoutanimation stops if player start a "local game"
This commit is contained in:
+38
-68
@@ -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; i<configBufferList.size(); i++) {
|
||||
TiXmlElement *tmpElement = new TiXmlElement(configBufferList[i].name);
|
||||
config->LinkEndChild( 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; i<configBufferList.size(); i++) {
|
||||
for (i=0; i<configBufferList.size(); i++) {
|
||||
|
||||
if (configBufferList[i].name == varName) {
|
||||
intToString << varCont;
|
||||
configBufferList[i].defaultValue = intToString.str();
|
||||
}
|
||||
if (configBufferList[i].name == varName) {
|
||||
intToString << varCont;
|
||||
configBufferList[i].defaultValue = intToString.str();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigFile::writeConfigString(string varName, string 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 );
|
||||
} 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; i<configBufferList.size(); i++) {
|
||||
if (configBufferList[i].name == varName) { configBufferList[i].defaultValue = varCont; }
|
||||
}
|
||||
else {
|
||||
//no writeaccess
|
||||
size_t i;
|
||||
for (i=0; i<configBufferList.size(); i++) {
|
||||
if (configBufferList[i].name == varName) { configBufferList[i].defaultValue = varCont; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ public:
|
||||
~ConfigFile();
|
||||
|
||||
void fillBuffer();
|
||||
void writeBuffer();
|
||||
|
||||
void updateConfig(ConfigState);
|
||||
|
||||
|
||||
@@ -36,4 +36,6 @@ changeHumanPlayerNameDialogImpl::changeHumanPlayerNameDialogImpl(QWidget *parent
|
||||
void changeHumanPlayerNameDialogImpl::savePlayerName() {
|
||||
|
||||
myConfig->writeConfigString("MyName", lineEdit->text().toUtf8().constData());
|
||||
}
|
||||
//write buffer to disc
|
||||
myConfig->writeBuffer();
|
||||
}
|
||||
|
||||
@@ -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; i<MAX_NUMBER_OF_PLAYERS; i++ ) {
|
||||
setLabelArray[i]->stopTimeOutAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
void mainWindowImpl::networkGameModification() {
|
||||
|
||||
@@ -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(); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user