summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@nokia.com>2012-03-06 14:32:32 +0100
committerTobias Hunger <tobias.hunger@nokia.com>2012-03-06 14:34:01 +0100
commit4b366303e65f15511200d6996d02315973e68f75 (patch)
tree484e059a396cd4c0d1213db3e1db4de86f4b7fc0 /src
parent5e365686287d39c6bec414de6bba91ad3fb0e5fa (diff)
downloadqt-creator-4b366303e65f15511200d6996d02315973e68f75.tar.gz
VCS: Make dark color schemes work with annotation highlighter
Task-number: QTCREATORBUG-6257 Change-Id: Ied01cf6773b5114100afccbac33f359cc72c0889 Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/bazaar/annotationhighlighter.cpp3
-rw-r--r--src/plugins/bazaar/annotationhighlighter.h2
-rw-r--r--src/plugins/bazaar/bazaareditor.cpp5
-rw-r--r--src/plugins/bazaar/bazaareditor.h2
-rw-r--r--src/plugins/cvs/annotationhighlighter.cpp3
-rw-r--r--src/plugins/cvs/annotationhighlighter.h2
-rw-r--r--src/plugins/cvs/cvseditor.cpp5
-rw-r--r--src/plugins/cvs/cvseditor.h2
-rw-r--r--src/plugins/git/annotationhighlighter.cpp5
-rw-r--r--src/plugins/git/annotationhighlighter.h2
-rw-r--r--src/plugins/git/giteditor.cpp5
-rw-r--r--src/plugins/git/giteditor.h2
-rw-r--r--src/plugins/mercurial/annotationhighlighter.cpp3
-rw-r--r--src/plugins/mercurial/annotationhighlighter.h2
-rw-r--r--src/plugins/mercurial/mercurialeditor.cpp5
-rw-r--r--src/plugins/mercurial/mercurialeditor.h2
-rw-r--r--src/plugins/perforce/annotationhighlighter.cpp3
-rw-r--r--src/plugins/perforce/annotationhighlighter.h1
-rw-r--r--src/plugins/perforce/perforceeditor.cpp5
-rw-r--r--src/plugins/perforce/perforceeditor.h2
-rw-r--r--src/plugins/subversion/annotationhighlighter.cpp5
-rw-r--r--src/plugins/subversion/annotationhighlighter.h2
-rw-r--r--src/plugins/subversion/subversioneditor.cpp5
-rw-r--r--src/plugins/subversion/subversioneditor.h2
-rw-r--r--src/plugins/vcsbase/baseannotationhighlighter.cpp26
-rw-r--r--src/plugins/vcsbase/baseannotationhighlighter.h4
-rw-r--r--src/plugins/vcsbase/vcsbaseeditor.cpp12
-rw-r--r--src/plugins/vcsbase/vcsbaseeditor.h3
28 files changed, 81 insertions, 39 deletions
diff --git a/src/plugins/bazaar/annotationhighlighter.cpp b/src/plugins/bazaar/annotationhighlighter.cpp
index 6dad6c709d..6ea7fd7108 100644
--- a/src/plugins/bazaar/annotationhighlighter.cpp
+++ b/src/plugins/bazaar/annotationhighlighter.cpp
@@ -37,8 +37,9 @@ using namespace Bazaar::Internal;
using namespace Bazaar;
BazaarAnnotationHighlighter::BazaarAnnotationHighlighter(const ChangeNumbers &changeNumbers,
+ const QColor &bg,
QTextDocument *document)
- : VcsBase::BaseAnnotationHighlighter(changeNumbers, document),
+ : VcsBase::BaseAnnotationHighlighter(changeNumbers, bg, document),
m_changeset(QLatin1String(Constants::CHANGESET_ID))
{
}
diff --git a/src/plugins/bazaar/annotationhighlighter.h b/src/plugins/bazaar/annotationhighlighter.h
index bea25e8a56..f97a4a9ae0 100644
--- a/src/plugins/bazaar/annotationhighlighter.h
+++ b/src/plugins/bazaar/annotationhighlighter.h
@@ -42,7 +42,7 @@ namespace Internal {
class BazaarAnnotationHighlighter : public VcsBase::BaseAnnotationHighlighter
{
public:
- explicit BazaarAnnotationHighlighter(const ChangeNumbers &changeNumbers,
+ explicit BazaarAnnotationHighlighter(const ChangeNumbers &changeNumbers, const QColor &bg,
QTextDocument *document = 0);
private:
diff --git a/src/plugins/bazaar/bazaareditor.cpp b/src/plugins/bazaar/bazaareditor.cpp
index 414a43de7f..b122152244 100644
--- a/src/plugins/bazaar/bazaareditor.cpp
+++ b/src/plugins/bazaar/bazaareditor.cpp
@@ -101,9 +101,10 @@ VcsBase::DiffHighlighter *BazaarEditor::createDiffHighlighter() const
return new VcsBase::DiffHighlighter(m_diffFileId);
}
-VcsBase::BaseAnnotationHighlighter *BazaarEditor::createAnnotationHighlighter(const QSet<QString> &changes) const
+VcsBase::BaseAnnotationHighlighter *BazaarEditor::createAnnotationHighlighter(const QSet<QString> &changes,
+ const QColor &bg) const
{
- return new BazaarAnnotationHighlighter(changes);
+ return new BazaarAnnotationHighlighter(changes, bg);
}
QString BazaarEditor::fileNameFromDiffSpecification(const QTextBlock &inBlock) const
diff --git a/src/plugins/bazaar/bazaareditor.h b/src/plugins/bazaar/bazaareditor.h
index 3c80e2402b..0c9198509f 100644
--- a/src/plugins/bazaar/bazaareditor.h
+++ b/src/plugins/bazaar/bazaareditor.h
@@ -51,7 +51,7 @@ private:
virtual QSet<QString> annotationChanges() const;
virtual QString changeUnderCursor(const QTextCursor &cursor) const;
virtual VcsBase::DiffHighlighter *createDiffHighlighter() const;
- virtual VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes) const;
+ virtual VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes, const QColor &bg) const;
virtual QString fileNameFromDiffSpecification(const QTextBlock &diffFileSpec) const;
const QRegExp m_exactChangesetId;
diff --git a/src/plugins/cvs/annotationhighlighter.cpp b/src/plugins/cvs/annotationhighlighter.cpp
index bbf279df24..9f4b756da4 100644
--- a/src/plugins/cvs/annotationhighlighter.cpp
+++ b/src/plugins/cvs/annotationhighlighter.cpp
@@ -36,8 +36,9 @@ using namespace Cvs;
using namespace Cvs::Internal;
CvsAnnotationHighlighter::CvsAnnotationHighlighter(const ChangeNumbers &changeNumbers,
+ const QColor &bg,
QTextDocument *document) :
- VcsBase::BaseAnnotationHighlighter(changeNumbers, document),
+ VcsBase::BaseAnnotationHighlighter(changeNumbers, bg, document),
m_blank(QLatin1Char(' '))
{
}
diff --git a/src/plugins/cvs/annotationhighlighter.h b/src/plugins/cvs/annotationhighlighter.h
index 8a99b898f1..ee6b874107 100644
--- a/src/plugins/cvs/annotationhighlighter.h
+++ b/src/plugins/cvs/annotationhighlighter.h
@@ -44,7 +44,7 @@ class CvsAnnotationHighlighter : public VcsBase::BaseAnnotationHighlighter
Q_OBJECT
public:
- explicit CvsAnnotationHighlighter(const ChangeNumbers &changeNumbers,
+ explicit CvsAnnotationHighlighter(const ChangeNumbers &changeNumbers, const QColor &bg,
QTextDocument *document = 0);
private:
diff --git a/src/plugins/cvs/cvseditor.cpp b/src/plugins/cvs/cvseditor.cpp
index b88f40e78d..769df31f50 100644
--- a/src/plugins/cvs/cvseditor.cpp
+++ b/src/plugins/cvs/cvseditor.cpp
@@ -131,9 +131,10 @@ VcsBase::DiffHighlighter *CvsEditor::createDiffHighlighter() const
return new VcsBase::DiffHighlighter(filePattern);
}
-VcsBase::BaseAnnotationHighlighter *CvsEditor::createAnnotationHighlighter(const QSet<QString> &changes) const
+VcsBase::BaseAnnotationHighlighter *CvsEditor::createAnnotationHighlighter(const QSet<QString> &changes,
+ const QColor &bg) const
{
- return new CvsAnnotationHighlighter(changes);
+ return new CvsAnnotationHighlighter(changes, bg);
}
QString CvsEditor::fileNameFromDiffSpecification(const QTextBlock &inBlock) const
diff --git a/src/plugins/cvs/cvseditor.h b/src/plugins/cvs/cvseditor.h
index 7c376d66ec..856871d792 100644
--- a/src/plugins/cvs/cvseditor.h
+++ b/src/plugins/cvs/cvseditor.h
@@ -52,7 +52,7 @@ private:
QSet<QString> annotationChanges() const;
QString changeUnderCursor(const QTextCursor &) const;
VcsBase::DiffHighlighter *createDiffHighlighter() const;
- VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes) const;
+ VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes, const QColor &bg) const;
QString fileNameFromDiffSpecification(const QTextBlock &diffFileName) const;
QStringList annotationPreviousVersions(const QString &revision) const;
diff --git a/src/plugins/git/annotationhighlighter.cpp b/src/plugins/git/annotationhighlighter.cpp
index 67550ca231..28bbcf9267 100644
--- a/src/plugins/git/annotationhighlighter.cpp
+++ b/src/plugins/git/annotationhighlighter.cpp
@@ -38,8 +38,9 @@ namespace Git {
namespace Internal {
GitAnnotationHighlighter::GitAnnotationHighlighter(const ChangeNumbers &changeNumbers,
- QTextDocument *document) :
- VcsBase::BaseAnnotationHighlighter(changeNumbers, document),
+ const QColor &bg,
+ QTextDocument *document) :
+ VcsBase::BaseAnnotationHighlighter(changeNumbers, bg, document),
m_blank(QLatin1Char(' '))
{
}
diff --git a/src/plugins/git/annotationhighlighter.h b/src/plugins/git/annotationhighlighter.h
index 03267e555e..8cbbccf1db 100644
--- a/src/plugins/git/annotationhighlighter.h
+++ b/src/plugins/git/annotationhighlighter.h
@@ -43,7 +43,7 @@ class GitAnnotationHighlighter : public VcsBase::BaseAnnotationHighlighter
{
Q_OBJECT
public:
- explicit GitAnnotationHighlighter(const ChangeNumbers &changeNumbers,
+ explicit GitAnnotationHighlighter(const ChangeNumbers &changeNumbers, const QColor &bg,
QTextDocument *document = 0);
private:
diff --git a/src/plugins/git/giteditor.cpp b/src/plugins/git/giteditor.cpp
index aec04d9e5d..8d7d1eec53 100644
--- a/src/plugins/git/giteditor.cpp
+++ b/src/plugins/git/giteditor.cpp
@@ -116,9 +116,10 @@ VcsBase::DiffHighlighter *GitEditor::createDiffHighlighter() const
return new VcsBase::DiffHighlighter(filePattern);
}
-VcsBase::BaseAnnotationHighlighter *GitEditor::createAnnotationHighlighter(const QSet<QString> &changes) const
+VcsBase::BaseAnnotationHighlighter *GitEditor::createAnnotationHighlighter(const QSet<QString> &changes,
+ const QColor &bg) const
{
- return new GitAnnotationHighlighter(changes);
+ return new GitAnnotationHighlighter(changes, bg);
}
QString GitEditor::fileNameFromDiffSpecification(const QTextBlock &inBlock) const
diff --git a/src/plugins/git/giteditor.h b/src/plugins/git/giteditor.h
index 4ce7bf84a2..65d237a5c5 100644
--- a/src/plugins/git/giteditor.h
+++ b/src/plugins/git/giteditor.h
@@ -61,7 +61,7 @@ private:
virtual QSet<QString> annotationChanges() const;
virtual QString changeUnderCursor(const QTextCursor &) const;
virtual VcsBase::DiffHighlighter *createDiffHighlighter() const;
- virtual VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes) const;
+ virtual VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes, const QColor &bg) const;
virtual QString fileNameFromDiffSpecification(const QTextBlock &diffFileName) const;
virtual QStringList annotationPreviousVersions(const QString &revision) const;
diff --git a/src/plugins/mercurial/annotationhighlighter.cpp b/src/plugins/mercurial/annotationhighlighter.cpp
index 84003f3785..00e0b7257e 100644
--- a/src/plugins/mercurial/annotationhighlighter.cpp
+++ b/src/plugins/mercurial/annotationhighlighter.cpp
@@ -37,8 +37,9 @@ using namespace Mercurial::Internal;
using namespace Mercurial;
MercurialAnnotationHighlighter::MercurialAnnotationHighlighter(const ChangeNumbers &changeNumbers,
+ const QColor &bg,
QTextDocument *document)
- : VcsBase::BaseAnnotationHighlighter(changeNumbers, document),
+ : VcsBase::BaseAnnotationHighlighter(changeNumbers, bg, document),
changeset(QLatin1String(Constants::CHANGESETID12))
{
}
diff --git a/src/plugins/mercurial/annotationhighlighter.h b/src/plugins/mercurial/annotationhighlighter.h
index 6dbbe948cd..92f2dc38b2 100644
--- a/src/plugins/mercurial/annotationhighlighter.h
+++ b/src/plugins/mercurial/annotationhighlighter.h
@@ -42,7 +42,7 @@ namespace Internal {
class MercurialAnnotationHighlighter : public VcsBase::BaseAnnotationHighlighter
{
public:
- explicit MercurialAnnotationHighlighter(const ChangeNumbers &changeNumbers,
+ explicit MercurialAnnotationHighlighter(const ChangeNumbers &changeNumbers, const QColor &bg,
QTextDocument *document = 0);
private:
diff --git a/src/plugins/mercurial/mercurialeditor.cpp b/src/plugins/mercurial/mercurialeditor.cpp
index b47c5b9d0e..af592e85e5 100644
--- a/src/plugins/mercurial/mercurialeditor.cpp
+++ b/src/plugins/mercurial/mercurialeditor.cpp
@@ -96,9 +96,10 @@ VcsBase::DiffHighlighter *MercurialEditor::createDiffHighlighter() const
return new VcsBase::DiffHighlighter(diffIdentifier);
}
-VcsBase::BaseAnnotationHighlighter *MercurialEditor::createAnnotationHighlighter(const QSet<QString> &changes) const
+VcsBase::BaseAnnotationHighlighter *MercurialEditor::createAnnotationHighlighter(const QSet<QString> &changes,
+ const QColor &bg) const
{
- return new MercurialAnnotationHighlighter(changes);
+ return new MercurialAnnotationHighlighter(changes, bg);
}
QString MercurialEditor::fileNameFromDiffSpecification(const QTextBlock &inBlock) const
diff --git a/src/plugins/mercurial/mercurialeditor.h b/src/plugins/mercurial/mercurialeditor.h
index 3261b17d95..03de664c35 100644
--- a/src/plugins/mercurial/mercurialeditor.h
+++ b/src/plugins/mercurial/mercurialeditor.h
@@ -50,7 +50,7 @@ private:
virtual QSet<QString> annotationChanges() const;
virtual QString changeUnderCursor(const QTextCursor &cursor) const;
virtual VcsBase::DiffHighlighter *createDiffHighlighter() const;
- virtual VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes) const;
+ virtual VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes, const QColor &bg) const;
virtual QString fileNameFromDiffSpecification(const QTextBlock &diffFileSpec) const;
virtual QStringList annotationPreviousVersions(const QString &revision) const;
diff --git a/src/plugins/perforce/annotationhighlighter.cpp b/src/plugins/perforce/annotationhighlighter.cpp
index 6e45a57087..26670e5fe8 100644
--- a/src/plugins/perforce/annotationhighlighter.cpp
+++ b/src/plugins/perforce/annotationhighlighter.cpp
@@ -36,8 +36,9 @@ namespace Perforce {
namespace Internal {
PerforceAnnotationHighlighter::PerforceAnnotationHighlighter(const ChangeNumbers &changeNumbers,
+ const QColor &bg,
QTextDocument *document) :
- VcsBase::BaseAnnotationHighlighter(changeNumbers, document),
+ VcsBase::BaseAnnotationHighlighter(changeNumbers, bg, document),
m_colon(QLatin1Char(':'))
{
}
diff --git a/src/plugins/perforce/annotationhighlighter.h b/src/plugins/perforce/annotationhighlighter.h
index 68c94b8628..70e94c7f30 100644
--- a/src/plugins/perforce/annotationhighlighter.h
+++ b/src/plugins/perforce/annotationhighlighter.h
@@ -44,6 +44,7 @@ class PerforceAnnotationHighlighter : public VcsBase::BaseAnnotationHighlighter
Q_OBJECT
public:
explicit PerforceAnnotationHighlighter(const ChangeNumbers &changeNumbers,
+ const QColor &bg,
QTextDocument *document = 0);
private:
diff --git a/src/plugins/perforce/perforceeditor.cpp b/src/plugins/perforce/perforceeditor.cpp
index 9aab63c648..707720185a 100644
--- a/src/plugins/perforce/perforceeditor.cpp
+++ b/src/plugins/perforce/perforceeditor.cpp
@@ -112,9 +112,10 @@ VcsBase::DiffHighlighter *PerforceEditor::createDiffHighlighter() const
return new VcsBase::DiffHighlighter(filePattern);
}
-VcsBase::BaseAnnotationHighlighter *PerforceEditor::createAnnotationHighlighter(const QSet<QString> &changes) const
+VcsBase::BaseAnnotationHighlighter *PerforceEditor::createAnnotationHighlighter(const QSet<QString> &changes,
+ const QColor &bg) const
{
- return new PerforceAnnotationHighlighter(changes);
+ return new PerforceAnnotationHighlighter(changes, bg);
}
QString PerforceEditor::fileNameFromDiffSpecification(const QTextBlock &inBlock) const
diff --git a/src/plugins/perforce/perforceeditor.h b/src/plugins/perforce/perforceeditor.h
index bbe2d1a8d1..801da2fa48 100644
--- a/src/plugins/perforce/perforceeditor.h
+++ b/src/plugins/perforce/perforceeditor.h
@@ -54,7 +54,7 @@ private:
virtual QSet<QString> annotationChanges() const;
virtual QString changeUnderCursor(const QTextCursor &) const;
virtual VcsBase::DiffHighlighter *createDiffHighlighter() const;
- virtual VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes) const;
+ virtual VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes, const QColor &bg) const;
virtual QString fileNameFromDiffSpecification(const QTextBlock &diffFileName) const;
virtual QStringList annotationPreviousVersions(const QString &v) const;
diff --git a/src/plugins/subversion/annotationhighlighter.cpp b/src/plugins/subversion/annotationhighlighter.cpp
index a994739c15..16a9a30c55 100644
--- a/src/plugins/subversion/annotationhighlighter.cpp
+++ b/src/plugins/subversion/annotationhighlighter.cpp
@@ -36,8 +36,9 @@ using namespace Subversion;
using namespace Subversion::Internal;
SubversionAnnotationHighlighter::SubversionAnnotationHighlighter(const ChangeNumbers &changeNumbers,
- QTextDocument *document) :
- VcsBase::BaseAnnotationHighlighter(changeNumbers, document),
+ const QColor &bg,
+ QTextDocument *document) :
+ VcsBase::BaseAnnotationHighlighter(changeNumbers, bg, document),
m_blank(QLatin1Char(' '))
{
}
diff --git a/src/plugins/subversion/annotationhighlighter.h b/src/plugins/subversion/annotationhighlighter.h
index fcaeb9c2cc..bd43e548cb 100644
--- a/src/plugins/subversion/annotationhighlighter.h
+++ b/src/plugins/subversion/annotationhighlighter.h
@@ -43,7 +43,7 @@ class SubversionAnnotationHighlighter : public VcsBase::BaseAnnotationHighlighte
{
Q_OBJECT
public:
- explicit SubversionAnnotationHighlighter(const ChangeNumbers &changeNumbers,
+ explicit SubversionAnnotationHighlighter(const ChangeNumbers &changeNumbers, const QColor &bg,
QTextDocument *document = 0);
private:
diff --git a/src/plugins/subversion/subversioneditor.cpp b/src/plugins/subversion/subversioneditor.cpp
index 10a5ef2185..692d273df5 100644
--- a/src/plugins/subversion/subversioneditor.cpp
+++ b/src/plugins/subversion/subversioneditor.cpp
@@ -117,9 +117,10 @@ VcsBase::DiffHighlighter *SubversionEditor::createDiffHighlighter() const
return new VcsBase::DiffHighlighter(filePattern);
}
-VcsBase::BaseAnnotationHighlighter *SubversionEditor::createAnnotationHighlighter(const QSet<QString> &changes) const
+VcsBase::BaseAnnotationHighlighter *SubversionEditor::createAnnotationHighlighter(const QSet<QString> &changes,
+ const QColor &bg) const
{
- return new SubversionAnnotationHighlighter(changes);
+ return new SubversionAnnotationHighlighter(changes, bg);
}
QString SubversionEditor::fileNameFromDiffSpecification(const QTextBlock &inBlock) const
diff --git a/src/plugins/subversion/subversioneditor.h b/src/plugins/subversion/subversioneditor.h
index 1fc930329f..74f413f2f9 100644
--- a/src/plugins/subversion/subversioneditor.h
+++ b/src/plugins/subversion/subversioneditor.h
@@ -52,7 +52,7 @@ private:
virtual QSet<QString> annotationChanges() const;
virtual QString changeUnderCursor(const QTextCursor &) const;
virtual VcsBase::DiffHighlighter *createDiffHighlighter() const;
- virtual VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes) const;
+ virtual VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes, const QColor &bg) const;
virtual QString fileNameFromDiffSpecification(const QTextBlock &diffFileName) const;
virtual QStringList annotationPreviousVersions(const QString &) const;
diff --git a/src/plugins/vcsbase/baseannotationhighlighter.cpp b/src/plugins/vcsbase/baseannotationhighlighter.cpp
index 08c8831955..6cd06fda20 100644
--- a/src/plugins/vcsbase/baseannotationhighlighter.cpp
+++ b/src/plugins/vcsbase/baseannotationhighlighter.cpp
@@ -62,15 +62,18 @@ class BaseAnnotationHighlighterPrivate
{
public:
ChangeNumberFormatMap m_changeNumberMap;
+ QColor m_background;
};
} // namespace Internal
BaseAnnotationHighlighter::BaseAnnotationHighlighter(const ChangeNumbers &changeNumbers,
- QTextDocument *document) :
+ const QColor &bg,
+ QTextDocument *document) :
TextEditor::SyntaxHighlighter(document),
d(new Internal::BaseAnnotationHighlighterPrivate)
{
+ d->m_background = bg;
setChangeNumbers(changeNumbers);
}
@@ -81,6 +84,7 @@ BaseAnnotationHighlighter::~BaseAnnotationHighlighter()
void BaseAnnotationHighlighter::setChangeNumbers(const ChangeNumbers &changeNumbers)
{
+ QColor bg = d->m_background;
d->m_changeNumberMap.clear();
if (!changeNumbers.isEmpty()) {
// Assign a color gradient to annotation change numbers. Give
@@ -89,10 +93,16 @@ void BaseAnnotationHighlighter::setChangeNumbers(const ChangeNumbers &changeNumb
const int step = qRound(ceil(pow(double(changeNumbers.count()), oneThird)));
QList<QColor> colors;
const int factor = 255 / step;
- for (int i=0; i<step; ++i)
- for (int j=0; j<step; ++j)
- for (int k=0; k<step; ++k)
- colors.append(QColor(i*factor, j*factor, k*factor));
+ int half = factor / 2;
+ for (int i=0; i<=step; ++i)
+ for (int j=0; j<=step; ++j)
+ for (int k=0; k<=step; ++k) {
+ QColor c(i*factor, j*factor, k*factor);
+ if ((bg.red() - half > c.red() ||bg.red() + half <= c.red())
+ && (bg.green() - half > c.green() || bg.green() + half <= c.green())
+ && (bg.blue() - half > c.blue() || bg.blue() + half <= c.blue()))
+ colors.prepend(c);
+ }
int m = 0;
const int cstep = colors.count() / changeNumbers.count();
@@ -116,4 +126,10 @@ void BaseAnnotationHighlighter::highlightBlock(const QString &text)
setFormat(0, text.length(), it.value());
}
+void BaseAnnotationHighlighter::setBackgroundColor(const QColor &color)
+{
+ d->m_background = color;
+ setChangeNumbers(d->m_changeNumberMap.keys().toSet());
+}
+
} // namespace VcsBase
diff --git a/src/plugins/vcsbase/baseannotationhighlighter.h b/src/plugins/vcsbase/baseannotationhighlighter.h
index 47785aeb1e..fadb8d8e16 100644
--- a/src/plugins/vcsbase/baseannotationhighlighter.h
+++ b/src/plugins/vcsbase/baseannotationhighlighter.h
@@ -48,7 +48,7 @@ class VCSBASE_EXPORT BaseAnnotationHighlighter : public TextEditor::SyntaxHighli
public:
typedef QSet<QString> ChangeNumbers;
- explicit BaseAnnotationHighlighter(const ChangeNumbers &changeNumbers,
+ explicit BaseAnnotationHighlighter(const ChangeNumbers &changeNumbers, const QColor &bg,
QTextDocument *document = 0);
virtual ~BaseAnnotationHighlighter();
@@ -56,6 +56,8 @@ public:
virtual void highlightBlock(const QString &text);
+ void setBackgroundColor(const QColor &color);
+
private:
// Implement this to return the change number of a line
virtual QString changeNumber(const QString &block) const = 0;
diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp
index e5dfe8f4fe..85864f5d4a 100644
--- a/src/plugins/vcsbase/vcsbaseeditor.cpp
+++ b/src/plugins/vcsbase/vcsbaseeditor.cpp
@@ -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();
+ }
}
}
diff --git a/src/plugins/vcsbase/vcsbaseeditor.h b/src/plugins/vcsbase/vcsbaseeditor.h
index 6744c57cc5..9dfb1e9541 100644
--- a/src/plugins/vcsbase/vcsbaseeditor.h
+++ b/src/plugins/vcsbase/vcsbaseeditor.h
@@ -249,7 +249,8 @@ private:
virtual QString changeUnderCursor(const QTextCursor &) const = 0;
// Factory functions for highlighters
virtual DiffHighlighter *createDiffHighlighter() const = 0;
- virtual BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes) const = 0;
+ virtual BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes,
+ const QColor &bg) const = 0;
// Implement to return a local file name from the diff file specification
// (text cursor at position above change hunk)
virtual QString fileNameFromDiffSpecification(const QTextBlock &diffFileSpec) const = 0;