Editor: Allow to open links in a new split.

This changes current behavior while opening links. Link is now opened in
next split by default. If you use CTRL+Click to open links, it will also
open in next split. However, by using CTRL+ALT+click it will open in
current split.

There are two new checkboxes in Tools/Options/Text Editor/Display:
- "Open Links in New Split" - if it is checked, links will not be opened
in current split. However, if document with link is already opened, it
will be used to open the split
- "Force open links in next split" - Links will always open in next
split, even if their document is already opened somewhere else.

Task-number: QTCREATORBUG-8117
Change-Id: Ib99075b55d9e9683ed2c2386767227457de0a3fc
Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
Petar Perisin
2012-11-01 03:43:28 +01:00
committed by David Schulz
parent c0e7b65db3
commit 39e9c5ef20
10 changed files with 276 additions and 51 deletions

View File

@@ -45,6 +45,8 @@ static const char highlightMatchingParenthesesKey[] = "HightlightMatchingParenth
static const char markTextChangesKey[] = "MarkTextChanges";
static const char autoFoldFirstCommentKey[] = "AutoFoldFirstComment";
static const char centerCursorOnScrollKey[] = "CenterCursorOnScroll";
static const char openLinksInNextSplitKey[] = "OpenLinksInNextSplitKey";
static const char forceOpenLinksInNextSplitKey[] = "ForceOpenLinksInNextSplitKey";
static const char groupPostfix[] = "DisplaySettings";
namespace TextEditor {
@@ -62,7 +64,9 @@ DisplaySettings::DisplaySettings() :
m_highlightMatchingParentheses(true),
m_markTextChanges(true),
m_autoFoldFirstComment(true),
m_centerCursorOnScroll(false)
m_centerCursorOnScroll(false),
m_openLinksInNextSplit(true),
m_forceOpenLinksInNextSplit(false)
{
}
@@ -85,6 +89,8 @@ void DisplaySettings::toSettings(const QString &category, QSettings *s) const
s->setValue(QLatin1String(markTextChangesKey), m_markTextChanges);
s->setValue(QLatin1String(autoFoldFirstCommentKey), m_autoFoldFirstComment);
s->setValue(QLatin1String(centerCursorOnScrollKey), m_centerCursorOnScroll);
s->setValue(QLatin1String(openLinksInNextSplitKey), m_openLinksInNextSplit);
s->setValue(QLatin1String(forceOpenLinksInNextSplitKey), m_forceOpenLinksInNextSplit);
s->endGroup();
}
@@ -110,6 +116,8 @@ void DisplaySettings::fromSettings(const QString &category, const QSettings *s)
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();
m_openLinksInNextSplit = s->value(group + QLatin1String(openLinksInNextSplitKey), m_openLinksInNextSplit).toBool();
m_forceOpenLinksInNextSplit = s->value(group + QLatin1String(forceOpenLinksInNextSplitKey), m_forceOpenLinksInNextSplit).toBool();
}
bool DisplaySettings::equals(const DisplaySettings &ds) const
@@ -127,6 +135,8 @@ bool DisplaySettings::equals(const DisplaySettings &ds) const
&& m_markTextChanges == ds.m_markTextChanges
&& m_autoFoldFirstComment== ds.m_autoFoldFirstComment
&& m_centerCursorOnScroll == ds.m_centerCursorOnScroll
&& m_openLinksInNextSplit == ds.m_openLinksInNextSplit
&& m_forceOpenLinksInNextSplit == ds.m_forceOpenLinksInNextSplit
;
}