playernicks for local game enabled
This commit is contained in:
@@ -33,12 +33,16 @@ public:
|
||||
virtual ~GuiInterface();
|
||||
|
||||
|
||||
//wird nach Einbau der EngineInterfaces umbenannt in setGameInterface und cp.
|
||||
//set
|
||||
virtual void setGame(Game*) =0;
|
||||
virtual void setHand(HandInterface*) =0;
|
||||
virtual void setSession(Session*) =0;
|
||||
//
|
||||
|
||||
//get
|
||||
virtual int getMaxQuantityPlayers() const=0;
|
||||
virtual std::string getPlayerName(int) const=0;
|
||||
|
||||
|
||||
|
||||
//refresh-Funktionen
|
||||
virtual void refreshSet() const=0;
|
||||
@@ -89,8 +93,6 @@ public:
|
||||
virtual void meInAction() const=0;
|
||||
|
||||
|
||||
|
||||
|
||||
//log.cpp
|
||||
virtual void showPlayerActionLogMsg(std::string playName, int action, int setValue) const=0;
|
||||
|
||||
|
||||
@@ -52,10 +52,10 @@ QString ConfigFile::readConfig(QString varName, QString defaultvalue)
|
||||
stream << "gamespeed=4\n";
|
||||
stream << "showgamesettingsdialogonnewgame=1\n";
|
||||
stream << "myname=Human Player\n";
|
||||
stream << "oppponent1name=Player 1\n";
|
||||
stream << "oppponent2name=Player 2\n";
|
||||
stream << "oppponent3name=Player 3\n";
|
||||
stream << "oppponent4name=Player 4\n";
|
||||
stream << "opponent1name=Player 1\n";
|
||||
stream << "opponent2name=Player 2\n";
|
||||
stream << "opponent3name=Player 3\n";
|
||||
stream << "opponent4name=Player 4\n";
|
||||
configFile.close();
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ QString ConfigFile::readConfig(QString varName, QString defaultvalue)
|
||||
if (foundvarname == 0) {
|
||||
|
||||
QDir configDir;
|
||||
configDir.setPath(QDir::home().absPath()+"/.pokerth/config/");
|
||||
configDir.setPath(QDir::home().absPath()+"/.pokerth/");
|
||||
|
||||
QFile configFile (configDir.absPath()+"/pokerth.conf");
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@ GuiWrapper::GuiWrapper() : myLog(0), myW(0)
|
||||
myW = new mainWindowImpl;
|
||||
myW->show();
|
||||
|
||||
|
||||
myLog = new Log(myW);
|
||||
|
||||
myConfig = new ConfigFile;
|
||||
|
||||
}
|
||||
|
||||
@@ -47,6 +47,15 @@ void GuiWrapper::setHand(HandInterface *lh) { myW->setHand(lh); }
|
||||
void GuiWrapper::setSession(Session *s) { myW->setSession(s); }
|
||||
|
||||
int GuiWrapper::getMaxQuantityPlayers() const { return myW->getMaxQuantityPlayers(); }
|
||||
std::string GuiWrapper::getPlayerName(int id) const {
|
||||
|
||||
if(id==0) {
|
||||
return myConfig->readConfig("myname", "Human Player").toStdString() ;
|
||||
}
|
||||
else { return myConfig->readConfig("opponent"+QString::number(id)+"name", "Player "+QString::number(id)).toStdString() ; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GuiWrapper::refreshSet() const { myW->refreshSet(); }
|
||||
void GuiWrapper::refreshChangePlayer() const { myW->refreshChangePlayer(); }
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "log.h"
|
||||
#include "mainwindowimpl.h"
|
||||
#include "configfile.h"
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
@@ -44,6 +45,7 @@ public:
|
||||
void setSession(Session*);
|
||||
|
||||
int getMaxQuantityPlayers() const;
|
||||
std::string getPlayerName(int) const;
|
||||
|
||||
void refreshSet() const;
|
||||
void refreshChangePlayer() const;
|
||||
@@ -87,6 +89,7 @@ private:
|
||||
|
||||
Log *myLog;
|
||||
mainWindowImpl *myW;
|
||||
ConfigFile *myConfig;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -320,6 +320,7 @@ void mainWindowImpl::refreshButton() {
|
||||
|
||||
void mainWindowImpl::refreshPlayerName() {
|
||||
|
||||
// cout << "refresh" << endl;
|
||||
int i;
|
||||
for (i=1; i<maxQuantityPlayers; i++) { groupBoxArray[i]->setTitle(QString::fromStdString(actualHand->getPlayerArray()[i]->getMyName()));
|
||||
}
|
||||
|
||||
@@ -179,6 +179,14 @@
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11" />
|
||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||
<tabstops>
|
||||
<tabstop>spinBox_quantityPlayers</tabstop>
|
||||
<tabstop>spinBox_startCash</tabstop>
|
||||
<tabstop>spinBox_smallBlind</tabstop>
|
||||
<tabstop>spinBox_gameSpeed</tabstop>
|
||||
<tabstop>buttonOk</tabstop>
|
||||
<tabstop>buttonCancel</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
@@ -188,8 +196,8 @@
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>129</x>
|
||||
<y>176</y>
|
||||
<x>120</x>
|
||||
<y>201</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>137</x>
|
||||
@@ -204,8 +212,8 @@
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>222</x>
|
||||
<y>176</y>
|
||||
<x>201</x>
|
||||
<y>201</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>137</x>
|
||||
|
||||
@@ -328,6 +328,20 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>listWidget</tabstop>
|
||||
<tabstop>spinBox_quantityPlayers</tabstop>
|
||||
<tabstop>spinBox_startCash</tabstop>
|
||||
<tabstop>spinBox_smallBlind</tabstop>
|
||||
<tabstop>spinBox_gameSpeed</tabstop>
|
||||
<tabstop>checkBox_showGameSettingsDialogOnNewGame</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
<tabstop>lineEdit_humanPlayerName</tabstop>
|
||||
<tabstop>lineEdit_Opponent1Name</tabstop>
|
||||
<tabstop>lineEdit_Opponent2Name</tabstop>
|
||||
<tabstop>lineEdit_Opponent3Name</tabstop>
|
||||
<tabstop>lineEdit_Opponent4Name</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
|
||||
@@ -35,10 +35,10 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, const char *name)
|
||||
|
||||
//Player Nicks
|
||||
lineEdit_humanPlayerName->setText(config.readConfig("myname", "Human Player"));
|
||||
lineEdit_Opponent1Name->setText(config.readConfig("oppponent1name", "Player 1"));
|
||||
lineEdit_Opponent2Name->setText(config.readConfig("oppponent2name", "Player 2"));
|
||||
lineEdit_Opponent3Name->setText(config.readConfig("oppponent3name", "Player 3"));
|
||||
lineEdit_Opponent4Name->setText(config.readConfig("oppponent4name", "Player 4"));
|
||||
lineEdit_Opponent1Name->setText(config.readConfig("opponent1name", "Player 1"));
|
||||
lineEdit_Opponent2Name->setText(config.readConfig("opponent2name", "Player 2"));
|
||||
lineEdit_Opponent3Name->setText(config.readConfig("opponent3name", "Player 3"));
|
||||
lineEdit_Opponent4Name->setText(config.readConfig("opponent4name", "Player 4"));
|
||||
|
||||
//Game Settings
|
||||
spinBox_quantityPlayers->setValue(config.readConfig("numberofplayers", "5").toInt(&ok,10));
|
||||
@@ -60,10 +60,10 @@ void settingsDialogImpl::accept() {
|
||||
|
||||
//Player Nicks
|
||||
config.writeConfig("myname", lineEdit_humanPlayerName->text());
|
||||
config.writeConfig("oppponent1name", lineEdit_Opponent1Name->text());
|
||||
config.writeConfig("oppponent2name", lineEdit_Opponent2Name->text());
|
||||
config.writeConfig("oppponent3name", lineEdit_Opponent3Name->text());
|
||||
config.writeConfig("oppponent4name", lineEdit_Opponent4Name->text());
|
||||
config.writeConfig("opponent1name", lineEdit_Opponent1Name->text());
|
||||
config.writeConfig("opponent2name", lineEdit_Opponent2Name->text());
|
||||
config.writeConfig("opponent3name", lineEdit_Opponent3Name->text());
|
||||
config.writeConfig("opponent4name", lineEdit_Opponent4Name->text());
|
||||
|
||||
//Game Settings
|
||||
config.writeConfig("numberofplayers", QString::number(spinBox_quantityPlayers->value(),10));
|
||||
|
||||
Reference in New Issue
Block a user