diff --git a/src/gui/qt/log.cpp b/src/gui/qt/log.cpp index b6e721d2..00b5a154 100644 --- a/src/gui/qt/log.cpp +++ b/src/gui/qt/log.cpp @@ -42,11 +42,11 @@ Log::Log(mainWindowImpl* w) : myW(w) stream << "\n"; stream << "\n"; stream << "

Log-File for PokerTH Session started on "+QDate::currentDate().toString("yyyy-MM-dd")+" at "+QTime::currentTime().toString("hh:mm:ss")+"

\n"; - stream << "\n"; - stream << "\n"; +// stream << "\n"; +// stream << "\n"; myLogFile->close(); - linesInFile = 5; + linesInFile = 3; } } @@ -85,10 +85,10 @@ void Log::logPlayerActionMsg(string playerName, int action, int setValue) { myLogFile->open( QIODevice::ReadWrite ); QTextStream stream( myLogFile ); - for(i=0; i<=linesInFile-2; i++) { stream.readLine(); } + for(i=0; i<=linesInFile; i++) { stream.readLine(); } stream << msg+"
\n"; - stream << "\n"; - stream << "\n"; +// stream << "\n"; +// stream << "\n"; myLogFile->close(); linesInFile++; @@ -103,14 +103,45 @@ void Log::logNewGameHandMsg(int gameID, int handID) { myLogFile->open( QIODevice::ReadWrite ); QTextStream stream( myLogFile ); - for(i=0; i<=linesInFile-2; i++) { stream.readLine(); } + for(i=0; i<=linesInFile; i++) { stream.readLine(); } - QString msg("

##### Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" #####

"); + QString msg("

##### Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" #####
"); stream << msg << "\n"; - stream << "\n"; - stream << "\n"; + + for(i=0; igetMaxQuantityPlayers(); i++) { + if(myW->getActualHand()->getPlayerArray()[i]->getMyButton() == 1) { + stream << QString::fromStdString(myW->getActualHand()->getPlayerArray()[i]->getMyName())+" (Dealer): "+QString::number(myW->getActualHand()->getPlayerArray()[i]->getMyCash(),10)+"$, "; + } + else { + stream << QString::fromStdString(myW->getActualHand()->getPlayerArray()[i]->getMyName())+": "+QString::number(myW->getActualHand()->getPlayerArray()[i]->getMyCash(),10)+"$, "; + } + } + stream << "

\n"; +// stream << "\n"; +// stream << "\n"; myLogFile->close(); linesInFile++; + linesInFile++; + +} + +void Log::logPlayerWinsMsg(int playerID) { + + int i; + + myW->textBrowser_Log->append(QString::fromStdString(myW->getActualHand()->getPlayerArray()[playerID]->getMyName())+" wins!!! "); + + myLogFile->open( QIODevice::ReadWrite ); + QTextStream stream( myLogFile ); + for(i=0; i<=linesInFile; i++) { stream.readLine(); } + + QString msg("

"+QString::fromStdString(myW->getActualHand()->getPlayerArray()[playerID]->getMyName())+" wins!!!

\n"); + stream << msg; + + myLogFile->close(); + + linesInFile++; + linesInFile++; } diff --git a/src/gui/qt/log.h b/src/gui/qt/log.h index 019467db..9b2cd145 100644 --- a/src/gui/qt/log.h +++ b/src/gui/qt/log.h @@ -25,14 +25,12 @@ #include "configfile.h" + #include - - - - class mainWindowImpl; + class Log{ public: Log(mainWindowImpl*); @@ -42,7 +40,9 @@ public: void logPlayerActionMsg(std::string playName, int action, int setValue); void logNewGameHandMsg(int gameID, int handID); + void logPlayerWinsMsg(int playerID); + void closeLogFile(); private: @@ -50,6 +50,7 @@ private: mainWindowImpl *myW; ConfigFile *myConfig; + QTextStream stream; QFile *myLogFile; QDir *myLogDir; diff --git a/src/gui/qt/mainwindow/mainwindowimpl.cpp b/src/gui/qt/mainwindow/mainwindowimpl.cpp index b1ee3ec7..b26e3e72 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindow/mainwindowimpl.cpp @@ -26,7 +26,7 @@ #include "startsplash.h" #include "mycardspixmaplabel.h" -#include "handinterface.h" + #include "playerinterface.h" #include "boardinterface.h" @@ -408,6 +408,7 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent) } +mainWindowImpl::~mainWindowImpl() {} void mainWindowImpl::callNewGameDialog() { @@ -1368,11 +1369,14 @@ void mainWindowImpl::postRiverRunAnimation3() { //Alle Winner erhellen und "Winner" schreiben for(i=0; igetPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1 && actualHand->getPlayerArray()[i]->getMyCardsValueInt() == actualHand->getRiver()->getHighestCardsValue() ) { + QPalette tempPalette = groupBoxArray[i]->palette(); tempPalette.setColor(QPalette::Window, highlight); groupBoxArray[i]->setPalette(tempPalette); actionLabelArray[i]->setText("

- Winner -

"); + myLog->logPlayerWinsMsg(i); + //nicht gewonnene Karten ausblenden if ( actualHand->getActivePlayersCounter() != 1 && myConfig->readConfigInt("ShowFadeOutCardsAnimation")) { diff --git a/src/gui/qt/mainwindow/mainwindowimpl.h b/src/gui/qt/mainwindow/mainwindowimpl.h index c4e442a1..3a636ba2 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.h +++ b/src/gui/qt/mainwindow/mainwindowimpl.h @@ -27,13 +27,15 @@ #include #include +#include "handinterface.h" + class Game; class Session; class Log; class ConfigFile; class BoardInterface; -class HandInterface; +// class HandInterface; class PlayerInterface; class MyCardsPixmapLabel; @@ -46,12 +48,18 @@ Q_OBJECT public: mainWindowImpl(QMainWindow *parent = 0 ); + ~mainWindowImpl(); + void setGame(Game*); void setHand(HandInterface*); void setSession(Session*); void setLog(Log*); int getMaxQuantityPlayers() const { return maxQuantityPlayers; } + + void setActualHand(HandInterface* theValue) { actualHand = theValue;} + HandInterface* getActualHand() const { return actualHand;} + //refresh-Funktionen void refreshSet(); @@ -156,6 +164,9 @@ public slots: void paintStartSplash(); + + + private: Game *actualGame;