forked from qt-creator/qt-creator
VcsBase: Modernize headers
* Use pragma once * Use override * Remove Q_DECLARE_PRIVATE as that makes no sense for QtCreator Change-Id: Ic31d4868c172a0b8fcb50cc9a71a6e95639cf84c Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -97,14 +97,25 @@ static inline QTextCharFormat invertedColorFormat(const QTextCharFormat &in)
|
||||
// --- DiffAndLogHighlighterPrivate
|
||||
class DiffAndLogHighlighterPrivate
|
||||
{
|
||||
DiffAndLogHighlighter *q_ptr;
|
||||
Q_DECLARE_PUBLIC(DiffAndLogHighlighter)
|
||||
public:
|
||||
DiffAndLogHighlighterPrivate(const QRegExp &filePattern, const QRegExp &changePattern);
|
||||
DiffAndLogHighlighterPrivate(DiffAndLogHighlighter *q_, const QRegExp &filePattern,
|
||||
const QRegExp &changePattern) :
|
||||
q(q_),
|
||||
m_filePattern(filePattern),
|
||||
m_changePattern(changePattern),
|
||||
m_locationIndicator(QLatin1String("@@")),
|
||||
m_diffInIndicator(QLatin1Char('+')),
|
||||
m_diffOutIndicator(QLatin1Char('-')),
|
||||
m_foldingState(Internal::StartOfFile)
|
||||
{
|
||||
QTC_CHECK(filePattern.isValid());
|
||||
}
|
||||
|
||||
Internal::DiffFormats analyzeLine(const QString &block) const;
|
||||
void updateOtherFormats();
|
||||
|
||||
DiffAndLogHighlighter *const q;
|
||||
|
||||
mutable QRegExp m_filePattern;
|
||||
mutable QRegExp m_changePattern;
|
||||
const QString m_locationIndicator;
|
||||
@@ -115,18 +126,6 @@ public:
|
||||
Internal::FoldingState m_foldingState;
|
||||
};
|
||||
|
||||
DiffAndLogHighlighterPrivate::DiffAndLogHighlighterPrivate(const QRegExp &filePattern, const QRegExp &changePattern) :
|
||||
q_ptr(0),
|
||||
m_filePattern(filePattern),
|
||||
m_changePattern(changePattern),
|
||||
m_locationIndicator(QLatin1String("@@")),
|
||||
m_diffInIndicator(QLatin1Char('+')),
|
||||
m_diffOutIndicator(QLatin1Char('-')),
|
||||
m_foldingState(Internal::StartOfFile)
|
||||
{
|
||||
QTC_CHECK(filePattern.isValid());
|
||||
}
|
||||
|
||||
Internal::DiffFormats DiffAndLogHighlighterPrivate::analyzeLine(const QString &text) const
|
||||
{
|
||||
// Do not match on git "--- a/" as a deleted line, check
|
||||
@@ -146,7 +145,6 @@ Internal::DiffFormats DiffAndLogHighlighterPrivate::analyzeLine(const QString &t
|
||||
|
||||
void DiffAndLogHighlighterPrivate::updateOtherFormats()
|
||||
{
|
||||
Q_Q(DiffAndLogHighlighter);
|
||||
m_addedTrailingWhiteSpaceFormat =
|
||||
invertedColorFormat(q->formatForCategory(Internal::DiffInFormat));
|
||||
|
||||
@@ -155,11 +153,8 @@ void DiffAndLogHighlighterPrivate::updateOtherFormats()
|
||||
// --- DiffAndLogHighlighter
|
||||
DiffAndLogHighlighter::DiffAndLogHighlighter(const QRegExp &filePattern, const QRegExp &changePattern) :
|
||||
TextEditor::SyntaxHighlighter(static_cast<QTextDocument *>(0)),
|
||||
d_ptr(new DiffAndLogHighlighterPrivate(filePattern, changePattern))
|
||||
d(new DiffAndLogHighlighterPrivate(this, filePattern, changePattern))
|
||||
{
|
||||
d_ptr->q_ptr = this;
|
||||
Q_D(DiffAndLogHighlighter);
|
||||
|
||||
static QVector<TextEditor::TextStyle> categories;
|
||||
if (categories.isEmpty()) {
|
||||
categories << TextEditor::C_TEXT
|
||||
@@ -175,6 +170,7 @@ DiffAndLogHighlighter::DiffAndLogHighlighter(const QRegExp &filePattern, const Q
|
||||
|
||||
DiffAndLogHighlighter::~DiffAndLogHighlighter()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
// Check trailing spaces
|
||||
@@ -194,7 +190,6 @@ static inline int trimmedLength(const QString &in)
|
||||
*/
|
||||
void DiffAndLogHighlighter::highlightBlock(const QString &text)
|
||||
{
|
||||
Q_D(DiffAndLogHighlighter);
|
||||
if (text.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -274,7 +269,6 @@ void DiffAndLogHighlighter::highlightBlock(const QString &text)
|
||||
|
||||
void DiffAndLogHighlighter::setFontSettings(const TextEditor::FontSettings &fontSettings)
|
||||
{
|
||||
Q_D(DiffAndLogHighlighter);
|
||||
SyntaxHighlighter::setFontSettings(fontSettings);
|
||||
d->updateOtherFormats();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user