This commit is contained in:
@@ -34,23 +34,34 @@ using namespace std;
|
|||||||
ConfigFile::ConfigFile()
|
ConfigFile::ConfigFile()
|
||||||
{
|
{
|
||||||
// !!!! Revisionsnummer der Configdefaults !!!!!
|
// !!!! Revisionsnummer der Configdefaults !!!!!
|
||||||
configRev = 3;
|
configRev = 4;
|
||||||
|
|
||||||
// Pfad und Dateinamen setzen
|
// Pfad und Dateinamen setzen
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
const char *appDataPath = getenv("AppData");
|
const char *appDataPath = getenv("AppData");
|
||||||
if (appDataPath)
|
if (appDataPath)
|
||||||
{
|
{ //Programmordner erstellen
|
||||||
configFileName = appDataPath;
|
configFileName = appDataPath;
|
||||||
configFileName += "\\pokerth\\";
|
configFileName += "\\pokerth\\";
|
||||||
mkdir(configFileName.c_str());
|
mkdir(configFileName.c_str());
|
||||||
|
//Log-File Ordner auch erstellen
|
||||||
|
logDir = configFileName;
|
||||||
|
logDir += "\\log-files\\";
|
||||||
|
mkdir(logDir.c_str());
|
||||||
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// hier Linux/Mac Code zur Basispfadbestimmung, z.B.
|
//Programmordner erstellen
|
||||||
string homePath = getenv("HOME");
|
const char *homePath = getenv("HOME");
|
||||||
configFileName = homePath+"/.pokerth/";
|
if(homePath) {
|
||||||
mkdir(configFileName.c_str(), MODUS) ;
|
configFileName = homePath;
|
||||||
// wenn nicht existiert, erzeugen!
|
configFileName += "/.pokerth/";
|
||||||
|
mkdir(configFileName.c_str(), MODUS) ;
|
||||||
|
//Log-File Ordner auch erstellen
|
||||||
|
logDir = configFileName;
|
||||||
|
logDir += "/log-files/";
|
||||||
|
mkdir(logDir.c_str(), MODUS);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
configFileName += "config.xml";
|
configFileName += "config.xml";
|
||||||
|
|
||||||
@@ -147,7 +158,13 @@ void ConfigFile::createDefaultConfig() {
|
|||||||
TiXmlElement * confElement18 = new TiXmlElement( "FlipsideOwnFile" );
|
TiXmlElement * confElement18 = new TiXmlElement( "FlipsideOwnFile" );
|
||||||
config->LinkEndChild( confElement18 );
|
config->LinkEndChild( confElement18 );
|
||||||
confElement18->SetAttribute("value", "");
|
confElement18->SetAttribute("value", "");
|
||||||
|
TiXmlElement * confElement20 = new TiXmlElement( "LogDir" );
|
||||||
|
config->LinkEndChild( confElement20 );
|
||||||
|
confElement20->SetAttribute("value", logDir);
|
||||||
|
TiXmlElement * confElement21 = new TiXmlElement( "LogStoreDuration" );
|
||||||
|
config->LinkEndChild( confElement21 );
|
||||||
|
confElement21->SetAttribute("value", 2);
|
||||||
|
|
||||||
doc.SaveFile( configFileName );
|
doc.SaveFile( configFileName );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::string configFileName;
|
std::string configFileName;
|
||||||
|
std::string logDir;
|
||||||
int configRev;
|
int configRev;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>580</width>
|
<width>580</width>
|
||||||
<height>342</height>
|
<height>349</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle" >
|
||||||
@@ -435,7 +435,56 @@ p, li { white-space: pre-wrap; }
|
|||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="2" column="0" >
|
<item row="3" column="0" >
|
||||||
|
<layout class="QHBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing" >
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_17" >
|
||||||
|
<property name="maximumSize" >
|
||||||
|
<size>
|
||||||
|
<width>99</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Store Log Files for</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinBox_logStoreDuration" >
|
||||||
|
<property name="maximumSize" >
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximum" >
|
||||||
|
<number>7</number>
|
||||||
|
</property>
|
||||||
|
<property name="minimum" >
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="value" >
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_18" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Day(s)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0" >
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation" >
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@@ -448,13 +497,6 @@ p, li { white-space: pre-wrap; }
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" >
|
|
||||||
<widget class="Line" name="line_2" >
|
|
||||||
<property name="orientation" >
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0" >
|
||||||
<widget class="QLabel" name="label_6" >
|
<widget class="QLabel" name="label_6" >
|
||||||
<property name="font" >
|
<property name="font" >
|
||||||
@@ -468,6 +510,52 @@ p, li { white-space: pre-wrap; }
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0" >
|
||||||
|
<widget class="Line" name="line_2" >
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" >
|
||||||
|
<layout class="QHBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_16" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Log File Directory: </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_logDir" />
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_openLogDir" >
|
||||||
|
<property name="minimumSize" >
|
||||||
|
<size>
|
||||||
|
<width>27</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize" >
|
||||||
|
<size>
|
||||||
|
<width>27</width>
|
||||||
|
<height>23</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="icon" >
|
||||||
|
<iconset resource="deck.qrc" >:/graphics/graphics/fileopen16.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
|||||||
@@ -61,6 +61,10 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent)
|
|||||||
pushButton_openFlipsidePicture->setEnabled(TRUE);
|
pushButton_openFlipsidePicture->setEnabled(TRUE);
|
||||||
}
|
}
|
||||||
lineEdit_OwnFlipsideFilename->setText(QString::fromStdString(myConfig.readConfigString("FlipsideOwnFile", "")));
|
lineEdit_OwnFlipsideFilename->setText(QString::fromStdString(myConfig.readConfigString("FlipsideOwnFile", "")));
|
||||||
|
|
||||||
|
//Log
|
||||||
|
lineEdit_logDir->setText(QString::fromStdString(myConfig.readConfigString("LogDir", "")));
|
||||||
|
spinBox_logStoreDuration->setValue(myConfig.readConfigInt("LogStoreDuration", 2));
|
||||||
|
|
||||||
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() ) );
|
||||||
@@ -69,6 +73,7 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent)
|
|||||||
connect( lineEdit_Opponent3Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) );
|
connect( lineEdit_Opponent3Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) );
|
||||||
connect( lineEdit_Opponent4Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) );
|
connect( lineEdit_Opponent4Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) );
|
||||||
connect( pushButton_openFlipsidePicture, SIGNAL( clicked() ), this, SLOT( setFlipsidePicFileName()) );
|
connect( pushButton_openFlipsidePicture, SIGNAL( clicked() ), this, SLOT( setFlipsidePicFileName()) );
|
||||||
|
connect( pushButton_openLogDir, SIGNAL( clicked() ), this, SLOT( setLogDir()) );
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -104,6 +109,10 @@ void settingsDialogImpl::isAccepted() {
|
|||||||
myConfig.writeConfigInt("FlipsideOwn", radioButton_flipsideOwn->isChecked());
|
myConfig.writeConfigInt("FlipsideOwn", radioButton_flipsideOwn->isChecked());
|
||||||
myConfig.writeConfigString("FlipsideOwnFile", lineEdit_OwnFlipsideFilename->text().toStdString());
|
myConfig.writeConfigString("FlipsideOwnFile", lineEdit_OwnFlipsideFilename->text().toStdString());
|
||||||
|
|
||||||
|
// Log
|
||||||
|
myConfig.writeConfigString("LogDir", lineEdit_logDir->text().toStdString());
|
||||||
|
myConfig.writeConfigInt("LogStoreDuration", spinBox_logStoreDuration->value());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void settingsDialogImpl::setFlipsidePicFileName()
|
void settingsDialogImpl::setFlipsidePicFileName()
|
||||||
@@ -115,3 +124,13 @@ void settingsDialogImpl::setFlipsidePicFileName()
|
|||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
lineEdit_OwnFlipsideFilename->setText(fileName);
|
lineEdit_OwnFlipsideFilename->setText(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void settingsDialogImpl::setLogDir()
|
||||||
|
{
|
||||||
|
QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"),
|
||||||
|
QDir::homePath(),
|
||||||
|
QFileDialog::ShowDirsOnly
|
||||||
|
| QFileDialog::DontResolveSymlinks);
|
||||||
|
|
||||||
|
if (!dir.isEmpty()) lineEdit_logDir->setText(dir);
|
||||||
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ public slots:
|
|||||||
void isAccepted();
|
void isAccepted();
|
||||||
void playerNickChanged() { setPlayerNickIsChanged(TRUE); };
|
void playerNickChanged() { setPlayerNickIsChanged(TRUE); };
|
||||||
void setFlipsidePicFileName();
|
void setFlipsidePicFileName();
|
||||||
|
void setLogDir();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user