From 867f22d3c8634ae9cecde04fc56b5eac6c411520 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sun, 20 Oct 2019 13:41:10 +0200 Subject: [PATCH] fix regressions in SplashObserver::SendLog and ReportOutput::SendLog --- src/Gui/ReportView.cpp | 15 ++++++++++----- src/Gui/Splashscreen.cpp | 7 ++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/Gui/ReportView.cpp b/src/Gui/ReportView.cpp index e1426a6519..24937a441a 100644 --- a/src/Gui/ReportView.cpp +++ b/src/Gui/ReportView.cpp @@ -384,7 +384,7 @@ void ReportOutput::restoreFont() void ReportOutput::SendLog(const std::string& msg, Base::LogStyle level) { ReportHighlighter::Paragraph style = ReportHighlighter::LogText; - switch(level){ + switch (level) { case Base::LogStyle::Warning: style = ReportHighlighter::Warning; break; @@ -398,12 +398,17 @@ void ReportOutput::SendLog(const std::string& msg, Base::LogStyle level) style = ReportHighlighter::LogText; break; } - // This truncates messages that are too long + QString qMsg = QString::fromUtf8(msg.c_str()); - if(messageSize > 0 && qMsg.size()>messageSize) { - qMsg.truncate(messageSize); - qMsg += QString::fromLatin1("...\n"); + + // This truncates log messages that are too long + if (style == ReportHighlighter::LogText) { + if (messageSize > 0 && qMsg.size()>messageSize) { + qMsg.truncate(messageSize); + qMsg += QString::fromLatin1("...\n"); + } } + // Send the event to itself to allow thread-safety. Qt will delete it when done. CustomReportEvent* ev = new CustomReportEvent(style, qMsg); QApplication::postEvent(this, ev); diff --git a/src/Gui/Splashscreen.cpp b/src/Gui/Splashscreen.cpp index dbf0648439..db8d03b49c 100644 --- a/src/Gui/Splashscreen.cpp +++ b/src/Gui/Splashscreen.cpp @@ -112,12 +112,13 @@ public: } void SendLog(const std::string& msg, Base::LogStyle level) override { - (void) level; // to eliminate unused parameter warning - #ifdef FC_DEBUG Log(msg.c_str()); + Q_UNUSED(level) #else - Q_UNUSED(msg.c_str()); + if (level == Base::LogStyle::Log) { + Log(msg.c_str()); + } #endif } void Log (const char * s)