additional log in sqlite-db + preparation for replay mode
This commit is contained in:
@@ -106,14 +106,14 @@ void ServerGuiWrapper::changeVoteOnKickButtonsState(bool /*showHide*/) {}
|
||||
void ServerGuiWrapper::refreshVotesMonitor(int /*currentVotes*/, int /*numVotesNeededToKick*/) {}
|
||||
void ServerGuiWrapper::endVoteOnKick() {}
|
||||
|
||||
void ServerGuiWrapper::logPlayerActionMsg(string /*playerName*/, int /*action*/, int /*setValue*/) {}
|
||||
void ServerGuiWrapper::logPlayerActionMsg(string /*playerName*/, int /*playerID*/, int /*action*/, int /*setValue*/) {}
|
||||
void ServerGuiWrapper::logNewGameHandMsg(int /*gameID*/, int /*handID*/) {}
|
||||
void ServerGuiWrapper::logPlayerWinsMsg(std::string /*playerName*/, int /*pot*/, bool /*main*/) {}
|
||||
void ServerGuiWrapper::logPlayerSitsOut(std::string /*playerName*/) {}
|
||||
void ServerGuiWrapper::logNewBlindsSetsMsg(int /*sbSet*/, int /*bbSet*/, std::string /*sbName*/, std::string /*bbName*/) {}
|
||||
|
||||
void ServerGuiWrapper::logDealBoardCardsMsg(int /*roundID*/, int /*card1*/, int /*card2*/, int /*card3*/, int /*card4*/, int /*card5*/) {}
|
||||
void ServerGuiWrapper::logFlipHoleCardsMsg(std::string /*playerName*/, int /*card1*/, int /*card2*/, int /*cardsValueInt*/, std::string /*showHas*/) {}
|
||||
void ServerGuiWrapper::logFlipHoleCardsMsg(std::string /*playerName*/, int /*playerID*/, int /*card1*/, int /*card2*/, int /*cardsValueInt*/, std::string /*showHas*/) {}
|
||||
void ServerGuiWrapper::logPlayerWinGame(std::string /*playerName*/, int /*gameID*/) {}
|
||||
void ServerGuiWrapper::flushLogAtGame(int /*gameID*/) {}
|
||||
void ServerGuiWrapper::flushLogAtHand() {}
|
||||
|
||||
@@ -93,13 +93,13 @@ public:
|
||||
void refreshVotesMonitor(int currentVotes, int numVotesNeededToKick);
|
||||
void endVoteOnKick();
|
||||
|
||||
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
|
||||
void logPlayerActionMsg(std::string playerName, int playerID, int action, int setValue) ;
|
||||
void logNewGameHandMsg(int gameID, int handID) ;
|
||||
void logPlayerWinsMsg(std::string playerName, int pot, bool main);
|
||||
void logPlayerSitsOut(std::string playerName);
|
||||
void logNewBlindsSetsMsg(int sbSet, int bbSet, std::string sbName, std::string bbName);
|
||||
void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1) ;
|
||||
void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") ;
|
||||
void logFlipHoleCardsMsg(std::string playerName, int playerID, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") ;
|
||||
void logPlayerWinGame(std::string playerName, int gameID);
|
||||
void flushLogAtGame(int gameID);
|
||||
void flushLogAtHand();
|
||||
|
||||
@@ -97,13 +97,13 @@ public:
|
||||
virtual void endVoteOnKick() =0;
|
||||
|
||||
//log.cpp
|
||||
virtual void logPlayerActionMsg(std::string playName, int action, int setValue) =0;
|
||||
virtual void logPlayerActionMsg(std::string playName, int playerID, int action, int setValue) =0;
|
||||
virtual void logNewGameHandMsg(int gameID, int HandID) =0;
|
||||
virtual void logPlayerWinsMsg(std::string playerName, int pot, bool main) = 0;
|
||||
virtual void logPlayerSitsOut(std::string playerName) = 0;
|
||||
virtual void logNewBlindsSetsMsg(int sbSet, int bbSet, std::string sbName, std::string bbName) =0;
|
||||
virtual void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1) = 0;
|
||||
virtual void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") = 0;
|
||||
virtual void logFlipHoleCardsMsg(std::string playerName, int playerID, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows") = 0;
|
||||
virtual void logPlayerWinGame(std::string playerName, int gameID) =0;
|
||||
virtual void flushLogAtGame(int gameID) =0;
|
||||
virtual void flushLogAtHand() =0;
|
||||
|
||||
@@ -28,20 +28,20 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
Log::Log(gameTableImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(0), myLogFile(0)
|
||||
Log::Log(gameTableImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(0), myHtmlLogFile(0), mySqliteLogDb(0)
|
||||
{
|
||||
myW->setLog(this);
|
||||
myStyle = myW->getMyGameTableStyle();
|
||||
|
||||
myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str());
|
||||
|
||||
connect(this, SIGNAL(signalLogPlayerActionMsg(QString, int, int)), this, SLOT(logPlayerActionMsg(QString, int, int)));
|
||||
connect(this, SIGNAL(signalLogPlayerActionMsg(QString, int, int, int)), this, SLOT(logPlayerActionMsg(QString, int, int, int)));
|
||||
connect(this, SIGNAL(signalLogNewGameHandMsg(int, int)), this, SLOT(logNewGameHandMsg(int, int)));
|
||||
connect(this, SIGNAL(signalLogNewBlindsSetsMsg(int, int, QString, QString)), this, SLOT(logNewBlindsSetsMsg(int, int, QString, QString)));
|
||||
connect(this, SIGNAL(signalLogPlayerWinsMsg(QString, int, bool)), this, SLOT(logPlayerWinsMsg(QString, int, bool)));
|
||||
connect(this, SIGNAL(signalLogPlayerSitsOut(QString)), this, SLOT(logPlayerSitsOut(QString)));
|
||||
connect(this, SIGNAL(signalLogDealBoardCardsMsg(int, int, int, int, int, int)), this, SLOT(logDealBoardCardsMsg(int, int, int, int, int, int)));
|
||||
connect(this, SIGNAL(signalLogFlipHoleCardsMsg(QString, int, int, int, QString)), this, SLOT(logFlipHoleCardsMsg(QString, int, int, int, QString)));
|
||||
connect(this, SIGNAL(signalLogFlipHoleCardsMsg(QString, int, int, int, int, QString)), this, SLOT(logFlipHoleCardsMsg(QString, int, int, int, int, QString)));
|
||||
connect(this, SIGNAL(signalLogPlayerLeftMsg(QString, int)), this, SLOT(logPlayerLeftMsg(QString, int)));
|
||||
connect(this, SIGNAL(signalLogNewGameAdminMsg(QString)), this, SLOT(logNewGameAdminMsg(QString)));
|
||||
connect(this, SIGNAL(signalLogPlayerWinGame(QString, int)), this, SLOT(logPlayerWinGame(QString, int)));
|
||||
@@ -55,19 +55,22 @@ Log::Log(gameTableImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(0), my
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
QDir logDir(QString::fromUtf8(myConfig->readConfigString("LogDir").c_str()));
|
||||
if(myConfig->readConfigString("LogDir") != "" && logDir.exists()) {
|
||||
|
||||
if(myConfig->readConfigString("LogDir") != "" && logDir.exists()) {
|
||||
|
||||
myLogDir = new QDir(QString::fromUtf8(myConfig->readConfigString("LogDir").c_str()));
|
||||
myLogFile = new QFile(myLogDir->absolutePath()+"/pokerth-log-"+QDateTime::currentDateTime().toString("yyyy-MM-dd_hh.mm.ss")+".html");
|
||||
QDateTime currentTime = QDateTime::currentDateTime();
|
||||
myHtmlLogFile = new QFile(myLogDir->absolutePath()+"/pokerth-log-"+currentTime.toString("yyyy-MM-dd_hh.mm.ss")+".html");
|
||||
mySqliteLogDb = new QSqlDatabase();
|
||||
|
||||
//Logo-Pixmap extrahieren
|
||||
QPixmap logoChipPixmapFile(":/gfx/logoChip3D.png");
|
||||
logoChipPixmapFile.save(myLogDir->absolutePath()+"/logo.png");
|
||||
|
||||
// myW->textBrowser_Log->append(myLogFile->fileName());
|
||||
// myW->textBrowser_Log->append(myHtmlLogFile->fileName());
|
||||
|
||||
myLogFile->open( QIODevice::WriteOnly );
|
||||
QTextStream stream( myLogFile );
|
||||
// erstelle html-Datei
|
||||
myHtmlLogFile->open( QIODevice::WriteOnly );
|
||||
QTextStream stream( myHtmlLogFile );
|
||||
stream << "<html>\n";
|
||||
stream << "<head>\n";
|
||||
stream << "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf8\">";
|
||||
@@ -75,11 +78,83 @@ Log::Log(gameTableImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(0), my
|
||||
stream << "<body style=\"font-size:smaller\">\n";
|
||||
stream << "<img src='logo.png'>\n";
|
||||
stream << QString("<h3><b>Log-File for PokerTH %1 Session started on ").arg(POKERTH_BETA_RELEASE_STRING)+QDate::currentDate().toString("yyyy-MM-dd")+" at "+QTime::currentTime().toString("hh:mm:ss")+"</b></h3>\n";
|
||||
myLogFile->close();
|
||||
myHtmlLogFile->close();
|
||||
|
||||
int i;
|
||||
// lege sqlite-Datenbank
|
||||
*mySqliteLogDb = QSqlDatabase::addDatabase("QSQLITE");
|
||||
mySqliteLogDb->setDatabaseName(myLogDir->absolutePath()+"/pokerth-log-"+currentTime.toString("yyyy-MM-dd_hh.mm.ss")+".db");
|
||||
if(!mySqliteLogDb->open()) {
|
||||
QMessageBox::critical(0, tr("ERROR"),mySqliteLogDb->lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
|
||||
QString sql;
|
||||
QSqlQuery query;
|
||||
|
||||
// Session-Tabelle
|
||||
sql = "CREATE TABLE Session (Version TEXT,Date TEXT,Time TEXT, PRIMARY KEY(Date,Time))";
|
||||
if(!query.exec(sql)) {
|
||||
QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
sql = "INSERT INTO Session (Version,Date,Time) VALUES (";
|
||||
sql += "'"+QString("%1").arg(POKERTH_BETA_RELEASE_STRING)+"',";
|
||||
sql += "'"+currentTime.toString("yyyy-MM-dd")+"',";
|
||||
sql += "'"+currentTime.toString("hh:mm:ss")+"')";
|
||||
if(!query.exec(sql)) {
|
||||
QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
|
||||
// Game-Tabelle
|
||||
sql = "CREATE TABLE Game (";
|
||||
sql += "GameID INTEGER NOT NULL PRIMARY KEY,";
|
||||
sql += "Startmoney INTEGER NOT NULL,";
|
||||
sql += "StartSb INTEGER NOT NULL,";
|
||||
sql += "DealerPos INTEGER NOT NULL";
|
||||
for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
sql += ",Seat_" + QString("%1").arg(i);
|
||||
}
|
||||
sql += ")";
|
||||
if(!query.exec(sql)) {
|
||||
QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
|
||||
// Hand-Tabelle
|
||||
sql = "CREATE TABLE Hand (";
|
||||
sql += "HandID INTEGER NOT NULL,";
|
||||
sql += "GameID INTEGER NOT NULL,";
|
||||
for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
sql += "Seat_" + QString("%1").arg(i) + "_Cash INTEGER,";
|
||||
sql += "Seat_" + QString("%1").arg(i) + "_Card_1 INTEGER,";
|
||||
sql += "Seat_" + QString("%1").arg(i) + "_Card_2 INTEGER,";
|
||||
}
|
||||
for(i=1; i<=5; i++) {
|
||||
sql += "BoardCard_" + QString("%1").arg(i) + " INTEGER,";
|
||||
}
|
||||
sql += "PRIMARY KEY(HandID,GameID))";
|
||||
if(!query.exec(sql)) {
|
||||
QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
|
||||
// Action-Tabelle
|
||||
sql = "CREATE TABLE Action (";
|
||||
sql += "ActionID INTEGER PRIMARY KEY AUTOINCREMENT,";
|
||||
sql += "HandID INTEGER NOT NULL,";
|
||||
sql += "GameID INTEGER NOT NULL,";
|
||||
sql += "BeRo INTEGER NOT NULL,";
|
||||
sql += "Player INTEGER NOT NULL,";
|
||||
sql += "Action INTEGER NOT NULL,";
|
||||
sql += "Amount INTEGER)";
|
||||
if(!query.exec(sql)) {
|
||||
QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
|
||||
query.clear();
|
||||
|
||||
// Datenbank schließen
|
||||
mySqliteLogDb->close();
|
||||
|
||||
//Zu alte Dateien löschen!!!
|
||||
int daysUntilWaste = myConfig->readConfigInt("LogStoreDuration");
|
||||
int i;
|
||||
|
||||
QStringList filters("pokerth-log*");
|
||||
QStringList logFileList = myLogDir->entryList(filters, QDir::Files);
|
||||
@@ -113,13 +188,17 @@ Log::Log(gameTableImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(0), my
|
||||
|
||||
Log::~Log()
|
||||
{
|
||||
|
||||
|
||||
|
||||
delete myConfig;
|
||||
delete myLogDir;
|
||||
delete myLogFile;
|
||||
delete myHtmlLogFile;
|
||||
delete mySqliteLogDb;
|
||||
myConfig = 0;
|
||||
}
|
||||
|
||||
void Log::logPlayerActionMsg(QString msg, int action, int setValue) {
|
||||
void Log::logPlayerActionMsg(QString msg, int playerID, int action, int setValue) {
|
||||
|
||||
switch (action) {
|
||||
|
||||
@@ -151,6 +230,31 @@ void Log::logPlayerActionMsg(QString msg, int action, int setValue) {
|
||||
logFileStreamString = "";
|
||||
}
|
||||
|
||||
if(!mySqliteLogDb->open()) {
|
||||
QMessageBox::critical(0, tr("ERROR"),mySqliteLogDb->lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
|
||||
QString sql;
|
||||
QSqlQuery query;
|
||||
|
||||
sql = "INSERT INTO Action (HandID,GameID,BeRo,Player,Action,Amount) VALUES (";
|
||||
sql += QString::number(myW->getSession()->getCurrentGame()->getCurrentHandID(),10);
|
||||
sql += "," + QString::number(myW->getSession()->getCurrentGame()->getMyGameID(),10);
|
||||
sql += "," + QString::number(myW->getSession()->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->getMyBeRoID(),10);
|
||||
sql += "," + QString::number(playerID,10);
|
||||
sql += "," + QString::number(action,10);
|
||||
sql += "," + QString::number(setValue,10);
|
||||
sql += ")";
|
||||
|
||||
if(!query.exec(sql)) {
|
||||
QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
|
||||
query.clear();
|
||||
|
||||
mySqliteLogDb->close();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,15 +268,74 @@ void Log::logNewGameHandMsg(int gameID, int handID) {
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
|
||||
int i;
|
||||
|
||||
logFileStreamString += "<table><tr><td width=\"600\" align=\"center\"><hr noshade size=\"3\"><b>Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+"</b></td><td></td></tr></table>";
|
||||
logFileStreamString += "BLIND LEVEL: $"+QString::number(currentHand->getSmallBlind())+" / $"+QString::number(currentHand->getSmallBlind()*2)+"</br>";
|
||||
|
||||
if(!mySqliteLogDb->open()) {
|
||||
QMessageBox::critical(0, tr("ERROR"),mySqliteLogDb->lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
|
||||
// bei Beginn eines Games
|
||||
QString sql;
|
||||
QSqlQuery query;
|
||||
if(handID == 1) {
|
||||
sql = "INSERT INTO Game (GameID,Startmoney,StartSb,DealerPos";
|
||||
for(i=1;i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
sql += ",Seat_" + QString::number(i,10);
|
||||
}
|
||||
sql += ") VALUES (";
|
||||
sql += QString::number(gameID,10) + ",";
|
||||
sql += QString::number(myW->getSession()->getCurrentGame()->getStartCash(),10) + ",";
|
||||
sql += QString::number(myW->getSession()->getCurrentGame()->getStartSmallBlind(),10) + ",";
|
||||
sql += QString::number(myW->getSession()->getCurrentGame()->getDealerPosition(),10);
|
||||
for(it_c = currentHand->getSeatsList()->begin();it_c!=currentHand->getSeatsList()->end();it_c++) {
|
||||
if((*it_c)->getMyActiveStatus()) {
|
||||
sql += ",'" + QString::fromUtf8((*it_c)->getMyName().c_str()) +"'";
|
||||
} else {
|
||||
sql += ",NULL";
|
||||
}
|
||||
}
|
||||
sql += ")";
|
||||
if(!query.exec(sql)) {
|
||||
QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
}
|
||||
|
||||
sql = "INSERT INTO Hand (HandID,GameID";
|
||||
for(i=1;i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
sql += ",Seat_" + QString("%1").arg(i) + "_Cash";
|
||||
}
|
||||
sql += ") VALUES (";
|
||||
sql += QString::number(handID,10);
|
||||
sql += "," + QString::number(gameID,10);
|
||||
for(it_c = currentHand->getSeatsList()->begin();it_c!=currentHand->getSeatsList()->end();it_c++) {
|
||||
if((*it_c)->getMyActiveStatus()) {
|
||||
sql += "," + QString::number((*it_c)->getMyCash()+(*it_c)->getMySet(),10);
|
||||
} else {
|
||||
sql += ",NULL";
|
||||
}
|
||||
}
|
||||
sql += ")";
|
||||
|
||||
if(!query.exec(sql)) {
|
||||
QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
|
||||
query.clear();
|
||||
|
||||
mySqliteLogDb->close();
|
||||
|
||||
|
||||
//print cash only for active players
|
||||
for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||
|
||||
logFileStreamString += "Seat " + QString::number((*it_c)->getMyID()+1,10) + ": <b>" + QString::fromUtf8((*it_c)->getMyName().c_str()) + "</b> ($" + QString::number((*it_c)->getMyCash()+(*it_c)->getMySet(),10)+")</br>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -272,16 +435,24 @@ void Log::logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
|
||||
QString sql;
|
||||
sql = "UPDATE Hand SET ";
|
||||
|
||||
switch (roundID) {
|
||||
|
||||
case 1: round = "Flop";
|
||||
logFileStreamString += "</br><b>"+round.toUpper()+"</b> [board cards <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+",<b>"+translateCardCode(card3).at(0)+"</b>"+translateCardCode(card3).at(1)+"]"+"</br>\n";
|
||||
sql += "BoardCard_1 = " + QString::number(card1,10) + ",";
|
||||
sql += "BoardCard_2 = " + QString::number(card2,10) + ",";
|
||||
sql += "BoardCard_3 = " + QString::number(card3,10);
|
||||
break;
|
||||
case 2: round = "Turn";
|
||||
logFileStreamString += "</br><b>"+round.toUpper()+"</b> [board cards <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+",<b>"+translateCardCode(card3).at(0)+"</b>"+translateCardCode(card3).at(1)+",<b>"+translateCardCode(card4).at(0)+"</b>"+translateCardCode(card4).at(1)+"]"+"</br>\n";
|
||||
sql += "BoardCard_4 = " + QString::number(card4,10);
|
||||
break;
|
||||
case 3: round = "River";
|
||||
logFileStreamString += "</br><b>"+round.toUpper()+"</b> [board cards <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+",<b>"+translateCardCode(card3).at(0)+"</b>"+translateCardCode(card3).at(1)+",<b>"+translateCardCode(card4).at(0)+"</b>"+translateCardCode(card4).at(1)+",<b>"+translateCardCode(card5).at(0)+"</b>"+translateCardCode(card5).at(1)+"]"+"</br>\n";
|
||||
sql += "BoardCard_5 = " + QString::number(card5,10);
|
||||
break;
|
||||
default: round = "ERROR";
|
||||
}
|
||||
@@ -290,10 +461,29 @@ void Log::logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int
|
||||
logFileStreamString = "";
|
||||
}
|
||||
|
||||
sql += " WHERE ";
|
||||
sql += "HandID = " + QString::number(myW->getSession()->getCurrentGame()->getCurrentHandID(),10) + " AND ";
|
||||
sql += "GameID = " + QString::number(myW->getSession()->getCurrentGame()->getMyGameID(),10);
|
||||
|
||||
if(roundID <= 3) {
|
||||
if(!mySqliteLogDb->open()) {
|
||||
QMessageBox::critical(0, tr("ERROR"),mySqliteLogDb->lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
|
||||
QSqlQuery query;
|
||||
if(!query.exec(sql)) {
|
||||
QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
|
||||
query.clear();
|
||||
|
||||
mySqliteLogDb->close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void Log::logFlipHoleCardsMsg(QString playerName, int card1, int card2, int cardsValueInt, QString showHas) {
|
||||
void Log::logFlipHoleCardsMsg(QString playerName, int playerID, int card1, int card2, int cardsValueInt, QString showHas) {
|
||||
|
||||
if (cardsValueInt != -1) {
|
||||
|
||||
@@ -326,6 +516,27 @@ void Log::logFlipHoleCardsMsg(QString playerName, int card1, int card2, int card
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString sql = "UPDATE Hand SET ";
|
||||
sql += "Seat_" + QString::number(playerID+1,10) + "_Card_1 = " + QString::number(card1,10) + ",";
|
||||
sql += "Seat_" + QString::number(playerID+1,10) + "_Card_2 = " + QString::number(card2,10);
|
||||
sql += " WHERE ";
|
||||
sql += "HandID = " + QString::number(myW->getSession()->getCurrentGame()->getCurrentHandID(),10) + " AND ";
|
||||
sql += "GameID = " + QString::number(myW->getSession()->getCurrentGame()->getMyGameID(),10);
|
||||
|
||||
if(!mySqliteLogDb->open()) {
|
||||
QMessageBox::critical(0, tr("ERROR"),mySqliteLogDb->lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
|
||||
QSqlQuery query;
|
||||
if(!query.exec(sql)) {
|
||||
QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
|
||||
query.clear();
|
||||
|
||||
mySqliteLogDb->close();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1647,12 +1858,12 @@ QString Log::determineHandName(int myCardsValueInt) {
|
||||
|
||||
void Log::writeLogFileStream(QString streamString) {
|
||||
|
||||
if(myLogFile) {
|
||||
if(myLogFile->open( QIODevice::ReadWrite )) {
|
||||
QTextStream stream( myLogFile );
|
||||
if(myHtmlLogFile) {
|
||||
if(myHtmlLogFile->open( QIODevice::ReadWrite )) {
|
||||
QTextStream stream( myHtmlLogFile );
|
||||
stream.readAll();
|
||||
stream << streamString;
|
||||
myLogFile->close();
|
||||
myHtmlLogFile->close();
|
||||
}
|
||||
else { cout << "Could not open log-file to write log-messages!" << endl; }
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
|
||||
#include "configfile.h"
|
||||
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtSql>
|
||||
|
||||
class gameTableImpl;
|
||||
class GameTableStyleReader;
|
||||
@@ -40,13 +40,13 @@ public:
|
||||
~Log();
|
||||
|
||||
public slots:
|
||||
void logPlayerActionMsg(QString playerName, int action, int setValue);
|
||||
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 card1, int card2, int cardsValueInt = -1, QString showHas = "shows");
|
||||
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);
|
||||
@@ -62,13 +62,13 @@ public:
|
||||
void writeLogFileStream(QString string);
|
||||
|
||||
signals:
|
||||
void signalLogPlayerActionMsg(QString playerName, int action, int setValue);
|
||||
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 card1, int card2, int cardsValueInt = -1, QString showHas = "shows");
|
||||
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);
|
||||
@@ -83,7 +83,8 @@ private:
|
||||
ConfigFile *myConfig;
|
||||
QTextStream stream;
|
||||
QDir *myLogDir;
|
||||
QFile *myLogFile;
|
||||
QFile *myHtmlLogFile;
|
||||
QSqlDatabase *mySqliteLogDb;
|
||||
QString logFileStreamString;
|
||||
QString myAppDataPath;
|
||||
|
||||
|
||||
@@ -111,13 +111,13 @@ 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 action, int setValue) { myLog->signalLogPlayerActionMsg(QString::fromUtf8(playerName.c_str()), action, setValue); }
|
||||
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 card1, int card2, int cardsValueInt, string showHas) { myLog->signalLogFlipHoleCardsMsg(QString::fromUtf8(playerName.c_str()), card1, card2, cardsValueInt, QString::fromUtf8(showHas.c_str())); }
|
||||
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(); }
|
||||
|
||||
@@ -100,13 +100,13 @@ public:
|
||||
void refreshVotesMonitor(int currentVotes, int numVotesNeededToKick);
|
||||
void endVoteOnKick();
|
||||
|
||||
void logPlayerActionMsg(std::string playerName, int action, int setValue) ;
|
||||
void logPlayerActionMsg(std::string playerName, int playerID, int action, int setValue) ;
|
||||
void logNewGameHandMsg(int gameID, int handID) ;
|
||||
void logNewBlindsSetsMsg(int sbSet, int bbSet, std::string sbName, std::string bbName);
|
||||
void logPlayerWinsMsg(std::string playerName, int pot, bool main);
|
||||
void logPlayerSitsOut(std::string playerName);
|
||||
void logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4 = -1, int card5 = -1);
|
||||
void logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows");
|
||||
void logFlipHoleCardsMsg(std::string playerName, int playerID, int card1, int card2, int cardsValueInt = -1, std::string showHas = "shows");
|
||||
void logPlayerWinGame(std::string playerName, int gameID);
|
||||
void flushLogAtGame(int gameID);
|
||||
void flushLogAtHand();
|
||||
|
||||
@@ -273,9 +273,9 @@ void startWindowImpl::startNewLocalGame(newGameDialogImpl *v) {
|
||||
int tmpDealerPos = 0;
|
||||
startData.numberOfPlayers = gameData.maxNumberOfPlayers;
|
||||
Tools::getRandNumber(0, startData.numberOfPlayers-1, 1, &tmpDealerPos, 0);
|
||||
if(DEBUG_MODE) {
|
||||
tmpDealerPos = 4;
|
||||
}
|
||||
//if(DEBUG_MODE) {
|
||||
// tmpDealerPos = 4;
|
||||
//}
|
||||
startData.startDealerPlayerId = static_cast<unsigned>(tmpDealerPos);
|
||||
|
||||
//some gui modifications
|
||||
|
||||
Reference in New Issue
Block a user