From 11fd7987d641580d0d59d69e26ab81284ac97ae1 Mon Sep 17 00:00:00 2001 From: doitux Date: Sat, 20 Jan 2007 01:38:40 +0000 Subject: [PATCH] --- src/gui/qt/configfile.cpp | 1 + src/gui/qt/mainwindow.ui | 30 +++- src/gui/qt/mainwindowimpl.cpp | 35 ++++- src/gui/qt/mainwindowimpl.h | 4 + src/gui/qt/settingsdialog.ui | 244 +++++++++++++++++++----------- src/gui/qt/settingsdialogimpl.cpp | 10 +- src/gui/qt/settingsdialogimpl.h | 2 +- 7 files changed, 229 insertions(+), 97 deletions(-) diff --git a/src/gui/qt/configfile.cpp b/src/gui/qt/configfile.cpp index 076d44eb..41da7c6a 100644 --- a/src/gui/qt/configfile.cpp +++ b/src/gui/qt/configfile.cpp @@ -56,6 +56,7 @@ QString ConfigFile::readConfig(QString varName, QString defaultvalue) stream << "opponent2name=Player 2\n"; stream << "opponent3name=Player 3\n"; stream << "opponent4name=Player 4\n"; + stream << "showtoolbox=1\n"; configFile.close(); } diff --git a/src/gui/qt/mainwindow.ui b/src/gui/qt/mainwindow.ui index f492bce6..f64380e2 100644 --- a/src/gui/qt/mainwindow.ui +++ b/src/gui/qt/mainwindow.ui @@ -498,6 +498,9 @@ + + Qt::ClickFocus + PokerTH - The Open-Source Texas Holdem Engine @@ -554,6 +557,18 @@ true + + + 382 + 212 + + + + + 382 + 212 + + @@ -1446,7 +1461,20 @@ 20 - 20 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 0 diff --git a/src/gui/qt/mainwindowimpl.cpp b/src/gui/qt/mainwindowimpl.cpp index dd11096c..a83fd03b 100755 --- a/src/gui/qt/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindowimpl.cpp @@ -59,10 +59,16 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent, const char *name) if ( !progDir1.exists() ) { progDir1.mkdir(progDir1.absPath()); } + myConfigFile = new ConfigFile; setupUi(this); int i; + bool ok; + + //Toolbox verstecken? + if (!myConfigFile->readConfig("showtoolbox", "1").toInt(&ok,10)) { groupBox_tools->hide(); } + pushButton_raise->setDisabled(TRUE); pushButton_call->setDisabled(TRUE); @@ -187,17 +193,18 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent, const char *name) void mainWindowImpl::callNewGameDialog() { - ConfigFile configFile; + //wenn Dialogfenster gezeigt werden soll bool ok; - if(configFile.readConfig("showgamesettingsdialogonnewgame", "1").toInt(&ok,10)) { + if(myConfigFile->readConfig("showgamesettingsdialogonnewgame", "1").toInt(&ok,10)) { newGameDialogImpl *v = new newGameDialogImpl(); v->exec(); if (v->result() == QDialog::Accepted ) { - + + if(actualGame) { mySession->deleteGame(); actualGame = 0; @@ -248,7 +255,7 @@ void mainWindowImpl::callNewGameDialog() { label_Pot->setText("

Pot Total

"); label_Sets->setText("

Sets:

