Gui: implement temporary blocker for console observer

This commit is contained in:
0penBrain
2022-06-20 16:09:08 +02:00
committed by wwmayer
parent 06d65c73a3
commit 95a98669a4
3 changed files with 51 additions and 12 deletions

View File

@@ -55,6 +55,7 @@
#include <App/Document.h>
#include <App/DocumentObject.h>
#include <App/DocumentObjectGroup.h>
#include <Base/ConsoleObserver.h>
#include <Base/Parameter.h>
#include <Base/Exception.h>
#include <Base/FileInfo.h>
@@ -1412,14 +1413,12 @@ void MainWindow::loadWindowSettings()
pos.setX(qMin(qMax(pos.x(),x1-this->width()+30),x2-30));
pos.setY(qMin(qMax(pos.y(),y1-10),y2-10));
this->move(pos);
// tmp. disable the report window to suppress some bothering warnings
auto tmp = Base::Console().IsMsgTypeEnabled("ReportOutput", Base::ConsoleSingleton::MsgType_Wrn);
Base::Console().SetEnabledMsgType("ReportOutput", Base::ConsoleSingleton::MsgType_Wrn, false);
this->restoreState(config.value(QString::fromLatin1("MainWindowState")).toByteArray());
{
// tmp. disable the report window to suppress some bothering warnings
const Base::ILoggerBlocker blocker("ReportOutput", Base::ConsoleSingleton::MsgType_Wrn);
this->restoreState(config.value(QString::fromLatin1("MainWindowState")).toByteArray());
}
std::clog << "Main window restored" << std::endl;
Base::Console().SetEnabledMsgType("ReportOutput", Base::ConsoleSingleton::MsgType_Wrn, tmp);
bool max = config.value(QString::fromLatin1("Maximized"), false).toBool();
max ? showMaximized() : show();