aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkobus <jaroslaw.kobus@digia.com>2013-06-05 15:25:42 +0200
committerhjk <hjk121@nokiamail.com>2013-06-12 09:23:50 +0200
commitabe3951d67398310287785e8e1a132b42121269d (patch)
tree77fb64f880a214e1a57e4434561d295868afb8d8
parent93ea763a8d09557ce266f37d95352e858dcf9ede (diff)
Take diff colors from color scheme
Change-Id: I706612a8f89917cb57b7d1e9ecebd86b3f4bcc8d Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com> Reviewed-by: Eike Ziller <eike.ziller@digia.com> Reviewed-by: David Schulz <david.schulz@digia.com>
-rw-r--r--share/qtcreator/styles/darkvim.xml6
-rw-r--r--share/qtcreator/styles/grayscale.xml6
-rw-r--r--share/qtcreator/styles/inkpot.xml6
-rw-r--r--src/plugins/diffeditor/diffeditorwidget.cpp130
-rw-r--r--src/plugins/diffeditor/diffeditorwidget.h9
-rw-r--r--src/plugins/texteditor/basetexteditor.cpp15
-rw-r--r--src/plugins/texteditor/basetexteditor.h1
-rw-r--r--src/plugins/texteditor/colorscheme.cpp8
-rw-r--r--src/plugins/texteditor/colorscheme.h1
-rw-r--r--src/plugins/texteditor/fontsettingspage.cpp7
-rw-r--r--src/plugins/texteditor/texteditorconstants.cpp7
-rw-r--r--src/plugins/texteditor/texteditorconstants.h7
-rw-r--r--src/plugins/texteditor/texteditorsettings.cpp26
13 files changed, 175 insertions, 54 deletions
diff --git a/share/qtcreator/styles/darkvim.xml b/share/qtcreator/styles/darkvim.xml
index a7f0f924ab..9c753067ea 100644
--- a/share/qtcreator/styles/darkvim.xml
+++ b/share/qtcreator/styles/darkvim.xml
@@ -45,4 +45,10 @@
<style name="JsScopeVar" foreground="#8888ff" italic="true"/>
<style name="JsImportVar" foreground="#8888ff" italic="true"/>
<style name="JsGlobalVar" foreground="#8888ff" italic="true"/>
+ <style name="DillFileLine" foreground="#000000" background="#d7d700"/>
+ <style name="DiffContextLine" foreground="#000000" background="#8aaab6"/>
+ <style name="DiffSourceLine" background="#8c2d2d"/>
+ <style name="DiffSourceChar" foreground="#000000" background="#c34141"/>
+ <style name="DiffDestLine" background="#2d8c2d"/>
+ <style name="DiffDestChar" foreground="#000000" background="#41c341"/>
</style-scheme>
diff --git a/share/qtcreator/styles/grayscale.xml b/share/qtcreator/styles/grayscale.xml
index c1a29c2054..1d14c348aa 100644
--- a/share/qtcreator/styles/grayscale.xml
+++ b/share/qtcreator/styles/grayscale.xml
@@ -5,6 +5,12 @@
<style name="CurrentLine" foreground="#000000" background="#f2f2f2"/>
<style name="DiffFile"/>
<style name="DiffLocation"/>
+ <style name="DillFileLine" foreground="#ffffff" background="#000000"/>
+ <style name="DiffContextLine" foreground="#ffffff" background="#7f7f7f"/>
+ <style name="DiffSourceLine" background="#d7d7d7"/>
+ <style name="DiffSourceChar" background="#afafaf"/>
+ <style name="DiffDestLine" background="#d7d7d7"/>
+ <style name="DiffDestChar" background="#afafaf"/>
<style name="Doxygen.Comment" foreground="#808080"/>
<style name="Doxygen.Tag" foreground="#808080" italic="true"/>
<style name="Field"/>
diff --git a/share/qtcreator/styles/inkpot.xml b/share/qtcreator/styles/inkpot.xml
index 730c170f56..2c2200d1d1 100644
--- a/share/qtcreator/styles/inkpot.xml
+++ b/share/qtcreator/styles/inkpot.xml
@@ -53,5 +53,11 @@
<style name="JsScopeVar" foreground="#8888ff" italic="true"/>
<style name="JsImportVar" foreground="#8888ff" italic="true"/>
<style name="JsGlobalVar" foreground="#8888ff" italic="true"/>
+ <style name="DillFileLine" foreground="#404040" background="#dcb178"/>
+ <style name="DiffContextLine" foreground="#404040" background="#97bac7"/>
+ <style name="DiffSourceLine" background="#8c2d2d"/>
+ <style name="DiffSourceChar" background="#c34141"/>
+ <style name="DiffDestLine" background="#277027"/>
+ <style name="DiffDestChar" background="#339d33"/>
</style-scheme>
diff --git a/src/plugins/diffeditor/diffeditorwidget.cpp b/src/plugins/diffeditor/diffeditorwidget.cpp
index 97616375ea..059d5c8884 100644
--- a/src/plugins/diffeditor/diffeditorwidget.cpp
+++ b/src/plugins/diffeditor/diffeditorwidget.cpp
@@ -43,6 +43,7 @@
#include <texteditor/syntaxhighlighter.h>
#include <texteditor/basetextdocument.h>
#include <texteditor/texteditorsettings.h>
+#include <texteditor/fontsettings.h>
#include <texteditor/displaysettings.h>
#include <coreplugin/minisplitter.h>
@@ -141,6 +142,7 @@ public:
public slots:
void setDisplaySettings(const DisplaySettings &ds);
+ void setFontSettings(const TextEditor::FontSettings &fs);
protected:
virtual int extraAreaWidth(int *markWidthPtr = 0) const { return BaseTextEditorWidget::extraAreaWidth(markWidthPtr); }
@@ -149,6 +151,7 @@ protected:
virtual int lineNumberDigits() const;
virtual bool selectionVisible(int blockNumber) const;
virtual bool replacementVisible(int blockNumber) const;
+ QColor replacementPenColor(int blockNumber) const;
virtual QString plainTextFromSelection(const QTextCursor &cursor) const;
virtual void drawCollapsedBlockPopup(QPainter &painter,
const QTextBlock &block,
@@ -160,7 +163,8 @@ protected:
private:
void paintCollapsedBlockPopup(QPainter &painter, const QRect &clipRect);
- void paintSeparator(QPainter &painter, const QString &text, const QTextBlock &block, int top);
+ void paintSeparator(QPainter &painter, QColor &color, const QString &text,
+ const QTextBlock &block, int top);
void jumpToOriginalFile(const QTextCursor &cursor);
QString m_workingDirectory;
@@ -173,6 +177,9 @@ private:
// block number, separator. Separator used as lines alignment and inside skipped lines
QMap<int, bool> m_separators;
bool m_inPaintEvent;
+ QColor m_fileLineForeground;
+ QColor m_chunkLineForeground;
+ QColor m_textForeground;
};
DiffViewEditorWidget::DiffViewEditorWidget(QWidget *parent)
@@ -198,6 +205,15 @@ void DiffViewEditorWidget::setDisplaySettings(const DisplaySettings &ds)
SnippetEditorWidget::setDisplaySettings(settings);
}
+void DiffViewEditorWidget::setFontSettings(const TextEditor::FontSettings &fs)
+{
+ SnippetEditorWidget::setFontSettings(fs);
+ m_fileLineForeground = fs.formatFor(C_DIFF_FILE_LINE).foreground();
+ m_chunkLineForeground = fs.formatFor(C_DIFF_CONTEXT_LINE).foreground();
+ m_textForeground = fs.toTextCharFormat(C_TEXT).foreground().color();
+ update();
+}
+
QString DiffViewEditorWidget::lineNumber(int blockNumber) const
{
if (m_lineNumbers.contains(blockNumber))
@@ -221,6 +237,12 @@ bool DiffViewEditorWidget::replacementVisible(int blockNumber) const
&& TextEditor::BaseTextDocumentLayout::isFolded(document()->findBlockByNumber(blockNumber)));
}
+QColor DiffViewEditorWidget::replacementPenColor(int blockNumber) const
+{
+ Q_UNUSED(blockNumber)
+ return m_chunkLineForeground;
+}
+
QString DiffViewEditorWidget::plainTextFromSelection(const QTextCursor &cursor) const
{
const int startPosition = cursor.selectionStart();
@@ -322,11 +344,23 @@ void DiffViewEditorWidget::scrollContentsBy(int dx, int dy)
viewport()->update();
}
-void DiffViewEditorWidget::paintSeparator(QPainter &painter, const QString &text, const QTextBlock &block, int top)
+void DiffViewEditorWidget::paintSeparator(QPainter &painter,
+ QColor &color,
+ const QString &text,
+ const QTextBlock &block,
+ int top)
{
QPointF offset = contentOffset();
painter.save();
- painter.setPen(palette().foreground().color());
+
+ QColor foreground = color;
+ if (!foreground.isValid())
+ foreground = m_textForeground;
+ if (!foreground.isValid())
+ foreground = palette().foreground().color();
+
+ painter.setPen(foreground);
+
const QString replacementText = QLatin1String(" {")
+ foldReplacementText(block)
+ QLatin1String("}; ");
@@ -404,7 +438,8 @@ void DiffViewEditorWidget::paintEvent(QPaintEvent *e)
const int skippedBefore = m_skippedLines.value(blockNumber);
if (skippedBefore) {
const QString skippedRowsText = tr("Skipped %n lines...", 0, skippedBefore);
- paintSeparator(painter, skippedRowsText, currentBlock, top);
+ paintSeparator(painter, m_chunkLineForeground,
+ skippedRowsText, currentBlock, top);
}
const DiffEditorWidget::DiffFileInfo fileInfo = m_fileInfo.value(blockNumber);
@@ -412,7 +447,8 @@ void DiffViewEditorWidget::paintEvent(QPaintEvent *e)
const QString fileNameText = fileInfo.typeInfo.isEmpty()
? fileInfo.fileName
: tr("[%1] %2").arg(fileInfo.typeInfo).arg(fileInfo.fileName);
- paintSeparator(painter, fileNameText, currentBlock, top);
+ paintSeparator(painter, m_fileLineForeground,
+ fileNameText, currentBlock, top);
}
}
}
@@ -536,9 +572,6 @@ DiffEditorWidget::DiffEditorWidget(QWidget *parent)
m_leftEditor = new DiffViewEditorWidget(this);
m_leftEditor->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_leftEditor->setReadOnly(true);
- connect(settings, SIGNAL(fontSettingsChanged(TextEditor::FontSettings)),
- m_leftEditor, SLOT(setFontSettings(TextEditor::FontSettings)));
- m_leftEditor->setFontSettings(settings->fontSettings());
connect(settings, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)),
m_leftEditor, SLOT(setDisplaySettings(TextEditor::DisplaySettings)));
m_leftEditor->setDisplaySettings(settings->displaySettings());
@@ -546,14 +579,15 @@ DiffEditorWidget::DiffEditorWidget(QWidget *parent)
m_rightEditor = new DiffViewEditorWidget(this);
m_rightEditor->setReadOnly(true);
- connect(settings, SIGNAL(fontSettingsChanged(TextEditor::FontSettings)),
- m_rightEditor, SLOT(setFontSettings(TextEditor::FontSettings)));
- m_rightEditor->setFontSettings(settings->fontSettings());
connect(settings, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)),
m_rightEditor, SLOT(setDisplaySettings(TextEditor::DisplaySettings)));
m_rightEditor->setDisplaySettings(settings->displaySettings());
m_rightEditor->setCodeStyle(settings->codeStyle());
+ connect(settings, SIGNAL(fontSettingsChanged(TextEditor::FontSettings)),
+ this, SLOT(setFontSettings(TextEditor::FontSettings)));
+ setFontSettings(settings->fontSettings());
+
connect(m_leftEditor->verticalScrollBar(), SIGNAL(valueChanged(int)),
this, SLOT(leftVSliderChanged()));
connect(m_leftEditor->verticalScrollBar(), SIGNAL(actionTriggered(int)),
@@ -1231,37 +1265,12 @@ QList<QTextEdit::ExtraSelection> DiffEditorWidget::colorPositions(
void DiffEditorWidget::colorDiff(const QList<FileData> &fileDataList)
{
- QTextCharFormat leftLineFormat;
- leftLineFormat.setBackground(QColor(255, 223, 223));
- leftLineFormat.setProperty(QTextFormat::FullWidthSelection, true);
-
- QTextCharFormat leftCharFormat;
- leftCharFormat.setBackground(QColor(255, 175, 175));
- leftCharFormat.setProperty(QTextFormat::FullWidthSelection, true);
-
- QTextCharFormat rightLineFormat;
- rightLineFormat.setBackground(QColor(223, 255, 223));
- rightLineFormat.setProperty(QTextFormat::FullWidthSelection, true);
-
- QTextCharFormat rightCharFormat;
- rightCharFormat.setBackground(QColor(175, 255, 175));
- rightCharFormat.setProperty(QTextFormat::FullWidthSelection, true);
-
QPalette pal = m_leftEditor->extraArea()->palette();
pal.setCurrentColorGroup(QPalette::Active);
QTextCharFormat spanLineFormat;
spanLineFormat.setBackground(pal.color(QPalette::Background));
spanLineFormat.setProperty(QTextFormat::FullWidthSelection, true);
- QTextCharFormat chunkLineFormat;
- chunkLineFormat.setBackground(QColor(175, 215, 231));
- chunkLineFormat.setProperty(QTextFormat::FullWidthSelection, true);
-
- QTextCharFormat fileLineFormat;
- fileLineFormat.setBackground(QColor(255, 255, 0));
-// fileLineFormat.setBackground(QColor(130, 60, 0));
- fileLineFormat.setProperty(QTextFormat::FullWidthSelection, true);
-
int leftPos = 0;
int rightPos = 0;
QMap<int, int> leftLinePos;
@@ -1350,33 +1359,52 @@ void DiffEditorWidget::colorDiff(const QList<FileData> &fileDataList)
QTextCursor rightCursor = m_rightEditor->textCursor();
QList<QTextEdit::ExtraSelection> leftSelections
- = colorPositions(leftLineFormat, leftCursor, leftLinePos);
+ = colorPositions(m_leftLineFormat, leftCursor, leftLinePos);
leftSelections
+= colorPositions(spanLineFormat, leftCursor, leftSkippedPos);
leftSelections
- += colorPositions(chunkLineFormat, leftCursor, leftChunkPos);
+ += colorPositions(m_chunkLineFormat, leftCursor, leftChunkPos);
leftSelections
- += colorPositions(fileLineFormat, leftCursor, leftFilePos);
+ += colorPositions(m_fileLineFormat, leftCursor, leftFilePos);
leftSelections
- += colorPositions(leftCharFormat, leftCursor, leftCharPos);
+ += colorPositions(m_leftCharFormat, leftCursor, leftCharPos);
QList<QTextEdit::ExtraSelection> rightSelections
- = colorPositions(rightLineFormat, rightCursor, rightLinePos);
+ = colorPositions(m_rightLineFormat, rightCursor, rightLinePos);
rightSelections
+= colorPositions(spanLineFormat, rightCursor, rightSkippedPos);
rightSelections
- += colorPositions(chunkLineFormat, rightCursor, rightChunkPos);
+ += colorPositions(m_chunkLineFormat, rightCursor, rightChunkPos);
rightSelections
- += colorPositions(fileLineFormat, rightCursor, rightFilePos);
+ += colorPositions(m_fileLineFormat, rightCursor, rightFilePos);
rightSelections
- += colorPositions(rightCharFormat, rightCursor, rightCharPos);
-
- m_leftEditor->setExtraSelections(BaseTextEditorWidget::OtherSelection,
- m_leftEditor->extraSelections(BaseTextEditorWidget::OtherSelection)
- + leftSelections);
- m_rightEditor->setExtraSelections(BaseTextEditorWidget::OtherSelection,
- m_rightEditor->extraSelections(BaseTextEditorWidget::OtherSelection)
- + rightSelections);
+ += colorPositions(m_rightCharFormat, rightCursor, rightCharPos);
+
+ m_leftEditor->setExtraSelections(BaseTextEditorWidget::OtherSelection, leftSelections);
+ m_rightEditor->setExtraSelections(BaseTextEditorWidget::OtherSelection, rightSelections);
+}
+
+static QTextCharFormat fullWidthFormatForTextStyle(const TextEditor::FontSettings &fontSettings,
+ TextEditor::TextStyle textStyle)
+{
+ QTextCharFormat format = fontSettings.toTextCharFormat(textStyle);
+ format.setProperty(QTextFormat::FullWidthSelection, true);
+ return format;
+}
+
+void DiffEditorWidget::setFontSettings(const TextEditor::FontSettings &fontSettings)
+{
+ m_leftEditor->setFontSettings(fontSettings);
+ m_rightEditor->setFontSettings(fontSettings);
+
+ m_fileLineFormat = fullWidthFormatForTextStyle(fontSettings, C_DIFF_FILE_LINE);
+ m_chunkLineFormat = fullWidthFormatForTextStyle(fontSettings, C_DIFF_CONTEXT_LINE);
+ m_leftLineFormat = fullWidthFormatForTextStyle(fontSettings, C_DIFF_SOURCE_LINE);
+ m_leftCharFormat = fullWidthFormatForTextStyle(fontSettings, C_DIFF_SOURCE_CHAR);
+ m_rightLineFormat = fullWidthFormatForTextStyle(fontSettings, C_DIFF_DEST_LINE);
+ m_rightCharFormat = fullWidthFormatForTextStyle(fontSettings, C_DIFF_DEST_CHAR);
+
+ colorDiff(m_contextFileData);
}
void DiffEditorWidget::leftVSliderChanged()
diff --git a/src/plugins/diffeditor/diffeditorwidget.h b/src/plugins/diffeditor/diffeditorwidget.h
index 28affe26c8..5bb4e1cb7f 100644
--- a/src/plugins/diffeditor/diffeditorwidget.h
+++ b/src/plugins/diffeditor/diffeditorwidget.h
@@ -38,6 +38,7 @@
namespace TextEditor {
class BaseTextEditorWidget;
class SnippetEditorWidget;
+class FontSettings;
}
QT_BEGIN_NAMESPACE
@@ -101,6 +102,7 @@ protected:
TextEditor::SnippetEditorWidget *rightEditor() const;
private slots:
+ void setFontSettings(const TextEditor::FontSettings &fontSettings);
void leftVSliderChanged();
void rightVSliderChanged();
void leftHSliderChanged();
@@ -146,6 +148,13 @@ private:
bool m_syncScrollBars;
bool m_foldingBlocker;
+
+ QTextCharFormat m_fileLineFormat;
+ QTextCharFormat m_chunkLineFormat;
+ QTextCharFormat m_leftLineFormat;
+ QTextCharFormat m_leftCharFormat;
+ QTextCharFormat m_rightLineFormat;
+ QTextCharFormat m_rightCharFormat;
};
} // namespace DiffEditor
diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp
index 30c7d44b08..a9b9df101f 100644
--- a/src/plugins/texteditor/basetexteditor.cpp
+++ b/src/plugins/texteditor/basetexteditor.cpp
@@ -3517,9 +3517,13 @@ void BaseTextEditorWidget::paintEvent(QPaintEvent *e)
bool selectThis = (hasSelection
&& nextBlock.position() >= selectionStart
&& nextBlock.position() < selectionEnd);
+ painter.save();
if (selectThis) {
- painter.save();
painter.setBrush(palette().highlight());
+ } else {
+ QColor rc = replacementPenColor(block.blockNumber());
+ if (rc.isValid())
+ painter.setPen(rc);
}
QTextLayout *layout = block.layout();
@@ -3566,8 +3570,7 @@ void BaseTextEditorWidget::paintEvent(QPaintEvent *e)
if (selectThis)
painter.setPen(palette().highlightedText().color());
painter.drawText(collapseRect, Qt::AlignCenter, replacement);
- if (selectThis)
- painter.restore();
+ painter.restore();
}
}
@@ -6206,6 +6209,12 @@ bool BaseTextEditorWidget::replacementVisible(int blockNumber) const
return true;
}
+QColor BaseTextEditorWidget::replacementPenColor(int blockNumber) const
+{
+ Q_UNUSED(blockNumber)
+ return QColor();
+}
+
void BaseTextEditorWidget::appendMenuActionsFromContext(QMenu *menu, const Core::Id menuContextId)
{
Core::ActionContainer *mcontext = Core::ActionManager::actionContainer(menuContextId);
diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h
index 4a1f17e571..850eb64eee 100644
--- a/src/plugins/texteditor/basetexteditor.h
+++ b/src/plugins/texteditor/basetexteditor.h
@@ -354,6 +354,7 @@ protected:
virtual int lineNumberDigits() const;
virtual bool selectionVisible(int blockNumber) const;
virtual bool replacementVisible(int blockNumber) const;
+ virtual QColor replacementPenColor(int blockNumber) const;
static QString msgTextTooLarge(quint64 size);
private:
diff --git a/src/plugins/texteditor/colorscheme.cpp b/src/plugins/texteditor/colorscheme.cpp
index 5d61039e6c..1ac40cdfdf 100644
--- a/src/plugins/texteditor/colorscheme.cpp
+++ b/src/plugins/texteditor/colorscheme.cpp
@@ -51,6 +51,14 @@ Format::Format() :
{
}
+Format::Format(const QColor &foreground, const QColor &background) :
+ m_foreground(foreground),
+ m_background(background),
+ m_bold(false),
+ m_italic(false)
+{
+}
+
void Format::setForeground(const QColor &foreground)
{
m_foreground = foreground;
diff --git a/src/plugins/texteditor/colorscheme.h b/src/plugins/texteditor/colorscheme.h
index 082cc9f57a..12317fef98 100644
--- a/src/plugins/texteditor/colorscheme.h
+++ b/src/plugins/texteditor/colorscheme.h
@@ -48,6 +48,7 @@ class TEXTEDITOR_EXPORT Format
{
public:
Format();
+ Format(const QColor &foreground, const QColor &background);
QColor foreground() const { return m_foreground; }
void setForeground(const QColor &foreground);
diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp
index 80eb613577..a1a52cfd79 100644
--- a/src/plugins/texteditor/fontsettingspage.cpp
+++ b/src/plugins/texteditor/fontsettingspage.cpp
@@ -298,6 +298,13 @@ QColor FormatDescription::background() const
return QColor(255, 100, 100);
} else if (m_id == C_DISABLED_CODE) {
return QColor(239, 239, 239);
+ } else if (m_id == C_DIFF_FILE_LINE
+ || m_id == C_DIFF_CONTEXT_LINE
+ || m_id == C_DIFF_SOURCE_LINE
+ || m_id == C_DIFF_SOURCE_CHAR
+ || m_id == C_DIFF_DEST_LINE
+ || m_id == C_DIFF_DEST_CHAR) {
+ return m_format.background();
}
return QColor(); // invalid color
}
diff --git a/src/plugins/texteditor/texteditorconstants.cpp b/src/plugins/texteditor/texteditorconstants.cpp
index baa8c41356..6c6166a241 100644
--- a/src/plugins/texteditor/texteditorconstants.cpp
+++ b/src/plugins/texteditor/texteditorconstants.cpp
@@ -87,6 +87,13 @@ const char *nameForStyle(TextStyle style)
case C_DIFF_FILE: return "DiffFile";
case C_DIFF_LOCATION: return "DiffLocation";
+ case C_DIFF_FILE_LINE: return "DillFileLine";
+ case C_DIFF_CONTEXT_LINE: return "DiffContextLine";
+ case C_DIFF_SOURCE_LINE: return "DiffSourceLine";
+ case C_DIFF_SOURCE_CHAR: return "DiffSourceChar";
+ case C_DIFF_DEST_LINE: return "DiffDestLine";
+ case C_DIFF_DEST_CHAR: return "DiffDestChar";
+
case C_LAST_STYLE_SENTINEL: return "LastStyleSentinel";
}
diff --git a/src/plugins/texteditor/texteditorconstants.h b/src/plugins/texteditor/texteditorconstants.h
index 7a9edef2f7..e65b158d79 100644
--- a/src/plugins/texteditor/texteditorconstants.h
+++ b/src/plugins/texteditor/texteditorconstants.h
@@ -86,6 +86,13 @@ enum TextStyle {
C_DIFF_FILE,
C_DIFF_LOCATION,
+ C_DIFF_FILE_LINE,
+ C_DIFF_CONTEXT_LINE,
+ C_DIFF_SOURCE_LINE,
+ C_DIFF_SOURCE_CHAR,
+ C_DIFF_DEST_LINE,
+ C_DIFF_DEST_CHAR,
+
C_LAST_STYLE_SENTINEL
};
diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp
index 6bbf02464f..cbdf323387 100644
--- a/src/plugins/texteditor/texteditorsettings.cpp
+++ b/src/plugins/texteditor/texteditorsettings.cpp
@@ -253,6 +253,32 @@ TextEditorSettings::TextEditorSettings(QObject *parent)
tr("Location in the files where the difference is "
"(in diff editor)."), Qt::blue));
+ // New diff categories
+ formatDescr.append(FormatDescription(C_DIFF_FILE_LINE, tr("Diff File Line"),
+ tr("Applied to lines with file information "
+ "in differences (in side-by-side diff editor)."),
+ Format(QColor(), QColor(255, 255, 0))));
+ formatDescr.append(FormatDescription(C_DIFF_CONTEXT_LINE, tr("Diff Context Line"),
+ tr("Applied to lines describing hidden context "
+ "in differences (in side-by-side diff editor)."),
+ Format(QColor(), QColor(175, 215, 231))));
+ formatDescr.append(FormatDescription(C_DIFF_SOURCE_LINE, tr("Diff Source Line"),
+ tr("Applied to source lines with changes "
+ "in differences (in side-by-side diff editor)."),
+ Format(QColor(), QColor(255, 223, 223))));
+ formatDescr.append(FormatDescription(C_DIFF_SOURCE_CHAR, tr("Diff Source Character"),
+ tr("Applied to removed characters "
+ "in differences (in side-by-side diff editor)."),
+ Format(QColor(), QColor(255, 175, 175))));
+ formatDescr.append(FormatDescription(C_DIFF_DEST_LINE, tr("Diff Destination Line"),
+ tr("Applied to destination lines with changes "
+ "in differences (in side-by-side diff editor)."),
+ Format(QColor(), QColor(223, 255, 223))));
+ formatDescr.append(FormatDescription(C_DIFF_DEST_CHAR, tr("Diff Destination Character"),
+ tr("Applied to added characters "
+ "in differences (in side-by-side diff editor)."),
+ Format(QColor(), QColor(175, 255, 175))));
+
m_d->m_fontSettingsPage = new FontSettingsPage(formatDescr,
Constants::TEXT_EDITOR_FONT_SETTINGS,
this);