This commit is contained in:
doitux
2007-01-20 01:38:40 +00:00
parent ed989f2a64
commit 11fd7987d6
7 changed files with 229 additions and 97 deletions
+1
View File
@@ -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();
}
+29 -1
View File
@@ -498,6 +498,9 @@
</disabled>
</palette>
</property>
<property name="focusPolicy" >
<enum>Qt::ClickFocus</enum>
</property>
<property name="windowTitle" >
<string>PokerTH - The Open-Source Texas Holdem Engine</string>
</property>
@@ -554,6 +557,18 @@
<property name="enabled" >
<bool>true</bool>
</property>
<property name="minimumSize" >
<size>
<width>382</width>
<height>212</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>382</width>
<height>212</height>
</size>
</property>
<property name="palette" >
<palette>
<active>
@@ -1446,7 +1461,20 @@
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>0</height>
</size>
</property>
</spacer>
+29 -6
View File
@@ -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("<p align='center'><span style='font-size:x-large; font-weight:bold'>Pot Total</span></p>");
label_Sets->setText("<p align='center'><span style='font-size:medium; font-weight:bold'>Sets:</span></p>");
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;
}
+4
View File
@@ -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;
+157 -87
View File
@@ -44,7 +44,7 @@
</item>
<item>
<property name="text" >
<string>Log</string>
<string>Interface</string>
</property>
</item>
<item>
@@ -52,6 +52,11 @@
<string>Player Nicks</string>
</property>
</item>
<item>
<property name="text" >
<string>Log Messages</string>
</property>
</item>
</widget>
</item>
<item row="0" column="1" >
@@ -67,6 +72,27 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="0" colspan="2" >
<widget class="Line" name="line_3" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2" >
<widget class="QCheckBox" name="checkBox_showGameSettingsDialogOnNewGame" >
<property name="text" >
<string>Show game settings dialog on every new game</string>
</property>
</widget>
</item>
<item row="5" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Game-Speed</string>
</property>
</widget>
</item>
<item row="7" column="0" >
<spacer>
<property name="orientation" >
@@ -80,20 +106,6 @@
</property>
</spacer>
</item>
<item row="6" column="0" colspan="2" >
<widget class="QCheckBox" name="checkBox_showGameSettingsDialogOnNewGame" >
<property name="text" >
<string>show game settings dialog on every new game</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Start Cash</string>
</property>
</widget>
</item>
<item row="4" column="1" >
<widget class="QSpinBox" name="spinBox_smallBlind" >
<property name="maximum" >
@@ -104,10 +116,37 @@
</property>
</widget>
</item>
<item row="5" column="0" >
<widget class="QLabel" name="label" >
<item row="3" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Game-Speed</string>
<string>Start Cash</string>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Small Blind</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Number of Players</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2" >
<widget class="QLabel" name="label_5" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Game Settings</string>
</property>
</widget>
</item>
@@ -121,13 +160,6 @@
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Small Blind</string>
</property>
</widget>
</item>
<item row="5" column="1" >
<widget class="QSpinBox" name="spinBox_gameSpeed" >
<property name="maximum" >
@@ -151,36 +183,9 @@
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Number of Players</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2" >
<widget class="Line" name="line_3" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2" >
<widget class="QLabel" name="label_5" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Game Settings</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_3" >
<widget class="QWidget" name="page_2" >
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
@@ -188,7 +193,27 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="2" column="0" >
<item row="0" column="0" >
<widget class="QLabel" name="label_13" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Interface</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="Line" name="line_5" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
@@ -201,23 +226,10 @@
</property>
</spacer>
</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" >
<widget class="QLabel" name="label_6" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<item row="2" column="0" >
<widget class="QCheckBox" name="checkBox_showToolbox" >
<property name="text" >
<string>Log Settings</string>
<string>Show Toolbox</string>
</property>
</widget>
</item>
@@ -316,7 +328,49 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2" />
<widget class="QWidget" name="page_3" >
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="2" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</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" >
<widget class="QLabel" name="label_6" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Log Messages</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0" colspan="2" >
@@ -344,22 +398,6 @@
</tabstops>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>settingsDialog</receiver>
<slot>hide()</slot>
<hints>
<hint type="sourcelabel" >
<x>227</x>
<y>316</y>
</hint>
<hint type="destinationlabel" >
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
@@ -392,5 +430,37 @@
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>settingsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>243</x>
<y>315</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>315</y>
</hint>
<hint type="destinationlabel" >
<x>243</x>
<y>169</y>
</hint>
</hints>
</connection>
</connections>
</ui>
+8 -2
View File
@@ -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));
}
+1 -1
View File
@@ -30,7 +30,7 @@ public:
public slots:
void accept();
void isAccepted();
};
#endif