Files
pokerth/src/gui/qt/settingsdialogimpl.cpp
T

79 lines
3.8 KiB
C++
Raw Normal View History

2007-01-17 01:22:55 +00:00
/***************************************************************************
* Copyright (C) 2006 by FThauer FHammer *
* f.thauer@web.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "settingsdialogimpl.h"
2007-01-17 23:57:41 +00:00
#include "configfile.h"
#include <iostream>
2007-01-17 01:22:55 +00:00
settingsDialogImpl::settingsDialogImpl(QWidget *parent, const char *name)
: QDialog(parent, name)
{
setupUi(this);
2007-01-17 23:57:41 +00:00
//Formulare Füllen
2007-01-22 22:25:58 +00:00
ConfigFile myConfig;
2007-01-17 23:57:41 +00:00
//Player Nicks
2007-01-22 22:25:58 +00:00
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")));
2007-01-17 23:57:41 +00:00
//Game Settings
2007-01-22 22:25:58 +00:00
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));
checkBox_showGameSettingsDialogOnNewGame->setChecked(myConfig.readConfigInt("ShowGameSettingsDialogOnNewGame", 1));
2007-01-20 01:38:40 +00:00
//Interface
2007-01-22 22:25:58 +00:00
checkBox_showToolbox->setChecked(myConfig.readConfigInt("ShowToolBox", 1));
2007-01-17 01:22:55 +00:00
2007-01-20 01:38:40 +00:00
connect( buttonBox, SIGNAL( accepted() ), this, SLOT( isAccepted() ) );
2007-01-17 23:57:41 +00:00
}
2007-01-20 01:38:40 +00:00
void settingsDialogImpl::isAccepted() {
2007-01-17 23:57:41 +00:00
//Daten speichern
2007-01-22 22:25:58 +00:00
ConfigFile myConfig;
2007-01-17 23:57:41 +00:00
2007-01-22 22:25:58 +00:00
// Player Nicks
myConfig.writeConfigString("MyName", lineEdit_humanPlayerName->text().toStdString());
myConfig.writeConfigString("Opponent1Name", lineEdit_Opponent1Name->text().toStdString());
myConfig.writeConfigString("Opponent2Name", lineEdit_Opponent2Name->text().toStdString());
myConfig.writeConfigString("Opponent3Name", lineEdit_Opponent3Name->text().toStdString());
myConfig.writeConfigString("Opponent4Name", lineEdit_Opponent4Name->text().toStdString());
2007-01-17 23:57:41 +00:00
2007-01-22 22:25:58 +00:00
// Game Settings
myConfig.writeConfigInt("NumberOfPlayers", spinBox_quantityPlayers->value());
myConfig.writeConfigInt("StartCash", spinBox_startCash->value());
myConfig.writeConfigInt("SmallBlind", spinBox_smallBlind->value());
myConfig.writeConfigInt("GameSpeed", spinBox_gameSpeed->value());
myConfig.writeConfigInt("ShowGameSettingsDialogOnNewGame", checkBox_showGameSettingsDialogOnNewGame->isChecked());
2007-01-17 23:57:41 +00:00
2007-01-22 22:25:58 +00:00
// Interface
myConfig.writeConfigInt("ShowToolBox", checkBox_showToolbox->isChecked());
2007-01-20 01:38:40 +00:00
2007-01-17 01:22:55 +00:00
}