Skip to content

Commit

Permalink
fix regressions in SplashObserver::SendLog and ReportOutput::SendLog
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Oct 20, 2019
1 parent f94bf69 commit 867f22d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
15 changes: 10 additions & 5 deletions src/Gui/ReportView.cpp
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
7 changes: 4 additions & 3 deletions src/Gui/Splashscreen.cpp
Expand Up @@ -112,12 +112,13 @@ class SplashObserver : public Base::ILogger
}
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)
Expand Down

0 comments on commit 867f22d

Please sign in to comment.