forked from qt-creator/qt-creator
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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user