log file handling as standalone dialog finished
This commit is contained in:
+161
-23
@@ -1,39 +1,177 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<author/>
|
||||
<comment/>
|
||||
<exportmacro/>
|
||||
<class>LogFileDialog</class>
|
||||
<widget class="QDialog" name="LogFileDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>618</width>
|
||||
<height>392</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>240</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Game:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="treeWidget_logFiles">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</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>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<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="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" 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>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/text-html.png</normaloff>:/gfx/text-html.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_exportLogTxt">
|
||||
<property name="text">
|
||||
<string>Export as txt</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/text-plain.png</normaloff>:/gfx/text-plain.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_saveLogAs">
|
||||
<property name="text">
|
||||
<string>Save as ...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/filesave.png</normaloff>:/gfx/filesave.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_deleteLog">
|
||||
<property name="text">
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/editdelete.png</normaloff>:/gfx/editdelete.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<pixmapfunction/>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="resources/pokerth.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
|
||||
@@ -18,15 +18,152 @@
|
||||
|
||||
#include "logfiledialog.h"
|
||||
#include "ui_logfiledialog.h"
|
||||
#include <QtCore>
|
||||
#include "guilog.h"
|
||||
#include "configfile.h"
|
||||
#include "mymessagebox.h"
|
||||
|
||||
LogFileDialog::LogFileDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
LogFileDialog::LogFileDialog(QWidget *parent, ConfigFile *c) :
|
||||
QDialog(parent), myConfig(c),
|
||||
ui(new Ui::LogFileDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect( ui->pushButton_deleteLog, SIGNAL(clicked()), this, SLOT (deleteLogFile()));
|
||||
connect( ui->pushButton_exportLogHtml, SIGNAL(clicked()), this, SLOT (exportLogToHtml()));
|
||||
connect( ui->pushButton_exportLogTxt, SIGNAL(clicked()), this, SLOT (exportLogToTxt()));
|
||||
connect( ui->pushButton_saveLogAs, SIGNAL(clicked()), this, SLOT (saveLogFileAs()));
|
||||
connect( ui->treeWidget_logFiles, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(showLogFilePreview()));
|
||||
}
|
||||
|
||||
LogFileDialog::~LogFileDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void LogFileDialog::exec()
|
||||
{
|
||||
refreshLogFileList();
|
||||
QDialog::exec();
|
||||
}
|
||||
|
||||
void LogFileDialog::refreshLogFileList()
|
||||
{
|
||||
QDir logFileDir;
|
||||
logFileDir.setPath(QString::fromUtf8(myConfig->readConfigString("LogDir").c_str()));
|
||||
QStringList filters;
|
||||
filters << "*.pdb";
|
||||
QFileInfoList dbFilesList = logFileDir.entryInfoList(filters, QDir::Files, QDir::Time);
|
||||
|
||||
QFileInfo currentSqliteLogFile(QString::fromStdString(myGuiLog->getMySqliteLogFileName()));
|
||||
|
||||
ui->treeWidget_logFiles->clear();
|
||||
int i;
|
||||
for (i=0; i < dbFilesList.size(); i++) {
|
||||
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem;
|
||||
item->setText(0, dbFilesList.at(i).fileName());
|
||||
item->setData(0, Qt::UserRole, dbFilesList.at(i).absoluteFilePath());
|
||||
if(currentSqliteLogFile.fileName() == dbFilesList.at(i).fileName()) {
|
||||
item->setData(0, Qt::BackgroundColorRole, QColor(Qt::red));
|
||||
item->setData(0, Qt::TextColorRole, QColor(Qt::white));
|
||||
item->setData(0, Qt::UserRole+1, "current");
|
||||
}
|
||||
ui->treeWidget_logFiles->addTopLevelItem(item);
|
||||
}
|
||||
ui->treeWidget_logFiles->sortItems(0, Qt::DescendingOrder);
|
||||
}
|
||||
|
||||
void LogFileDialog::deleteLogFile()
|
||||
{
|
||||
QList<QTreeWidgetItem*> selectedItemsList = ui->treeWidget_logFiles->selectedItems();
|
||||
|
||||
if(!selectedItemsList.isEmpty() && !( selectedItemsList.size() == 1 && selectedItemsList.front()->data(0, Qt::UserRole+1).toString() == "current" )) {
|
||||
|
||||
int ret = MyMessageBox::warning(this, tr("PokerTH - Delete log files"),
|
||||
tr("Do you really want to delete the selected log files?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if(ret == QMessageBox::Yes) {
|
||||
for (int i = 0; i < selectedItemsList.size(); ++i) {
|
||||
if(selectedItemsList.at(i)->data(0, Qt::UserRole+1).toString() != "current") {
|
||||
|
||||
if(!QFile::remove(selectedItemsList.at(i)->data(0, Qt::UserRole).toString())) {
|
||||
MyMessageBox::warning(this, "Remove log file", "PokerTH cannot remove this log file, please verify that you have write access to this file!", QMessageBox::Close );
|
||||
}
|
||||
}
|
||||
}
|
||||
refreshLogFileList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LogFileDialog::exportLogToHtml()
|
||||
{
|
||||
QTreeWidgetItem* selectedItem = ui->treeWidget_logFiles->currentItem();
|
||||
|
||||
if(selectedItem) {
|
||||
QFileInfo fi(selectedItem->text(0));
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Export PokerTH log file to HTML"),
|
||||
QDir::homePath()+"/"+fi.baseName()+".html",
|
||||
tr("PokerTH HTML log (*.html)"));
|
||||
|
||||
if(!fileName.isEmpty()) {
|
||||
myGuiLog->exportLogPdbToHtml(selectedItem->data(0, Qt::UserRole).toString(),fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LogFileDialog::exportLogToTxt()
|
||||
{
|
||||
QTreeWidgetItem* selectedItem = ui->treeWidget_logFiles->currentItem();
|
||||
|
||||
if(selectedItem) {
|
||||
QFileInfo fi(selectedItem->text(0));
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Export PokerTH log file to plain text"),
|
||||
QDir::homePath()+"/"+fi.baseName()+".txt",
|
||||
tr("PokerTH plain text log (*.txt)"));
|
||||
|
||||
if(!fileName.isEmpty()) {
|
||||
myGuiLog->exportLogPdbToTxt(selectedItem->data(0, Qt::UserRole).toString(),fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LogFileDialog::saveLogFileAs()
|
||||
{
|
||||
QTreeWidgetItem* selectedItem = ui->treeWidget_logFiles->currentItem();
|
||||
|
||||
if(selectedItem) {
|
||||
QFileInfo fi(selectedItem->text(0));
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save PokerTH log file"),
|
||||
QDir::homePath()+"/"+fi.baseName()+".pdb",
|
||||
tr("PokerTH SQL log (*.pdb)"));
|
||||
|
||||
if(!fileName.isEmpty()) {
|
||||
QFile::copy(selectedItem->data(0, Qt::UserRole).toString(), fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LogFileDialog::showLogFilePreview()
|
||||
{
|
||||
QTreeWidgetItem* selectedItem = ui->treeWidget_logFiles->currentItem();
|
||||
|
||||
if(selectedItem) {
|
||||
myGuiLog->showLog(selectedItem->data(0, Qt::UserRole).toString(), ui->textBrowser_logPreview);
|
||||
}
|
||||
|
||||
QTextCursor cursor(ui->textBrowser_logPreview->textCursor());
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
ui->textBrowser_logPreview->setTextCursor(cursor);
|
||||
}
|
||||
|
||||
void LogFileDialog::keyPressEvent ( QKeyEvent * event )
|
||||
{
|
||||
if (event->key() == Qt::Key_Delete ) { /*Delete*/
|
||||
if(ui->treeWidget_logFiles->hasFocus()) {
|
||||
ui->pushButton_deleteLog->click();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,19 +21,38 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class LogFileDialog;
|
||||
}
|
||||
|
||||
|
||||
class guiLog;
|
||||
class ConfigFile;
|
||||
|
||||
class LogFileDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LogFileDialog(QWidget *parent = 0);
|
||||
explicit LogFileDialog(QWidget *parent = 0, ConfigFile *c = 0);
|
||||
~LogFileDialog();
|
||||
|
||||
void setGuiLog(guiLog *g) { myGuiLog = g; }
|
||||
void exec();
|
||||
|
||||
public slots:
|
||||
void refreshLogFileList();
|
||||
void deleteLogFile();
|
||||
void exportLogToHtml();
|
||||
void exportLogToTxt();
|
||||
void saveLogFileAs();
|
||||
void showLogFilePreview();
|
||||
void keyPressEvent ( QKeyEvent * event );
|
||||
|
||||
private:
|
||||
ConfigFile *myConfig;
|
||||
guiLog *myGuiLog;
|
||||
Ui::LogFileDialog *ui;
|
||||
};
|
||||
|
||||
|
||||
+11
-105
@@ -3534,107 +3534,17 @@ p, li { white-space: pre-wrap; }
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<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="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</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_4">
|
||||
<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">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_exportLogHtml">
|
||||
<property name="text">
|
||||
<string>Export as HTML</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/text-html.png</normaloff>:/gfx/text-html.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_exportLogTxt">
|
||||
<property name="text">
|
||||
<string>Export as txt</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/text-plain.png</normaloff>:/gfx/text-plain.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_saveLogAs">
|
||||
<property name="text">
|
||||
<string>Save as ...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/filesave.png</normaloff>:/gfx/filesave.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_deleteLog">
|
||||
<property name="text">
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/editdelete.png</normaloff>:/gfx/editdelete.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<spacer name="verticalSpacer_7">
|
||||
<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>
|
||||
@@ -3887,10 +3797,6 @@ p, li { white-space: pre-wrap; }
|
||||
<tabstop>comboBox_logInterval</tabstop>
|
||||
<tabstop>lineEdit_logDir</tabstop>
|
||||
<tabstop>pushButton_openLogDir</tabstop>
|
||||
<tabstop>pushButton_exportLogHtml</tabstop>
|
||||
<tabstop>pushButton_exportLogTxt</tabstop>
|
||||
<tabstop>pushButton_saveLogAs</tabstop>
|
||||
<tabstop>pushButton_deleteLog</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "carddeckstylereader.h"
|
||||
|
||||
#include "configfile.h"
|
||||
#include "guilog.h"
|
||||
#include <net/socket_startup.h>
|
||||
#include <QSet>
|
||||
|
||||
@@ -46,14 +45,6 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, ConfigFile *c, selectAva
|
||||
listWidget->takeItem(1);
|
||||
#endif
|
||||
|
||||
if(!SQLITE_LOG) {//temporarely remove sql log features
|
||||
pushButton_deleteLog->hide();
|
||||
pushButton_saveLogAs->hide();
|
||||
pushButton_exportLogTxt->hide();
|
||||
pushButton_exportLogHtml->hide();
|
||||
treeWidget_logFiles->hide();
|
||||
}
|
||||
|
||||
myManualBlindsOrderDialog = new manualBlindsOrderDialogImpl;
|
||||
|
||||
myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str());
|
||||
@@ -141,12 +132,6 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, ConfigFile *c, selectAva
|
||||
connect( pushButton_removeCardDeckStyle, SIGNAL( clicked() ), this, SLOT( removeCardDeckStyle()) );
|
||||
connect( pushButton_internetGameRemoveIgnoredPlayer, SIGNAL( clicked()), this, SLOT( removePlayerFromIgnoredPlayersList()));
|
||||
|
||||
connect( pushButton_deleteLog, SIGNAL(clicked()), this, SLOT (deleteLogFile()));
|
||||
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(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(showLogFilePreview()));
|
||||
|
||||
#ifdef GUI_800x480
|
||||
//make the scrollbar touchable for mobile guis
|
||||
comboBox_switchLanguage->setStyleSheet("QObject {font: 30px} QScrollBar:vertical { border: 1px solid grey; background: white; width: 60px; margin: 0px -1px 0px 0px; } QScrollBar::handle:vertical { border-radius: 3px; border: 2px solid grey; background: LightGrey ; min-height: 60px; } QScrollBar::add-line:vertical { background: none; } QScrollBar::sub-line:vertical { background: none; } QScrollBar:up-arrow:vertical, QScrollBar::down-arrow:vertical { background: none; } QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { background: none; }");
|
||||
@@ -517,8 +502,6 @@ void settingsDialogImpl::prepareDialog()
|
||||
spinBox_logStoreDuration->setValue(myConfig->readConfigInt("LogStoreDuration"));
|
||||
comboBox_logInterval->setCurrentIndex(myConfig->readConfigInt("LogInterval"));
|
||||
|
||||
refreshLogFileList();
|
||||
|
||||
bool tmpHasIpv6 = socket_has_ipv6();
|
||||
bool tmpHasSctp = socket_has_sctp();
|
||||
checkBox_useIpv6->setEnabled(tmpHasIpv6);
|
||||
@@ -955,7 +938,6 @@ void settingsDialogImpl::setLogDir()
|
||||
QDir logDir(dir);
|
||||
if(logDir.exists()) {
|
||||
lineEdit_logDir->setText(dir);
|
||||
refreshLogFileList();
|
||||
MyMessageBox::information(this, tr("Settings Information"),
|
||||
tr("You have changed the log file directory.\n"
|
||||
"Please restart PokerTH to use the new directory for the log files!"),
|
||||
@@ -1371,118 +1353,6 @@ void settingsDialogImpl::removePlayerFromIgnoredPlayersList()
|
||||
}
|
||||
}
|
||||
|
||||
void settingsDialogImpl::refreshLogFileList()
|
||||
{
|
||||
QDir logFileDir;
|
||||
logFileDir.setPath(lineEdit_logDir->text());
|
||||
QStringList filters;
|
||||
filters << "*.pdb";
|
||||
QFileInfoList dbFilesList = logFileDir.entryInfoList(filters, QDir::Files, QDir::Time);
|
||||
|
||||
QFileInfo currentSqliteLogFile(QString::fromStdString(myGuiLog->getMySqliteLogFileName()));
|
||||
|
||||
treeWidget_logFiles->clear();
|
||||
int i;
|
||||
for (i=0; i < dbFilesList.size(); i++) {
|
||||
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem;
|
||||
item->setText(0, dbFilesList.at(i).fileName());
|
||||
item->setData(0, Qt::UserRole, dbFilesList.at(i).absoluteFilePath());
|
||||
if(currentSqliteLogFile.fileName() == dbFilesList.at(i).fileName()) {
|
||||
item->setData(0, Qt::BackgroundColorRole, QColor(Qt::red));
|
||||
item->setData(0, Qt::TextColorRole, QColor(Qt::white));
|
||||
item->setData(0, Qt::UserRole+1, "current");
|
||||
}
|
||||
treeWidget_logFiles->addTopLevelItem(item);
|
||||
}
|
||||
treeWidget_logFiles->sortItems(0, Qt::DescendingOrder);
|
||||
}
|
||||
|
||||
void settingsDialogImpl::deleteLogFile()
|
||||
{
|
||||
QList<QTreeWidgetItem*> selectedItemsList = treeWidget_logFiles->selectedItems();
|
||||
|
||||
if(!selectedItemsList.isEmpty() && !( selectedItemsList.size() == 1 && selectedItemsList.front()->data(0, Qt::UserRole+1).toString() == "current" )) {
|
||||
|
||||
int ret = MyMessageBox::warning(this, tr("PokerTH - Delete log files"),
|
||||
tr("Do you really want to delete the selected log files?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if(ret == QMessageBox::Yes) {
|
||||
for (int i = 0; i < selectedItemsList.size(); ++i) {
|
||||
if(selectedItemsList.at(i)->data(0, Qt::UserRole+1).toString() != "current") {
|
||||
|
||||
if(!QFile::remove(selectedItemsList.at(i)->data(0, Qt::UserRole).toString())) {
|
||||
MyMessageBox::warning(this, "Remove log file", "PokerTH cannot remove this log file, please verify that you have write access to this file!", QMessageBox::Close );
|
||||
}
|
||||
}
|
||||
}
|
||||
refreshLogFileList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void settingsDialogImpl::exportLogToHtml()
|
||||
{
|
||||
QTreeWidgetItem* selectedItem = treeWidget_logFiles->currentItem();
|
||||
|
||||
if(selectedItem) {
|
||||
QFileInfo fi(selectedItem->text(0));
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Export PokerTH log file to HTML"),
|
||||
QDir::homePath()+"/"+fi.baseName()+".html",
|
||||
tr("PokerTH HTML log (*.html)"));
|
||||
|
||||
if(!fileName.isEmpty()) {
|
||||
myGuiLog->exportLogPdbToHtml(selectedItem->data(0, Qt::UserRole).toString(),fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void settingsDialogImpl::exportLogToTxt()
|
||||
{
|
||||
QTreeWidgetItem* selectedItem = treeWidget_logFiles->currentItem();
|
||||
|
||||
if(selectedItem) {
|
||||
QFileInfo fi(selectedItem->text(0));
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Export PokerTH log file to plain text"),
|
||||
QDir::homePath()+"/"+fi.baseName()+".txt",
|
||||
tr("PokerTH plain text log (*.txt)"));
|
||||
|
||||
if(!fileName.isEmpty()) {
|
||||
myGuiLog->exportLogPdbToTxt(selectedItem->data(0, Qt::UserRole).toString(),fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void settingsDialogImpl::saveLogFileAs()
|
||||
{
|
||||
QTreeWidgetItem* selectedItem = treeWidget_logFiles->currentItem();
|
||||
|
||||
if(selectedItem) {
|
||||
QFileInfo fi(selectedItem->text(0));
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save PokerTH log file"),
|
||||
QDir::homePath()+"/"+fi.baseName()+".pdb",
|
||||
tr("PokerTH SQL log (*.pdb)"));
|
||||
|
||||
if(!fileName.isEmpty()) {
|
||||
QFile::copy(selectedItem->data(0, Qt::UserRole).toString(), fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void settingsDialogImpl::showLogFilePreview()
|
||||
{
|
||||
QTreeWidgetItem* selectedItem = treeWidget_logFiles->currentItem();
|
||||
|
||||
if(selectedItem) {
|
||||
myGuiLog->showLog(selectedItem->data(0, Qt::UserRole).toString(), textBrowser_logPreview);
|
||||
}
|
||||
|
||||
QTextCursor cursor(textBrowser_logPreview->textCursor());
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
textBrowser_logPreview->setTextCursor(cursor);
|
||||
}
|
||||
|
||||
void settingsDialogImpl::resetSettings()
|
||||
{
|
||||
int ret = MyMessageBox::warning(this, tr("PokerTH - Settings"),
|
||||
@@ -1496,11 +1366,3 @@ void settingsDialogImpl::resetSettings()
|
||||
|
||||
}
|
||||
|
||||
void settingsDialogImpl::keyPressEvent ( QKeyEvent * event )
|
||||
{
|
||||
if (event->key() == Qt::Key_Delete ) { /*Delete*/
|
||||
if(treeWidget_logFiles->hasFocus()) {
|
||||
pushButton_deleteLog->click();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,14 +112,7 @@ public slots:
|
||||
void addCardDeckStyle();
|
||||
void removeCardDeckStyle();
|
||||
void removePlayerFromIgnoredPlayersList();
|
||||
void refreshLogFileList();
|
||||
void deleteLogFile();
|
||||
void exportLogToHtml();
|
||||
void exportLogToTxt();
|
||||
void saveLogFileAs();
|
||||
void showLogFilePreview();
|
||||
void resetSettings();
|
||||
void keyPressEvent ( QKeyEvent * event );
|
||||
|
||||
private:
|
||||
|
||||
@@ -140,7 +133,6 @@ private:
|
||||
std::list<std::string> myCardDeckStylesList;
|
||||
|
||||
ConfigFile* myConfig;
|
||||
guiLog* myGuiLog;
|
||||
selectAvatarDialogImpl *mySelectAvatarDialogImpl;
|
||||
manualBlindsOrderDialogImpl *myManualBlindsOrderDialog;
|
||||
|
||||
@@ -149,6 +141,7 @@ private:
|
||||
bool languageIsChanged;
|
||||
bool calledIngame;
|
||||
int changedLanguageIndex;
|
||||
guiLog *myGuiLog;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -198,7 +198,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>450</width>
|
||||
<height>26</height>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuPokerTH">
|
||||
@@ -215,6 +215,7 @@
|
||||
<addaction name="actionStart_Local_Game"/>
|
||||
<addaction name="actionInternet_Game"/>
|
||||
<addaction name="menuNetwork_Game"/>
|
||||
<addaction name="actionLogs"/>
|
||||
<addaction name="actionAbout_PokerTH"/>
|
||||
<addaction name="actionQuit"/>
|
||||
</widget>
|
||||
@@ -296,6 +297,15 @@
|
||||
<string>Join Network Game ...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLogs">
|
||||
<property name="icon">
|
||||
<iconset resource="resources/pokerth.qrc">
|
||||
<normaloff>:/gfx/registered.png</normaloff>:/gfx/registered.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Logs ...</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resources/pokerth.qrc"/>
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "chattools.h"
|
||||
#include "serverlistdialogimpl.h"
|
||||
#include "internetgamelogindialogimpl.h"
|
||||
#include "logfiledialog.h"
|
||||
#include "guilog.h"
|
||||
|
||||
using namespace std;
|
||||
@@ -119,10 +120,12 @@ startWindowImpl::startWindowImpl(ConfigFile *c, Log *l)
|
||||
myCreateNetworkGameDialog = new createNetworkGameDialogImpl(this, myConfig);
|
||||
myAboutPokerthDialog = new aboutPokerthImpl(this, myConfig);
|
||||
myGameLobbyDialog = new gameLobbyDialogImpl(this, myConfig);
|
||||
myLogFileDialog = new LogFileDialog(this, myConfig);
|
||||
|
||||
myStartNetworkGameDialog->setMyW(myGuiInterface->getMyW());
|
||||
myGameLobbyDialog->setMyW(myGuiInterface->getMyW());
|
||||
mySettingsDialog->setGuiLog(myGuiLog);
|
||||
myLogFileDialog->setGuiLog(myGuiLog);
|
||||
|
||||
myTimeoutDialog = new timeoutMsgBoxImpl(this);
|
||||
myServerListDialog = new serverListDialogImpl(this, this, myConfig);
|
||||
@@ -135,7 +138,8 @@ startWindowImpl::startWindowImpl(ConfigFile *c, Log *l)
|
||||
connect( actionCreate_Network_Game, SIGNAL( triggered() ), this, SLOT( callCreateNetworkGameDialog() ) );
|
||||
connect( pushButton_Create_Network_Game, SIGNAL( clicked() ), this, SLOT( callCreateNetworkGameDialog() ) );
|
||||
connect( actionJoin_Network_Game, SIGNAL( triggered() ), this, SLOT( callJoinNetworkGameDialog() ) );
|
||||
connect( pushButton_Join_Network_Game, SIGNAL( clicked() ), this, SLOT( callJoinNetworkGameDialog() ) );
|
||||
connect( pushButton_Join_Network_Game, SIGNAL( clicked() ), this, SLOT( callJoinNetworkGameDialog() ) );
|
||||
connect( actionLogs, SIGNAL( triggered() ), this, SLOT( callLogFileDialog() ) );
|
||||
|
||||
connect(this, SIGNAL(signalShowClientDialog()), this, SLOT(showClientDialog()));
|
||||
|
||||
@@ -625,6 +629,11 @@ void startWindowImpl::callSettingsDialog(bool ingame)
|
||||
}
|
||||
}
|
||||
|
||||
void startWindowImpl::callLogFileDialog()
|
||||
{
|
||||
myLogFileDialog->exec();
|
||||
}
|
||||
|
||||
void startWindowImpl::showTimeoutDialog(int msgID, unsigned duration)
|
||||
{
|
||||
if(myTimeoutDialog->isHidden()) {
|
||||
|
||||
@@ -53,6 +53,7 @@ class serverListDialogImpl;
|
||||
class internetGameLoginDialogImpl;
|
||||
class guiLog;
|
||||
class Log;
|
||||
class LogFileDialog;
|
||||
|
||||
class startWindowImpl: public QMainWindow, public Ui::startWindow
|
||||
{
|
||||
@@ -139,6 +140,7 @@ public slots:
|
||||
void joinGameLobby();
|
||||
void showClientDialog();
|
||||
void showNetworkStartDialog();
|
||||
void callLogFileDialog();
|
||||
|
||||
void startNewLocalGame(newGameDialogImpl* =0);
|
||||
|
||||
@@ -178,8 +180,9 @@ private:
|
||||
startWindowImpl *myStartWindow;
|
||||
serverListDialogImpl *myServerListDialog;
|
||||
internetGameLoginDialogImpl *myInternetGameLoginDialog;
|
||||
LogFileDialog *myLogFileDialog;
|
||||
|
||||
MyMessageBox msgBoxOutdatedVersion;
|
||||
MyMessageBox msgBoxOutdatedVersion;
|
||||
bool msgBoxOutdatedVersionActive;
|
||||
|
||||
friend class GuiWrapper;
|
||||
|
||||
Reference in New Issue
Block a user