VCS: Unbold messages and errors in output pane

Change-Id: Id154d75c07cf95b9ceaad3ee26fcac08e66b3200
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Orgad Shaneh
2018-11-23 12:33:42 +02:00
committed by Orgad Shaneh
parent 28352173e4
commit 5873612767
3 changed files with 13 additions and 2 deletions

View File

@@ -42,6 +42,7 @@ public:
QTextCursor cursor;
AnsiEscapeCodeHandler escapeCodeHandler;
OutputFormat lastFormat = NumberOfFormats;
bool boldFontEnabled = true;
};
} // namespace Internal
@@ -123,11 +124,9 @@ void OutputFormatter::initFormats()
Theme *theme = creatorTheme();
// NormalMessageFormat
d->formats[NormalMessageFormat].setFontWeight(QFont::Bold);
d->formats[NormalMessageFormat].setForeground(theme->color(Theme::OutputPanes_NormalMessageTextColor));
// ErrorMessageFormat
d->formats[ErrorMessageFormat].setFontWeight(QFont::Bold);
d->formats[ErrorMessageFormat].setForeground(theme->color(Theme::OutputPanes_ErrorMessageTextColor));
// LogMessageFormat
@@ -142,6 +141,8 @@ void OutputFormatter::initFormats()
d->formats[StdErrFormatSameLine] = d->formats[StdErrFormat];
d->formats[DebugFormat].setForeground(theme->color(Theme::OutputPanes_DebugTextColor));
setBoldFontEnabled(d->boldFontEnabled);
}
void OutputFormatter::handleLink(const QString &href)
@@ -149,6 +150,14 @@ void OutputFormatter::handleLink(const QString &href)
Q_UNUSED(href);
}
void OutputFormatter::setBoldFontEnabled(bool enabled)
{
d->boldFontEnabled = enabled;
const QFont::Weight fontWeight = enabled ? QFont::Bold : QFont::Normal;
d->formats[NormalMessageFormat].setFontWeight(fontWeight);
d->formats[ErrorMessageFormat].setFontWeight(fontWeight);
}
void OutputFormatter::flush()
{
d->escapeCodeHandler.endFormatScope();

View File

@@ -60,6 +60,7 @@ public:
virtual void handleLink(const QString &href);
virtual QList<QWidget *> toolbarWidgets() const { return {}; }
virtual void clear() {}
void setBoldFontEnabled(bool enabled);
protected:
void initFormats();

View File

@@ -120,6 +120,7 @@ OutputWindowPlainTextEdit::OutputWindowPlainTextEdit(QWidget *parent) :
setUndoRedoEnabled(false);
setFrameStyle(QFrame::NoFrame);
m_formatter = new OutputFormatter;
m_formatter->setBoldFontEnabled(false);
m_formatter->setPlainTextEdit(this);
auto agg = new Aggregation::Aggregate;
agg->add(this);