Add log file's viewer in AboutQETDialog for user

This commit is contained in:
Simon De Backer
2020-08-31 21:21:17 +02:00
parent 4a8e07b227
commit 51c4b16836
3 changed files with 50 additions and 6 deletions

View File

@@ -18,6 +18,7 @@
#include "aboutqetdialog.h" #include "aboutqetdialog.h"
#include "ui_aboutqetdialog.h" #include "ui_aboutqetdialog.h"
#include "qet.h" #include "qet.h"
#include "qetapp.h"
#include "machine_info.h" #include "machine_info.h"
#include <QDate> #include <QDate>
@@ -37,6 +38,7 @@ AboutQETDialog::AboutQETDialog(QWidget *parent) :
setVersion(); setVersion();
setLibraries(); setLibraries();
setLicence(); setLicence();
setLoginfo();
} }
/** /**
@@ -170,6 +172,24 @@ void AboutQETDialog::setLicence()
ui->m_license_text_edit->setPlainText(QET::license()); ui->m_license_text_edit->setPlainText(QET::license());
} }
/**
@brief AboutQETDialog::setLoginfo
fills the m_log_comboBox with log files
*/
void AboutQETDialog::setLoginfo()
{
const QString path = QETApp::configDir() + "/";
QString filter("%1%1%1%1%1%1%1%1.log"); // pattern
filter = filter.arg("[0123456789]"); // valid characters
Q_FOREACH (auto fileInfo,
QDir(path).entryInfoList(
QStringList(filter),
QDir::Files))
{
ui->m_log_comboBox->addItem(fileInfo.absoluteFilePath());
}
}
/** /**
@brief AboutQETDialog::addAuthor @brief AboutQETDialog::addAuthor
Adds a person to the list of authors Adds a person to the list of authors
@@ -205,3 +225,12 @@ void AboutQETDialog::addLibrary(QLabel *label, const QString &name, const QStrin
new_text += Library_template.arg(name).arg(link); new_text += Library_template.arg(name).arg(link);
label->setText(new_text); label->setText(new_text);
} }
void AboutQETDialog::on_m_log_comboBox_currentTextChanged(const QString &arg1)
{
QFile log_File(arg1);
if(log_File.open(QIODevice::ReadOnly)){
ui->m_log_textEdit->setPlainText(log_File.readAll());
}
log_File.close();
}

View File

@@ -38,6 +38,7 @@ class AboutQETDialog : public QDialog
~AboutQETDialog(); ~AboutQETDialog();
private: private:
Ui::AboutQETDialog *ui;
void setAbout(); void setAbout();
void setAuthors(); void setAuthors();
void setTranslators(); void setTranslators();
@@ -45,6 +46,7 @@ class AboutQETDialog : public QDialog
void setVersion(); void setVersion();
void setLibraries(); void setLibraries();
void setLicence(); void setLicence();
void setLoginfo();
void addAuthor(QLabel *label, void addAuthor(QLabel *label,
const QString &name, const QString &name,
const QString &email, const QString &email,
@@ -53,8 +55,8 @@ class AboutQETDialog : public QDialog
const QString &name, const QString &name,
const QString &link); const QString &link);
private: private slots:
Ui::AboutQETDialog *ui; void on_m_log_comboBox_currentTextChanged(const QString &arg1);
}; };
#endif // ABOUTQETDIALOG_H #endif // ABOUTQETDIALOG_H

View File

@@ -79,7 +79,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>676</width> <width>676</width>
<height>409</height> <height>423</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
@@ -159,7 +159,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>676</width> <width>676</width>
<height>409</height> <height>423</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
@@ -242,7 +242,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>676</width> <width>676</width>
<height>409</height> <height>423</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
@@ -374,7 +374,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>676</width> <width>676</width>
<height>409</height> <height>423</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_5"> <layout class="QHBoxLayout" name="horizontalLayout_5">
@@ -444,6 +444,19 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tab_8">
<attribute name="title">
<string>log</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QComboBox" name="m_log_comboBox"/>
</item>
<item>
<widget class="QTextEdit" name="m_log_textEdit"/>
</item>
</layout>
</widget>
</widget> </widget>
</item> </item>
<item> <item>