This commit is contained in:
doitux
2007-02-03 22:47:16 +00:00
parent b186596b88
commit 27041becbf
10 changed files with 118 additions and 117 deletions
+16
View File
@@ -26,6 +26,22 @@ using namespace std;
Log::Log(mainWindowImpl* w) : myW(w)
{
myW->setLog(this);
myConfig = new ConfigFile;
if(myConfig->readConfigString("LogDir") != "" && QDir::QDir(QString::fromStdString(myConfig->readConfigString("LogDir"))).exists()) {
myLogDir = new QDir(QString::fromStdString(myConfig->readConfigString("LogDir")));
myLogFile = new QFile(myLogDir->absolutePath()+"/pokerth-log-"+QDateTime::currentDateTime().toString("yyyy-MM-dd_hh:mm:ss")+".log");
myLogFile->open( QIODevice::WriteOnly );
QTextStream stream( myLogFile );
stream << "### This is a Log File for PokerTH ### \n";
myLogFile->close();
}
;
}
+8
View File
@@ -22,10 +22,15 @@
#include <string>
#include <iostream>
#include "configfile.h"
#include <QtCore>
class mainWindowImpl;
class Log{
@@ -41,6 +46,9 @@ public:
private:
mainWindowImpl *myW;
ConfigFile *myConfig;
QFile *myLogFile;
QDir *myLogDir;
};
+23 -22
View File
@@ -176,8 +176,8 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent)
//Flipside festlegen;
flipside = new QPixmap(":/cards/graphics/cards/flipside.png");
if (myConfig->readConfigInt("FlipsideOwn",0) && myConfig->readConfigString("FlipsideOwnFile","") != "") {
QPixmap tmpFlipside(QString::fromStdString(myConfig->readConfigString("FlipsideOwnFile", "")));
if (myConfig->readConfigInt("FlipsideOwn") && myConfig->readConfigString("FlipsideOwnFile") != "") {
QPixmap tmpFlipside(QString::fromStdString(myConfig->readConfigString("FlipsideOwnFile")));
flipside = new QPixmap(tmpFlipside.scaled(QSize(57, 80)));
}
else { flipside->load(":/cards/graphics/cards/flipside.png"); }
@@ -187,9 +187,9 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent)
//Toolbox verstecken?
if (!myConfig->readConfigInt("ShowToolBox", 1)) { groupBox_tools->hide(); }
if (!myConfig->readConfigInt("ShowToolBox")) { groupBox_tools->hide(); }
//Intro abspielen?
if (myConfig->readConfigInt("ShowIntro", 1)) {
if (myConfig->readConfigInt("ShowIntro")) {
label_logo->hide();
QTimer::singleShot(100, this, SLOT( paintStartSplash() )); }
@@ -411,7 +411,7 @@ void mainWindowImpl::callNewGameDialog() {
//wenn Dialogfenster gezeigt werden soll
if(myConfig->readConfigInt("ShowGameSettingsDialogOnNewGame", 1)){
if(myConfig->readConfigInt("ShowGameSettingsDialogOnNewGame")){
newGameDialogImpl *v = new newGameDialogImpl();
v->exec();
@@ -458,7 +458,7 @@ void mainWindowImpl::callNewGameDialog() {
actualGame = 0;
}
guiGameSpeed = myConfig->readConfigInt("GameSpeed",4);
guiGameSpeed = myConfig->readConfigInt("GameSpeed");
//Speeds
setSpeeds();
@@ -482,7 +482,7 @@ void mainWindowImpl::callNewGameDialog() {
horizontalSlider_speed->setValue(guiGameSpeed);
//Start Game!!!
mySession->startGame(myConfig->readConfigInt("NumberOfPlayers",5), myConfig->readConfigInt("StartCash",2000), myConfig->readConfigInt("SmallBlind",10));
mySession->startGame(myConfig->readConfigInt("NumberOfPlayers"), myConfig->readConfigInt("StartCash"), myConfig->readConfigInt("SmallBlind"));
}
@@ -500,10 +500,10 @@ void mainWindowImpl::callSettingsDialog() {
settingsDialogImpl *v = new settingsDialogImpl();
v->exec();
if (v->result()) {
if (v->getSettingsCorrect()) {
//Toolbox verstecken?
if (!myConfig->readConfigInt("ShowToolBox", 1)) { groupBox_tools->hide(); }
if (!myConfig->readConfigInt("ShowToolBox")) { groupBox_tools->hide(); }
else { groupBox_tools->show(); }
//Falls Spielernamen geändert wurden --> neu zeichnen --> erst beim nächsten Neustart neu ausgelesen
@@ -520,9 +520,10 @@ void mainWindowImpl::callSettingsDialog() {
}
//Flipside refresh
if (myConfig->readConfigInt("FlipsideOwn",0) && myConfig->readConfigString("FlipsideOwnFile","") != "") {
QPixmap tmpFlipside(QString::fromStdString(myConfig->readConfigString("FlipsideOwnFile", "")));
flipside = new QPixmap(tmpFlipside.scaled(QSize(57, 80)));
if (myConfig->readConfigInt("FlipsideOwn") && myConfig->readConfigString("FlipsideOwnFile") != "") {
QPixmap tmpFlipside(QString::fromStdString(myConfig->readConfigString("FlipsideOwnFile")));
flipside = new QPixmap(tmpFlipside.scaled(QSize(57, 80)));
}
else { flipside->load(":/cards/graphics/cards/flipside.png"); }
@@ -804,7 +805,7 @@ void mainWindowImpl::dealFlopCards4() {
QPixmap card(tempCardsPixmap);
//Config? mit oder ohne Eye-Candy?
if(myConfig->readConfigInt("ShowFlipCardsAnimation", 1)) {
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
//mit Eye-Candy
boardCardsArray[0]->startFlipCards(guiGameSpeed, card, flipside);
}
@@ -824,7 +825,7 @@ void mainWindowImpl::dealFlopCards5() {
QPixmap card(tempCardsPixmap);
//Config? mit oder ohne Eye-Candy?
if(myConfig->readConfigInt("ShowFlipCardsAnimation", 1)) {
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
//mit Eye-Candy
boardCardsArray[1]->startFlipCards(guiGameSpeed, card, flipside);
}
@@ -845,7 +846,7 @@ void mainWindowImpl::dealFlopCards6() {
QPixmap card(tempCardsPixmap);
//Config? mit oder ohne Eye-Candy?
if(myConfig->readConfigInt("ShowFlipCardsAnimation", 1)) {
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
//mit Eye-Candy
boardCardsArray[2]->startFlipCards(guiGameSpeed, card, flipside);
}
@@ -880,7 +881,7 @@ void mainWindowImpl::dealTurnCards2() {
QPixmap card(tempCardsPixmap);
//Config? mit oder ohne Eye-Candy?
if(myConfig->readConfigInt("ShowFlipCardsAnimation", 1)) {
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
//mit Eye-Candy
boardCardsArray[3]->startFlipCards(guiGameSpeed, card, flipside);
}
@@ -916,7 +917,7 @@ void mainWindowImpl::dealRiverCards2() {
QPixmap card(tempCardsPixmap);
//Config? mit oder ohne Eye-Candy?
if(myConfig->readConfigInt("ShowFlipCardsAnimation", 1)) {
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
//mit Eye-Candy
boardCardsArray[4]->startFlipCards(guiGameSpeed, card, flipside);
}
@@ -1303,7 +1304,7 @@ void mainWindowImpl::postRiverRunAnimation2() {
if(!flipHolecardsAllInAlreadyDone) {
//Config? mit oder ohne Eye-Candy?
if(myConfig->readConfigInt("ShowFlipCardsAnimation", 1)) {
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
// mit Eye-Candy
//TempArrays
@@ -1369,7 +1370,7 @@ void mainWindowImpl::postRiverRunAnimation3() {
actionLabelArray[i]->setText("<p align='center'><b>- Winner -</b></p>");
//nicht gewonnene Karten ausblenden
if ( actualHand->getActivePlayersCounter() != 1 && myConfig->readConfigInt("ShowFadeOutCardsAnimation", 1)) {
if ( actualHand->getActivePlayersCounter() != 1 && myConfig->readConfigInt("ShowFadeOutCardsAnimation")) {
int j;
@@ -1421,7 +1422,7 @@ void mainWindowImpl::postRiverRunAnimation3() {
}
else {
if( actualHand->getActivePlayersCounter() != 1 && actualHand->getPlayerArray()[i]->getMyAction() != 1 && actualHand->getPlayerArray()[i]->getMyActiveStatus() && myConfig->readConfigInt("ShowFadeOutCardsAnimation", 1) ) {
if( actualHand->getActivePlayersCounter() != 1 && actualHand->getPlayerArray()[i]->getMyAction() != 1 && actualHand->getPlayerArray()[i]->getMyActiveStatus() && myConfig->readConfigInt("ShowFadeOutCardsAnimation") ) {
//aufgedeckte Gegner auch ausblenden
holeCardsArray[i][0]->startFadeOut(guiGameSpeed);
@@ -1533,7 +1534,7 @@ void mainWindowImpl::flipHolecardsAllIn() {
if(activePlayersCounter!=1) {
//Config? mit oder ohne Eye-Candy?
if(myConfig->readConfigInt("ShowFlipCardsAnimation", 1)) {
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
// mit Eye-Candy
//TempArrays
@@ -1641,7 +1642,7 @@ void mainWindowImpl::nextRoundCleanGui() {
flipHolecardsAllInAlreadyDone = FALSE;
//Wenn Pause zwischen den Hands in der Konfiguration steht den Stop Button drücken!
if (myConfig->readConfigInt("PauseBetweenHands", 0)) { pushButton_break->click(); }
if (myConfig->readConfigInt("PauseBetweenHands")) { pushButton_break->click(); }
}
+5 -5
View File
@@ -31,11 +31,11 @@ newGameDialogImpl::newGameDialogImpl(QWidget *parent)
//Game Settings
spinBox_quantityPlayers->setValue(myConfig.readConfigInt("NumberOfPlayers", 5));
spinBox_startCash->setValue(myConfig.readConfigInt("StartCash", 2000));
spinBox_smallBlind->setValue(myConfig.readConfigInt("SmallBlind", 10));
spinBox_gameSpeed->setValue(myConfig.readConfigInt("GameSpeed", 4));
spinBox_handsBeforeRaiseSmallBlind->setValue(myConfig.readConfigInt("HandsBeforeRaiseSmallBlind", 9));
spinBox_quantityPlayers->setValue(myConfig.readConfigInt("NumberOfPlayers"));
spinBox_startCash->setValue(myConfig.readConfigInt("StartCash"));
spinBox_smallBlind->setValue(myConfig.readConfigInt("SmallBlind"));
spinBox_gameSpeed->setValue(myConfig.readConfigInt("GameSpeed"));
spinBox_handsBeforeRaiseSmallBlind->setValue(myConfig.readConfigInt("HandsBeforeRaiseSmallBlind"));
}
+20 -52
View File
@@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>580</width>
<height>349</height>
<width>571</width>
<height>353</height>
</rect>
</property>
<property name="windowTitle" >
@@ -644,8 +644,8 @@ p, li { white-space: pre-wrap; }
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>295</x>
<y>302</y>
<x>304</x>
<y>339</y>
</hint>
<hint type="destinationlabel" >
<x>286</x>
@@ -669,38 +669,6 @@ p, li { white-space: pre-wrap; }
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>settingsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>243</x>
<y>295</y>
</hint>
<hint type="destinationlabel" >
<x>243</x>
<y>169</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>settingsDialog</receiver>
<slot>hide()</slot>
<hints>
<hint type="sourcelabel" >
<x>243</x>
<y>295</y>
</hint>
<hint type="destinationlabel" >
<x>243</x>
<y>169</y>
</hint>
</hints>
</connection>
<connection>
<sender>radioButton_flipsideTux</sender>
<signal>clicked(bool)</signal>
@@ -708,12 +676,12 @@ p, li { white-space: pre-wrap; }
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>209</x>
<y>170</y>
<x>394</x>
<y>213</y>
</hint>
<hint type="destinationlabel" >
<x>353</x>
<y>205</y>
<x>512</x>
<y>245</y>
</hint>
</hints>
</connection>
@@ -724,12 +692,12 @@ p, li { white-space: pre-wrap; }
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>220</x>
<y>210</y>
<x>325</x>
<y>246</y>
</hint>
<hint type="destinationlabel" >
<x>429</x>
<y>207</y>
<x>512</x>
<y>245</y>
</hint>
</hints>
</connection>
@@ -740,12 +708,12 @@ p, li { white-space: pre-wrap; }
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>345</x>
<y>173</y>
<x>530</x>
<y>213</y>
</hint>
<hint type="destinationlabel" >
<x>474</x>
<y>194</y>
<x>520</x>
<y>245</y>
</hint>
</hints>
</connection>
@@ -756,12 +724,12 @@ p, li { white-space: pre-wrap; }
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>199</x>
<y>208</y>
<x>325</x>
<y>246</y>
</hint>
<hint type="destinationlabel" >
<x>463</x>
<y>201</y>
<x>520</x>
<y>245</y>
</hint>
</hints>
</connection>
+34 -22
View File
@@ -34,37 +34,37 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent)
ConfigFile myConfig;
//Player Nicks
lineEdit_humanPlayerName->setText(QString::fromStdString(myConfig.readConfigString("MyName", "Human Player")));
lineEdit_Opponent1Name->setText(QString::fromStdString(myConfig.readConfigString("Opponent1Name", "Player 1")));
lineEdit_Opponent2Name->setText(QString::fromStdString(myConfig.readConfigString("Opponent2Name", "Player 2")));
lineEdit_Opponent3Name->setText(QString::fromStdString(myConfig.readConfigString("Opponent3Name", "Player 3")));
lineEdit_Opponent4Name->setText(QString::fromStdString(myConfig.readConfigString("Opponent4Name", "Player 4")));
lineEdit_humanPlayerName->setText(QString::fromStdString(myConfig.readConfigString("MyName")));
lineEdit_Opponent1Name->setText(QString::fromStdString(myConfig.readConfigString("Opponent1Name")));
lineEdit_Opponent2Name->setText(QString::fromStdString(myConfig.readConfigString("Opponent2Name")));
lineEdit_Opponent3Name->setText(QString::fromStdString(myConfig.readConfigString("Opponent3Name")));
lineEdit_Opponent4Name->setText(QString::fromStdString(myConfig.readConfigString("Opponent4Name")));
//Game Settings
spinBox_quantityPlayers->setValue(myConfig.readConfigInt("NumberOfPlayers", 5));
spinBox_startCash->setValue(myConfig.readConfigInt("StartCash", 2000));
spinBox_smallBlind->setValue(myConfig.readConfigInt("SmallBlind", 10));
spinBox_handsBeforeRaiseSmallBlind->setValue(myConfig.readConfigInt("HandsBeforeRaiseSmallBlind", 9));
spinBox_gameSpeed->setValue(myConfig.readConfigInt("GameSpeed", 4));
checkBox_pauseBetweenHands->setChecked(myConfig.readConfigInt("PauseBetweenHands", 0));
checkBox_showGameSettingsDialogOnNewGame->setChecked(myConfig.readConfigInt("ShowGameSettingsDialogOnNewGame", 1));
spinBox_quantityPlayers->setValue(myConfig.readConfigInt("NumberOfPlayers"));
spinBox_startCash->setValue(myConfig.readConfigInt("StartCash"));
spinBox_smallBlind->setValue(myConfig.readConfigInt("SmallBlind"));
spinBox_handsBeforeRaiseSmallBlind->setValue(myConfig.readConfigInt("HandsBeforeRaiseSmallBlind"));
spinBox_gameSpeed->setValue(myConfig.readConfigInt("GameSpeed"));
checkBox_pauseBetweenHands->setChecked(myConfig.readConfigInt("PauseBetweenHands"));
checkBox_showGameSettingsDialogOnNewGame->setChecked(myConfig.readConfigInt("ShowGameSettingsDialogOnNewGame"));
//Interface
checkBox_showToolbox->setChecked(myConfig.readConfigInt("ShowToolBox", 1));
checkBox_showIntro->setChecked(myConfig.readConfigInt("ShowIntro", 1));
checkBox_showFadeOutCardsAnimation->setChecked(myConfig.readConfigInt("ShowFadeOutCardsAnimation", 1));
checkBox_showFlipCardsAnimation->setChecked(myConfig.readConfigInt("ShowFlipCardsAnimation", 1));
radioButton_flipsideTux->setChecked(myConfig.readConfigInt("FlipsideTux", 1));
radioButton_flipsideOwn->setChecked(myConfig.readConfigInt("FlipsideOwn", 0));
checkBox_showToolbox->setChecked(myConfig.readConfigInt("ShowToolBox"));
checkBox_showIntro->setChecked(myConfig.readConfigInt("ShowIntro"));
checkBox_showFadeOutCardsAnimation->setChecked(myConfig.readConfigInt("ShowFadeOutCardsAnimation"));
checkBox_showFlipCardsAnimation->setChecked(myConfig.readConfigInt("ShowFlipCardsAnimation"));
radioButton_flipsideTux->setChecked(myConfig.readConfigInt("FlipsideTux"));
radioButton_flipsideOwn->setChecked(myConfig.readConfigInt("FlipsideOwn"));
if(radioButton_flipsideOwn->isChecked()) {
lineEdit_OwnFlipsideFilename->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));
lineEdit_logDir->setText(QString::fromStdString(myConfig.readConfigString("LogDir")));
spinBox_logStoreDuration->setValue(myConfig.readConfigInt("LogStoreDuration"));
connect( buttonBox, SIGNAL( accepted() ), this, SLOT( isAccepted() ) );
connect( lineEdit_humanPlayerName, SIGNAL( textChanged( const QString &) ), this, SLOT( playerNickChanged() ) );
@@ -81,6 +81,8 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent)
void settingsDialogImpl::isAccepted() {
settingsCorrect = TRUE;
//Daten speichern
ConfigFile myConfig;
@@ -110,9 +112,19 @@ void settingsDialogImpl::isAccepted() {
myConfig.writeConfigString("FlipsideOwnFile", lineEdit_OwnFlipsideFilename->text().toStdString());
// Log
myConfig.writeConfigString("LogDir", lineEdit_logDir->text().toStdString());
if(QDir::QDir(lineEdit_logDir->text()).exists() && lineEdit_logDir->text() != "") { myConfig.writeConfigString("LogDir", lineEdit_logDir->text().toStdString()); }
else {
QMessageBox::warning(this, tr("Settings Error"),
tr("The Log File Directory doesn't exists.\n"
"Please select an existing Directory!"),
QMessageBox::Ok);
settingsCorrect = FALSE;
}
myConfig.writeConfigInt("LogStoreDuration", spinBox_logStoreDuration->value());
if(settingsCorrect) { this->hide(); }
}
void settingsDialogImpl::setFlipsidePicFileName()
+3
View File
@@ -34,6 +34,8 @@ public:
void setPlayerNickIsChanged(bool theValue){ playerNickIsChanged = theValue;}
bool getPlayerNickIsChanged() const{ return playerNickIsChanged;}
bool getSettingsCorrect() const{ return settingsCorrect;}
public slots:
void isAccepted();
@@ -44,6 +46,7 @@ public slots:
private:
bool playerNickIsChanged;
bool settingsCorrect;
};