Utils: Remove unneeded double indirection in OutputFormatter

Change-Id: I1af77688172d139cca105ac20086a3b7c5f32df6
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2015-02-25 13:31:40 +01:00
committed by Orgad Shaneh
parent 4413096cae
commit 1b71e8a53d

View File

@@ -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