"); - guiGameSpeed = configFile.readConfig("gamespeed","4").toInt(&ok,10); + guiGameSpeed = myConfigFile->readConfig("gamespeed","4").toInt(&ok,10); // debugMode = v->checkBox_debugMode->isChecked(); //Tools und Board aufhellen und enablen @@ -259,11 +266,13 @@ void mainWindowImpl::callNewGameDialog() { //Speeds setSpeeds(); + //positioning Slider horizontalSlider_speed->setValue(guiGameSpeed); - + + //Start Game!!! - mySession->startGame(configFile.readConfig("numberofplayers","5").toInt(&ok,10), configFile.readConfig("startcash","2000").toInt(&ok,10), configFile.readConfig("smallblind","10").toInt(&ok,10)); + mySession->startGame(myConfigFile->readConfig("numberofplayers","5").toInt(&ok,10), myConfigFile->readConfig("startcash","2000").toInt(&ok,10), myConfigFile->readConfig("smallblind","10").toInt(&ok,10)); } @@ -279,6 +288,15 @@ void mainWindowImpl::callSettingsDialog() { settingsDialogImpl *v = new settingsDialogImpl(); v->exec(); + + if (v->result()) { + + bool ok; + //Toolbox verstecken? + if (!myConfigFile->readConfig("showtoolbox", "1").toInt(&ok,10)) { groupBox_tools->hide(); } + else { groupBox_tools->show(); } + + } } @@ -1348,3 +1366,8 @@ void mainWindowImpl::breakButtonClicked() { } } +void mainWindowImpl::keyPressEvent ( QKeyEvent * event ) { + +// cout << event->key()/*.toStdString()*/ << endl; + +} diff --git a/src/gui/qt/mainwindowimpl.h b/src/gui/qt/mainwindowimpl.h index 8d7a0d1c..c53e465f 100755 --- a/src/gui/qt/mainwindowimpl.h +++ b/src/gui/qt/mainwindowimpl.h @@ -30,6 +30,7 @@ class Game; class Session; class Log; +class ConfigFile; class BoardInterface; class HandInterface; @@ -155,12 +156,15 @@ public slots: void timerBlockerFalse(); void breakButtonClicked(); + void keyPressEvent ( QKeyEvent * event ); + private: Game *actualGame; HandInterface *actualHand; Session *mySession; Log *myLog; + ConfigFile *myConfigFile; QTimer *potDistributeTimer; diff --git a/src/gui/qt/settingsdialog.ui b/src/gui/qt/settingsdialog.ui index 02d41963..55663114 100644 --- a/src/gui/qt/settingsdialog.ui +++ b/src/gui/qt/settingsdialog.ui @@ -44,7 +44,7 @@
- Log + Interface @@ -52,6 +52,11 @@ Player Nicks
+ + + Log Messages + + @@ -67,6 +72,27 @@ 6 + + + + Qt::Horizontal + + + + + + + Show game settings dialog on every new game + + + + + + + Game-Speed + + + @@ -80,20 +106,6 @@ - - - - show game settings dialog on every new game - - - - - - - Start Cash - - - @@ -104,10 +116,37 @@ - - + + - Game-Speed + Start Cash + + + + + + + Small Blind + + + + + + + Number of Players + + + + + + + + 75 + true + + + + Game Settings @@ -121,13 +160,6 @@ - - - - Small Blind - - - @@ -151,36 +183,9 @@ - - - - Number of Players - - - - - - - Qt::Horizontal - - - - - - - - 75 - true - - - - Game Settings - - - - + 9 @@ -188,7 +193,27 @@ 6 - + + + + + 75 + true + + + + Interface + + + + + + + Qt::Horizontal + + + + Qt::Vertical @@ -201,23 +226,10 @@ - - - - Qt::Horizontal - - - - - - - - 75 - true - - + + - Log Settings + Show Toolbox @@ -316,7 +328,49 @@ - + + + + 9 + + + 6 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + + + + + + 75 + true + + + + Log Messages + + + + + @@ -344,22 +398,6 @@ - - buttonBox - accepted() - settingsDialog - hide() - - - 227 - 316 - - - 157 - 274 - - - buttonBox rejected() @@ -392,5 +430,37 @@ + + buttonBox + accepted() + settingsDialog + accept() + + + 243 + 315 + + + 243 + 169 + + + + + buttonBox + accepted() + settingsDialog + hide() + + + 243 + 315 + + + 243 + 169 + + + diff --git a/src/gui/qt/settingsdialogimpl.cpp b/src/gui/qt/settingsdialogimpl.cpp index 3a04806f..8a27c6a9 100644 --- a/src/gui/qt/settingsdialogimpl.cpp +++ b/src/gui/qt/settingsdialogimpl.cpp @@ -46,14 +46,17 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, const char *name) spinBox_smallBlind->setValue(config.readConfig("smallblind", "10").toInt(&ok,10)); spinBox_gameSpeed->setValue(config.readConfig("gamespeed", "4").toInt(&ok,10)); checkBox_showGameSettingsDialogOnNewGame->setChecked(config.readConfig("showgamesettingsdialogonnewgame", "1").toInt(&ok,10)); + + //Interface + checkBox_showToolbox->setChecked(config.readConfig("showtoolbox", "1").toInt(&ok,10)); - connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) ); + connect( buttonBox, SIGNAL( accepted() ), this, SLOT( isAccepted() ) ); } -void settingsDialogImpl::accept() { +void settingsDialogImpl::isAccepted() { //Daten speichern ConfigFile config; @@ -72,4 +75,7 @@ void settingsDialogImpl::accept() { config.writeConfig("gamespeed", QString::number(spinBox_gameSpeed->value(),10)); config.writeConfig("showgamesettingsdialogonnewgame", QString::number(checkBox_showGameSettingsDialogOnNewGame->isChecked(),10)); + //Interface + config.writeConfig("showtoolbox", QString::number(checkBox_showToolbox->isChecked(),10)); + } diff --git a/src/gui/qt/settingsdialogimpl.h b/src/gui/qt/settingsdialogimpl.h index 3663ec2f..1c4e9c92 100644 --- a/src/gui/qt/settingsdialogimpl.h +++ b/src/gui/qt/settingsdialogimpl.h @@ -30,7 +30,7 @@ public: public slots: - void accept(); + void isAccepted(); }; #endif