remeber last gametable and carddeck style dir in settings

This commit is contained in:
doitux
2009-04-23 09:25:39 +00:00
parent 46ff759986
commit 4c35676a68
2 changed files with 21 additions and 3 deletions
+3 -1
View File
@@ -48,7 +48,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
myQtToolsInterface = CreateQtToolsWrapper(); myQtToolsInterface = CreateQtToolsWrapper();
// !!!! Revisionsnummer der Configdefaults !!!!! // !!!! Revisionsnummer der Configdefaults !!!!!
configRev = 66; configRev = 67;
//standard defaults //standard defaults
logOnOffDefault = "1"; logOnOffDefault = "1";
@@ -149,6 +149,8 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
configList.push_back(ConfigInfo("CurrentGameTableStyle", CONFIG_TYPE_STRING, "")); configList.push_back(ConfigInfo("CurrentGameTableStyle", CONFIG_TYPE_STRING, ""));
configList.push_back(ConfigInfo("CardDeckStylesList", CONFIG_TYPE_STRING_LIST, "CardDeckStyles")); configList.push_back(ConfigInfo("CardDeckStylesList", CONFIG_TYPE_STRING_LIST, "CardDeckStyles"));
configList.push_back(ConfigInfo("CurrentCardDeckStyle", CONFIG_TYPE_STRING, "")); configList.push_back(ConfigInfo("CurrentCardDeckStyle", CONFIG_TYPE_STRING, ""));
configList.push_back(ConfigInfo("LastGameTableStyleDir", CONFIG_TYPE_STRING, ""));
configList.push_back(ConfigInfo("LastCardDeckStyleDir", CONFIG_TYPE_STRING, ""));
configList.push_back(ConfigInfo("PlaySoundEffects", CONFIG_TYPE_INT, "1")); configList.push_back(ConfigInfo("PlaySoundEffects", CONFIG_TYPE_INT, "1"));
configList.push_back(ConfigInfo("SoundVolume", CONFIG_TYPE_INT, "8")); configList.push_back(ConfigInfo("SoundVolume", CONFIG_TYPE_INT, "8"));
configList.push_back(ConfigInfo("PlayGameActions", CONFIG_TYPE_INT, "1")); configList.push_back(ConfigInfo("PlayGameActions", CONFIG_TYPE_INT, "1"));
@@ -943,8 +943,14 @@ void settingsDialogImpl::setSelectedGameTableStyleActivated()
void settingsDialogImpl::addGameTableStyle() void settingsDialogImpl::addGameTableStyle()
{ {
QDir dir(QString::fromUtf8(myConfig->readConfigString("LastGameTableStyleDir").c_str()));
QString dirString;
if(dir.exists()) dirString = dir.absolutePath();
else dirString = QDir::home().absolutePath();
QString fileName = QFileDialog::getOpenFileName(this, tr("Please select your game table style"), QString fileName = QFileDialog::getOpenFileName(this, tr("Please select your game table style"),
QDir::home().absolutePath(), dirString,
tr("PokerTH game table styles (*.xml)")); tr("PokerTH game table styles (*.xml)"));
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
@@ -977,6 +983,8 @@ void settingsDialogImpl::addGameTableStyle()
QMessageBox::Ok); QMessageBox::Ok);
} }
} }
//save current filepath
myConfig->writeConfigString("LastGameTableStyleDir",QFileInfo(fileName).absolutePath().toUtf8().constData());
} }
} }
@@ -1038,8 +1046,14 @@ void settingsDialogImpl::setSelectedCardDeckStyleActivated()
void settingsDialogImpl::addCardDeckStyle() void settingsDialogImpl::addCardDeckStyle()
{ {
QDir dir(QString::fromUtf8(myConfig->readConfigString("LastCardDeckStyleDir").c_str()));
QString dirString;
if(dir.exists()) dirString = dir.absolutePath();
else dirString = QDir::home().absolutePath();
QString fileName = QFileDialog::getOpenFileName(this, tr("Please select your card deck style"), QString fileName = QFileDialog::getOpenFileName(this, tr("Please select your card deck style"),
QDir::home().absolutePath(), dirString,
tr("PokerTH card deck styles (*.xml)")); tr("PokerTH card deck styles (*.xml)"));
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
@@ -1072,6 +1086,8 @@ void settingsDialogImpl::addCardDeckStyle()
QMessageBox::Ok); QMessageBox::Ok);
} }
} }
//save current filepath
myConfig->writeConfigString("LastCardDeckStyleDir",QFileInfo(fileName).absolutePath().toUtf8().constData());
} }
} }