gui preperation for log export and live preview
This commit is contained in:
+1
-1
@@ -25,7 +25,7 @@
|
||||
#define MAX_GUI_SPEED 11
|
||||
|
||||
#define DEBUG_MODE 0
|
||||
#define SQLITE_LOG 0
|
||||
#define SQLITE_LOG 1
|
||||
#define HTML_LOG 1
|
||||
|
||||
#define POKERTH_VERSION_MAJOR 0
|
||||
|
||||
@@ -580,23 +580,26 @@ void guiLog::flushLogAtGame(int gameID)
|
||||
}
|
||||
}
|
||||
|
||||
void guiLog::exportLogPdbToHtml(string fileString)
|
||||
void guiLog::exportLogPdbToHtml(QString fileString)
|
||||
{
|
||||
|
||||
cout << "Export pdb to html" << endl;
|
||||
qDebug() << "Export pdb to html" << fileString;
|
||||
|
||||
}
|
||||
|
||||
void guiLog::exportLogPdbToTxt(string fileString)
|
||||
void guiLog::exportLogPdbToTxt(QString fileString)
|
||||
{
|
||||
|
||||
cout << "Export pdb to txt" << endl;
|
||||
qDebug() << "Export pdb to txt" << fileString;
|
||||
|
||||
}
|
||||
|
||||
void guiLog::showLog(string fileString)
|
||||
void guiLog::showLog(QString fileString, QTextBrowser *tb)
|
||||
{
|
||||
|
||||
cout << "show Log" << endl;
|
||||
tb->clear();
|
||||
for(int i=0; i<5; i++) {
|
||||
tb->append(fileString);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <sqlite3.h>
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
#include <QtSql>
|
||||
|
||||
class gameTableImpl;
|
||||
@@ -55,9 +56,9 @@ public slots:
|
||||
void logPlayerWinGame(QString playerName, int gameID);
|
||||
void flushLogAtGame(int gameID);
|
||||
void flushLogAtHand();
|
||||
void exportLogPdbToHtml(std::string fileString);
|
||||
void exportLogPdbToTxt(std::string fileString);
|
||||
void showLog(std::string fileString);
|
||||
void exportLogPdbToHtml(QString fileString);
|
||||
void exportLogPdbToTxt(QString fileString);
|
||||
void showLog(QString fileString, QTextBrowser* tb);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@@ -34,6 +34,7 @@ GuiWrapper::GuiWrapper(ConfigFile *c, startWindowImpl *s) : myGuiLog(NULL), myW(
|
||||
myW = new gameTableImpl(myConfig);
|
||||
myGuiLog = new guiLog(myW, myConfig);
|
||||
|
||||
myStartWindow->setGuiLog(myGuiLog);
|
||||
myW->setStartWindow(myStartWindow);
|
||||
}
|
||||
|
||||
|
||||
@@ -3356,6 +3356,23 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QLabel { font-weight: bold; }</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Log Messages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_logOnOff">
|
||||
<property name="title">
|
||||
@@ -3370,8 +3387,14 @@ p, li { white-space: pre-wrap; }
|
||||
<layout class="QGridLayout" name="gridLayout_20">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_27">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Store log files for</string>
|
||||
<string>Store log files for:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBox_logStoreDuration</cstring>
|
||||
@@ -3380,6 +3403,12 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="spinBox_logStoreDuration">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> Day(s)</string>
|
||||
</property>
|
||||
@@ -3396,6 +3425,12 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_39">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Write log after every: </string>
|
||||
</property>
|
||||
@@ -3434,6 +3469,12 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_29">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Log File Directory: </string>
|
||||
</property>
|
||||
@@ -3472,12 +3513,64 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="treeWidget_logFiles">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="indentation">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="allColumnsShowFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Log File</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_37">
|
||||
<property name="text">
|
||||
<string>Preview:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="textBrowser_logPreview">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_exportLogHtml">
|
||||
<property name="text">
|
||||
<string>Export as html</string>
|
||||
<string>Export as HTML</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
@@ -3520,60 +3613,9 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QTreeWidget" name="treeWidget_logFiles">
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="indentation">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="allColumnsShowFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Log File</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QLabel { font-weight: bold; }</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Log Messages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "carddeckstylereader.h"
|
||||
|
||||
#include "configfile.h"
|
||||
#include "guilog.h"
|
||||
#include <net/socket_startup.h>
|
||||
|
||||
enum StyleType { POKERTH_DISTRIBUTED_STYLE, ADDITIONAL_STYLE };
|
||||
@@ -135,6 +136,7 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, ConfigFile *c, selectAva
|
||||
connect( pushButton_exportLogHtml, SIGNAL(clicked()), this, SLOT (exportLogToHtml()));
|
||||
connect( pushButton_exportLogTxt, SIGNAL(clicked()), this, SLOT (exportLogToTxt()));
|
||||
connect( pushButton_saveLogAs, SIGNAL(clicked()), this, SLOT (saveLogFileAs()));
|
||||
connect( treeWidget_logFiles, SIGNAL(itemSelectionChanged()), this, SLOT(showLogFilePreview()));
|
||||
|
||||
}
|
||||
|
||||
@@ -1309,12 +1311,32 @@ void settingsDialogImpl::deleteLogFile()
|
||||
|
||||
void settingsDialogImpl::exportLogToHtml()
|
||||
{
|
||||
QTreeWidgetItem* selectedItem = treeWidget_logFiles->currentItem();
|
||||
|
||||
if(selectedItem) {
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Export PokerTH log file to HTML"),
|
||||
QDir::homePath()+"/"+selectedItem->text(0),
|
||||
tr("PokerTH HTML log (*.html)"));
|
||||
|
||||
if(!fileName.isEmpty()) {
|
||||
myGuiLog->exportLogPdbToHtml(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void settingsDialogImpl::exportLogToTxt()
|
||||
{
|
||||
QTreeWidgetItem* selectedItem = treeWidget_logFiles->currentItem();
|
||||
|
||||
if(selectedItem) {
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Export PokerTH log file to plain text"),
|
||||
QDir::homePath()+"/"+selectedItem->text(0),
|
||||
tr("PokerTH plain text log (*.txt)"));
|
||||
|
||||
if(!fileName.isEmpty()) {
|
||||
myGuiLog->exportLogPdbToTxt(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void settingsDialogImpl::saveLogFileAs()
|
||||
@@ -1331,3 +1353,12 @@ void settingsDialogImpl::saveLogFileAs()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void settingsDialogImpl::showLogFilePreview()
|
||||
{
|
||||
QTreeWidgetItem* selectedItem = treeWidget_logFiles->currentItem();
|
||||
|
||||
if(selectedItem) {
|
||||
myGuiLog->showLog(selectedItem->data(0, Qt::UserRole).toString(), textBrowser_logPreview);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ class ConfigFile;
|
||||
class selectAvatarDialogImpl;
|
||||
class manualBlindsOrderDialogImpl;
|
||||
class MyStyleListItem;
|
||||
class guiLog;
|
||||
|
||||
class settingsDialogImpl: public QDialog, public Ui::settingsDialog
|
||||
{
|
||||
@@ -56,6 +57,10 @@ public:
|
||||
return settingsCorrect;
|
||||
}
|
||||
|
||||
void setGuiLog(guiLog* l) {
|
||||
myGuiLog = l;
|
||||
}
|
||||
|
||||
public slots:
|
||||
|
||||
void isAccepted();
|
||||
@@ -108,6 +113,7 @@ public slots:
|
||||
void exportLogToHtml();
|
||||
void exportLogToTxt();
|
||||
void saveLogFileAs();
|
||||
void showLogFilePreview();
|
||||
|
||||
private:
|
||||
|
||||
@@ -128,6 +134,7 @@ private:
|
||||
std::list<std::string> myCardDeckStylesList;
|
||||
|
||||
ConfigFile* myConfig;
|
||||
guiLog* myGuiLog;
|
||||
selectAvatarDialogImpl *mySelectAvatarDialogImpl;
|
||||
manualBlindsOrderDialogImpl *myManualBlindsOrderDialog;
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "chattools.h"
|
||||
#include "serverlistdialogimpl.h"
|
||||
#include "internetgamelogindialogimpl.h"
|
||||
#include "guilog.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -85,6 +86,7 @@ startWindowImpl::startWindowImpl(ConfigFile *c)
|
||||
|
||||
myStartNetworkGameDialog->setMyW(myGuiInterface->getMyW());
|
||||
myGameLobbyDialog->setMyW(myGuiInterface->getMyW());
|
||||
mySettingsDialog->setGuiLog(myGuiLog);
|
||||
|
||||
myTimeoutDialog = new timeoutMsgBoxImpl(this);
|
||||
myServerListDialog = new serverListDialogImpl(this, this, myConfig);
|
||||
|
||||
@@ -50,6 +50,7 @@ class gameLobbyDialogImpl;
|
||||
class timeoutMsgBoxImpl;
|
||||
class serverListDialogImpl;
|
||||
class internetGameLoginDialogImpl;
|
||||
class guiLog;
|
||||
|
||||
class startWindowImpl: public QMainWindow, public Ui::startWindow
|
||||
{
|
||||
@@ -72,6 +73,10 @@ public:
|
||||
return myConnectToServerDialog;
|
||||
}
|
||||
|
||||
void setGuiLog(guiLog* l) {
|
||||
myGuiLog = l;
|
||||
}
|
||||
|
||||
// void keyPressEvent( QKeyEvent *);
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
|
||||
@@ -149,6 +154,7 @@ public slots:
|
||||
|
||||
private:
|
||||
ConfigFile *myConfig;
|
||||
guiLog *myGuiLog;
|
||||
|
||||
boost::shared_ptr<GuiInterface> myGuiInterface;
|
||||
boost::shared_ptr<Session> mySession;
|
||||
|
||||
Reference in New Issue
Block a user