aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2020-03-17 15:18:06 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2020-03-18 13:52:17 +0000
commit9348ac5fece45460f960281bd003a39d2026b28a (patch)
tree457e1a29057a9e71a4978e0a24b9d78ba5e73491 /src
parent80293aac9364227afe996416cbf399ad09346ee0 (diff)
Utils: Remove the *SameLine OutputFormat enums
Presumably, they were intended for output that shouldn't get an automatic newline, but if there ever was such a thing as automatic newlines, it must have evaporated over time. All users of OutputFormatter provide a newline if they want one. Change-Id: Ibd219b7305fd503ce075d6f77930d2b538d5e2e8 Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/libs/utils/outputformat.h2
-rw-r--r--src/libs/utils/outputformatter.cpp43
-rw-r--r--src/plugins/android/androidrunner.cpp4
-rw-r--r--src/plugins/autotest/testrunner.cpp6
-rw-r--r--src/plugins/debugger/debuggerengine.cpp4
-rw-r--r--src/plugins/debugger/debuggerruncontrol.cpp8
-rw-r--r--src/plugins/projectexplorer/applicationlauncher.cpp4
-rw-r--r--src/plugins/projectexplorer/runcontrol.cpp4
-rw-r--r--src/plugins/python/pythonrunconfiguration.cpp3
9 files changed, 17 insertions, 61 deletions
diff --git a/src/libs/utils/outputformat.h b/src/libs/utils/outputformat.h
index 12b14d5b80..1e959d05d4 100644
--- a/src/libs/utils/outputformat.h
+++ b/src/libs/utils/outputformat.h
@@ -35,8 +35,6 @@ enum OutputFormat
DebugFormat,
StdOutFormat,
StdErrFormat,
- StdOutFormatSameLine,
- StdErrFormatSameLine,
NumberOfFormats // Keep this entry last.
};
diff --git a/src/libs/utils/outputformatter.cpp b/src/libs/utils/outputformatter.cpp
index 3ad865f3ee..d4da38564c 100644
--- a/src/libs/utils/outputformatter.cpp
+++ b/src/libs/utils/outputformatter.cpp
@@ -144,26 +144,12 @@ void OutputFormatter::initFormats()
return;
Theme *theme = creatorTheme();
-
- // NormalMessageFormat
d->formats[NormalMessageFormat].setForeground(theme->color(Theme::OutputPanes_NormalMessageTextColor));
-
- // ErrorMessageFormat
d->formats[ErrorMessageFormat].setForeground(theme->color(Theme::OutputPanes_ErrorMessageTextColor));
-
- // LogMessageFormat
d->formats[LogMessageFormat].setForeground(theme->color(Theme::OutputPanes_WarningMessageTextColor));
-
- // StdOutFormat
d->formats[StdOutFormat].setForeground(theme->color(Theme::OutputPanes_StdOutTextColor));
- d->formats[StdOutFormatSameLine] = d->formats[StdOutFormat];
-
- // StdErrFormat
d->formats[StdErrFormat].setForeground(theme->color(Theme::OutputPanes_StdErrTextColor));
- d->formats[StdErrFormatSameLine] = d->formats[StdErrFormat];
-
d->formats[DebugFormat].setForeground(theme->color(Theme::OutputPanes_DebugTextColor));
-
setBoldFontEnabled(d->boldFontEnabled);
}
@@ -203,34 +189,7 @@ void OutputFormatter::appendMessage(const QString &text, OutputFormat format)
d->prependCarriageReturn = true;
out.chop(1);
}
-
- if (format != StdOutFormatSameLine && format != StdErrFormatSameLine) {
- doAppendMessage(doNewlineEnforcement(out), format);
- return;
- }
-
- const bool enforceNewline = d->enforceNewline;
- d->enforceNewline = false;
- if (enforceNewline) {
- out.prepend('\n');
- } else {
- const int newline = out.indexOf('\n');
- plainTextEdit()->moveCursor(QTextCursor::End);
- if (newline != -1) {
- doAppendMessage(out.left(newline), format);// doesn't enforce new paragraph like appendPlainText
- out = out.mid(newline);
- }
- }
-
- if (out.isEmpty()) {
- d->enforceNewline = true;
- } else {
- if (out.endsWith('\n')) {
- d->enforceNewline = true;
- out.chop(1);
- }
- doAppendMessage(out, format);
- }
+ doAppendMessage(doNewlineEnforcement(out), format);
}
QString OutputFormatter::doNewlineEnforcement(const QString &out)
diff --git a/src/plugins/android/androidrunner.cpp b/src/plugins/android/androidrunner.cpp
index 06871b93ae..16098ae179 100644
--- a/src/plugins/android/androidrunner.cpp
+++ b/src/plugins/android/androidrunner.cpp
@@ -215,14 +215,14 @@ void AndroidRunner::qmlServerPortReady(Port port)
void AndroidRunner::remoteOutput(const QString &output)
{
Core::MessageManager::write("LOGCAT: " + output, Core::MessageManager::Silent);
- appendMessage(output, Utils::StdOutFormatSameLine);
+ appendMessage(output, Utils::StdOutFormat);
m_outputParser.processOutput(output);
}
void AndroidRunner::remoteErrorOutput(const QString &output)
{
Core::MessageManager::write("LOGCAT: " + output, Core::MessageManager::Silent);
- appendMessage(output, Utils::StdErrFormatSameLine);
+ appendMessage(output, Utils::StdErrFormat);
m_outputParser.processOutput(output);
}
diff --git a/src/plugins/autotest/testrunner.cpp b/src/plugins/autotest/testrunner.cpp
index ec3c1e2f49..17826087d3 100644
--- a/src/plugins/autotest/testrunner.cpp
+++ b/src/plugins/autotest/testrunner.cpp
@@ -497,8 +497,8 @@ static void processOutput(TestOutputReader *outputreader, const QString &msg,
{
QByteArray message = msg.toUtf8();
switch (format) {
- case Utils::OutputFormat::StdErrFormatSameLine:
- case Utils::OutputFormat::StdOutFormatSameLine:
+ case Utils::OutputFormat::StdErrFormat:
+ case Utils::OutputFormat::StdOutFormat:
case Utils::OutputFormat::DebugFormat: {
static const QByteArray gdbSpecialOut = "Qt: gdb: -nograb added to command-line options.\n"
"\t Use the -dograb option to enforce grabbing.";
@@ -507,7 +507,7 @@ static void processOutput(TestOutputReader *outputreader, const QString &msg,
message.chop(1); // all messages have an additional \n at the end
for (auto line : message.split('\n')) {
- if (format == Utils::OutputFormat::StdOutFormatSameLine)
+ if (format == Utils::OutputFormat::StdOutFormat)
outputreader->processStdOutput(line);
else
outputreader->processStdError(line);
diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp
index a1c2aad6ab..4f3984d4c4 100644
--- a/src/plugins/debugger/debuggerengine.cpp
+++ b/src/plugins/debugger/debuggerengine.cpp
@@ -1756,11 +1756,11 @@ void DebuggerEngine::showMessage(const QString &msg, int channel, int timeout) c
case AppOutput:
case AppStuff:
d->m_logWindow->showOutput(channel, msg);
- emit appendMessageRequested(msg, StdOutFormatSameLine, false);
+ emit appendMessageRequested(msg, StdOutFormat, false);
break;
case AppError:
d->m_logWindow->showOutput(channel, msg);
- emit appendMessageRequested(msg, StdErrFormatSameLine, false);
+ emit appendMessageRequested(msg, StdErrFormat, false);
break;
default:
d->m_logWindow->showOutput(channel, msg);
diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp
index c6cf2ec248..fadb50acbc 100644
--- a/src/plugins/debugger/debuggerruncontrol.cpp
+++ b/src/plugins/debugger/debuggerruncontrol.cpp
@@ -128,14 +128,14 @@ public:
{
const QByteArray ba = m_proc.readAllStandardOutput();
const QString msg = QString::fromLocal8Bit(ba, ba.length());
- m_runTool->appendMessage(msg, StdOutFormatSameLine);
+ m_runTool->appendMessage(msg, StdOutFormat);
}
void handleStandardError()
{
const QByteArray ba = m_proc.readAllStandardError();
const QString msg = QString::fromLocal8Bit(ba, ba.length());
- m_runTool->appendMessage(msg, StdErrFormatSameLine);
+ m_runTool->appendMessage(msg, StdErrFormat);
}
void handleFinished()
@@ -1025,10 +1025,10 @@ void DebuggerRunTool::showMessage(const QString &msg, int channel, int timeout)
m_engine->showMessage(msg, channel, timeout);
switch (channel) {
case AppOutput:
- appendMessage(msg, StdOutFormatSameLine);
+ appendMessage(msg, StdOutFormat);
break;
case AppError:
- appendMessage(msg, StdErrFormatSameLine);
+ appendMessage(msg, StdErrFormat);
break;
case AppStuff:
appendMessage(msg, DebugFormat);
diff --git a/src/plugins/projectexplorer/applicationlauncher.cpp b/src/plugins/projectexplorer/applicationlauncher.cpp
index e0a725716a..a7ef576661 100644
--- a/src/plugins/projectexplorer/applicationlauncher.cpp
+++ b/src/plugins/projectexplorer/applicationlauncher.cpp
@@ -305,7 +305,7 @@ void ApplicationLauncherPrivate::readLocalStandardOutput()
QByteArray data = m_guiProcess.readAllStandardOutput();
QString msg = m_outputCodec->toUnicode(
data.constData(), data.length(), &m_outputCodecState);
- emit q->appendMessage(msg, StdOutFormatSameLine, false);
+ emit q->appendMessage(msg, StdOutFormat, false);
}
void ApplicationLauncherPrivate::readLocalStandardError()
@@ -313,7 +313,7 @@ void ApplicationLauncherPrivate::readLocalStandardError()
QByteArray data = m_guiProcess.readAllStandardError();
QString msg = m_outputCodec->toUnicode(
data.constData(), data.length(), &m_errorCodecState);
- emit q->appendMessage(msg, StdErrFormatSameLine, false);
+ emit q->appendMessage(msg, StdErrFormat, false);
}
void ApplicationLauncherPrivate::cannotRetrieveLocalDebugOutput()
diff --git a/src/plugins/projectexplorer/runcontrol.cpp b/src/plugins/projectexplorer/runcontrol.cpp
index 0c3eecc060..37bf2f3c49 100644
--- a/src/plugins/projectexplorer/runcontrol.cpp
+++ b/src/plugins/projectexplorer/runcontrol.cpp
@@ -1214,12 +1214,12 @@ void SimpleTargetRunner::doStart(const Runnable &runnable, const IDevice::ConstP
connect(&m_launcher, &ApplicationLauncher::remoteStderr,
this, [this](const QString &output) {
- appendMessage(output, Utils::StdErrFormatSameLine, false);
+ appendMessage(output, Utils::StdErrFormat, false);
});
connect(&m_launcher, &ApplicationLauncher::remoteStdout,
this, [this](const QString &output) {
- appendMessage(output, Utils::StdOutFormatSameLine, false);
+ appendMessage(output, Utils::StdOutFormat, false);
});
connect(&m_launcher, &ApplicationLauncher::finished,
diff --git a/src/plugins/python/pythonrunconfiguration.cpp b/src/plugins/python/pythonrunconfiguration.cpp
index c05e318c0c..1846c4b69e 100644
--- a/src/plugins/python/pythonrunconfiguration.cpp
+++ b/src/plugins/python/pythonrunconfiguration.cpp
@@ -73,8 +73,7 @@ public:
private:
void doAppendMessage(const QString &text, OutputFormat format) final
{
- const bool isTrace = (format == StdErrFormat
- || format == StdErrFormatSameLine)
+ const bool isTrace = format == StdErrFormat
&& (text.startsWith("Traceback (most recent call last):")
|| text.startsWith("\nTraceback (most recent call last):"));