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 <christian.kandeler@qt.io>
This commit is contained in:
Christian Stenger
2021-01-13 15:00:15 +01:00
parent 3e30c4b571
commit f6d4170c05
7 changed files with 10 additions and 8 deletions

View File

@@ -35,6 +35,7 @@ enum OutputFormat
DebugFormat, DebugFormat,
StdOutFormat, StdOutFormat,
StdErrFormat, StdErrFormat,
GeneralMessageFormat,
NumberOfFormats // Keep this entry last. NumberOfFormats // Keep this entry last.
}; };

View File

@@ -496,6 +496,7 @@ void OutputFormatter::initFormats()
d->formats[StdOutFormat].setForeground(theme->color(Theme::OutputPanes_StdOutTextColor)); d->formats[StdOutFormat].setForeground(theme->color(Theme::OutputPanes_StdOutTextColor));
d->formats[StdErrFormat].setForeground(theme->color(Theme::OutputPanes_StdErrTextColor)); d->formats[StdErrFormat].setForeground(theme->color(Theme::OutputPanes_StdErrTextColor));
d->formats[DebugFormat].setForeground(theme->color(Theme::OutputPanes_DebugTextColor)); d->formats[DebugFormat].setForeground(theme->color(Theme::OutputPanes_DebugTextColor));
d->formats[GeneralMessageFormat].setForeground(theme->color(Theme::OutputPanes_DebugTextColor));
setBoldFontEnabled(d->boldFontEnabled); setBoldFontEnabled(d->boldFontEnabled);
} }

View File

@@ -128,7 +128,7 @@ void AndroidRunner::stop()
if (m_checkAVDTimer.isActive()) { if (m_checkAVDTimer.isActive()) {
m_checkAVDTimer.stop(); m_checkAVDTimer.stop();
appendMessage("\n\n" + tr("\"%1\" terminated.").arg(m_packageName), appendMessage("\n\n" + tr("\"%1\" terminated.").arg(m_packageName),
Utils::DebugFormat); Utils::NormalMessageFormat);
return; return;
} }
@@ -171,7 +171,7 @@ void AndroidRunner::handleRemoteProcessStarted(Utils::Port debugServerPort,
void AndroidRunner::handleRemoteProcessFinished(const QString &errString) void AndroidRunner::handleRemoteProcessFinished(const QString &errString)
{ {
appendMessage(errString, Utils::DebugFormat); appendMessage(errString, Utils::NormalMessageFormat);
if (runControl()->isRunning()) if (runControl()->isRunning())
runControl()->initiateStop(); runControl()->initiateStop();
reportStopped(); reportStopped();

View File

@@ -107,7 +107,7 @@ QString MessageOutputWindow::displayName() const
void MessageOutputWindow::append(const QString &text) void MessageOutputWindow::append(const QString &text)
{ {
m_widget->appendMessage(text, Utils::DebugFormat); m_widget->appendMessage(text, Utils::GeneralMessageFormat);
} }
int MessageOutputWindow::priorityInStatusBar() const int MessageOutputWindow::priorityInStatusBar() const

View File

@@ -89,7 +89,7 @@ public:
if (url.isValid()) { if (url.isValid()) {
args.append(QStringList{"--host", url.host(), "--port", QString::number(url.port())}); 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.createParser(args);
m_reader.startParser(); m_reader.startParser();
} }

View File

@@ -424,7 +424,7 @@ void QmlDebugTranslationWidget::loadLogFile()
if (f.open(QFile::ReadOnly)) { if (f.open(QFile::ReadOnly)) {
clear(); clear();
while (!f.atEnd()) while (!f.atEnd())
appendMessage(QString::fromUtf8(f.readLine()), Utils::DebugFormat); appendMessage(QString::fromUtf8(f.readLine()), Utils::GeneralMessageFormat);
} else { } else {
// TODO: maybe add this message to log and tasks // TODO: maybe add this message to log and tasks
qWarning() << "Failed to open" << fileName << ":" << f.errorString(); qWarning() << "Failed to open" << fileName << ":" << f.errorString();

View File

@@ -72,9 +72,9 @@ void ValgrindToolRunner::start()
m_progress.reportStarted(); m_progress.reportStarted();
#if VALGRIND_DEBUG_OUTPUT #if VALGRIND_DEBUG_OUTPUT
emit outputReceived(tr("Valgrind options: %1").arg(toolArguments().join(' ')), DebugFormat); emit outputReceived(tr("Valgrind options: %1").arg(toolArguments().join(' ')), LogMessageFormat);
emit outputReceived(tr("Working directory: %1").arg(runnable().workingDirectory), DebugFormat); emit outputReceived(tr("Working directory: %1").arg(runnable().workingDirectory), LogMessageFormat);
emit outputReceived(tr("Command line arguments: %1").arg(runnable().debuggeeArgs), DebugFormat); emit outputReceived(tr("Command line arguments: %1").arg(runnable().debuggeeArgs), LogMessageFormat);
#endif #endif
CommandLine valgrind{m_settings.valgrindExecutable()}; CommandLine valgrind{m_settings.valgrindExecutable()};