Gui: add an option to also suppress normal messages

This commit is contained in:
wmayer
2020-07-31 19:39:11 +02:00
parent a41ad338e9
commit ed4876abb4
4 changed files with 77 additions and 33 deletions

View File

@@ -33,6 +33,25 @@
<number>11</number>
</property>
<item row="0" column="0">
<widget class="Gui::PrefCheckBox" name="checkMessage">
<property name="toolTip">
<string>Normal messages will be recorded</string>
</property>
<property name="text">
<string>Record normal messages</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>checkMessage</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>OutputWindow</cstring>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="Gui::PrefCheckBox" name="checkLogging">
<property name="toolTip">
<string>Log messages will be recorded</string>
@@ -48,7 +67,7 @@
</property>
</widget>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="Gui::PrefCheckBox" name="checkWarning">
<property name="toolTip">
<string>Warnings will be recorded</string>
@@ -67,7 +86,7 @@
</property>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="Gui::PrefCheckBox" name="checkError">
<property name="toolTip">
<string>Error messages will be recorded</string>
@@ -86,7 +105,7 @@
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="Gui::PrefCheckBox" name="checkShowReportViewOnError">
<property name="toolTip">
<string>When an error has occurred, the Report View dialog becomes visible
@@ -106,7 +125,7 @@ on-screen while displaying the error</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="Gui::PrefCheckBox" name="checkShowReportViewOnWarning">
<property name="toolTip">
<string>When a warning has occurred, the Report View dialog becomes visible
@@ -126,7 +145,7 @@ on-screen while displaying the warning</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="Gui::PrefCheckBox" name="checkShowReportViewOnNormalMessage">
<property name="toolTip">
<string>When a normal message has occurred, the Report View dialog becomes visible
@@ -146,7 +165,7 @@ on-screen while displaying the message</string>
</property>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="Gui::PrefCheckBox" name="checkShowReportViewOnLogMessage">
<property name="toolTip">
<string>When a log message has occurred, the Report View dialog becomes visible
@@ -166,7 +185,7 @@ on-screen while displaying the log message</string>
</property>
</widget>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="Gui::PrefCheckBox" name="checkShowReportTimecode">
<property name="toolTip">
<string>Include a timecode for each report</string>

View File

