Log -> guiLog

This commit is contained in:
floty
2010-12-13 22:09:48 +00:00
parent 41b0186279
commit ad055022f3
8 changed files with 2219 additions and 27 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ public:
void setSession(boost::shared_ptr<Session> session);
gameTableImpl* getMyW() const {return NULL;}
Log* getMyLog() const {return NULL;}
guiLog* getMyLog() const {return NULL;}
void refreshSet() const;
void refreshCash() const;
+2 -2
View File
@@ -27,7 +27,7 @@
#include <string>
#include <boost/shared_ptr.hpp>
class Log;
class guiLog;
class Session;
class gameTableImpl;
@@ -41,7 +41,7 @@ public:
virtual void setSession(boost::shared_ptr<Session> session) =0;
virtual gameTableImpl *getMyW() const=0;
virtual Log* getMyLog() const=0;
virtual guiLog* getMyLog() const=0;
//refresh-Funktionen
+3 -3
View File
@@ -29,7 +29,7 @@
#include <QtGui>
#include <QtCore>
class Log;
class guiLog;
class ChatTools;
class ConfigFile;
class Session;
@@ -67,7 +67,7 @@ public:
bool getGuestMode() const { return guestMode; }
void setStartWindow(startWindowImpl* s) { myStartWindow = s; }
void setLog(Log* l) { myLog = l; }
void setGuiLog(guiLog* l) { myGuiLog = l; }
void setSpeeds();
@@ -314,7 +314,7 @@ public slots:
private:
boost::shared_ptr<GuiInterface> myServerGuiInterface;
Log *myLog;
guiLog *myGuiLog;
ChatTools *myChat;
ConfigFile *myConfig;
File diff suppressed because it is too large Load Diff
+101
View File
@@ -0,0 +1,101 @@
/***************************************************************************
* Copyright (C) 2006 by FThauer FHammer *
* f.thauer@web.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef GUILOG_H
#define GUILOG_H
#include <fstream>
#include <iostream>
#include <sstream>
#include "configfile.h"
#include <sqlite3.h>
#include <QtCore>
#include <QtSql>
class gameTableImpl;
class GameTableStyleReader;
class guiLog : public QObject
{
Q_OBJECT
public:
guiLog(gameTableImpl*, ConfigFile *c);
~guiLog();
public slots:
void closeLogDbAtExit();
void logPlayerActionMsg(QString playerName, int playerID, int action, int setValue);
void logNewGameHandMsg(int gameID, int handID);
void logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString bbName);
void logPlayerWinsMsg(QString playerName, int pot, bool main);
void logPlayerSitsOut(QString playerName);
void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1);
void logFlipHoleCardsMsg(QString playerName, int playerID, int card1, int card2, int cardsValueInt = -1, QString showHas = "shows");
void logPlayerLeftMsg(QString playerName, int wasKicked);
void logNewGameAdminMsg(QString playerName);
void logPlayerWinGame(QString playerName, int gameID);
void flushLogAtGame(int gameID);
void flushLogAtHand();
public:
QStringList translateCardsValueCode(int cardsValueCode);
QStringList translateCardCode(int cardCode);
QString determineHandName(int cardsValueInt);
void writeLogFileStream(QString string);
signals:
void signalLogPlayerActionMsg(QString playerName, int playerID, int action, int setValue);
void signalLogNewGameHandMsg(int gameID, int handID);
void signalLogNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString bbName);
void signalLogPlayerWinsMsg(QString playerName, int pot, bool main);
void signalLogPlayerSitsOut(QString playerName);
void signalLogDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1);
void signalLogFlipHoleCardsMsg(QString playerName, int playerID, int card1, int card2, int cardsValueInt = -1, QString showHas = "shows");
void signalLogPlayerLeftMsg(QString playerName, int wasKicked);
void signalLogNewGameAdminMsg(QString playerName);
void signalLogPlayerWinGame(QString playerName, int gameID);
void signalFlushLogAtGame(int gameID);
void signalFlushLogAtHand();
private:
int lastGameID;
gameTableImpl *myW;
ConfigFile *myConfig;
QTextStream stream;
QDir *myLogDir;
QFile *myHtmlLogFile;
sqlite3 *mySqliteLogDb;
QString logFileStreamString;
QString myAppDataPath;
GameTableStyleReader *myStyle;
friend class GuiWrapper;
};
#endif
+15 -15
View File
@@ -30,12 +30,12 @@
using namespace std;
GuiWrapper::GuiWrapper(ConfigFile *c, startWindowImpl *s) : myLog(NULL), myW(NULL), myConfig(c), myStartWindow(s)
GuiWrapper::GuiWrapper(ConfigFile *c, startWindowImpl *s) : myGuiLog(NULL), myW(NULL), myConfig(c), myStartWindow(s)
{
myW = new gameTableImpl(myConfig);
myLog = new Log(myW, myConfig);
myGuiLog = new guiLog(myW, myConfig);
myW->setStartWindow(myStartWindow);
}
@@ -43,7 +43,7 @@ GuiWrapper::GuiWrapper(ConfigFile *c, startWindowImpl *s) : myLog(NULL), myW(NUL
GuiWrapper::~GuiWrapper()
{
delete myLog;
delete myGuiLog;
}
@@ -113,16 +113,16 @@ void GuiWrapper::changeVoteOnKickButtonsState(bool showHide) { myW->signalChange
void GuiWrapper::refreshVotesMonitor(int currentVotes, int numVotesNeededToKick) { myW->refreshVotesMonitor(currentVotes, numVotesNeededToKick); }
void GuiWrapper::endVoteOnKick() { myW->signalEndVoteOnKick(); }
void GuiWrapper::logPlayerActionMsg(string playerName, int playerID, int action, int setValue) { myLog->signalLogPlayerActionMsg(QString::fromUtf8(playerName.c_str()), playerID, action, setValue); }
void GuiWrapper::logNewGameHandMsg(int gameID, int handID) { myLog->signalLogNewGameHandMsg(gameID, handID); }
void GuiWrapper::logNewBlindsSetsMsg(int sbSet, int bbSet, std::string sbName, std::string bbName) { myLog->signalLogNewBlindsSetsMsg(sbSet, bbSet, QString::fromUtf8(sbName.c_str()), QString::fromUtf8(bbName.c_str())); }
void GuiWrapper::logPlayerWinsMsg(std::string playerName, int pot, bool main) { myLog->signalLogPlayerWinsMsg(QString::fromUtf8(playerName.c_str()), pot, main); }
void GuiWrapper::logPlayerSitsOut(std::string playerName) { myLog->signalLogPlayerSitsOut(QString::fromUtf8(playerName.c_str())); }
void GuiWrapper::logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4, int card5) { myLog->signalLogDealBoardCardsMsg(roundID, card1, card2, card3, card4, card5); }
void GuiWrapper::logFlipHoleCardsMsg(string playerName, int playerID, int card1, int card2, int cardsValueInt, string showHas) { myLog->signalLogFlipHoleCardsMsg(QString::fromUtf8(playerName.c_str()), playerID, card1, card2, cardsValueInt, QString::fromUtf8(showHas.c_str())); }
void GuiWrapper::logPlayerWinGame(std::string playerName, int gameID) { myLog->signalLogPlayerWinGame(QString::fromUtf8(playerName.c_str()), gameID); }
void GuiWrapper::flushLogAtGame(int gameID) { myLog->signalFlushLogAtGame(gameID); }
void GuiWrapper::flushLogAtHand() { myLog->signalFlushLogAtHand(); }
void GuiWrapper::logPlayerActionMsg(string playerName, int playerID, int action, int setValue) { myGuiLog->signalLogPlayerActionMsg(QString::fromUtf8(playerName.c_str()), playerID, action, setValue); }
void GuiWrapper::logNewGameHandMsg(int gameID, int handID) { myGuiLog->signalLogNewGameHandMsg(gameID, handID); }
void GuiWrapper::logNewBlindsSetsMsg(int sbSet, int bbSet, std::string sbName, std::string bbName) { myGuiLog->signalLogNewBlindsSetsMsg(sbSet, bbSet, QString::fromUtf8(sbName.c_str()), QString::fromUtf8(bbName.c_str())); }
void GuiWrapper::logPlayerWinsMsg(std::string playerName, int pot, bool main) { myGuiLog->signalLogPlayerWinsMsg(QString::fromUtf8(playerName.c_str()), pot, main); }
void GuiWrapper::logPlayerSitsOut(std::string playerName) { myGuiLog->signalLogPlayerSitsOut(QString::fromUtf8(playerName.c_str())); }
void GuiWrapper::logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4, int card5) { myGuiLog->signalLogDealBoardCardsMsg(roundID, card1, card2, card3, card4, card5); }
void GuiWrapper::logFlipHoleCardsMsg(string playerName, int playerID, int card1, int card2, int cardsValueInt, string showHas) { myGuiLog->signalLogFlipHoleCardsMsg(QString::fromUtf8(playerName.c_str()), playerID, card1, card2, cardsValueInt, QString::fromUtf8(showHas.c_str())); }
void GuiWrapper::logPlayerWinGame(std::string playerName, int gameID) { myGuiLog->signalLogPlayerWinGame(QString::fromUtf8(playerName.c_str()), gameID); }
void GuiWrapper::flushLogAtGame(int gameID) { myGuiLog->signalFlushLogAtGame(gameID); }
void GuiWrapper::flushLogAtHand() { myGuiLog->signalFlushLogAtHand(); }
void GuiWrapper::SignalNetClientConnect(int actionID) { myStartWindow->signalNetClientConnect(actionID); }
@@ -149,13 +149,13 @@ void GuiWrapper::SignalNetClientPlayerLeft(unsigned playerId, const string &play
myStartWindow->signalNetClientPlayerLeft(playerId, tmpName);
myW->signalNetClientPlayerLeft(playerId);
if (!playerName.empty() && playerName[0] != '#')
myLog->signalLogPlayerLeftMsg(tmpName, removeReason == NTF_NET_REMOVED_KICKED);
myGuiLog->signalLogPlayerLeftMsg(tmpName, removeReason == NTF_NET_REMOVED_KICKED);
}
void GuiWrapper::SignalNetClientNewGameAdmin(unsigned playerId, const string &playerName) {
myStartWindow->signalNetClientNewGameAdmin(playerId, QString::fromUtf8(playerName.c_str()));
if (!playerName.empty() && playerName[0] != '#')
myLog->signalLogNewGameAdminMsg(QString::fromUtf8(playerName.c_str()));
myGuiLog->signalLogNewGameAdminMsg(QString::fromUtf8(playerName.c_str()));
}
+2 -2
View File
@@ -44,7 +44,7 @@ public:
void setSession(boost::shared_ptr<Session> session);
gameTableImpl* getMyW() const { return myW; }
Log* getMyLog() const { return myLog; }
guiLog* getMyLog() const { return myGuiLog; }
void refreshSet() const;
void refreshCash() const;
@@ -167,7 +167,7 @@ public:
private:
Log *myLog;
guiLog *myGuiLog;
gameTableImpl *myW;
ConfigFile *myConfig;
startWindowImpl *myStartWindow;