From f6d4170c0507946a52b469e9244472bc5e346c71 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 13 Jan 2021 15:00:15 +0100 Subject: [PATCH] OutputFormatter: Reduce usages of DebugFormat This is usually used in a wrong or at least misleading way. Replace most of the usages by newly introduced GeneralMessageFormat as most of the replaced usages just print to General Messages and using any of the existing formats would change the layout of the text. Except for some special debug output inside the valgrind plugin that can use one of the existing formats which also makes it easier to spot them and the runners which print QC internal output. Task-number: QTCREATORBUG-24560 Change-Id: I824dc4250b2f3e4656bab8676b45c98e3407d59c Reviewed-by: Christian Kandeler --- src/libs/utils/outputformat.h | 1 + src/libs/utils/outputformatter.cpp | 1 + src/plugins/android/androidrunner.cpp | 4 ++-- src/plugins/coreplugin/messageoutputwindow.cpp | 2 +- src/plugins/perfprofiler/perfprofilerruncontrol.cpp | 2 +- src/plugins/qmlpreview/qmldebugtranslationwidget.cpp | 2 +- src/plugins/valgrind/valgrindengine.cpp | 6 +++--- 7 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/libs/utils/outputformat.h b/src/libs/utils/outputformat.h index 1e959d05d46..96c2ef2b3ae 100644 --- a/src/libs/utils/outputformat.h +++ b/src/libs/utils/outputformat.h @@ -35,6 +35,7 @@ enum OutputFormat DebugFormat, StdOutFormat, StdErrFormat, + GeneralMessageFormat, NumberOfFormats // Keep this entry last. }; diff --git a/src/libs/utils/outputformatter.cpp b/src/libs/utils/outputformatter.cpp index 875ba0ebecf..0ca2e495d0c 100644 --- a/src/libs/utils/outputformatter.cpp +++ b/src/libs/utils/outputformatter.cpp @@ -496,6 +496,7 @@ void OutputFormatter::initFormats() d->formats[StdOutFormat].setForeground(theme->color(Theme::OutputPanes_StdOutTextColor)); d->formats[StdErrFormat].setForeground(theme->color(Theme::OutputPanes_StdErrTextColor)); d->formats[DebugFormat].setForeground(theme->color(Theme::OutputPanes_DebugTextColor)); + d->formats[GeneralMessageFormat].setForeground(theme->color(Theme::OutputPanes_DebugTextColor)); setBoldFontEnabled(d->boldFontEnabled); } diff --git a/src/plugins/android/androidrunner.cpp b/src/plugins/android/androidrunner.cpp index 67c60dc37e0..1682d882b47 100644 --- a/src/plugins/android/androidrunner.cpp +++ b/src/plugins/android/androidrunner.cpp @@ -128,7 +128,7 @@ void AndroidRunner::stop() if (m_checkAVDTimer.isActive()) { m_checkAVDTimer.stop(); appendMessage("\n\n" + tr("\"%1\" terminated.").arg(m_packageName), - Utils::DebugFormat); + Utils::NormalMessageFormat); return; } @@ -171,7 +171,7 @@ void AndroidRunner::handleRemoteProcessStarted(Utils::Port debugServerPort, void AndroidRunner::handleRemoteProcessFinished(const QString &errString) { - appendMessage(errString, Utils::DebugFormat); + appendMessage(errString, Utils::NormalMessageFormat); if (runControl()->isRunning()) runControl()->initiateStop(); reportStopped(); diff --git a/src/plugins/coreplugin/messageoutputwindow.cpp b/src/plugins/coreplugin/messageoutputwindow.cpp index 1ca9a6be8f3..ef84b100ab1 100644 --- a/src/plugins/coreplugin/messageoutputwindow.cpp +++ b/src/plugins/coreplugin/messageoutputwindow.cpp @@ -107,7 +107,7 @@ QString MessageOutputWindow::displayName() const void MessageOutputWindow::append(const QString &text) { - m_widget->appendMessage(text, Utils::DebugFormat); + m_widget->appendMessage(text, Utils::GeneralMessageFormat); } int MessageOutputWindow::priorityInStatusBar() const diff --git a/src/plugins/perfprofiler/perfprofilerruncontrol.cpp b/src/plugins/perfprofiler/perfprofilerruncontrol.cpp index bdf2c7670c1..dfccc06d2c0 100644 --- a/src/plugins/perfprofiler/perfprofilerruncontrol.cpp +++ b/src/plugins/perfprofiler/perfprofilerruncontrol.cpp @@ -89,7 +89,7 @@ public: if (url.isValid()) { args.append(QStringList{"--host", url.host(), "--port", QString::number(url.port())}); } - appendMessage("PerfParser args: " + args.join(' '), Utils::DebugFormat); + appendMessage("PerfParser args: " + args.join(' '), Utils::NormalMessageFormat); m_reader.createParser(args); m_reader.startParser(); } diff --git a/src/plugins/qmlpreview/qmldebugtranslationwidget.cpp b/src/plugins/qmlpreview/qmldebugtranslationwidget.cpp index 7a25c6f75fe..218d1366590 100644 --- a/src/plugins/qmlpreview/qmldebugtranslationwidget.cpp +++ b/src/plugins/qmlpreview/qmldebugtranslationwidget.cpp @@ -424,7 +424,7 @@ void QmlDebugTranslationWidget::loadLogFile() if (f.open(QFile::ReadOnly)) { clear(); while (!f.atEnd()) - appendMessage(QString::fromUtf8(f.readLine()), Utils::DebugFormat); + appendMessage(QString::fromUtf8(f.readLine()), Utils::GeneralMessageFormat); } else { // TODO: maybe add this message to log and tasks qWarning() << "Failed to open" << fileName << ":" << f.errorString(); diff --git a/src/plugins/valgrind/valgrindengine.cpp b/src/plugins/valgrind/valgrindengine.cpp index ff0a2928acf..41086584acf 100644 --- a/src/plugins/valgrind/valgrindengine.cpp +++ b/src/plugins/valgrind/valgrindengine.cpp @@ -72,9 +72,9 @@ void ValgrindToolRunner::start() m_progress.reportStarted(); #if VALGRIND_DEBUG_OUTPUT - emit outputReceived(tr("Valgrind options: %1").arg(toolArguments().join(' ')), DebugFormat); - emit outputReceived(tr("Working directory: %1").arg(runnable().workingDirectory), DebugFormat); - emit outputReceived(tr("Command line arguments: %1").arg(runnable().debuggeeArgs), DebugFormat); + emit outputReceived(tr("Valgrind options: %1").arg(toolArguments().join(' ')), LogMessageFormat); + emit outputReceived(tr("Working directory: %1").arg(runnable().workingDirectory), LogMessageFormat); + emit outputReceived(tr("Command line arguments: %1").arg(runnable().debuggeeArgs), LogMessageFormat); #endif CommandLine valgrind{m_settings.valgrindExecutable()};