VCS: Make dark color schemes work with annotation highlighter

Task-number: QTCREATORBUG-6257

Change-Id: Ied01cf6773b5114100afccbac33f359cc72c0889
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
Tobias Hunger
2012-03-06 14:32:32 +01:00
parent 5e36568628
commit 4b366303e6
28 changed files with 81 additions and 39 deletions

View File

@@ -605,6 +605,8 @@ public:
bool m_revertChunkEnabled;
bool m_mouseDragging;
QList<AbstractTextCursorHandler *> m_textCursorHandlers;
QColor m_backgroundColor;
};
VcsBaseEditorWidgetPrivate::VcsBaseEditorWidgetPrivate(VcsBaseEditorWidget *editorWidget,
@@ -1017,7 +1019,7 @@ void VcsBaseEditorWidget::slotActivateAnnotation()
ah->setChangeNumbers(changes);
ah->rehighlight();
} else {
baseTextDocument()->setSyntaxHighlighter(createAnnotationHighlighter(changes));
baseTextDocument()->setSyntaxHighlighter(createAnnotationHighlighter(changes, d->m_backgroundColor));
}
}
@@ -1149,6 +1151,9 @@ void VcsBaseEditorWidget::setPlainTextData(const QByteArray &data)
void VcsBaseEditorWidget::setFontSettings(const TextEditor::FontSettings &fs)
{
TextEditor::BaseTextEditorWidget::setFontSettings(fs);
d->m_backgroundColor = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_TEXT))
.brushProperty(QTextFormat::BackgroundBrush).color();
if (d->m_parameters->type == DiffOutput) {
if (DiffHighlighter *highlighter = qobject_cast<DiffHighlighter*>(baseTextDocument()->syntaxHighlighter())) {
static QVector<QString> categories;
@@ -1162,6 +1167,11 @@ void VcsBaseEditorWidget::setFontSettings(const TextEditor::FontSettings &fs)
highlighter->setFormats(fs.toTextCharFormats(categories));
highlighter->rehighlight();
}
} else if (d->m_parameters->type == AnnotateOutput) {
if (BaseAnnotationHighlighter *highlighter = qobject_cast<BaseAnnotationHighlighter *>(baseTextDocument()->syntaxHighlighter())) {
highlighter->setBackgroundColor(d->m_backgroundColor);
highlighter->rehighlight();
}
}
}