From d34bf41a37adcab0904eabb08b9026b7a5fd97a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= <thorbjorn.lindeijer@nokia.com> Date: Thu, 16 Jul 2009 11:27:02 +0200 Subject: [PATCH] Added the option to turn off marking of text changes --- dist/changes-1.3.0 | 1 + src/plugins/texteditor/basetexteditor.cpp | 3 +- src/plugins/texteditor/displaysettings.cpp | 7 ++- src/plugins/texteditor/displaysettings.h | 1 + .../texteditor/displaysettingspage.cpp | 2 + src/plugins/texteditor/displaysettingspage.ui | 43 +++++++++++-------- 6 files changed, 37 insertions(+), 20 deletions(-) diff --git a/dist/changes-1.3.0 b/dist/changes-1.3.0 index 3db748a069e..c103d4eec9f 100644 --- a/dist/changes-1.3.0 +++ b/dist/changes-1.3.0 @@ -18,6 +18,7 @@ General: Editing: * Added support for text editor color schemes * Added highlighting of uses of the symbol under the cursor + * Added the option to turn off marking of text changes Project support: * Added support for adding and removing files from a generic Makefile-based diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 414e5c7bb26..72c1f48b118 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -2449,7 +2449,7 @@ void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e) painter.setPen(QPen(Qt::darkGreen, 2)); else painter.setPen(QPen(Qt::red, 2)); - painter.drawLine(extraAreaWidth-1, top, extraAreaWidth-1, bottom-1); + painter.drawLine(extraAreaWidth - 1, top, extraAreaWidth - 1, bottom - 1); painter.restore(); } @@ -3921,6 +3921,7 @@ void BaseTextEditor::setDisplaySettings(const DisplaySettings &ds) setVisibleWrapColumn(ds.m_showWrapColumn ? ds.m_wrapColumn : 0); setCodeFoldingVisible(ds.m_displayFoldingMarkers); setHighlightCurrentLine(ds.m_highlightCurrentLine); + setRevisionsVisible(ds.m_markTextChanges); if (d->m_displaySettings.m_visualizeWhitespace != ds.m_visualizeWhitespace) { if (QSyntaxHighlighter *highlighter = baseTextDocument()->syntaxHighlighter()) diff --git a/src/plugins/texteditor/displaysettings.cpp b/src/plugins/texteditor/displaysettings.cpp index 3ec7c2ad71e..51dea08de70 100644 --- a/src/plugins/texteditor/displaysettings.cpp +++ b/src/plugins/texteditor/displaysettings.cpp @@ -44,6 +44,7 @@ static const char * const highlightCurrentLineKey = "HighlightCurrentLineKeyV2"; static const char * const highlightBlocksKey = "HighlightBlocksKey"; static const char * const animateMatchingParenthesesKey= "AnimateMatchingParenthesesKey"; static const char * const mouseNavigationKey = "MouseNavigation"; +static const char * const markTextChangesKey = "MarkTextChanges"; static const char * const groupPostfix = "DisplaySettings"; namespace TextEditor { @@ -58,7 +59,8 @@ DisplaySettings::DisplaySettings() : m_highlightCurrentLine(false), m_highlightBlocks(false), m_animateMatchingParentheses(true), - m_mouseNavigation(true) + m_mouseNavigation(true), + m_markTextChanges(true) { } @@ -78,6 +80,7 @@ void DisplaySettings::toSettings(const QString &category, QSettings *s) const s->setValue(QLatin1String(highlightBlocksKey), m_highlightBlocks); s->setValue(QLatin1String(animateMatchingParenthesesKey), m_animateMatchingParentheses); s->setValue(QLatin1String(mouseNavigationKey), m_mouseNavigation); + s->setValue(QLatin1String(markTextChangesKey), m_markTextChanges); s->endGroup(); } @@ -100,6 +103,7 @@ void DisplaySettings::fromSettings(const QString &category, const QSettings *s) m_highlightBlocks = s->value(group + QLatin1String(highlightBlocksKey), m_highlightBlocks).toBool(); m_animateMatchingParentheses = s->value(group + QLatin1String(animateMatchingParenthesesKey), m_animateMatchingParentheses).toBool(); m_mouseNavigation = s->value(group + QLatin1String(mouseNavigationKey), m_mouseNavigation).toBool(); + m_markTextChanges = s->value(group + QLatin1String(markTextChangesKey), m_markTextChanges).toBool(); } bool DisplaySettings::equals(const DisplaySettings &ds) const @@ -114,6 +118,7 @@ bool DisplaySettings::equals(const DisplaySettings &ds) const && m_highlightBlocks == ds.m_highlightBlocks && m_animateMatchingParentheses == ds.m_animateMatchingParentheses && m_mouseNavigation == ds.m_mouseNavigation + && m_markTextChanges == ds.m_markTextChanges ; } diff --git a/src/plugins/texteditor/displaysettings.h b/src/plugins/texteditor/displaysettings.h index 7cbc190228a..3068714c25e 100644 --- a/src/plugins/texteditor/displaysettings.h +++ b/src/plugins/texteditor/displaysettings.h @@ -55,6 +55,7 @@ struct TEXTEDITOR_EXPORT DisplaySettings bool m_highlightBlocks; bool m_animateMatchingParentheses; bool m_mouseNavigation; + bool m_markTextChanges; bool equals(const DisplaySettings &ds) const; }; diff --git a/src/plugins/texteditor/displaysettingspage.cpp b/src/plugins/texteditor/displaysettingspage.cpp index c55db797caa..0cd6fd22094 100644 --- a/src/plugins/texteditor/displaysettingspage.cpp +++ b/src/plugins/texteditor/displaysettingspage.cpp @@ -125,6 +125,7 @@ void DisplaySettingsPage::settingsFromUI(DisplaySettings &displaySettings) const displaySettings.m_highlightBlocks = m_d->m_page.highlightBlocks->isChecked(); displaySettings.m_animateMatchingParentheses = m_d->m_page.animateMatchingParentheses->isChecked(); displaySettings.m_mouseNavigation = m_d->m_page.mouseNavigation->isChecked(); + displaySettings.m_markTextChanges = m_d->m_page.markTextChanges->isChecked(); } void DisplaySettingsPage::settingsToUI() @@ -140,6 +141,7 @@ void DisplaySettingsPage::settingsToUI() m_d->m_page.highlightBlocks->setChecked(displaySettings.m_highlightBlocks); m_d->m_page.animateMatchingParentheses->setChecked(displaySettings.m_animateMatchingParentheses); m_d->m_page.mouseNavigation->setChecked(displaySettings.m_mouseNavigation); + m_d->m_page.markTextChanges->setChecked(displaySettings.m_markTextChanges); } DisplaySettings DisplaySettingsPage::displaySettings() const diff --git a/src/plugins/texteditor/displaysettingspage.ui b/src/plugins/texteditor/displaysettingspage.ui index c1e984389c3..8bb8ab13522 100644 --- a/src/plugins/texteditor/displaysettingspage.ui +++ b/src/plugins/texteditor/displaysettingspage.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>381</width> - <height>402</height> + <width>448</width> + <height>330</height> </rect> </property> <layout class="QGridLayout" name="gridLayout_3"> @@ -29,46 +29,53 @@ <property name="title"> <string>Display</string> </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> <widget class="QCheckBox" name="displayLineNumbers"> <property name="text"> <string>Display line &numbers</string> </property> </widget> </item> - <item> + <item row="0" column="1"> + <widget class="QCheckBox" name="highlightCurrentLine"> + <property name="text"> + <string>Highlight current &line</string> + </property> + </widget> + </item> + <item row="1" column="0"> <widget class="QCheckBox" name="displayFoldingMarkers"> <property name="text"> <string>Display &folding markers</string> </property> </widget> </item> - <item> - <widget class="QCheckBox" name="visualizeWhitespace"> - <property name="toolTip"> - <string>Show tabs and spaces.</string> - </property> + <item row="1" column="1"> + <widget class="QCheckBox" name="highlightBlocks"> <property name="text"> - <string>&Visualize whitespace</string> + <string>Highlight &blocks</string> </property> </widget> </item> - <item> - <widget class="QCheckBox" name="highlightCurrentLine"> + <item row="2" column="0"> + <widget class="QCheckBox" name="markTextChanges"> <property name="text"> - <string>Highlight current &line</string> + <string>Mark text changes</string> </property> </widget> </item> - <item> - <widget class="QCheckBox" name="highlightBlocks"> + <item row="4" column="0"> + <widget class="QCheckBox" name="visualizeWhitespace"> + <property name="toolTip"> + <string>Show tabs and spaces.</string> + </property> <property name="text"> - <string>Highlight &blocks</string> + <string>&Visualize whitespace</string> </property> </widget> </item> - <item> + <item row="2" column="1"> <widget class="QCheckBox" name="animateMatchingParentheses"> <property name="text"> <string>Animate matching parentheses</string> -- GitLab