Added color support of ANSI escape codes

in compile and application output pane. Only simple font and background
controles added.

Task-number: QTCREATORBUG-9592
Task-number: QTCREATORBUG-5956
Change-Id: Ida010ed17d34bb73ae1364a77073ff435a03a060
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
Petar Perisin
2013-09-03 06:47:17 +03:00
committed by hjk
parent 7e29974e4e
commit e8f5502b78
10 changed files with 313 additions and 5 deletions

View File

@@ -40,6 +40,7 @@
#include <extensionsystem/pluginmanager.h>
#include <texteditor/texteditorsettings.h>
#include <texteditor/fontsettings.h>
#include <utils/ansiescapecodehandler.h>
#include <QIcon>
#include <QTextCharFormat>
@@ -103,7 +104,8 @@ private:
} // namespace ProjectExplorer
CompileOutputWindow::CompileOutputWindow(BuildManager * /*bm*/, QAction *cancelBuildAction) :
m_cancelBuildButton(new QToolButton)
m_cancelBuildButton(new QToolButton),
m_escapeCodeHandler(new Utils::AnsiEscapeCodeHandler)
{
Core::Context context(Constants::C_COMPILE_OUTPUT);
m_outputWindow = new CompileOutputTextEdit(context);
@@ -142,6 +144,7 @@ CompileOutputWindow::~CompileOutputWindow()
ExtensionSystem::PluginManager::removeObject(m_handler);
delete m_handler;
delete m_cancelBuildButton;
delete m_escapeCodeHandler;
}
void CompileOutputWindow::updateWordWrapMode()
@@ -203,7 +206,8 @@ void CompileOutputWindow::appendText(const QString &text, ProjectExplorer::Build
}
m_outputWindow->appendText(text, textFormat);
foreach (const Utils::StringFormatPair &pair, m_escapeCodeHandler->parseText(text, textFormat))
m_outputWindow->appendText(pair.first, pair.second);
}
void CompileOutputWindow::clearContents()
@@ -271,4 +275,10 @@ void CompileOutputWindow::showPositionOf(const Task &task)
m_outputWindow->setTextCursor(newCursor);
}
void CompileOutputWindow::flush()
{
if (m_escapeCodeHandler)
m_escapeCodeHandler->endFormatScope();
}
#include "compileoutputwindow.moc"