This commit is contained in:
@@ -40,7 +40,7 @@ using namespace std;
|
|||||||
ConfigFile::ConfigFile(bool configFirstStart)
|
ConfigFile::ConfigFile(bool configFirstStart)
|
||||||
{
|
{
|
||||||
// !!!! Revisionsnummer der Configdefaults !!!!!
|
// !!!! Revisionsnummer der Configdefaults !!!!!
|
||||||
configRev = 17;
|
configRev = 18;
|
||||||
|
|
||||||
// Pfad und Dateinamen setzen
|
// Pfad und Dateinamen setzen
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -187,10 +187,11 @@ void ConfigFile::updateConfig(ConfigState myConfigState) {
|
|||||||
configList.push_back(ConfigInfo("Opponent5Avatar", CONFIG_TYPE_STRING, ""));
|
configList.push_back(ConfigInfo("Opponent5Avatar", CONFIG_TYPE_STRING, ""));
|
||||||
configList.push_back(ConfigInfo("Opponent6Name", CONFIG_TYPE_STRING, "Player 6"));
|
configList.push_back(ConfigInfo("Opponent6Name", CONFIG_TYPE_STRING, "Player 6"));
|
||||||
configList.push_back(ConfigInfo("Opponent6Avatar", CONFIG_TYPE_STRING, ""));
|
configList.push_back(ConfigInfo("Opponent6Avatar", CONFIG_TYPE_STRING, ""));
|
||||||
|
configList.push_back(ConfigInfo("LogOnOff", CONFIG_TYPE_INT, "1"));
|
||||||
configList.push_back(ConfigInfo("LogDir", CONFIG_TYPE_STRING, logDir));
|
configList.push_back(ConfigInfo("LogDir", CONFIG_TYPE_STRING, logDir));
|
||||||
configList.push_back(ConfigInfo("LogStoreDuration", CONFIG_TYPE_INT, "2"));
|
configList.push_back(ConfigInfo("LogStoreDuration", CONFIG_TYPE_INT, "2"));
|
||||||
|
configList.push_back(ConfigInfo("LogInterval", CONFIG_TYPE_INT, "0"));
|
||||||
configList.push_back(ConfigInfo("DataDir", CONFIG_TYPE_STRING, dataDir));
|
configList.push_back(ConfigInfo("DataDir", CONFIG_TYPE_STRING, dataDir));
|
||||||
configList.push_back(ConfigInfo("LogStoreDuration", CONFIG_TYPE_INT, "2"));
|
|
||||||
|
|
||||||
|
|
||||||
if(myConfigState == NONEXISTING) {
|
if(myConfigState == NONEXISTING) {
|
||||||
|
|||||||
+187
-150
@@ -31,63 +31,65 @@ Log::Log(mainWindowImpl* w, ConfigFile *c) : myW(w), myConfig(c)
|
|||||||
{
|
{
|
||||||
myW->setLog(this);
|
myW->setLog(this);
|
||||||
|
|
||||||
if(myConfig->readConfigString("LogDir") != "" && QDir::QDir(QString::fromUtf8(myConfig->readConfigString("LogDir").c_str())).exists()) {
|
if(myConfig->readConfigInt("LogOnOff")) {
|
||||||
|
//if write logfiles is enabled
|
||||||
|
if(myConfig->readConfigString("LogDir") != "" && QDir::QDir(QString::fromUtf8(myConfig->readConfigString("LogDir").c_str())).exists()) {
|
||||||
|
|
||||||
myLogDir = new QDir(QString::fromUtf8(myConfig->readConfigString("LogDir").c_str()));
|
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");
|
myLogFile = new QFile(myLogDir->absolutePath()+"/pokerth-log-"+QDateTime::currentDateTime().toString("yyyy-MM-dd_hh.mm.ss")+".html");
|
||||||
|
|
||||||
//Logo-Pixmap extrahieren
|
//Logo-Pixmap extrahieren
|
||||||
QPixmap::QPixmap(":graphics/resources/graphics/logoChip3D.png").save(myLogDir->absolutePath()+"/logo.png");
|
QPixmap::QPixmap(":graphics/resources/graphics/logoChip3D.png").save(myLogDir->absolutePath()+"/logo.png");
|
||||||
|
|
||||||
// myW->textBrowser_Log->append(myLogFile->fileName());
|
// myW->textBrowser_Log->append(myLogFile->fileName());
|
||||||
|
|
||||||
myLogFile->open( QIODevice::WriteOnly );
|
myLogFile->open( QIODevice::WriteOnly );
|
||||||
QTextStream stream( myLogFile );
|
QTextStream stream( myLogFile );
|
||||||
stream << "<html>\n";
|
stream << "<html>\n";
|
||||||
stream << "<head>\n";
|
stream << "<head>\n";
|
||||||
stream << "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf8\">";
|
stream << "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf8\">";
|
||||||
stream << "</head>\n";
|
stream << "</head>\n";
|
||||||
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 0.4 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 0.4 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 = 3;
|
linesInFile = 3;
|
||||||
|
|
||||||
//Zu alte Dateien löschen!!!
|
//Zu alte Dateien löschen!!!
|
||||||
int daysUntilWaste = myConfig->readConfigInt("LogStoreDuration");
|
int daysUntilWaste = myConfig->readConfigInt("LogStoreDuration");
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
QStringList filters("pokerth-log*");
|
QStringList filters("pokerth-log*");
|
||||||
QStringList logFileList = myLogDir->entryList(filters, QDir::Files);
|
QStringList logFileList = myLogDir->entryList(filters, QDir::Files);
|
||||||
|
|
||||||
for(i=0; i<logFileList.count(); i++) {
|
for(i=0; i<logFileList.count(); i++) {
|
||||||
|
|
||||||
// cout << logFileList.at(i).toStdString() << endl;
|
// cout << logFileList.at(i).toStdString() << endl;
|
||||||
|
|
||||||
QString dateString = logFileList.at(i);
|
QString dateString = logFileList.at(i);
|
||||||
dateString.remove("pokerth-log-");
|
dateString.remove("pokerth-log-");
|
||||||
dateString.remove(10,14);
|
dateString.remove(10,14);
|
||||||
|
|
||||||
QDate dateOfFile(QDate::fromString(dateString, Qt::ISODate));
|
QDate dateOfFile(QDate::fromString(dateString, Qt::ISODate));
|
||||||
QDate today(QDate::currentDate());
|
QDate today(QDate::currentDate());
|
||||||
|
|
||||||
// cout << dateOfFile.daysTo(today) << endl;
|
// cout << dateOfFile.daysTo(today) << endl;
|
||||||
|
|
||||||
if (dateOfFile.daysTo(today) > daysUntilWaste) {
|
if (dateOfFile.daysTo(today) > daysUntilWaste) {
|
||||||
|
|
||||||
|
// cout << QString::QString(myLogDir->absolutePath()+"/"+logFileList.at(i)).toStdString() << endl;
|
||||||
|
QFile fileToDelete(myLogDir->absolutePath()+"/"+logFileList.at(i));
|
||||||
|
fileToDelete.remove();
|
||||||
|
}
|
||||||
|
|
||||||
// cout << QString::QString(myLogDir->absolutePath()+"/"+logFileList.at(i)).toStdString() << endl;
|
|
||||||
QFile fileToDelete(myLogDir->absolutePath()+"/"+logFileList.at(i));
|
|
||||||
fileToDelete.remove();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else { cout << "Log directory doesn't exists. Cannot create log files"; }
|
||||||
}
|
}
|
||||||
else { cout << "Log directory doesn't exists. Cannot create log files"; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Log::~Log()
|
Log::~Log()
|
||||||
@@ -124,16 +126,18 @@ void Log::logPlayerActionMsg(string playerName, int action, int setValue) {
|
|||||||
|
|
||||||
myW->textBrowser_Log->append(msg);
|
myW->textBrowser_Log->append(msg);
|
||||||
|
|
||||||
myLogFile->open( QIODevice::ReadWrite );
|
if(myConfig->readConfigInt("LogOnOff")) {
|
||||||
QTextStream stream( myLogFile );
|
//if write logfiles is enabled
|
||||||
for(i=0; i<=linesInFile; i++) { stream.readLine(); }
|
myLogFile->open( QIODevice::ReadWrite );
|
||||||
stream << msg+"</br>\n";
|
QTextStream stream( myLogFile );
|
||||||
// stream << "</body>\n";
|
for(i=0; i<=linesInFile; i++) { stream.readLine(); }
|
||||||
// stream << "</html>\n";
|
stream << msg+"</br>\n";
|
||||||
myLogFile->close();
|
// stream << "</body>\n";
|
||||||
|
// stream << "</html>\n";
|
||||||
linesInFile++;
|
myLogFile->close();
|
||||||
|
|
||||||
|
linesInFile++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Log::logNewGameHandMsg(int gameID, int handID) {
|
void Log::logNewGameHandMsg(int gameID, int handID) {
|
||||||
@@ -142,88 +146,91 @@ void Log::logNewGameHandMsg(int gameID, int handID) {
|
|||||||
|
|
||||||
myW->textBrowser_Log->append("<b>## Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" ##</b>");
|
myW->textBrowser_Log->append("<b>## Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" ##</b>");
|
||||||
|
|
||||||
myLogFile->open( QIODevice::ReadWrite );
|
if(myConfig->readConfigInt("LogOnOff")) {
|
||||||
QTextStream stream( myLogFile );
|
//if write logfiles is enabled
|
||||||
for(i=0; i<=linesInFile; i++) { stream.readLine(); }
|
|
||||||
|
|
||||||
stream << "<p><b>####################   Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+"   ####################</b></br>";
|
myLogFile->open( QIODevice::ReadWrite );
|
||||||
stream << "CASH: ";
|
QTextStream stream( myLogFile );
|
||||||
|
for(i=0; i<=linesInFile; i++) { stream.readLine(); }
|
||||||
|
|
||||||
//Aktive Spieler zählen
|
stream << "<p><b>####################   Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+"   ####################</b></br>";
|
||||||
int activePlayersCounter = 0;
|
stream << "CASH: ";
|
||||||
HandInterface *currentHand = myW->getSession().getCurrentGame()->getCurrentHand();
|
|
||||||
for (k=0; k<MAX_NUMBER_OF_PLAYERS; k++) {
|
|
||||||
if (currentHand->getPlayerArray()[k]->getMyActiveStatus() == 1) activePlayersCounter++;
|
|
||||||
}
|
|
||||||
k = 0;
|
|
||||||
if(activePlayersCounter > 2) {
|
|
||||||
|
|
||||||
for(i=0; i<currentHand->getStartQuantityPlayers(); i++) {
|
|
||||||
|
|
||||||
if(currentHand->getPlayerArray()[i]->getMyActiveStatus()) {
|
|
||||||
//print cash only for active players
|
|
||||||
|
|
||||||
|
|
||||||
if(currentHand->getPlayerArray()[i]->getMyButton() == 1) {
|
|
||||||
if(k==1) { stream << ", "; }
|
|
||||||
k=1;
|
|
||||||
stream << QString::fromUtf8(currentHand->getPlayerArray()[i]->getMyName().c_str())+" (Dealer): "+QString::number(currentHand->getPlayerArray()[i]->getMyCash(),10)+"$";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(k==1) { stream << ", "; }
|
|
||||||
k=1;
|
|
||||||
stream << QString::fromUtf8(currentHand->getPlayerArray()[i]->getMyName().c_str())+": "+QString::number(currentHand->getPlayerArray()[i]->getMyCash()+currentHand->getPlayerArray()[i]->getMySet(),10)+"$";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for(i=0; i<currentHand->getStartQuantityPlayers(); i++) {
|
|
||||||
if(currentHand->getPlayerArray()[i]->getMyActiveStatus()) {
|
|
||||||
//print cash only for active players
|
|
||||||
if(currentHand->getPlayerArray()[i]->getMyButton() == 3) {
|
|
||||||
if(k==1) { stream << ", "; }
|
|
||||||
k=1;
|
|
||||||
stream << QString::fromUtf8(currentHand->getPlayerArray()[i]->getMyName().c_str())+" (Dealer): "+QString::number(currentHand->getPlayerArray()[i]->getMyCash()+currentHand->getPlayerArray()[i]->getMySet(),10)+"$";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(k==1) { stream << ", "; }
|
|
||||||
k=1;
|
|
||||||
stream << QString::fromUtf8(currentHand->getPlayerArray()[i]->getMyName().c_str())+": "+QString::number(currentHand->getPlayerArray()[i]->getMyCash()+currentHand->getPlayerArray()[i]->getMySet(),10)+"$";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stream << "</br>BLINDS: ";
|
|
||||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
|
|
||||||
j = 0;
|
|
||||||
//Aktive Spieler zählen
|
//Aktive Spieler zählen
|
||||||
int activePlayersCounter = 0;
|
int activePlayersCounter = 0;
|
||||||
|
HandInterface *currentHand = myW->getSession().getCurrentGame()->getCurrentHand();
|
||||||
for (k=0; k<MAX_NUMBER_OF_PLAYERS; k++) {
|
for (k=0; k<MAX_NUMBER_OF_PLAYERS; k++) {
|
||||||
if (currentHand->getPlayerArray()[k]->getMyAction() != 1 && currentHand->getPlayerArray()[k]->getMyActiveStatus() == 1) activePlayersCounter++;
|
if (currentHand->getPlayerArray()[k]->getMyActiveStatus() == 1) activePlayersCounter++;
|
||||||
}
|
}
|
||||||
if(activePlayersCounter < 3) { j=1; }
|
k = 0;
|
||||||
|
if(activePlayersCounter > 2) {
|
||||||
|
|
||||||
// cout << activePlayersCounter << endl;
|
for(i=0; i<currentHand->getStartQuantityPlayers(); i++) {
|
||||||
// cout << (i+currentHand->getDealerPosition()+j)%5 << endl;
|
|
||||||
|
|
||||||
switch (currentHand->getPlayerArray()[(i+currentHand->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMyButton()) {
|
if(currentHand->getPlayerArray()[i]->getMyActiveStatus()) {
|
||||||
case 2 : stream << QString::fromUtf8(currentHand->getPlayerArray()[(i+currentHand->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMyName().c_str())+" ("+QString::number(currentHand->getPlayerArray()[(i+currentHand->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMySet(),10)+"$), ";
|
//print cash only for active players
|
||||||
break;
|
|
||||||
case 3 : stream << QString::fromUtf8(currentHand->getPlayerArray()[(i+currentHand->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMyName().c_str())+" ("+QString::number(currentHand->getPlayerArray()[(i+currentHand->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMySet(),10)+"$)";
|
|
||||||
break;
|
if(currentHand->getPlayerArray()[i]->getMyButton() == 1) {
|
||||||
default :;
|
if(k==1) { stream << ", "; }
|
||||||
|
k=1;
|
||||||
|
stream << QString::fromUtf8(currentHand->getPlayerArray()[i]->getMyName().c_str())+" (Dealer): "+QString::number(currentHand->getPlayerArray()[i]->getMyCash(),10)+"$";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(k==1) { stream << ", "; }
|
||||||
|
k=1;
|
||||||
|
stream << QString::fromUtf8(currentHand->getPlayerArray()[i]->getMyName().c_str())+": "+QString::number(currentHand->getPlayerArray()[i]->getMyCash()+currentHand->getPlayerArray()[i]->getMySet(),10)+"$";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
for(i=0; i<currentHand->getStartQuantityPlayers(); i++) {
|
||||||
|
if(currentHand->getPlayerArray()[i]->getMyActiveStatus()) {
|
||||||
|
//print cash only for active players
|
||||||
|
if(currentHand->getPlayerArray()[i]->getMyButton() == 3) {
|
||||||
|
if(k==1) { stream << ", "; }
|
||||||
|
k=1;
|
||||||
|
stream << QString::fromUtf8(currentHand->getPlayerArray()[i]->getMyName().c_str())+" (Dealer): "+QString::number(currentHand->getPlayerArray()[i]->getMyCash()+currentHand->getPlayerArray()[i]->getMySet(),10)+"$";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(k==1) { stream << ", "; }
|
||||||
|
k=1;
|
||||||
|
stream << QString::fromUtf8(currentHand->getPlayerArray()[i]->getMyName().c_str())+": "+QString::number(currentHand->getPlayerArray()[i]->getMyCash()+currentHand->getPlayerArray()[i]->getMySet(),10)+"$";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stream << "</br>BLINDS: ";
|
||||||
|
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||||
|
|
||||||
|
j = 0;
|
||||||
|
//Aktive Spieler zählen
|
||||||
|
int activePlayersCounter = 0;
|
||||||
|
for (k=0; k<MAX_NUMBER_OF_PLAYERS; k++) {
|
||||||
|
if (currentHand->getPlayerArray()[k]->getMyAction() != 1 && currentHand->getPlayerArray()[k]->getMyActiveStatus() == 1) activePlayersCounter++;
|
||||||
|
}
|
||||||
|
if(activePlayersCounter < 3) { j=1; }
|
||||||
|
|
||||||
|
// cout << activePlayersCounter << endl;
|
||||||
|
// cout << (i+currentHand->getDealerPosition()+j)%5 << endl;
|
||||||
|
|
||||||
|
switch (currentHand->getPlayerArray()[(i+currentHand->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMyButton()) {
|
||||||
|
case 2 : stream << QString::fromUtf8(currentHand->getPlayerArray()[(i+currentHand->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMyName().c_str())+" ("+QString::number(currentHand->getPlayerArray()[(i+currentHand->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMySet(),10)+"$), ";
|
||||||
|
break;
|
||||||
|
case 3 : stream << QString::fromUtf8(currentHand->getPlayerArray()[(i+currentHand->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMyName().c_str())+" ("+QString::number(currentHand->getPlayerArray()[(i+currentHand->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMySet(),10)+"$)";
|
||||||
|
break;
|
||||||
|
default :;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stream << "</br></br><b>PREFLOP</b>";
|
||||||
|
stream << "</br>\n";
|
||||||
|
|
||||||
|
myLogFile->close();
|
||||||
|
|
||||||
|
linesInFile = linesInFile++;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream << "</br></br><b>PREFLOP</b>";
|
|
||||||
stream << "</br>\n";
|
|
||||||
|
|
||||||
myLogFile->close();
|
|
||||||
|
|
||||||
linesInFile = linesInFile++;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Log::logPlayerWinsMsg(int playerID, int pot) {
|
void Log::logPlayerWinsMsg(int playerID, int pot) {
|
||||||
@@ -231,62 +238,77 @@ void Log::logPlayerWinsMsg(int playerID, int pot) {
|
|||||||
int i;
|
int i;
|
||||||
HandInterface *currentHand = myW->getSession().getCurrentGame()->getCurrentHand();
|
HandInterface *currentHand = myW->getSession().getCurrentGame()->getCurrentHand();
|
||||||
|
|
||||||
myLogFile->open( QIODevice::ReadWrite );
|
|
||||||
QTextStream stream( myLogFile );
|
|
||||||
for(i=0; i<=linesInFile; i++) { stream.readLine(); }
|
|
||||||
|
|
||||||
// if (cardsValueInt != -1) {
|
|
||||||
// myW->textBrowser_Log->append(QString::fromUtf8(currentHand->getPlayerArray()[playerID]->getMyName())+" wins "+QString::number(pot,10)+"$ with "+translateCardsValueCode(cardsValueInt).at(0)+"!!! ");
|
|
||||||
// stream << "</br><i>"+QString::fromUtf8(currentHand->getPlayerArray()[playerID]->getMyName())+" wins "+QString::number(pot,10)+"$!!!</i></p>\n";
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
myW->textBrowser_Log->append(QString::fromUtf8(currentHand->getPlayerArray()[playerID]->getMyName().c_str())+" wins "+QString::number(pot,10)+"$!!! ");
|
myW->textBrowser_Log->append(QString::fromUtf8(currentHand->getPlayerArray()[playerID]->getMyName().c_str())+" wins "+QString::number(pot,10)+"$!!! ");
|
||||||
stream << "</br><i>"+QString::fromUtf8(currentHand->getPlayerArray()[playerID]->getMyName().c_str())+" wins "+QString::number(pot,10)+"$!!!</i></p>\n";
|
|
||||||
// }
|
|
||||||
myLogFile->close();
|
|
||||||
|
|
||||||
linesInFile++;
|
if(myConfig->readConfigInt("LogOnOff")) {
|
||||||
|
//if write logfiles is enabled
|
||||||
|
myLogFile->open( QIODevice::ReadWrite );
|
||||||
|
QTextStream stream( myLogFile );
|
||||||
|
for(i=0; i<=linesInFile; i++) { stream.readLine(); }
|
||||||
|
|
||||||
|
// if (cardsValueInt != -1) {
|
||||||
|
// myW->textBrowser_Log->append(QString::fromUtf8(currentHand->getPlayerArray()[playerID]->getMyName())+" wins "+QString::number(pot,10)+"$ with "+translateCardsValueCode(cardsValueInt).at(0)+"!!! ");
|
||||||
|
// stream << "</br><i>"+QString::fromUtf8(currentHand->getPlayerArray()[playerID]->getMyName())+" wins "+QString::number(pot,10)+"$!!!</i></p>\n";
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
|
||||||
|
stream << "</br><i>"+QString::fromUtf8(currentHand->getPlayerArray()[playerID]->getMyName().c_str())+" wins "+QString::number(pot,10)+"$!!!</i></p>\n";
|
||||||
|
// }
|
||||||
|
myLogFile->close();
|
||||||
|
|
||||||
|
linesInFile++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Log::logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4, int card5) {
|
void Log::logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4, int card5) {
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
myLogFile->open( QIODevice::ReadWrite );
|
|
||||||
QTextStream stream( myLogFile );
|
|
||||||
for(i=0; i<=linesInFile; i++) { stream.readLine(); }
|
|
||||||
|
|
||||||
QString round;
|
QString round;
|
||||||
|
|
||||||
switch (roundID) {
|
switch (roundID) {
|
||||||
|
|
||||||
case 1: round = "Flop";
|
case 1: round = "Flop";
|
||||||
myW->textBrowser_Log->append("--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+"]");
|
myW->textBrowser_Log->append("--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+"]");
|
||||||
stream << "</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";
|
|
||||||
break;
|
break;
|
||||||
case 2: round = "Turn";
|
case 2: round = "Turn";
|
||||||
myW->textBrowser_Log->append("--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+"]");
|
myW->textBrowser_Log->append("--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+"]");
|
||||||
stream << "</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";
|
|
||||||
break;
|
break;
|
||||||
case 3: round = "River";
|
case 3: round = "River";
|
||||||
myW->textBrowser_Log->append("--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+","+translateCardCode(card5).at(0)+translateCardCode(card5).at(1)+"]");
|
myW->textBrowser_Log->append("--- "+round+" --- "+"["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+","+translateCardCode(card3).at(0)+translateCardCode(card3).at(1)+","+translateCardCode(card4).at(0)+translateCardCode(card4).at(1)+","+translateCardCode(card5).at(0)+translateCardCode(card5).at(1)+"]");
|
||||||
stream << "</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";
|
|
||||||
break;
|
break;
|
||||||
default: round = "ERROR";
|
default: round = "ERROR";
|
||||||
}
|
}
|
||||||
|
|
||||||
myLogFile->close();
|
if(myConfig->readConfigInt("LogOnOff")) {
|
||||||
linesInFile++;
|
//if write logfiles is enabled
|
||||||
|
|
||||||
|
myLogFile->open( QIODevice::ReadWrite );
|
||||||
|
QTextStream stream( myLogFile );
|
||||||
|
for(i=0; i<=linesInFile; i++) { stream.readLine(); }
|
||||||
|
|
||||||
|
switch (roundID) {
|
||||||
|
|
||||||
|
case 1: round = "Flop";
|
||||||
|
stream << "</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";
|
||||||
|
break;
|
||||||
|
case 2: round = "Turn";
|
||||||
|
stream << "</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";
|
||||||
|
break;
|
||||||
|
case 3: round = "River";
|
||||||
|
stream << "</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";
|
||||||
|
break;
|
||||||
|
default: round = "ERROR";
|
||||||
|
}
|
||||||
|
|
||||||
|
myLogFile->close();
|
||||||
|
linesInFile++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Log::logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt, string showHas) {
|
void Log::logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int cardsValueInt, string showHas) {
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
myLogFile->open( QIODevice::ReadWrite );
|
|
||||||
QTextStream stream( myLogFile );
|
|
||||||
for(i=0; i<=linesInFile; i++) { stream.readLine(); }
|
|
||||||
|
|
||||||
if (cardsValueInt != -1) {
|
if (cardsValueInt != -1) {
|
||||||
|
|
||||||
QString tempHandName;
|
QString tempHandName;
|
||||||
@@ -393,16 +415,31 @@ void Log::logFlipHoleCardsMsg(std::string playerName, int card1, int card2, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
myW->textBrowser_Log->append(QString::fromUtf8(playerName.c_str())+" "+QString::fromUtf8(showHas.c_str())+" \""+tempHandName+"\"");
|
myW->textBrowser_Log->append(QString::fromUtf8(playerName.c_str())+" "+QString::fromUtf8(showHas.c_str())+" \""+tempHandName+"\"");
|
||||||
stream << QString::fromUtf8(playerName.c_str())+" "+QString::fromUtf8(showHas.c_str())+" [ <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+"] - "+tempHandName+"</br>\n";
|
|
||||||
|
|
||||||
|
if(myConfig->readConfigInt("LogOnOff")) {
|
||||||
|
//if write logfiles is enabled
|
||||||
|
myLogFile->open( QIODevice::ReadWrite );
|
||||||
|
QTextStream stream( myLogFile );
|
||||||
|
for(i=0; i<=linesInFile; i++) { stream.readLine(); }
|
||||||
|
stream << QString::fromUtf8(playerName.c_str())+" "+QString::fromUtf8(showHas.c_str())+" [ <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+"] - "+tempHandName+"</br>\n";
|
||||||
|
myLogFile->close();
|
||||||
|
linesInFile++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
myW->textBrowser_Log->append(QString::fromUtf8(playerName.c_str())+" "+QString::fromUtf8(showHas.c_str())+" ["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+"]");
|
myW->textBrowser_Log->append(QString::fromUtf8(playerName.c_str())+" "+QString::fromUtf8(showHas.c_str())+" ["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+"]");
|
||||||
stream << QString::fromUtf8(playerName.c_str())+" "+QString::fromUtf8(showHas.c_str())+" [<b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+"]"+"</br>\n";
|
|
||||||
|
|
||||||
|
if(myConfig->readConfigInt("LogOnOff")) {
|
||||||
|
//if write logfiles is enabled
|
||||||
|
myLogFile->open( QIODevice::ReadWrite );
|
||||||
|
QTextStream stream( myLogFile );
|
||||||
|
for(i=0; i<=linesInFile; i++) { stream.readLine(); }
|
||||||
|
stream << QString::fromUtf8(playerName.c_str())+" "+QString::fromUtf8(showHas.c_str())+" [<b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+"]"+"</br>\n";
|
||||||
|
myLogFile->close();
|
||||||
|
linesInFile++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
myLogFile->close();
|
|
||||||
linesInFile++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Log::translateCardCode(int cardCode) {
|
QStringList Log::translateCardCode(int cardCode) {
|
||||||
|
|||||||
@@ -1030,7 +1030,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="2" column="0" >
|
<item row="2" column="0" >
|
||||||
<widget class="QGroupBox" name="groupBox_LogOnOff" >
|
<widget class="QGroupBox" name="groupBox_logOnOff" >
|
||||||
<property name="title" >
|
<property name="title" >
|
||||||
<string>Enable/Disable Logging</string>
|
<string>Enable/Disable Logging</string>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@@ -111,8 +111,10 @@ void settingsDialogImpl::exec() {
|
|||||||
lineEdit_OwnFlipsideFilename->setText(QString::fromUtf8(myConfig->readConfigString("FlipsideOwnFile").c_str()));
|
lineEdit_OwnFlipsideFilename->setText(QString::fromUtf8(myConfig->readConfigString("FlipsideOwnFile").c_str()));
|
||||||
|
|
||||||
//Log
|
//Log
|
||||||
|
groupBox_logOnOff->setChecked(myConfig->readConfigInt("LogOnOff"));
|
||||||
lineEdit_logDir->setText(QString::fromUtf8(myConfig->readConfigString("LogDir").c_str()));
|
lineEdit_logDir->setText(QString::fromUtf8(myConfig->readConfigString("LogDir").c_str()));
|
||||||
spinBox_logStoreDuration->setValue(myConfig->readConfigInt("LogStoreDuration"));
|
spinBox_logStoreDuration->setValue(myConfig->readConfigInt("LogStoreDuration"));
|
||||||
|
comboBox_logInterval->setCurrentIndex(myConfig->readConfigInt("LogInterval"));
|
||||||
|
|
||||||
QDialog::exec();
|
QDialog::exec();
|
||||||
|
|
||||||
@@ -242,6 +244,7 @@ void settingsDialogImpl::isAccepted() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Log
|
// Log
|
||||||
|
myConfig->writeConfigInt("LogOnOff", groupBox_logOnOff->isChecked());
|
||||||
if(QDir::QDir(lineEdit_logDir->text()).exists() && lineEdit_logDir->text() != "") { myConfig->writeConfigString("LogDir", lineEdit_logDir->text().toUtf8().constData()); }
|
if(QDir::QDir(lineEdit_logDir->text()).exists() && lineEdit_logDir->text() != "") { myConfig->writeConfigString("LogDir", lineEdit_logDir->text().toUtf8().constData()); }
|
||||||
else {
|
else {
|
||||||
QMessageBox::warning(this, tr("Settings Error"),
|
QMessageBox::warning(this, tr("Settings Error"),
|
||||||
@@ -252,6 +255,7 @@ void settingsDialogImpl::isAccepted() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
myConfig->writeConfigInt("LogStoreDuration", spinBox_logStoreDuration->value());
|
myConfig->writeConfigInt("LogStoreDuration", spinBox_logStoreDuration->value());
|
||||||
|
myConfig->writeConfigInt("LogInterval", comboBox_logInterval->currentIndex());
|
||||||
|
|
||||||
//Wenn alles richtig eingegeben wurde --> Dialog schließen
|
//Wenn alles richtig eingegeben wurde --> Dialog schließen
|
||||||
if(settingsCorrect) { this->hide(); }
|
if(settingsCorrect) { this->hide(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user