[Report View] add options to show report view on warning, error, normal, and log message types individually
This commit is contained in:
@@ -87,19 +87,79 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="Gui::PrefCheckBox" name="checkShowReportViewOnWarningOrError">
|
||||
<widget class="Gui::PrefCheckBox" name="checkShowReportViewOnError">
|
||||
<property name="toolTip">
|
||||
<string>When an error has occurred, the Report View dialog becomes visible
|
||||
on-screen while displaying the error</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show report view on warning or error</string>
|
||||
<string>Show report view on error</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>checkShowReportViewOnWarningOrError</cstring>
|
||||
<cstring>checkShowReportViewOnError</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>OutputWindow</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="Gui::PrefCheckBox" name="checkShowReportViewOnWarning">
|
||||
<property name="toolTip">
|
||||
<string>When a warning has occurred, the Report View dialog becomes visible
|
||||
on-screen while displaying the warning</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show report view on warning</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>checkShowReportViewOnWarning</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>OutputWindow</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="Gui::PrefCheckBox" name="checkShowReportViewOnNormalMessage">
|
||||
<property name="toolTip">
|
||||
<string>When a normal message has occurred, the Report View dialog becomes visible
|
||||
on-screen while displaying the message</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show report view on normal message</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>checkShowReportViewOnNormalMessage</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>OutputWindow</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="Gui::PrefCheckBox" name="checkShowReportViewOnLogMessage">
|
||||
<property name="toolTip">
|
||||
<string>When a log message has occurred, the Report View dialog becomes visible
|
||||
on-screen while displaying the log message</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show report view on log message</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>checkShowReportViewOnLogMessage</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>OutputWindow</cstring>
|
||||
@@ -489,7 +549,10 @@ from Python console to Report view panel</string>
|
||||
<tabstop>checkLogging</tabstop>
|
||||
<tabstop>checkWarning</tabstop>
|
||||
<tabstop>checkError</tabstop>
|
||||
<tabstop>checkShowReportViewOnWarningOrError</tabstop>
|
||||
<tabstop>checkShowReportViewOnWarning</tabstop>
|
||||
<tabstop>checkShowReportViewOnError</tabstop>
|
||||
<tabstop>checkShowReportViewOnNormalMessage</tabstop>
|
||||
<tabstop>checkShowReportViewOnLogMessage</tabstop>
|
||||
<tabstop>colorText</tabstop>
|
||||
<tabstop>colorLogging</tabstop>
|
||||
<tabstop>colorWarning</tabstop>
|
||||
|
||||
@@ -61,7 +61,10 @@ void DlgReportViewImp::saveSettings()
|
||||
ui->checkLogging->onSave();
|
||||
ui->checkWarning->onSave();
|
||||
ui->checkError->onSave();
|
||||
ui->checkShowReportViewOnWarningOrError->onSave();
|
||||
ui->checkShowReportViewOnWarning->onSave();
|
||||
ui->checkShowReportViewOnError->onSave();
|
||||
ui->checkShowReportViewOnNormalMessage->onSave();
|
||||
ui->checkShowReportViewOnLogMessage->onSave();
|
||||
ui->colorText->onSave();
|
||||
ui->colorLogging->onSave();
|
||||
ui->colorWarning->onSave();
|
||||
@@ -75,7 +78,10 @@ void DlgReportViewImp::loadSettings()
|
||||
ui->checkLogging->onRestore();
|
||||
ui->checkWarning->onRestore();
|
||||
ui->checkError->onRestore();
|
||||
ui->checkShowReportViewOnWarningOrError->onRestore();
|
||||
ui->checkShowReportViewOnWarning->onRestore();
|
||||
ui->checkShowReportViewOnError->onRestore();
|
||||
ui->checkShowReportViewOnNormalMessage->onRestore();
|
||||
ui->checkShowReportViewOnLogMessage->onRestore();
|
||||
ui->colorText->onRestore();
|
||||
ui->colorLogging->onRestore();
|
||||
ui->colorWarning->onRestore();
|
||||
|
||||
@@ -242,30 +242,45 @@ ReportOutputObserver::ReportOutputObserver(ReportOutput *report)
|
||||
this->reportView = report;
|
||||
}
|
||||
|
||||
void ReportOutputObserver::showReportView(){
|
||||
// get the QDockWidget parent of the report view
|
||||
QDockWidget* dw = nullptr;
|
||||
QWidget* par = reportView->parentWidget();
|
||||
while (par) {
|
||||
dw = qobject_cast<QDockWidget*>(par);
|
||||
if (dw)
|
||||
break;
|
||||
par = par->parentWidget();
|
||||
}
|
||||
|
||||
if (dw && !dw->toggleViewAction()->isChecked()) {
|
||||
dw->toggleViewAction()->activate(QAction::Trigger);
|
||||
}
|
||||
}
|
||||
|
||||
bool ReportOutputObserver::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::User && obj == reportView.data()) {
|
||||
CustomReportEvent* cr = dynamic_cast<CustomReportEvent*>(event);
|
||||
if (cr) {
|
||||
ParameterGrp::handle group = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("OutputWindow");
|
||||
ReportHighlighter::Paragraph msgType = cr->messageType();
|
||||
if (msgType == ReportHighlighter::Error || msgType == ReportHighlighter::Warning){
|
||||
ParameterGrp::handle group = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("OutputWindow");
|
||||
|
||||
if (group->GetBool("checkShowReportViewOnWarningOrError", true)) {
|
||||
// get the QDockWidget parent of the report view
|
||||
QDockWidget* dw = nullptr;
|
||||
QWidget* par = reportView->parentWidget();
|
||||
while (par) {
|
||||
dw = qobject_cast<QDockWidget*>(par);
|
||||
if (dw)
|
||||
break;
|
||||
par = par->parentWidget();
|
||||
}
|
||||
|
||||
if (dw && !dw->toggleViewAction()->isChecked()) {
|
||||
dw->toggleViewAction()->activate(QAction::Trigger);
|
||||
}
|
||||
if (msgType == ReportHighlighter::Warning){
|
||||
if (group->GetBool("checkShowReportViewOnWarning", true)) {
|
||||
showReportView();
|
||||
}
|
||||
} else if (msgType == ReportHighlighter::Error){
|
||||
if (group->GetBool("checkShowReportViewOnError", true)) {
|
||||
showReportView();
|
||||
}
|
||||
} else if (msgType == ReportHighlighter::Message){
|
||||
if (group->GetBool("checkShowReportViewOnNormalMessage", false)) {
|
||||
showReportView();
|
||||
}
|
||||
} else if (msgType == ReportHighlighter::LogText){
|
||||
if (group->GetBool("checkShowReportViewOnLogMessage", false)) {
|
||||
showReportView();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -530,10 +545,26 @@ void ReportOutput::onToggleError()
|
||||
getWindowParameter()->SetBool( "checkError", bErr );
|
||||
}
|
||||
|
||||
void ReportOutput::onToggleShowReportViewOnWarningOrError(){
|
||||
bool show = getWindowParameter()->GetBool("checkShowReportViewOnWarningOrError", true);
|
||||
getWindowParameter()->SetBool("checkShowReportViewOnWarningOrError", !show);
|
||||
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;
|
||||
|
||||
@@ -167,8 +167,14 @@ public Q_SLOTS:
|
||||
void onToggleWarning();
|
||||
/** Toggles the report of log messages. */
|
||||
void onToggleLogging();
|
||||
/** Toggles whether to show report view on warnings or errors */
|
||||
void onToggleShowReportViewOnWarningOrError();
|
||||
/** Toggles whether to show report view on warnings*/
|
||||
void onToggleShowReportViewOnWarning();
|
||||
/** Toggles whether to show report view on errors*/
|
||||
void onToggleShowReportViewOnError();
|
||||
/** Toggles whether to show report view on normal messages*/
|
||||
void onToggleShowReportViewOnNormalMessage();
|
||||
/** Toggles whether to show report view on log messages*/
|
||||
void onToggleShowReportViewOnLogMessage();
|
||||
/** Toggles the redirection of Python stdout. */
|
||||
void onToggleRedirectPythonStdout();
|
||||
/** Toggles the redirection of Python stderr. */
|
||||
@@ -200,6 +206,7 @@ public:
|
||||
|
||||
protected:
|
||||
QPointer <ReportOutput> reportView;
|
||||
void showReportView(void);
|
||||
};
|
||||
|
||||
} // namespace DockWnd
|
||||
|
||||
Reference in New Issue
Block a user