aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2018-11-16 08:59:57 +0200
committerOrgad Shaneh <orgads@gmail.com>2018-11-19 10:03:11 +0000
commit61aa2d37417e42479eabbd38179f8792101b7578 (patch)
treea4187f5c1023fcd00b3b8224592621021d9abe37 /src/plugins
parent85c1bab7a16c4c8c5df74dd7d9431b41822d03a5 (diff)
CompileOutput: Use output formatter
Change-Id: Ie7c3fd73de33fb5cfcc56f371ea72463f2ef72f4 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/projectexplorer/compileoutputwindow.cpp29
-rw-r--r--src/plugins/projectexplorer/compileoutputwindow.h4
2 files changed, 13 insertions, 20 deletions
diff --git a/src/plugins/projectexplorer/compileoutputwindow.cpp b/src/plugins/projectexplorer/compileoutputwindow.cpp
index 722b4886b5..a76ea49ea7 100644
--- a/src/plugins/projectexplorer/compileoutputwindow.cpp
+++ b/src/plugins/projectexplorer/compileoutputwindow.cpp
@@ -40,7 +40,7 @@
#include <texteditor/texteditorsettings.h>
#include <texteditor/fontsettings.h>
#include <texteditor/behaviorsettings.h>
-#include <utils/ansiescapecodehandler.h>
+#include <utils/outputformatter.h>
#include <utils/proxyaction.h>
#include <utils/theme/theme.h>
#include <utils/utilsicons.h>
@@ -151,7 +151,7 @@ CompileOutputWindow::CompileOutputWindow(QAction *cancelBuildAction) :
m_cancelBuildButton(new QToolButton),
m_zoomInButton(new QToolButton),
m_zoomOutButton(new QToolButton),
- m_escapeCodeHandler(new Utils::AnsiEscapeCodeHandler)
+ m_formatter(new Utils::OutputFormatter)
{
Core::Context context(C_COMPILE_OUTPUT);
m_outputWindow = new CompileOutputTextEdit(context);
@@ -160,6 +160,7 @@ CompileOutputWindow::CompileOutputWindow(QAction *cancelBuildAction) :
m_outputWindow->setReadOnly(true);
m_outputWindow->setUndoRedoEnabled(false);
m_outputWindow->setMaxCharCount(Core::Constants::DEFAULT_MAX_CHAR_COUNT);
+ m_outputWindow->setFormatter(m_formatter);
// Let selected text be colored as if the text edit was editable,
// otherwise the highlight for searching is too light
@@ -210,7 +211,7 @@ CompileOutputWindow::~CompileOutputWindow()
delete m_cancelBuildButton;
delete m_zoomInButton;
delete m_zoomOutButton;
- delete m_escapeCodeHandler;
+ delete m_formatter;
}
void CompileOutputWindow::updateZoomEnabled()
@@ -256,31 +257,24 @@ QList<QWidget *> CompileOutputWindow::toolBarWidgets() const
void CompileOutputWindow::appendText(const QString &text, BuildStep::OutputFormat format)
{
- using Utils::Theme;
- Theme *theme = Utils::creatorTheme();
- QTextCharFormat textFormat;
+ Utils::OutputFormat fmt = Utils::NormalMessageFormat;
switch (format) {
case BuildStep::OutputFormat::Stdout:
- textFormat.setForeground(theme->color(Theme::TextColorNormal));
- textFormat.setFontWeight(QFont::Normal);
+ fmt = Utils::StdOutFormat;
break;
case BuildStep::OutputFormat::Stderr:
- textFormat.setForeground(theme->color(Theme::OutputPanes_ErrorMessageTextColor));
- textFormat.setFontWeight(QFont::Normal);
+ fmt = Utils::StdErrFormat;
break;
case BuildStep::OutputFormat::NormalMessage:
- textFormat.setForeground(theme->color(Theme::OutputPanes_MessageOutput));
+ fmt = Utils::NormalMessageFormat;
break;
case BuildStep::OutputFormat::ErrorMessage:
- textFormat.setForeground(theme->color(Theme::OutputPanes_ErrorMessageTextColor));
- textFormat.setFontWeight(QFont::Bold);
+ fmt = Utils::ErrorMessageFormat;
break;
}
- foreach (const Utils::FormattedText &output,
- m_escapeCodeHandler->parseText(Utils::FormattedText(text, textFormat)))
- m_outputWindow->appendText(output.text, output.format);
+ m_outputWindow->appendMessage(text, fmt);
}
void CompileOutputWindow::clearContents()
@@ -362,8 +356,7 @@ void CompileOutputWindow::showPositionOf(const Task &task)
void CompileOutputWindow::flush()
{
- if (m_escapeCodeHandler)
- m_escapeCodeHandler->endFormatScope();
+ m_formatter->flush();
}
#include "compileoutputwindow.moc"
diff --git a/src/plugins/projectexplorer/compileoutputwindow.h b/src/plugins/projectexplorer/compileoutputwindow.h
index 3e9e3b0b51..9ff9c8ac92 100644
--- a/src/plugins/projectexplorer/compileoutputwindow.h
+++ b/src/plugins/projectexplorer/compileoutputwindow.h
@@ -37,7 +37,7 @@ class QTextCharFormat;
class QToolButton;
QT_END_NAMESPACE
-namespace Utils { class AnsiEscapeCodeHandler; }
+namespace Utils { class OutputFormatter; }
namespace ProjectExplorer {
@@ -91,7 +91,7 @@ private:
QToolButton *m_cancelBuildButton;
QToolButton *m_zoomInButton;
QToolButton *m_zoomOutButton;
- Utils::AnsiEscapeCodeHandler *m_escapeCodeHandler;
+ Utils::OutputFormatter *m_formatter;
};
} // namespace Internal