one ConfigFile for all
This commit is contained in:
1 parent
8ad92920cc
commit
6d673793be
7 files changed
+111
-113
No files matched your search
@@ -21,8 +21,8 @@
|
|||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "configfile.h"
|
#include "configfile.h"
|
||||||
|
|
||||||
createNetworkGameDialogImpl::createNetworkGameDialogImpl(QWidget *parent)
|
createNetworkGameDialogImpl::createNetworkGameDialogImpl(QWidget *parent, ConfigFile *c)
|
||||||
: QDialog(parent)
|
: QDialog(parent), myConfig(c)
|
||||||
{
|
{
|
||||||
|
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
@@ -45,15 +45,12 @@ void createNetworkGameDialogImpl::cancel() {
|
|||||||
|
|
||||||
void createNetworkGameDialogImpl::fillFormular() {
|
void createNetworkGameDialogImpl::fillFormular() {
|
||||||
|
|
||||||
//Formulare Füllen
|
|
||||||
ConfigFile myConfig;
|
|
||||||
|
|
||||||
//Network Game Settings
|
//Network Game Settings
|
||||||
spinBox_quantityPlayers->setValue(myConfig.readConfigInt("NetNumberOfPlayers"));
|
spinBox_quantityPlayers->setValue(myConfig->readConfigInt("NetNumberOfPlayers"));
|
||||||
spinBox_startCash->setValue(myConfig.readConfigInt("NetStartCash"));
|
spinBox_startCash->setValue(myConfig->readConfigInt("NetStartCash"));
|
||||||
spinBox_smallBlind->setValue(myConfig.readConfigInt("NetSmallBlind"));
|
spinBox_smallBlind->setValue(myConfig->readConfigInt("NetSmallBlind"));
|
||||||
spinBox_handsBeforeRaiseSmallBlind->setValue(myConfig.readConfigInt("NetHandsBeforeRaiseSmallBlind"));
|
spinBox_handsBeforeRaiseSmallBlind->setValue(myConfig->readConfigInt("NetHandsBeforeRaiseSmallBlind"));
|
||||||
spinBox_gameSpeed->setValue(myConfig.readConfigInt("NetGameSpeed"));
|
spinBox_gameSpeed->setValue(myConfig->readConfigInt("NetGameSpeed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void createNetworkGameDialogImpl::showDialog() {
|
void createNetworkGameDialogImpl::showDialog() {
|
||||||
|
|||||||
@@ -27,11 +27,12 @@
|
|||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
|
|
||||||
class Session;
|
class Session;
|
||||||
|
class ConfigFile;
|
||||||
|
|
||||||
class createNetworkGameDialogImpl: public QDialog, public Ui::createNetworkGameDialog {
|
class createNetworkGameDialogImpl: public QDialog, public Ui::createNetworkGameDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
createNetworkGameDialogImpl(QWidget *parent = 0);
|
createNetworkGameDialogImpl(QWidget *parent = 0, ConfigFile *c = 0);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
@@ -40,6 +41,9 @@ public slots:
|
|||||||
void fillFormular();
|
void fillFormular();
|
||||||
void showDialog();
|
void showDialog();
|
||||||
void keyPressEvent ( QKeyEvent * event );
|
void keyPressEvent ( QKeyEvent * event );
|
||||||
|
private:
|
||||||
|
|
||||||
|
ConfigFile *myConfig;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -24,14 +24,14 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
joinNetworkGameDialogImpl::joinNetworkGameDialogImpl(QWidget *parent)
|
joinNetworkGameDialogImpl::joinNetworkGameDialogImpl(QWidget *parent, ConfigFile *c)
|
||||||
: QDialog(parent)
|
: QDialog(parent), myConfig(c)
|
||||||
{
|
{
|
||||||
bool toIntTrue;
|
bool toIntTrue;
|
||||||
|
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
spinBox_port->setValue(QString::fromUtf8(myConfig.readConfigString("ServerPort").c_str()).toInt(&toIntTrue, 10));
|
spinBox_port->setValue(QString::fromUtf8(myConfig->readConfigString("ServerPort").c_str()).toInt(&toIntTrue, 10));
|
||||||
|
|
||||||
//Profile Name darf nicht mit einer Zahl beginnen --> XML konform
|
//Profile Name darf nicht mit einer Zahl beginnen --> XML konform
|
||||||
QRegExp rx("[A-Z|a-z]+[A-Z|a-z|\\d]*");
|
QRegExp rx("[A-Z|a-z]+[A-Z|a-z|\\d]*");
|
||||||
@@ -42,7 +42,7 @@ joinNetworkGameDialogImpl::joinNetworkGameDialogImpl(QWidget *parent)
|
|||||||
|
|
||||||
lineEdit_ipAddress->setFocus();
|
lineEdit_ipAddress->setFocus();
|
||||||
|
|
||||||
myServerProfilesFile = myConfig.readConfigString("DataDir")+"serverprofiles.xml";
|
myServerProfilesFile = myConfig->readConfigString("DataDir")+"serverprofiles.xml";
|
||||||
|
|
||||||
//Anlegen wenn noch nicht existiert!
|
//Anlegen wenn noch nicht existiert!
|
||||||
QFile serverProfilesfile(QString::fromUtf8(myServerProfilesFile.c_str()));
|
QFile serverProfilesfile(QString::fromUtf8(myServerProfilesFile.c_str()));
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ class ConfigFile;
|
|||||||
class joinNetworkGameDialogImpl: public QDialog, public Ui::joinNetworkGameDialog {
|
class joinNetworkGameDialogImpl: public QDialog, public Ui::joinNetworkGameDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
joinNetworkGameDialogImpl(QWidget *parent = 0);
|
joinNetworkGameDialogImpl(QWidget *parent = 0, ConfigFile *c = 0);
|
||||||
|
|
||||||
ConfigFile myConfig;
|
ConfigFile *myConfig;
|
||||||
std::string myServerProfilesFile;
|
std::string myServerProfilesFile;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|||||||
@@ -494,11 +494,11 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
|||||||
|
|
||||||
//Dialoge
|
//Dialoge
|
||||||
myNewGameDialog = new newGameDialogImpl(this, myConfig);
|
myNewGameDialog = new newGameDialogImpl(this, myConfig);
|
||||||
mySettingsDialog = new settingsDialogImpl(this);
|
mySettingsDialog = new settingsDialogImpl(this, myConfig);
|
||||||
myJoinNetworkGameDialog = new joinNetworkGameDialogImpl(this);
|
myJoinNetworkGameDialog = new joinNetworkGameDialogImpl(this, myConfig);
|
||||||
myConnectToServerDialog = new connectToServerDialogImpl(this);
|
myConnectToServerDialog = new connectToServerDialogImpl(this);
|
||||||
myStartNetworkGameDialog = new startNetworkGameDialogImpl(this);
|
myStartNetworkGameDialog = new startNetworkGameDialogImpl(this);
|
||||||
myCreateNetworkGameDialog = new createNetworkGameDialogImpl(this);
|
myCreateNetworkGameDialog = new createNetworkGameDialogImpl(this, myConfig);
|
||||||
myWaitingForServerGameDialog = new waitForServerToStartGameDialogImpl(this);
|
myWaitingForServerGameDialog = new waitForServerToStartGameDialogImpl(this);
|
||||||
myAboutPokerthDialog = new aboutPokerthImpl(this);
|
myAboutPokerthDialog = new aboutPokerthImpl(this);
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
settingsDialogImpl::settingsDialogImpl(QWidget *parent)
|
settingsDialogImpl::settingsDialogImpl(QWidget *parent, ConfigFile *c)
|
||||||
: QDialog(parent)
|
: QDialog(parent), myConfig(c)
|
||||||
{
|
{
|
||||||
|
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
@@ -34,65 +34,62 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent)
|
|||||||
|
|
||||||
playerNickIsChanged = FALSE;
|
playerNickIsChanged = FALSE;
|
||||||
|
|
||||||
//Formulare Füllen
|
|
||||||
ConfigFile myConfig;
|
|
||||||
|
|
||||||
//Player Nicks
|
//Player Nicks
|
||||||
lineEdit_humanPlayerName->setText(QString::fromUtf8(myConfig.readConfigString("MyName").c_str()));
|
lineEdit_humanPlayerName->setText(QString::fromUtf8(myConfig->readConfigString("MyName").c_str()));
|
||||||
lineEdit_humanPlayerAvatar->setText(QString::fromUtf8(myConfig.readConfigString("MyAvatar").c_str()));
|
lineEdit_humanPlayerAvatar->setText(QString::fromUtf8(myConfig->readConfigString("MyAvatar").c_str()));
|
||||||
lineEdit_Opponent1Name->setText(QString::fromUtf8(myConfig.readConfigString("Opponent1Name").c_str()));
|
lineEdit_Opponent1Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent1Name").c_str()));
|
||||||
lineEdit_Opponent1Avatar->setText(QString::fromUtf8(myConfig.readConfigString("Opponent1Avatar").c_str()));
|
lineEdit_Opponent1Avatar->setText(QString::fromUtf8(myConfig->readConfigString("Opponent1Avatar").c_str()));
|
||||||
lineEdit_Opponent2Name->setText(QString::fromUtf8(myConfig.readConfigString("Opponent2Name").c_str()));
|
lineEdit_Opponent2Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent2Name").c_str()));
|
||||||
lineEdit_Opponent2Avatar->setText(QString::fromUtf8(myConfig.readConfigString("Opponent2Avatar").c_str()));
|
lineEdit_Opponent2Avatar->setText(QString::fromUtf8(myConfig->readConfigString("Opponent2Avatar").c_str()));
|
||||||
lineEdit_Opponent3Name->setText(QString::fromUtf8(myConfig.readConfigString("Opponent3Name").c_str()));
|
lineEdit_Opponent3Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent3Name").c_str()));
|
||||||
lineEdit_Opponent3Avatar->setText(QString::fromUtf8(myConfig.readConfigString("Opponent3Avatar").c_str()));
|
lineEdit_Opponent3Avatar->setText(QString::fromUtf8(myConfig->readConfigString("Opponent3Avatar").c_str()));
|
||||||
lineEdit_Opponent4Name->setText(QString::fromUtf8(myConfig.readConfigString("Opponent4Name").c_str()));
|
lineEdit_Opponent4Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent4Name").c_str()));
|
||||||
lineEdit_Opponent4Avatar->setText(QString::fromUtf8(myConfig.readConfigString("Opponent4Avatar").c_str()));
|
lineEdit_Opponent4Avatar->setText(QString::fromUtf8(myConfig->readConfigString("Opponent4Avatar").c_str()));
|
||||||
lineEdit_Opponent5Name->setText(QString::fromUtf8(myConfig.readConfigString("Opponent5Name").c_str()));
|
lineEdit_Opponent5Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent5Name").c_str()));
|
||||||
lineEdit_Opponent5Avatar->setText(QString::fromUtf8(myConfig.readConfigString("Opponent5Avatar").c_str()));
|
lineEdit_Opponent5Avatar->setText(QString::fromUtf8(myConfig->readConfigString("Opponent5Avatar").c_str()));
|
||||||
lineEdit_Opponent6Name->setText(QString::fromUtf8(myConfig.readConfigString("Opponent6Name").c_str()));
|
lineEdit_Opponent6Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent6Name").c_str()));
|
||||||
lineEdit_Opponent6Avatar->setText(QString::fromUtf8(myConfig.readConfigString("Opponent6Avatar").c_str()));
|
lineEdit_Opponent6Avatar->setText(QString::fromUtf8(myConfig->readConfigString("Opponent6Avatar").c_str()));
|
||||||
|
|
||||||
//Local Game Settings
|
//Local Game Settings
|
||||||
spinBox_quantityPlayers->setValue(myConfig.readConfigInt("NumberOfPlayers"));
|
spinBox_quantityPlayers->setValue(myConfig->readConfigInt("NumberOfPlayers"));
|
||||||
spinBox_startCash->setValue(myConfig.readConfigInt("StartCash"));
|
spinBox_startCash->setValue(myConfig->readConfigInt("StartCash"));
|
||||||
spinBox_smallBlind->setValue(myConfig.readConfigInt("SmallBlind"));
|
spinBox_smallBlind->setValue(myConfig->readConfigInt("SmallBlind"));
|
||||||
spinBox_handsBeforeRaiseSmallBlind->setValue(myConfig.readConfigInt("HandsBeforeRaiseSmallBlind"));
|
spinBox_handsBeforeRaiseSmallBlind->setValue(myConfig->readConfigInt("HandsBeforeRaiseSmallBlind"));
|
||||||
spinBox_gameSpeed->setValue(myConfig.readConfigInt("GameSpeed"));
|
spinBox_gameSpeed->setValue(myConfig->readConfigInt("GameSpeed"));
|
||||||
checkBox_pauseBetweenHands->setChecked(myConfig.readConfigInt("PauseBetweenHands"));
|
checkBox_pauseBetweenHands->setChecked(myConfig->readConfigInt("PauseBetweenHands"));
|
||||||
checkBox_showGameSettingsDialogOnNewGame->setChecked(myConfig.readConfigInt("ShowGameSettingsDialogOnNewGame"));
|
checkBox_showGameSettingsDialogOnNewGame->setChecked(myConfig->readConfigInt("ShowGameSettingsDialogOnNewGame"));
|
||||||
comboBox_engineVersion->setCurrentIndex(myConfig.readConfigInt("EngineVersion"));
|
comboBox_engineVersion->setCurrentIndex(myConfig->readConfigInt("EngineVersion"));
|
||||||
|
|
||||||
//Network Game Settings
|
//Network Game Settings
|
||||||
spinBox_netQuantityPlayers->setValue(myConfig.readConfigInt("NetNumberOfPlayers"));
|
spinBox_netQuantityPlayers->setValue(myConfig->readConfigInt("NetNumberOfPlayers"));
|
||||||
spinBox_netStartCash->setValue(myConfig.readConfigInt("NetStartCash"));
|
spinBox_netStartCash->setValue(myConfig->readConfigInt("NetStartCash"));
|
||||||
spinBox_netSmallBlind->setValue(myConfig.readConfigInt("NetSmallBlind"));
|
spinBox_netSmallBlind->setValue(myConfig->readConfigInt("NetSmallBlind"));
|
||||||
spinBox_netHandsBeforeRaiseSmallBlind->setValue(myConfig.readConfigInt("NetHandsBeforeRaiseSmallBlind"));
|
spinBox_netHandsBeforeRaiseSmallBlind->setValue(myConfig->readConfigInt("NetHandsBeforeRaiseSmallBlind"));
|
||||||
spinBox_netGameSpeed->setValue(myConfig.readConfigInt("NetGameSpeed"));
|
spinBox_netGameSpeed->setValue(myConfig->readConfigInt("NetGameSpeed"));
|
||||||
comboBox_netEngineVersion->setCurrentIndex(myConfig.readConfigInt("NetEngineVersion"));
|
comboBox_netEngineVersion->setCurrentIndex(myConfig->readConfigInt("NetEngineVersion"));
|
||||||
spinBox_serverPort->setValue(myConfig.readConfigInt("ServerPort"));
|
spinBox_serverPort->setValue(myConfig->readConfigInt("ServerPort"));
|
||||||
lineEdit_serverPassword->setText(QString::fromUtf8(myConfig.readConfigString("ServerPassword").c_str()));
|
lineEdit_serverPassword->setText(QString::fromUtf8(myConfig->readConfigString("ServerPassword").c_str()));
|
||||||
checkBox_useIpv6->setChecked(myConfig.readConfigInt("ServerUseIpv6"));
|
checkBox_useIpv6->setChecked(myConfig->readConfigInt("ServerUseIpv6"));
|
||||||
|
|
||||||
|
|
||||||
//Interface
|
//Interface
|
||||||
checkBox_showLeftToolbox->setChecked(myConfig.readConfigInt("ShowLeftToolBox"));
|
checkBox_showLeftToolbox->setChecked(myConfig->readConfigInt("ShowLeftToolBox"));
|
||||||
checkBox_showRightToolbox->setChecked(myConfig.readConfigInt("ShowRightToolBox"));
|
checkBox_showRightToolbox->setChecked(myConfig->readConfigInt("ShowRightToolBox"));
|
||||||
checkBox_showStatusbarMessages->setChecked(myConfig.readConfigInt("ShowStatusbarMessages"));
|
checkBox_showStatusbarMessages->setChecked(myConfig->readConfigInt("ShowStatusbarMessages"));
|
||||||
checkBox_showIntro->setChecked(myConfig.readConfigInt("ShowIntro"));
|
checkBox_showIntro->setChecked(myConfig->readConfigInt("ShowIntro"));
|
||||||
checkBox_showFadeOutCardsAnimation->setChecked(myConfig.readConfigInt("ShowFadeOutCardsAnimation"));
|
checkBox_showFadeOutCardsAnimation->setChecked(myConfig->readConfigInt("ShowFadeOutCardsAnimation"));
|
||||||
checkBox_showFlipCardsAnimation->setChecked(myConfig.readConfigInt("ShowFlipCardsAnimation"));
|
checkBox_showFlipCardsAnimation->setChecked(myConfig->readConfigInt("ShowFlipCardsAnimation"));
|
||||||
radioButton_flipsideTux->setChecked(myConfig.readConfigInt("FlipsideTux"));
|
radioButton_flipsideTux->setChecked(myConfig->readConfigInt("FlipsideTux"));
|
||||||
radioButton_flipsideOwn->setChecked(myConfig.readConfigInt("FlipsideOwn"));
|
radioButton_flipsideOwn->setChecked(myConfig->readConfigInt("FlipsideOwn"));
|
||||||
if(radioButton_flipsideOwn->isChecked()) {
|
if(radioButton_flipsideOwn->isChecked()) {
|
||||||
lineEdit_OwnFlipsideFilename->setEnabled(TRUE);
|
lineEdit_OwnFlipsideFilename->setEnabled(TRUE);
|
||||||
pushButton_openFlipsidePicture->setEnabled(TRUE);
|
pushButton_openFlipsidePicture->setEnabled(TRUE);
|
||||||
}
|
}
|
||||||
lineEdit_OwnFlipsideFilename->setText(QString::fromUtf8(myConfig.readConfigString("FlipsideOwnFile").c_str()));
|
lineEdit_OwnFlipsideFilename->setText(QString::fromUtf8(myConfig->readConfigString("FlipsideOwnFile").c_str()));
|
||||||
|
|
||||||
//Log
|
//Log
|
||||||
lineEdit_logDir->setText(QString::fromUtf8(myConfig.readConfigString("LogDir").c_str()));
|
lineEdit_logDir->setText(QString::fromUtf8(myConfig->readConfigString("LogDir").c_str()));
|
||||||
spinBox_logStoreDuration->setValue(myConfig.readConfigInt("LogStoreDuration"));
|
spinBox_logStoreDuration->setValue(myConfig->readConfigInt("LogStoreDuration"));
|
||||||
|
|
||||||
connect( buttonBox, SIGNAL( accepted() ), this, SLOT( isAccepted() ) );
|
connect( buttonBox, SIGNAL( accepted() ), this, SLOT( isAccepted() ) );
|
||||||
connect( lineEdit_humanPlayerName, SIGNAL( textChanged( const QString &) ), this, SLOT( playerNickChanged() ) );
|
connect( lineEdit_humanPlayerName, SIGNAL( textChanged( const QString &) ), this, SLOT( playerNickChanged() ) );
|
||||||
@@ -119,13 +116,10 @@ void settingsDialogImpl::isAccepted() {
|
|||||||
|
|
||||||
settingsCorrect = TRUE;
|
settingsCorrect = TRUE;
|
||||||
|
|
||||||
//Daten speichern
|
|
||||||
ConfigFile myConfig;
|
|
||||||
|
|
||||||
// Player Nicks
|
// Player Nicks
|
||||||
myConfig.writeConfigString("MyName", lineEdit_humanPlayerName->text().toUtf8().constData());
|
myConfig->writeConfigString("MyName", lineEdit_humanPlayerName->text().toUtf8().constData());
|
||||||
if(QFile::QFile(lineEdit_humanPlayerAvatar->text()).exists() || lineEdit_humanPlayerAvatar->text() == "") {
|
if(QFile::QFile(lineEdit_humanPlayerAvatar->text()).exists() || lineEdit_humanPlayerAvatar->text() == "") {
|
||||||
myConfig.writeConfigString("MyAvatar", lineEdit_humanPlayerAvatar->text().toUtf8().constData());
|
myConfig->writeConfigString("MyAvatar", lineEdit_humanPlayerAvatar->text().toUtf8().constData());
|
||||||
}
|
}
|
||||||
else { QMessageBox::warning(this, tr("Settings Error"),
|
else { QMessageBox::warning(this, tr("Settings Error"),
|
||||||
tr("The entered human player avatar picture doesn't exists.\n"
|
tr("The entered human player avatar picture doesn't exists.\n"
|
||||||
@@ -134,9 +128,9 @@ void settingsDialogImpl::isAccepted() {
|
|||||||
settingsCorrect = FALSE;
|
settingsCorrect = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
myConfig.writeConfigString("Opponent1Name", lineEdit_Opponent1Name->text().toUtf8().constData());
|
myConfig->writeConfigString("Opponent1Name", lineEdit_Opponent1Name->text().toUtf8().constData());
|
||||||
if(QFile::QFile(lineEdit_Opponent1Avatar->text()).exists() || lineEdit_Opponent1Avatar->text() == "") {
|
if(QFile::QFile(lineEdit_Opponent1Avatar->text()).exists() || lineEdit_Opponent1Avatar->text() == "") {
|
||||||
myConfig.writeConfigString("Opponent1Avatar", lineEdit_Opponent1Avatar->text().toUtf8().constData());
|
myConfig->writeConfigString("Opponent1Avatar", lineEdit_Opponent1Avatar->text().toUtf8().constData());
|
||||||
}
|
}
|
||||||
else { QMessageBox::warning(this, tr("Settings Error"),
|
else { QMessageBox::warning(this, tr("Settings Error"),
|
||||||
tr("The entered \"opponent 1\" avatar picture doesn't exists.\n"
|
tr("The entered \"opponent 1\" avatar picture doesn't exists.\n"
|
||||||
@@ -145,9 +139,9 @@ void settingsDialogImpl::isAccepted() {
|
|||||||
settingsCorrect = FALSE;
|
settingsCorrect = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
myConfig.writeConfigString("Opponent2Name", lineEdit_Opponent2Name->text().toUtf8().constData());
|
myConfig->writeConfigString("Opponent2Name", lineEdit_Opponent2Name->text().toUtf8().constData());
|
||||||
if(QFile::QFile(lineEdit_Opponent2Avatar->text()).exists() || lineEdit_Opponent2Avatar->text() == "") {
|
if(QFile::QFile(lineEdit_Opponent2Avatar->text()).exists() || lineEdit_Opponent2Avatar->text() == "") {
|
||||||
myConfig.writeConfigString("Opponent2Avatar", lineEdit_Opponent2Avatar->text().toUtf8().constData());
|
myConfig->writeConfigString("Opponent2Avatar", lineEdit_Opponent2Avatar->text().toUtf8().constData());
|
||||||
}
|
}
|
||||||
else { QMessageBox::warning(this, tr("Settings Error"),
|
else { QMessageBox::warning(this, tr("Settings Error"),
|
||||||
tr("The entered \"opponent 2\" avatar picture doesn't exists.\n"
|
tr("The entered \"opponent 2\" avatar picture doesn't exists.\n"
|
||||||
@@ -156,9 +150,9 @@ void settingsDialogImpl::isAccepted() {
|
|||||||
settingsCorrect = FALSE;
|
settingsCorrect = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
myConfig.writeConfigString("Opponent3Name", lineEdit_Opponent3Name->text().toUtf8().constData());
|
myConfig->writeConfigString("Opponent3Name", lineEdit_Opponent3Name->text().toUtf8().constData());
|
||||||
if(QFile::QFile(lineEdit_Opponent3Avatar->text()).exists() || lineEdit_Opponent3Avatar->text() == "") {
|
if(QFile::QFile(lineEdit_Opponent3Avatar->text()).exists() || lineEdit_Opponent3Avatar->text() == "") {
|
||||||
myConfig.writeConfigString("Opponent3Avatar", lineEdit_Opponent3Avatar->text().toUtf8().constData());
|
myConfig->writeConfigString("Opponent3Avatar", lineEdit_Opponent3Avatar->text().toUtf8().constData());
|
||||||
}
|
}
|
||||||
else { QMessageBox::warning(this, tr("Settings Error"),
|
else { QMessageBox::warning(this, tr("Settings Error"),
|
||||||
tr("The entered \"opponent 3\" avatar picture doesn't exists.\n"
|
tr("The entered \"opponent 3\" avatar picture doesn't exists.\n"
|
||||||
@@ -167,9 +161,9 @@ void settingsDialogImpl::isAccepted() {
|
|||||||
settingsCorrect = FALSE;
|
settingsCorrect = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
myConfig.writeConfigString("Opponent4Name", lineEdit_Opponent4Name->text().toUtf8().constData());
|
myConfig->writeConfigString("Opponent4Name", lineEdit_Opponent4Name->text().toUtf8().constData());
|
||||||
if(QFile::QFile(lineEdit_Opponent4Avatar->text()).exists() || lineEdit_Opponent4Avatar->text() == "") {
|
if(QFile::QFile(lineEdit_Opponent4Avatar->text()).exists() || lineEdit_Opponent4Avatar->text() == "") {
|
||||||
myConfig.writeConfigString("Opponent4Avatar", lineEdit_Opponent4Avatar->text().toUtf8().constData());
|
myConfig->writeConfigString("Opponent4Avatar", lineEdit_Opponent4Avatar->text().toUtf8().constData());
|
||||||
}
|
}
|
||||||
else { QMessageBox::warning(this, tr("Settings Error"),
|
else { QMessageBox::warning(this, tr("Settings Error"),
|
||||||
tr("The entered \"opponent 4\" avatar picture doesn't exists.\n"
|
tr("The entered \"opponent 4\" avatar picture doesn't exists.\n"
|
||||||
@@ -178,9 +172,9 @@ void settingsDialogImpl::isAccepted() {
|
|||||||
settingsCorrect = FALSE;
|
settingsCorrect = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
myConfig.writeConfigString("Opponent5Name", lineEdit_Opponent5Name->text().toUtf8().constData());
|
myConfig->writeConfigString("Opponent5Name", lineEdit_Opponent5Name->text().toUtf8().constData());
|
||||||
if(QFile::QFile(lineEdit_Opponent5Avatar->text()).exists() || lineEdit_Opponent5Avatar->text() == "") {
|
if(QFile::QFile(lineEdit_Opponent5Avatar->text()).exists() || lineEdit_Opponent5Avatar->text() == "") {
|
||||||
myConfig.writeConfigString("Opponent5Avatar", lineEdit_Opponent5Avatar->text().toUtf8().constData());
|
myConfig->writeConfigString("Opponent5Avatar", lineEdit_Opponent5Avatar->text().toUtf8().constData());
|
||||||
}
|
}
|
||||||
else { QMessageBox::warning(this, tr("Settings Error"),
|
else { QMessageBox::warning(this, tr("Settings Error"),
|
||||||
tr("The entered \"opponent 5\" avatar picture doesn't exists.\n"
|
tr("The entered \"opponent 5\" avatar picture doesn't exists.\n"
|
||||||
@@ -189,9 +183,9 @@ void settingsDialogImpl::isAccepted() {
|
|||||||
settingsCorrect = FALSE;
|
settingsCorrect = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
myConfig.writeConfigString("Opponent6Name", lineEdit_Opponent6Name->text().toUtf8().constData());
|
myConfig->writeConfigString("Opponent6Name", lineEdit_Opponent6Name->text().toUtf8().constData());
|
||||||
if(QFile::QFile(lineEdit_Opponent6Avatar->text()).exists() || lineEdit_Opponent6Avatar->text() == "") {
|
if(QFile::QFile(lineEdit_Opponent6Avatar->text()).exists() || lineEdit_Opponent6Avatar->text() == "") {
|
||||||
myConfig.writeConfigString("Opponent6Avatar", lineEdit_Opponent6Avatar->text().toUtf8().constData());
|
myConfig->writeConfigString("Opponent6Avatar", lineEdit_Opponent6Avatar->text().toUtf8().constData());
|
||||||
}
|
}
|
||||||
else { QMessageBox::warning(this, tr("Settings Error"),
|
else { QMessageBox::warning(this, tr("Settings Error"),
|
||||||
tr("The entered \"opponent 6\" avatar picture doesn't exists.\n"
|
tr("The entered \"opponent 6\" avatar picture doesn't exists.\n"
|
||||||
@@ -201,38 +195,38 @@ void settingsDialogImpl::isAccepted() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Local Game Settings
|
// Local Game Settings
|
||||||
myConfig.writeConfigInt("NumberOfPlayers", spinBox_quantityPlayers->value());
|
myConfig->writeConfigInt("NumberOfPlayers", spinBox_quantityPlayers->value());
|
||||||
myConfig.writeConfigInt("StartCash", spinBox_startCash->value());
|
myConfig->writeConfigInt("StartCash", spinBox_startCash->value());
|
||||||
myConfig.writeConfigInt("SmallBlind", spinBox_smallBlind->value());
|
myConfig->writeConfigInt("SmallBlind", spinBox_smallBlind->value());
|
||||||
myConfig.writeConfigInt("HandsBeforeRaiseSmallBlind", spinBox_handsBeforeRaiseSmallBlind->value());
|
myConfig->writeConfigInt("HandsBeforeRaiseSmallBlind", spinBox_handsBeforeRaiseSmallBlind->value());
|
||||||
myConfig.writeConfigInt("GameSpeed", spinBox_gameSpeed->value());
|
myConfig->writeConfigInt("GameSpeed", spinBox_gameSpeed->value());
|
||||||
myConfig.writeConfigInt("EngineVersion", comboBox_engineVersion->currentIndex());
|
myConfig->writeConfigInt("EngineVersion", comboBox_engineVersion->currentIndex());
|
||||||
myConfig.writeConfigInt("PauseBetweenHands", checkBox_pauseBetweenHands->isChecked());
|
myConfig->writeConfigInt("PauseBetweenHands", checkBox_pauseBetweenHands->isChecked());
|
||||||
myConfig.writeConfigInt("ShowGameSettingsDialogOnNewGame", checkBox_showGameSettingsDialogOnNewGame->isChecked());
|
myConfig->writeConfigInt("ShowGameSettingsDialogOnNewGame", checkBox_showGameSettingsDialogOnNewGame->isChecked());
|
||||||
|
|
||||||
//Network Game Settings
|
//Network Game Settings
|
||||||
myConfig.writeConfigInt("NetNumberOfPlayers", spinBox_netQuantityPlayers->value());
|
myConfig->writeConfigInt("NetNumberOfPlayers", spinBox_netQuantityPlayers->value());
|
||||||
myConfig.writeConfigInt("NetStartCash", spinBox_netStartCash->value());
|
myConfig->writeConfigInt("NetStartCash", spinBox_netStartCash->value());
|
||||||
myConfig.writeConfigInt("NetSmallBlind", spinBox_netSmallBlind->value());
|
myConfig->writeConfigInt("NetSmallBlind", spinBox_netSmallBlind->value());
|
||||||
myConfig.writeConfigInt("NetHandsBeforeRaiseSmallBlind", spinBox_netHandsBeforeRaiseSmallBlind->value());
|
myConfig->writeConfigInt("NetHandsBeforeRaiseSmallBlind", spinBox_netHandsBeforeRaiseSmallBlind->value());
|
||||||
myConfig.writeConfigInt("NetGameSpeed", spinBox_netGameSpeed->value());
|
myConfig->writeConfigInt("NetGameSpeed", spinBox_netGameSpeed->value());
|
||||||
myConfig.writeConfigInt("NetEngineVersion", comboBox_netEngineVersion->currentIndex());
|
myConfig->writeConfigInt("NetEngineVersion", comboBox_netEngineVersion->currentIndex());
|
||||||
myConfig.writeConfigInt("ServerPort", spinBox_serverPort->value());
|
myConfig->writeConfigInt("ServerPort", spinBox_serverPort->value());
|
||||||
myConfig.writeConfigString("ServerPassword", lineEdit_serverPassword->text().toUtf8().constData());
|
myConfig->writeConfigString("ServerPassword", lineEdit_serverPassword->text().toUtf8().constData());
|
||||||
myConfig.writeConfigInt("ServerUseIpv6", checkBox_useIpv6->isChecked());
|
myConfig->writeConfigInt("ServerUseIpv6", checkBox_useIpv6->isChecked());
|
||||||
|
|
||||||
// Interface
|
// Interface
|
||||||
myConfig.writeConfigInt("ShowLeftToolBox", checkBox_showLeftToolbox->isChecked());
|
myConfig->writeConfigInt("ShowLeftToolBox", checkBox_showLeftToolbox->isChecked());
|
||||||
myConfig.writeConfigInt("ShowRightToolBox", checkBox_showRightToolbox->isChecked());
|
myConfig->writeConfigInt("ShowRightToolBox", checkBox_showRightToolbox->isChecked());
|
||||||
myConfig.writeConfigInt("ShowStatusbarMessages", checkBox_showStatusbarMessages->isChecked());
|
myConfig->writeConfigInt("ShowStatusbarMessages", checkBox_showStatusbarMessages->isChecked());
|
||||||
myConfig.writeConfigInt("ShowIntro", checkBox_showIntro->isChecked());
|
myConfig->writeConfigInt("ShowIntro", checkBox_showIntro->isChecked());
|
||||||
myConfig.writeConfigInt("ShowFadeOutCardsAnimation", checkBox_showFadeOutCardsAnimation->isChecked());
|
myConfig->writeConfigInt("ShowFadeOutCardsAnimation", checkBox_showFadeOutCardsAnimation->isChecked());
|
||||||
myConfig.writeConfigInt("ShowFlipCardsAnimation", checkBox_showFlipCardsAnimation->isChecked());
|
myConfig->writeConfigInt("ShowFlipCardsAnimation", checkBox_showFlipCardsAnimation->isChecked());
|
||||||
myConfig.writeConfigInt("FlipsideTux", radioButton_flipsideTux->isChecked());
|
myConfig->writeConfigInt("FlipsideTux", radioButton_flipsideTux->isChecked());
|
||||||
myConfig.writeConfigInt("FlipsideOwn", radioButton_flipsideOwn->isChecked());
|
myConfig->writeConfigInt("FlipsideOwn", radioButton_flipsideOwn->isChecked());
|
||||||
|
|
||||||
if(radioButton_flipsideOwn->isChecked()) {
|
if(radioButton_flipsideOwn->isChecked()) {
|
||||||
if(QFile::QFile(lineEdit_OwnFlipsideFilename->text()).exists() && lineEdit_OwnFlipsideFilename->text() != "") {myConfig.writeConfigString("FlipsideOwnFile", lineEdit_OwnFlipsideFilename->text().toUtf8().constData()); }
|
if(QFile::QFile(lineEdit_OwnFlipsideFilename->text()).exists() && lineEdit_OwnFlipsideFilename->text() != "") {myConfig->writeConfigString("FlipsideOwnFile", lineEdit_OwnFlipsideFilename->text().toUtf8().constData()); }
|
||||||
else { QMessageBox::warning(this, tr("Settings Error"),
|
else { QMessageBox::warning(this, tr("Settings Error"),
|
||||||
tr("The entered flipside picture doesn't exists.\n"
|
tr("The entered flipside picture doesn't exists.\n"
|
||||||
"Please enter an valid picture!"),
|
"Please enter an valid picture!"),
|
||||||
@@ -242,7 +236,7 @@ void settingsDialogImpl::isAccepted() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Log
|
// Log
|
||||||
if(QDir::QDir(lineEdit_logDir->text()).exists() && lineEdit_logDir->text() != "") { myConfig.writeConfigString("LogDir", lineEdit_logDir->text().toUtf8().constData()); }
|
if(QDir::QDir(lineEdit_logDir->text()).exists() && lineEdit_logDir->text() != "") { myConfig->writeConfigString("LogDir", lineEdit_logDir->text().toUtf8().constData()); }
|
||||||
else {
|
else {
|
||||||
QMessageBox::warning(this, tr("Settings Error"),
|
QMessageBox::warning(this, tr("Settings Error"),
|
||||||
tr("The log file directory doesn't exists.\n"
|
tr("The log file directory doesn't exists.\n"
|
||||||
@@ -251,7 +245,7 @@ void settingsDialogImpl::isAccepted() {
|
|||||||
settingsCorrect = FALSE;
|
settingsCorrect = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
myConfig.writeConfigInt("LogStoreDuration", spinBox_logStoreDuration->value());
|
myConfig->writeConfigInt("LogStoreDuration", spinBox_logStoreDuration->value());
|
||||||
|
|
||||||
//Wenn alles richtig eingegeben wurde --> Dialog schließen
|
//Wenn alles richtig eingegeben wurde --> Dialog schließen
|
||||||
if(settingsCorrect) { this->hide(); }
|
if(settingsCorrect) { this->hide(); }
|
||||||
|
|||||||
@@ -25,11 +25,12 @@
|
|||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
|
||||||
|
class ConfigFile;
|
||||||
|
|
||||||
class settingsDialogImpl: public QDialog, public Ui::settingsDialog {
|
class settingsDialogImpl: public QDialog, public Ui::settingsDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
settingsDialogImpl(QWidget *parent = 0);
|
settingsDialogImpl(QWidget *parent = 0, ConfigFile *c = 0);
|
||||||
|
|
||||||
void setPlayerNickIsChanged(bool theValue){ playerNickIsChanged = theValue;}
|
void setPlayerNickIsChanged(bool theValue){ playerNickIsChanged = theValue;}
|
||||||
bool getPlayerNickIsChanged() const{ return playerNickIsChanged;}
|
bool getPlayerNickIsChanged() const{ return playerNickIsChanged;}
|
||||||
@@ -53,6 +54,8 @@ private:
|
|||||||
|
|
||||||
bool playerNickIsChanged;
|
bool playerNickIsChanged;
|
||||||
bool settingsCorrect;
|
bool settingsCorrect;
|
||||||
|
|
||||||
|
ConfigFile* myConfig;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user