This commit is contained in:
doitux
2007-02-04 13:46:27 +00:00
parent ff6c1e5cbd
commit a7fa1b03e7
11 changed files with 87 additions and 28 deletions
+4 -1
View File
@@ -31,7 +31,7 @@
using namespace std;
Game::Game(ConfigFile* c, GuiInterface* g, int qP, int sC, int sB) : myConfig(c), myGui(g), actualHand(0), actualBoard(0), startQuantityPlayers(qP), startCash(sC), startSmallBlind(sB), actualQuantityPlayers(qP), actualSmallBlind(sB), actualHandID(0), dealerPosition(0)
Game::Game(ConfigFile* c, GuiInterface* g, int qP, int sC, int sB, int gId) : myConfig(c), myGui(g), actualHand(0), actualBoard(0), startQuantityPlayers(qP), startCash(sC), startSmallBlind(sB), myGameID(gId), actualQuantityPlayers(qP), actualSmallBlind(sB), actualHandID(0), dealerPosition(0)
{
// cout << "Create Game Object" << "\n";
int i;
@@ -142,5 +142,8 @@ void Game::startHand()
} while(!(playerArray[dealerPosition]->getMyActiveStatus()));
myGui->logNewGameHandMsg(myGameID, actualHandID);
// Abfrage Cash==0 -> player inactive -> actualQuantityPlayer--
}
+6 -2
View File
@@ -35,7 +35,7 @@ class ConfigFile;
class Game {
public:
Game(ConfigFile*, GuiInterface*, int, int, int);
Game(ConfigFile*, GuiInterface*, int, int, int, int);
~Game();
@@ -52,6 +52,10 @@ public:
void setDealerPosition(const int& theValue) { dealerPosition = theValue; }
int getDealerPosition() const { return dealerPosition; }
void setMyGameID(const int& theValue) { myGameID = theValue;}
int getMyGameID() const { return myGameID; }
//Zufgriff Laufvariablen
void setActualQuantityPlayers(const int& theValue) { actualQuantityPlayers = theValue; }
@@ -83,11 +87,11 @@ private:
BoardInterface *actualBoard;
PlayerInterface *playerArray[5];
//Startvariablen
int startQuantityPlayers;
int startCash;
int startSmallBlind;
int myGameID;
//Laufvariablen
int actualQuantityPlayers;
+2 -1
View File
@@ -92,7 +92,8 @@ public:
//log.cpp
virtual void logPlayerActionMsg(std::string playName, int action, int setValue) const=0;
virtual void logPlayerActionMsg(std::string playName, int action, int setValue) =0;
virtual void logNewGameHandMsg(int gameID, int HandID) =0;
+2 -2
View File
@@ -86,7 +86,7 @@ void GuiWrapper::nextRoundCleanGui() const { myW->nextRoundCleanGui(); }
void GuiWrapper::meInAction() const { myW->meInAction(); }
void GuiWrapper::logPlayerActionMsg(string playerName, int action, int setValue) const { myLog->logPlayerActionMsg(playerName, action, setValue); }
void GuiWrapper::logPlayerActionMsg(string playerName, int action, int setValue) { myLog->logPlayerActionMsg(playerName, action, setValue); }
void GuiWrapper::logNewGameHandMsg(int gameID, int handID) { myLog->logNewGameHandMsg(gameID, handID); }
+2 -1
View File
@@ -83,7 +83,8 @@ public:
void meInAction() const;
void logPlayerActionMsg(std::string playerName, int action, int setValue) const;
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
void logNewGameHandMsg(int gameID, int handID) ;
private:
+39 -12
View File
@@ -38,18 +38,16 @@ Log::Log(mainWindowImpl* w) : myW(w)
myLogFile->open( QIODevice::WriteOnly );
QTextStream stream( myLogFile );
stream << "<html>";
stream << "<body>";
stream << "<img src='logo.png'>";
stream << "<h3><b>Log-File for PokerTH Session started on "+QDate::currentDate().toString("yyyy-MM-dd")+" at "+QTime::currentTime().toString("hh:mm:ss")+"</b></h3>";
stream << "</body>";
stream << "</html>";
stream << "<html>\n";
stream << "<body>\n";
stream << "<img src='logo.png'>\n";
stream << "<h3><b>Log-File for PokerTH Session started on "+QDate::currentDate().toString("yyyy-MM-dd")+" at "+QTime::currentTime().toString("hh:mm:ss")+"</b></h3>\n";
stream << "</body>\n";
stream << "</html>\n";
myLogFile->close();
linesInFile = 5;
}
;
}
@@ -57,8 +55,10 @@ Log::~Log()
{
}
void Log::logPlayerActionMsg(string playerName, int action, int setValue) const {
void Log::logPlayerActionMsg(string playerName, int action, int setValue) {
int i;
QString msg;
msg = QString::fromStdString(playerName);
@@ -83,7 +83,34 @@ void Log::logPlayerActionMsg(string playerName, int action, int setValue) const
myW->textBrowser_Log->append(msg);
myLogFile->open( QIODevice::ReadWrite );
QTextStream stream( myLogFile );
for(i=0; i<=linesInFile-2; i++) { stream.readLine(); }
stream << msg+"</br>\n";
stream << "</body>\n";
stream << "</html>\n";
myLogFile->close();
linesInFile++;
}
void Log::logNewGameHandMsg(int gameID, int handID) {
int i;
myW->textBrowser_Log->append("## Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" ##");
myLogFile->open( QIODevice::ReadWrite );
QTextStream stream( myLogFile );
for(i=0; i<=linesInFile-2; i++) { stream.readLine(); }
QString msg("<p style='text-weight:bold;'>##### Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" #####<p>");
stream << msg << "\n";
stream << "</body>\n";
stream << "</html>\n";
myLogFile->close();
linesInFile++;
}
+4 -1
View File
@@ -40,11 +40,14 @@ public:
~Log();
void logPlayerActionMsg(std::string playName, int action, int setValue) const;
void logPlayerActionMsg(std::string playName, int action, int setValue);
void logNewGameHandMsg(int gameID, int handID);
private:
int linesInFile;
mainWindowImpl *myW;
ConfigFile *myConfig;
QFile *myLogFile;
+2 -2
View File
@@ -578,7 +578,7 @@
</size>
</property>
<property name="pixmap" >
<pixmap resource="deck.qrc" >:/graphics/graphics/logo-140-100.png</pixmap>
<pixmap/>
</property>
</widget>
</item>
@@ -4036,7 +4036,7 @@
<tabstop>pushButton_allin</tabstop>
</tabstops>
<resources>
<include location="deck.qrc" />
<include location="../deck.qrc" />
</resources>
<connections>
<connection>
+17 -5
View File
@@ -352,6 +352,9 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent)
inactive.setRgb(83,141,107);
highlight.setRgb(151,214,109);
//ShortCuts
// QShortcut *startNewGameKeys = new QShortcut(QKeySequence(Qt::Key_Control), Ui::mainWindow);
//Connects
connect(dealFlopCards0Timer, SIGNAL(timeout()), this, SLOT( dealFlopCards1() ));
connect(dealFlopCards1Timer, SIGNAL(timeout()), this, SLOT( dealFlopCards2() ));
@@ -385,6 +388,9 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent)
connect(postRiverRunAnimation5Timer, SIGNAL(timeout()), this, SLOT( postRiverRunAnimation6() ));
connect(postRiverRunAnimation6Timer, SIGNAL(timeout()), this, SLOT( startNewHand() ));
// connect( startNewGameKeys, SIGNAL(activated() ), this, SLOT( callNewGameDialog() ) );
connect( actionNewGame, SIGNAL( triggered() ), this, SLOT( callNewGameDialog() ) );
connect( actionAboutPokerth, SIGNAL( triggered() ), this, SLOT( callAboutPokerthDialog() ) );
connect( actionSettings, SIGNAL( triggered() ), this, SLOT( callSettingsDialog() ) );
@@ -560,8 +566,8 @@ void mainWindowImpl::refreshSet() {
void mainWindowImpl::refreshButton() {
QPixmap dealerButton(":/graphics/cards/dealerbutton.png");
QPixmap onePix(":/graphics/cards/1px.png");
QPixmap dealerButton(":/graphics/graphics/dealerbutton.png");
QPixmap onePix(":/graphics/graphics/1px.png");
int i;
for (i=0; i<maxQuantityPlayers; i++) {
@@ -593,7 +599,7 @@ void mainWindowImpl::refreshAction() {
if (actualHand->getPlayerArray()[i]->getMyAction()==1) {
groupBoxArray[i]->setDisabled(TRUE);
QPixmap onePix(":/graphics/cards/1px.png");
QPixmap onePix(":/graphics/graphics/1px.png");
if(i != 0) {
holeCardsArray[i][0]->setPixmap(onePix, FALSE);
holeCardsArray[i][1]->setPixmap(onePix, FALSE);
@@ -1744,11 +1750,17 @@ void mainWindowImpl::paintStartSplash() {
void mainWindowImpl::keyPressEvent ( QKeyEvent * event ) {
// cout << event->key() << endl;
cout << event->key() << endl;
bool ctrlPressed = FALSE;
if (event->key() == 16777220) { if(spinBox_set->hasFocus()) pushButton_set->click(); } //ENTER
if (event->key() == 16777265) { switchToolBox(); } //F2
if (event->key() == 16777249) { pushButton_break->click(); } //CTRL
if (event->key() == 16777249) {
pushButton_break->click();
ctrlPressed = TRUE;
// QTimer::SingleShot
} //CTRL
// if (event->key() == 65) { paintStartSplash();
+3 -1
View File
@@ -29,6 +29,7 @@ using namespace std;
Session::Session(GuiInterface* g) : actualGame(0), myGui(g)
{
actualGameID = 0;
// Session an mainwindowimpl bergeben
myGui->setSession(this);
@@ -45,8 +46,9 @@ Session::~Session()
void Session::startGame(int qP, int sC, int sB) {
actualGame = new Game(myConfig, myGui, qP, sC, sB);
actualGameID++;
actualGame = new Game(myConfig, myGui, qP, sC, sB, actualGameID);
}
void Session::deleteGame() {
+6
View File
@@ -38,9 +38,15 @@ public:
void startGame(int, int, int);
void deleteGame();
void setActualGameID(const int& theValue) { actualGameID = theValue; }
int getActualGameID() const { return actualGameID; }
// void createConfig();
private:
int actualGameID;
Game *actualGame;
GuiInterface *myGui;
ConfigFile *myConfig;