Logging improvements
This commit is contained in:
+41
-10
@@ -42,11 +42,11 @@ Log::Log(mainWindowImpl* w) : myW(w)
|
||||
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";
|
||||
// stream << "</body>\n";
|
||||
// stream << "</html>\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+"</br>\n";
|
||||
stream << "</body>\n";
|
||||
stream << "</html>\n";
|
||||
// stream << "</body>\n";
|
||||
// stream << "</html>\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("<p style='text-weight:bold;'>##### Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" #####<p>");
|
||||
QString msg("<p><b>##### Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" #####</b></br>");
|
||||
stream << msg << "\n";
|
||||
stream << "</body>\n";
|
||||
stream << "</html>\n";
|
||||
|
||||
for(i=0; i<myW->getMaxQuantityPlayers(); 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 << "</p>\n";
|
||||
// stream << "</body>\n";
|
||||
// stream << "</html>\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("<p><i>"+QString::fromStdString(myW->getActualHand()->getPlayerArray()[playerID]->getMyName())+" wins!!!</i></p>\n");
|
||||
stream << msg;
|
||||
|
||||
myLogFile->close();
|
||||
|
||||
linesInFile++;
|
||||
linesInFile++;
|
||||
|
||||
}
|
||||
|
||||
+5
-4
@@ -25,14 +25,12 @@
|
||||
|
||||
#include "configfile.h"
|
||||
|
||||
|
||||
#include <QtCore>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
@@ -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; i<maxQuantityPlayers; i++) {
|
||||
if(actualHand->getPlayerArray()[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("<p align='center'><b>- Winner -</b></p>");
|
||||
|
||||
myLog->logPlayerWinsMsg(i);
|
||||
|
||||
//nicht gewonnene Karten ausblenden
|
||||
if ( actualHand->getActivePlayersCounter() != 1 && myConfig->readConfigInt("ShowFadeOutCardsAnimation")) {
|
||||
|
||||
|
||||
@@ -27,13 +27,15 @@
|
||||
#include <QtGui>
|
||||
#include <QtCore>
|
||||
|
||||
#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;
|
||||
|
||||
Reference in New Issue
Block a user