@@ -58,6 +58,7 @@ DlgReportViewImp::~DlgReportViewImp()
void DlgReportViewImp::saveSettings()
{
ui->checkMessage->onSave();
ui->checkLogging->onSave();
ui->checkWarning->onSave();
ui->checkError->onSave();
@@ -76,6 +77,7 @@ void DlgReportViewImp::saveSettings()
void DlgReportViewImp::loadSettings()
{
ui->checkMessage->onRestore();
ui->checkLogging->onRestore();
ui->checkWarning->onRestore();
ui->checkError->onRestore();

View File

@@ -498,7 +498,11 @@ void ReportOutput::contextMenuEvent ( QContextMenuEvent * e )
displayMenu->setTitle(tr("Display message types"));
optionMenu->addMenu(displayMenu);
QAction* logAct = displayMenu->addAction(tr("Log messages"), this, SLOT(onToggleLogging()));
QAction* logMsg = displayMenu->addAction(tr("Normal messages"), this, SLOT(onToggleNormalMessage()));
logMsg->setCheckable(true);
logMsg->setChecked(bMsg);
QAction* logAct = displayMenu->addAction(tr("Log messages"), this, SLOT(onToggleLogMessage()));
logAct->setCheckable(true);
logAct->setChecked(bLog);
@@ -512,7 +516,7 @@ void ReportOutput::contextMenuEvent ( QContextMenuEvent * e )
QMenu* showOnMenu = new QMenu (optionMenu);
showOnMenu->setTitle(tr("Show report view on"));
optionMenu->insertMenu(optionMenu->actions().front(), showOnMenu);
optionMenu->addMenu(showOnMenu);
QAction* showNormAct = showOnMenu->addAction(tr("Normal messages"), this, SLOT(onToggleShowReportViewOnNormalMessage()));
showNormAct->setCheckable(true);
@@ -580,49 +584,64 @@ bool ReportOutput::isWarning() const
return bWrn;
}
bool ReportOutput::isLogging() const
bool ReportOutput::isLogMessage() const
{
return bLog;
}
bool ReportOutput::isNormalMessage() const
{
return bMsg;
}
void ReportOutput::onToggleError()
{
bErr = bErr ? false : true;
getWindowParameter()->SetBool( "checkError", bErr );
}
void ReportOutput::onToggleShowReportViewOnWarning(){
bool show = getWindowParameter()->GetBool("checkShowReportViewOnWarning", true);
getWindowParameter()->SetBool("checkShowReportViewOnWarning", !show);
}
void ReportOutput::onToggleShowReportViewOnError(){
bool show = getWindowParameter()->GetBool("checkShowReportViewOnError", true);
getWindowParameter()->SetBool("checkShowReportViewOnError", !show);
}
void ReportOutput::onToggleShowReportViewOnNormalMessage(){
bool show = getWindowParameter()->GetBool("checkShowReportViewOnNormalMessage", true);
getWindowParameter()->SetBool("checkShowReportViewOnNormalMessage", !show);
}
void ReportOutput::onToggleShowReportViewOnLogMessage(){
bool show = getWindowParameter()->GetBool("checkShowReportViewOnLogMessage", true);
getWindowParameter()->SetBool("checkShowReportViewOnLogMessage", !show);
}
void ReportOutput::onToggleWarning()
{
bWrn = bWrn ? false : true;
getWindowParameter()->SetBool( "checkWarning", bWrn );
}
void ReportOutput::onToggleLogging()
void ReportOutput::onToggleLogMessage()
{
bLog = bLog ? false : true;
getWindowParameter()->SetBool( "checkLogging", bLog );
}
void ReportOutput::onToggleNormalMessage()
{
bMsg = bMsg ? false : true;
getWindowParameter()->SetBool( "checkMessage", bMsg );
}
void ReportOutput::onToggleShowReportViewOnWarning()
{
bool show = getWindowParameter()->GetBool("checkShowReportViewOnWarning", true);
getWindowParameter()->SetBool("checkShowReportViewOnWarning", !show);
}
void ReportOutput::onToggleShowReportViewOnError()
{
bool show = getWindowParameter()->GetBool("checkShowReportViewOnError", true);
getWindowParameter()->SetBool("checkShowReportViewOnError", !show);
}
void ReportOutput::onToggleShowReportViewOnNormalMessage()
{
bool show = getWindowParameter()->GetBool("checkShowReportViewOnNormalMessage", true);
getWindowParameter()->SetBool("checkShowReportViewOnNormalMessage", !show);
}
void ReportOutput::onToggleShowReportViewOnLogMessage()
{
bool show = getWindowParameter()->GetBool("checkShowReportViewOnLogMessage", true);
getWindowParameter()->SetBool("checkShowReportViewOnLogMessage", !show);
}
void ReportOutput::onToggleRedirectPythonStdout()
{
if (d->redirected_stdout) {

View File

@@ -148,7 +148,9 @@ public:
/** Returns true whether warnings are reported. */
bool isWarning() const;
/** Returns true whether log messages are reported. */
bool isLogging() const;
bool isLogMessage() const;
/** Returns true whether normal messages are reported. */
bool isNormalMessage() const;
protected:
/** For internal use only */
@@ -166,7 +168,9 @@ public Q_SLOTS:
/** Toggles the report of warnings. */
void onToggleWarning();
/** Toggles the report of log messages. */
void onToggleLogging();
void onToggleLogMessage();
/** Toggles the report of normal messages. */
void onToggleNormalMessage();
/** Toggles whether to show report view on warnings*/
void onToggleShowReportViewOnWarning();
/** Toggles whether to show report view on errors*/