Add "center cursor on scroll" option for the base text editor

This commit is contained in:
mae
2010-04-14 11:49:58 +02:00
parent 212f18bebf
commit be92567948
5 changed files with 20 additions and 3 deletions

View File

@@ -42,7 +42,8 @@ static const char * const highlightCurrentLineKey = "HighlightCurrentLine2Key";
static const char * const highlightBlocksKey = "HighlightBlocksKey";
static const char * const animateMatchingParenthesesKey= "AnimateMatchingParenthesesKey";
static const char * const markTextChangesKey = "MarkTextChanges";
static const char * const autoFoldFirstCommentKey= "AutoFoldFirstComment";
static const char * const autoFoldFirstCommentKey = "AutoFoldFirstComment";
static const char * const centerCursorOnScrollKey = "CenterCursorOnScroll";
static const char * const groupPostfix = "DisplaySettings";
namespace TextEditor {
@@ -58,7 +59,8 @@ DisplaySettings::DisplaySettings() :
m_highlightBlocks(false),
m_animateMatchingParentheses(true),
m_markTextChanges(true),
m_autoFoldFirstComment(true)
m_autoFoldFirstComment(true),
m_centerCursorOnScroll(false)
{
}
@@ -79,6 +81,7 @@ void DisplaySettings::toSettings(const QString &category, QSettings *s) const
s->setValue(QLatin1String(animateMatchingParenthesesKey), m_animateMatchingParentheses);
s->setValue(QLatin1String(markTextChangesKey), m_markTextChanges);
s->setValue(QLatin1String(autoFoldFirstCommentKey), m_autoFoldFirstComment);
s->setValue(QLatin1String(centerCursorOnScrollKey), m_centerCursorOnScroll);
s->endGroup();
}
@@ -102,6 +105,7 @@ void DisplaySettings::fromSettings(const QString &category, const QSettings *s)
m_animateMatchingParentheses = s->value(group + QLatin1String(animateMatchingParenthesesKey), m_animateMatchingParentheses).toBool();
m_markTextChanges = s->value(group + QLatin1String(markTextChangesKey), m_markTextChanges).toBool();
m_autoFoldFirstComment = s->value(group + QLatin1String(autoFoldFirstCommentKey), m_autoFoldFirstComment).toBool();
m_centerCursorOnScroll = s->value(group + QLatin1String(centerCursorOnScrollKey), m_centerCursorOnScroll).toBool();
}
bool DisplaySettings::equals(const DisplaySettings &ds) const
@@ -117,6 +121,7 @@ bool DisplaySettings::equals(const DisplaySettings &ds) const
&& m_animateMatchingParentheses == ds.m_animateMatchingParentheses
&& m_markTextChanges == ds.m_markTextChanges
&& m_autoFoldFirstComment== ds.m_autoFoldFirstComment
&& m_centerCursorOnScroll == ds.m_centerCursorOnScroll
;
}