Add timecode option for report view

This commit is contained in:
mikeprice99
2020-07-09 07:16:53 +01:00
committed by wmayer
parent e89508355f
commit 415f23227b
3 changed files with 35 additions and 2 deletions

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>432</width>
<height>411</height>
<height>500</height>
</rect>
</property>
<property name="windowTitle">
@@ -166,6 +166,25 @@ on-screen while displaying the log message</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="Gui::PrefCheckBox" name="checkShowReportTimecode">
<property name="toolTip">
<string>Include a timecode for each report</string>
</property>
<property name="text">
<string>Include a timecode for each entry</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>checkShowReportTimecode</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>OutputWindow</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -553,6 +572,7 @@ from Python console to Report view panel</string>
<tabstop>checkShowReportViewOnError</tabstop>
<tabstop>checkShowReportViewOnNormalMessage</tabstop>
<tabstop>checkShowReportViewOnLogMessage</tabstop>
<tabstop>checkShowReportTimecode</tabstop>
<tabstop>colorText</tabstop>
<tabstop>colorLogging</tabstop>
<tabstop>colorWarning</tabstop>

View File

@@ -65,6 +65,7 @@ void DlgReportViewImp::saveSettings()
ui->checkShowReportViewOnError->onSave();
ui->checkShowReportViewOnNormalMessage->onSave();
ui->checkShowReportViewOnLogMessage->onSave();
ui->checkShowReportTimecode->onSave();
ui->colorText->onSave();
ui->colorLogging->onSave();
ui->colorWarning->onSave();
@@ -82,6 +83,7 @@ void DlgReportViewImp::loadSettings()
ui->checkShowReportViewOnError->onRestore();
ui->checkShowReportViewOnNormalMessage->onRestore();
ui->checkShowReportViewOnLogMessage->onRestore();
ui->checkShowReportTimecode->onRestore();
ui->colorText->onRestore();
ui->colorLogging->onRestore();
ui->colorWarning->onRestore();

View File

@@ -29,6 +29,7 @@
# include <QContextMenuEvent>
# include <QTextCursor>
# include <QTextStream>
# include <QTime>
# include <QDockWidget>
# include <QPointer>
#endif
@@ -415,7 +416,17 @@ void ReportOutput::SendLog(const std::string& msg, Base::LogStyle level)
break;
}
QString qMsg = QString::fromUtf8(msg.c_str());
QString qMsg;
bool showTimecode = getWindowParameter()->GetBool("checkShowReportTimecode", true);
if (showTimecode) {
QTime time = QTime::currentTime();
qMsg = time.toString(QLatin1String("hh:mm:ss "));
qMsg += QString::fromUtf8(msg.c_str());
}
else {
qMsg = QString::fromUtf8(msg.c_str());
}
// This truncates log messages that are too long
if (style == ReportHighlighter::LogText) {