Commit 1b71e8a5 authored by hjk's avatar hjk Committed by Orgad Shaneh

Utils: Remove unneeded double indirection in OutputFormatter

Change-Id: I1af77688172d139cca105ac20086a3b7c5f32df6
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent 4413096c
......@@ -43,24 +43,14 @@ class OutputFormatterPrivate
{
public:
OutputFormatterPrivate()
: plainTextEdit(0)
, formats(0)
, escapeCodeHandler(new AnsiEscapeCodeHandler)
, overwriteOutput(false)
{
}
~OutputFormatterPrivate()
{
delete[] formats;
delete escapeCodeHandler;
}
: plainTextEdit(0), overwriteOutput(false)
{}
QPlainTextEdit *plainTextEdit;
QTextCharFormat *formats;
QTextCharFormat formats[NumberOfFormats];
QFont font;
QTextCursor cursor;
AnsiEscapeCodeHandler *escapeCodeHandler;
AnsiEscapeCodeHandler escapeCodeHandler;
bool overwriteOutput;
};
......@@ -118,7 +108,7 @@ QTextCharFormat OutputFormatter::charFormat(OutputFormat format) const
QList<FormattedText> OutputFormatter::parseAnsi(const QString &text, const QTextCharFormat &format)
{
return d->escapeCodeHandler->parseText(FormattedText(text, format));
return d->escapeCodeHandler.parseText(FormattedText(text, format));
}
void OutputFormatter::append(QTextCursor &cursor, const QString &text,
......@@ -148,8 +138,6 @@ void OutputFormatter::initFormats()
QFont boldFont = d->font;
boldFont.setBold(true);
d->formats = new QTextCharFormat[NumberOfFormats];
Theme *theme = creatorTheme();
// NormalMessageFormat
......@@ -192,7 +180,7 @@ void OutputFormatter::setFont(const QFont &font)
void OutputFormatter::flush()
{
d->escapeCodeHandler->endFormatScope();
d->escapeCodeHandler.endFormatScope();
}
} // namespace Utils
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment