some bugfixes in Log and guiLog
This commit is contained in:
@@ -148,3 +148,60 @@ Log::~Log()
|
|||||||
sqlite3_close(mySqliteLogDb);
|
sqlite3_close(mySqliteLogDb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Log::logNewGameMsg(int gameID, Game *currentGame) {
|
||||||
|
|
||||||
|
if(SQLITE_LOG) {
|
||||||
|
|
||||||
|
PlayerListConstIterator it_c;
|
||||||
|
|
||||||
|
if(myConfig->readConfigInt("LogOnOff")) {
|
||||||
|
//if write logfiles is enabled
|
||||||
|
|
||||||
|
string sql;
|
||||||
|
int i;
|
||||||
|
char *errmsg;
|
||||||
|
|
||||||
|
if( mySqliteLogDb != 0 ) {
|
||||||
|
|
||||||
|
sql = "INSERT INTO Game (";
|
||||||
|
sql += "GameID";
|
||||||
|
sql += ",Startmoney";
|
||||||
|
sql += ",StartSb";
|
||||||
|
sql += ",DealerPos";
|
||||||
|
for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
||||||
|
sql += ",Seat_" + boost::lexical_cast<std::string>(i);
|
||||||
|
}
|
||||||
|
sql += ") VALUES (";
|
||||||
|
sql += boost::lexical_cast<string>(gameID);
|
||||||
|
sql += "," + boost::lexical_cast<string>(currentGame->getStartCash());
|
||||||
|
sql += "," + boost::lexical_cast<string>(currentGame->getStartSmallBlind());
|
||||||
|
sql += "," + boost::lexical_cast<string>(currentGame->getDealerPosition());
|
||||||
|
|
||||||
|
for(it_c = currentGame->getCurrentHand()->getSeatsList()->begin();it_c!=currentGame->getCurrentHand()->getSeatsList()->end();it_c++) {
|
||||||
|
if((*it_c)->getMyActiveStatus()) {
|
||||||
|
sql += ",\"" + (*it_c)->getMyName() +"\"";
|
||||||
|
} else {
|
||||||
|
sql += ",NULL";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sql += ")";
|
||||||
|
if(sqlite3_exec(mySqliteLogDb, sql.data(), 0, 0, &errmsg) != SQLITE_OK) {
|
||||||
|
cout << "Error in statement: " << sql.data() << "[" << errmsg << "]." << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//void
|
||||||
|
//Log::closeLogDbAtExit()
|
||||||
|
//{
|
||||||
|
// if(SQLITE_LOG) {
|
||||||
|
// // close sqlite-db
|
||||||
|
// sqlite3_close(mySqliteLogDb);
|
||||||
|
// mySqliteLogDb = NULL;
|
||||||
|
// }
|
||||||
|
|
||||||
|
//}
|
||||||
|
|||||||
@@ -22,10 +22,16 @@
|
|||||||
|
|
||||||
#include <sqlite3.h>
|
#include <sqlite3.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
#include <iostream>
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
|
#include "game.h"
|
||||||
|
#include "handinterface.h"
|
||||||
#include "configfile.h"
|
#include "configfile.h"
|
||||||
#include "game_defs.h"
|
#include "game_defs.h"
|
||||||
|
|
||||||
|
//class Game;
|
||||||
|
|
||||||
class Log
|
class Log
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -34,6 +40,10 @@ public:
|
|||||||
|
|
||||||
~Log();
|
~Log();
|
||||||
|
|
||||||
|
void logNewGameMsg(int, Game*);
|
||||||
|
// void closeLogDbAtExit();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ConfigFile *myConfig;
|
ConfigFile *myConfig;
|
||||||
sqlite3 *mySqliteLogDb;
|
sqlite3 *mySqliteLogDb;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public:
|
|||||||
void setSession(boost::shared_ptr<Session> session);
|
void setSession(boost::shared_ptr<Session> session);
|
||||||
|
|
||||||
gameTableImpl* getMyW() const {return NULL;}
|
gameTableImpl* getMyW() const {return NULL;}
|
||||||
guiLog* getMyLog() const {return NULL;}
|
guiLog* getMyGuiLog() const {return NULL;}
|
||||||
|
|
||||||
void refreshSet() const;
|
void refreshSet() const;
|
||||||
void refreshCash() const;
|
void refreshCash() const;
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
class guiLog;
|
class guiLog;
|
||||||
class Log;
|
|
||||||
class Session;
|
class Session;
|
||||||
class gameTableImpl;
|
class gameTableImpl;
|
||||||
|
|
||||||
@@ -42,7 +41,7 @@ public:
|
|||||||
virtual void setSession(boost::shared_ptr<Session> session) =0;
|
virtual void setSession(boost::shared_ptr<Session> session) =0;
|
||||||
|
|
||||||
virtual gameTableImpl *getMyW() const=0;
|
virtual gameTableImpl *getMyW() const=0;
|
||||||
virtual guiLog* getMyLog() const=0;
|
virtual guiLog* getMyGuiLog() const=0;
|
||||||
|
|
||||||
|
|
||||||
//refresh-Funktionen
|
//refresh-Funktionen
|
||||||
|
|||||||
@@ -126,21 +126,6 @@ guiLog::~guiLog()
|
|||||||
{
|
{
|
||||||
delete myLogDir;
|
delete myLogDir;
|
||||||
delete myHtmlLogFile;
|
delete myHtmlLogFile;
|
||||||
if(SQLITE_LOG) {
|
|
||||||
sqlite3_close(mySqliteLogDb);
|
|
||||||
// delete mySqliteLogDb;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void guiLog::closeLogDbAtExit()
|
|
||||||
{
|
|
||||||
if(SQLITE_LOG) {
|
|
||||||
// close sqlite-db
|
|
||||||
sqlite3_close(mySqliteLogDb);
|
|
||||||
// delete mySqliteLogDb;
|
|
||||||
mySqliteLogDb = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,8 +44,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void closeLogDbAtExit();
|
void logPlayerActionMsg(QString playerName, int playerID, int action, int setValue);
|
||||||
void logPlayerActionMsg(QString playerName, int playerID, int action, int setValue);
|
|
||||||
void logNewGameHandMsg(int gameID, int handID);
|
void logNewGameHandMsg(int gameID, int handID);
|
||||||
void logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString bbName);
|
void logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString bbName);
|
||||||
void logPlayerWinsMsg(QString playerName, int pot, bool main);
|
void logPlayerWinsMsg(QString playerName, int pot, bool main);
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
#include "guiwrapper.h"
|
#include "guiwrapper.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "guilog.h"
|
#include "guilog.h"
|
||||||
#include "log.h"
|
|
||||||
#include "gametableimpl.h"
|
#include "gametableimpl.h"
|
||||||
#include "startwindowimpl.h"
|
#include "startwindowimpl.h"
|
||||||
#include "configfile.h"
|
#include "configfile.h"
|
||||||
@@ -31,13 +30,12 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
GuiWrapper::GuiWrapper(ConfigFile *c, startWindowImpl *s) : myGuiLog(NULL), 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);
|
myW = new gameTableImpl(myConfig);
|
||||||
myGuiLog = new guiLog(myW, myConfig);
|
myGuiLog = new guiLog(myW, myConfig);
|
||||||
myLog = new Log(myConfig);
|
|
||||||
|
|
||||||
myW->setStartWindow(myStartWindow);
|
myW->setStartWindow(myStartWindow);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ class Session;
|
|||||||
class gameTableImpl;
|
class gameTableImpl;
|
||||||
class startWindowImpl;
|
class startWindowImpl;
|
||||||
class guiLog;
|
class guiLog;
|
||||||
class Log;
|
|
||||||
class ConfigFile;
|
class ConfigFile;
|
||||||
|
|
||||||
|
|
||||||
@@ -45,7 +44,7 @@ public:
|
|||||||
void setSession(boost::shared_ptr<Session> session);
|
void setSession(boost::shared_ptr<Session> session);
|
||||||
|
|
||||||
gameTableImpl* getMyW() const { return myW; }
|
gameTableImpl* getMyW() const { return myW; }
|
||||||
guiLog* getMyLog() const { return myGuiLog; }
|
guiLog* getMyGuiLog() const { return myGuiLog; }
|
||||||
|
|
||||||
void refreshSet() const;
|
void refreshSet() const;
|
||||||
void refreshCash() const;
|
void refreshCash() const;
|
||||||
@@ -169,7 +168,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
guiLog *myGuiLog;
|
guiLog *myGuiLog;
|
||||||
Log *myLog;
|
|
||||||
gameTableImpl *myW;
|
gameTableImpl *myW;
|
||||||
ConfigFile *myConfig;
|
ConfigFile *myConfig;
|
||||||
startWindowImpl *myStartWindow;
|
startWindowImpl *myStartWindow;
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#include <net/socket_msg.h>
|
#include <net/socket_msg.h>
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
#include "guilog.h"
|
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
#include "guiwrapper.h"
|
#include "guiwrapper.h"
|
||||||
@@ -988,7 +987,7 @@ bool startWindowImpl::eventFilter(QObject *obj, QEvent *event)
|
|||||||
{
|
{
|
||||||
if (event->type() == QEvent::Close) {
|
if (event->type() == QEvent::Close) {
|
||||||
event->ignore();
|
event->ignore();
|
||||||
myGuiInterface->getMyLog()->closeLogDbAtExit();
|
// mySession->getMyLog()->closeLogDbAtExit();
|
||||||
return QMainWindow::eventFilter(obj, event);
|
return QMainWindow::eventFilter(obj, event);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
+1
-1
@@ -42,7 +42,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
Session::Session(GuiInterface *g, ConfigFile *c)
|
Session::Session(GuiInterface *g, ConfigFile *c)
|
||||||
: currentGameNum(0), myGui(g), myConfig(c), myGameType(GAME_TYPE_NONE)
|
: currentGameNum(0), myGui(g), myConfig(c), myLog(0), myGameType(GAME_TYPE_NONE)
|
||||||
{
|
{
|
||||||
myQtToolsInterface = CreateQtToolsWrapper();
|
myQtToolsInterface = CreateQtToolsWrapper();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "log.h"
|
||||||
#include "serverdata.h"
|
#include "serverdata.h"
|
||||||
#include "gamedata.h"
|
#include "gamedata.h"
|
||||||
#include "playerdata.h"
|
#include "playerdata.h"
|
||||||
@@ -33,6 +34,7 @@
|
|||||||
class GuiInterface;
|
class GuiInterface;
|
||||||
class Game;
|
class Game;
|
||||||
class ConfigFile;
|
class ConfigFile;
|
||||||
|
class Log;
|
||||||
class ClientThread;
|
class ClientThread;
|
||||||
class ServerManager;
|
class ServerManager;
|
||||||
class IrcThread;
|
class IrcThread;
|
||||||
@@ -59,6 +61,7 @@ public:
|
|||||||
|
|
||||||
Game *getCurrentGame();
|
Game *getCurrentGame();
|
||||||
GuiInterface *getGui();
|
GuiInterface *getGui();
|
||||||
|
Log* getMyLog() {return myLog; }
|
||||||
GameType getGameType();
|
GameType getGameType();
|
||||||
|
|
||||||
boost::shared_ptr<AvatarManager> getAvatarManager();
|
boost::shared_ptr<AvatarManager> getAvatarManager();
|
||||||
@@ -122,6 +125,7 @@ private:
|
|||||||
boost::shared_ptr<Game> currentGame;
|
boost::shared_ptr<Game> currentGame;
|
||||||
GuiInterface *myGui;
|
GuiInterface *myGui;
|
||||||
ConfigFile *myConfig;
|
ConfigFile *myConfig;
|
||||||
|
Log *myLog;
|
||||||
GameType myGameType;
|
GameType myGameType;
|
||||||
QtToolsInterface *myQtToolsInterface;
|
QtToolsInterface *myQtToolsInterface;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user