Logging improvements
This commit is contained in:
+41
-10
@@ -42,11 +42,11 @@ Log::Log(mainWindowImpl* w) : myW(w)
|
|||||||
stream << "<body>\n";
|
stream << "<body>\n";
|
||||||
stream << "<img src='logo.png'>\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 << "<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 << "</body>\n";
|
||||||
stream << "</html>\n";
|
// stream << "</html>\n";
|
||||||
myLogFile->close();
|
myLogFile->close();
|
||||||
|
|
||||||
linesInFile = 5;
|
linesInFile = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -85,10 +85,10 @@ void Log::logPlayerActionMsg(string playerName, int action, int setValue) {
|
|||||||
|
|
||||||
myLogFile->open( QIODevice::ReadWrite );
|
myLogFile->open( QIODevice::ReadWrite );
|
||||||
QTextStream stream( myLogFile );
|
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 << msg+"</br>\n";
|
||||||
stream << "</body>\n";
|
// stream << "</body>\n";
|
||||||
stream << "</html>\n";
|
// stream << "</html>\n";
|
||||||
myLogFile->close();
|
myLogFile->close();
|
||||||
|
|
||||||
linesInFile++;
|
linesInFile++;
|
||||||
@@ -103,14 +103,45 @@ void Log::logNewGameHandMsg(int gameID, int handID) {
|
|||||||
|
|
||||||
myLogFile->open( QIODevice::ReadWrite );
|
myLogFile->open( QIODevice::ReadWrite );
|
||||||
QTextStream stream( myLogFile );
|
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 << 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();
|
myLogFile->close();
|
||||||
|
|
||||||
linesInFile++;
|
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 "configfile.h"
|
||||||
|
|
||||||
|
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class mainWindowImpl;
|
class mainWindowImpl;
|
||||||
|
|
||||||
|
|
||||||
class Log{
|
class Log{
|
||||||
public:
|
public:
|
||||||
Log(mainWindowImpl*);
|
Log(mainWindowImpl*);
|
||||||
@@ -42,7 +40,9 @@ public:
|
|||||||
|
|
||||||
void logPlayerActionMsg(std::string playName, int action, int setValue);
|
void logPlayerActionMsg(std::string playName, int action, int setValue);
|
||||||
void logNewGameHandMsg(int gameID, int handID);
|
void logNewGameHandMsg(int gameID, int handID);
|
||||||
|
void logPlayerWinsMsg(int playerID);
|
||||||
|
|
||||||
|
void closeLogFile();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@@ -50,6 +50,7 @@ private:
|
|||||||
|
|
||||||
mainWindowImpl *myW;
|
mainWindowImpl *myW;
|
||||||
ConfigFile *myConfig;
|
ConfigFile *myConfig;
|
||||||
|
QTextStream stream;
|
||||||
QFile *myLogFile;
|
QFile *myLogFile;
|
||||||
QDir *myLogDir;
|
QDir *myLogDir;
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#include "startsplash.h"
|
#include "startsplash.h"
|
||||||
#include "mycardspixmaplabel.h"
|
#include "mycardspixmaplabel.h"
|
||||||
|
|
||||||
#include "handinterface.h"
|
|
||||||
#include "playerinterface.h"
|
#include "playerinterface.h"
|
||||||
#include "boardinterface.h"
|
#include "boardinterface.h"
|
||||||
|
|
||||||
@@ -408,6 +408,7 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mainWindowImpl::~mainWindowImpl() {}
|
||||||
|
|
||||||
void mainWindowImpl::callNewGameDialog() {
|
void mainWindowImpl::callNewGameDialog() {
|
||||||
|
|
||||||
@@ -1368,11 +1369,14 @@ void mainWindowImpl::postRiverRunAnimation3() {
|
|||||||
//Alle Winner erhellen und "Winner" schreiben
|
//Alle Winner erhellen und "Winner" schreiben
|
||||||
for(i=0; i<maxQuantityPlayers; i++) {
|
for(i=0; i<maxQuantityPlayers; i++) {
|
||||||
if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1 && actualHand->getPlayerArray()[i]->getMyCardsValueInt() == actualHand->getRiver()->getHighestCardsValue() ) {
|
if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1 && actualHand->getPlayerArray()[i]->getMyCardsValueInt() == actualHand->getRiver()->getHighestCardsValue() ) {
|
||||||
|
|
||||||
QPalette tempPalette = groupBoxArray[i]->palette();
|
QPalette tempPalette = groupBoxArray[i]->palette();
|
||||||
tempPalette.setColor(QPalette::Window, highlight);
|
tempPalette.setColor(QPalette::Window, highlight);
|
||||||
groupBoxArray[i]->setPalette(tempPalette);
|
groupBoxArray[i]->setPalette(tempPalette);
|
||||||
actionLabelArray[i]->setText("<p align='center'><b>- Winner -</b></p>");
|
actionLabelArray[i]->setText("<p align='center'><b>- Winner -</b></p>");
|
||||||
|
|
||||||
|
myLog->logPlayerWinsMsg(i);
|
||||||
|
|
||||||
//nicht gewonnene Karten ausblenden
|
//nicht gewonnene Karten ausblenden
|
||||||
if ( actualHand->getActivePlayersCounter() != 1 && myConfig->readConfigInt("ShowFadeOutCardsAnimation")) {
|
if ( actualHand->getActivePlayersCounter() != 1 && myConfig->readConfigInt("ShowFadeOutCardsAnimation")) {
|
||||||
|
|
||||||
|
|||||||
@@ -27,13 +27,15 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
|
|
||||||
|
#include "handinterface.h"
|
||||||
|
|
||||||
class Game;
|
class Game;
|
||||||
class Session;
|
class Session;
|
||||||
class Log;
|
class Log;
|
||||||
class ConfigFile;
|
class ConfigFile;
|
||||||
|
|
||||||
class BoardInterface;
|
class BoardInterface;
|
||||||
class HandInterface;
|
// class HandInterface;
|
||||||
class PlayerInterface;
|
class PlayerInterface;
|
||||||
|
|
||||||
class MyCardsPixmapLabel;
|
class MyCardsPixmapLabel;
|
||||||
@@ -46,6 +48,8 @@ Q_OBJECT
|
|||||||
public:
|
public:
|
||||||
mainWindowImpl(QMainWindow *parent = 0 );
|
mainWindowImpl(QMainWindow *parent = 0 );
|
||||||
|
|
||||||
|
~mainWindowImpl();
|
||||||
|
|
||||||
void setGame(Game*);
|
void setGame(Game*);
|
||||||
void setHand(HandInterface*);
|
void setHand(HandInterface*);
|
||||||
void setSession(Session*);
|
void setSession(Session*);
|
||||||
@@ -53,6 +57,10 @@ public:
|
|||||||
|
|
||||||
int getMaxQuantityPlayers() const { return maxQuantityPlayers; }
|
int getMaxQuantityPlayers() const { return maxQuantityPlayers; }
|
||||||
|
|
||||||
|
void setActualHand(HandInterface* theValue) { actualHand = theValue;}
|
||||||
|
HandInterface* getActualHand() const { return actualHand;}
|
||||||
|
|
||||||
|
|
||||||
//refresh-Funktionen
|
//refresh-Funktionen
|
||||||
void refreshSet();
|
void refreshSet();
|
||||||
void refreshButton();
|
void refreshButton();
|
||||||
@@ -156,6 +164,9 @@ public slots:
|
|||||||
|
|
||||||
void paintStartSplash();
|
void paintStartSplash();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Game *actualGame;
|
Game *actualGame;
|
||||||
|
|||||||
Reference in New Issue
Block a user