forked from qt-creator/qt-creator
Moved the mouse navigation option to the Behaviour settings page
It used to be hidden on the Display settings page. Task-number: QTCREATORBUG-135
This commit is contained in:
@@ -34,6 +34,7 @@
|
|||||||
#include "texteditorplugin.h"
|
#include "texteditorplugin.h"
|
||||||
#include "completionsupport.h"
|
#include "completionsupport.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "behaviorsettings.h"
|
||||||
#include "basetextdocument.h"
|
#include "basetextdocument.h"
|
||||||
#include "basetexteditor_p.h"
|
#include "basetexteditor_p.h"
|
||||||
#include "codecselector.h"
|
#include "codecselector.h"
|
||||||
@@ -48,8 +49,8 @@
|
|||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <find/basetextfind.h>
|
#include <find/basetextfind.h>
|
||||||
#include <utils/stylehelper.h>
|
#include <utils/stylehelper.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <utils/linecolumnlabel.h>
|
#include <utils/linecolumnlabel.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -4659,7 +4660,6 @@ void BaseTextEditor::setDisplaySettings(const DisplaySettings &ds)
|
|||||||
setCodeFoldingVisible(ds.m_displayFoldingMarkers);
|
setCodeFoldingVisible(ds.m_displayFoldingMarkers);
|
||||||
setHighlightCurrentLine(ds.m_highlightCurrentLine);
|
setHighlightCurrentLine(ds.m_highlightCurrentLine);
|
||||||
setRevisionsVisible(ds.m_markTextChanges);
|
setRevisionsVisible(ds.m_markTextChanges);
|
||||||
setMouseNavigationEnabled(ds.m_mouseNavigation);
|
|
||||||
|
|
||||||
if (d->m_displaySettings.m_visualizeWhitespace != ds.m_visualizeWhitespace) {
|
if (d->m_displaySettings.m_visualizeWhitespace != ds.m_visualizeWhitespace) {
|
||||||
if (QSyntaxHighlighter *highlighter = baseTextDocument()->syntaxHighlighter())
|
if (QSyntaxHighlighter *highlighter = baseTextDocument()->syntaxHighlighter())
|
||||||
@@ -4684,6 +4684,11 @@ void BaseTextEditor::setDisplaySettings(const DisplaySettings &ds)
|
|||||||
extraArea()->update();
|
extraArea()->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BaseTextEditor::setBehaviorSettings(const TextEditor::BehaviorSettings &bs)
|
||||||
|
{
|
||||||
|
setMouseNavigationEnabled(bs.m_mouseNavigation);
|
||||||
|
}
|
||||||
|
|
||||||
void BaseTextEditor::setStorageSettings(const StorageSettings &storageSettings)
|
void BaseTextEditor::setStorageSettings(const StorageSettings &storageSettings)
|
||||||
{
|
{
|
||||||
d->m_document->setStorageSettings(storageSettings);
|
d->m_document->setStorageSettings(storageSettings);
|
||||||
|
@@ -62,6 +62,7 @@ class ITextMarkable;
|
|||||||
class TextEditorActionHandler;
|
class TextEditorActionHandler;
|
||||||
class BaseTextDocument;
|
class BaseTextDocument;
|
||||||
class FontSettings;
|
class FontSettings;
|
||||||
|
struct BehaviorSettings;
|
||||||
struct StorageSettings;
|
struct StorageSettings;
|
||||||
|
|
||||||
struct Parenthesis;
|
struct Parenthesis;
|
||||||
@@ -505,6 +506,7 @@ public slots:
|
|||||||
void setFontSettingsIfVisible(const TextEditor::FontSettings &);
|
void setFontSettingsIfVisible(const TextEditor::FontSettings &);
|
||||||
virtual void setTabSettings(const TextEditor::TabSettings &);
|
virtual void setTabSettings(const TextEditor::TabSettings &);
|
||||||
virtual void setDisplaySettings(const TextEditor::DisplaySettings &);
|
virtual void setDisplaySettings(const TextEditor::DisplaySettings &);
|
||||||
|
virtual void setBehaviorSettings(const TextEditor::BehaviorSettings &);
|
||||||
virtual void setStorageSettings(const TextEditor::StorageSettings &);
|
virtual void setStorageSettings(const TextEditor::StorageSettings &);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
74
src/plugins/texteditor/behaviorsettings.cpp
Normal file
74
src/plugins/texteditor/behaviorsettings.cpp
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
** Commercial Usage
|
||||||
|
**
|
||||||
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||||
|
** accordance with the Qt Commercial License Agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Nokia.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** If you are unsure which license is appropriate for your use, please
|
||||||
|
** contact the sales department at http://qt.nokia.com/contact.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#include "behaviorsettings.h"
|
||||||
|
|
||||||
|
#include <QtCore/QSettings>
|
||||||
|
#include <QtCore/QString>
|
||||||
|
|
||||||
|
static const char * const mouseNavigationKey = "MouseNavigation";
|
||||||
|
static const char * const groupPostfix = "BehaviorSettings";
|
||||||
|
|
||||||
|
namespace TextEditor {
|
||||||
|
|
||||||
|
BehaviorSettings::BehaviorSettings() :
|
||||||
|
m_mouseNavigation(true)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void BehaviorSettings::toSettings(const QString &category, QSettings *s) const
|
||||||
|
{
|
||||||
|
QString group = QLatin1String(groupPostfix);
|
||||||
|
if (!category.isEmpty())
|
||||||
|
group.insert(0, category);
|
||||||
|
s->beginGroup(group);
|
||||||
|
s->setValue(QLatin1String(mouseNavigationKey), m_mouseNavigation);
|
||||||
|
s->endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BehaviorSettings::fromSettings(const QString &category, const QSettings *s)
|
||||||
|
{
|
||||||
|
QString group = QLatin1String(groupPostfix);
|
||||||
|
if (!category.isEmpty())
|
||||||
|
group.insert(0, category);
|
||||||
|
group += QLatin1Char('/');
|
||||||
|
|
||||||
|
*this = BehaviorSettings(); // Assign defaults
|
||||||
|
|
||||||
|
m_mouseNavigation = s->value(group + QLatin1String(mouseNavigationKey), m_mouseNavigation).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BehaviorSettings::equals(const BehaviorSettings &ds) const
|
||||||
|
{
|
||||||
|
return m_mouseNavigation == ds.m_mouseNavigation
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace TextEditor
|
||||||
|
|
62
src/plugins/texteditor/behaviorsettings.h
Normal file
62
src/plugins/texteditor/behaviorsettings.h
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
** Commercial Usage
|
||||||
|
**
|
||||||
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||||
|
** accordance with the Qt Commercial License Agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Nokia.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** If you are unsure which license is appropriate for your use, please
|
||||||
|
** contact the sales department at http://qt.nokia.com/contact.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#ifndef BEHAVIORSETTINGS_H
|
||||||
|
#define BEHAVIORSETTINGS_H
|
||||||
|
|
||||||
|
#include "texteditor_global.h"
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QSettings;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
namespace TextEditor {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Settings that describe how the text editor behaves. This does not include
|
||||||
|
* the TabSettings and StorageSettings.
|
||||||
|
*/
|
||||||
|
struct TEXTEDITOR_EXPORT BehaviorSettings
|
||||||
|
{
|
||||||
|
BehaviorSettings();
|
||||||
|
|
||||||
|
void toSettings(const QString &category, QSettings *s) const;
|
||||||
|
void fromSettings(const QString &category, const QSettings *s);
|
||||||
|
|
||||||
|
bool equals(const BehaviorSettings &bs) const;
|
||||||
|
|
||||||
|
bool m_mouseNavigation;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline bool operator==(const BehaviorSettings &t1, const BehaviorSettings &t2) { return t1.equals(t2); }
|
||||||
|
inline bool operator!=(const BehaviorSettings &t1, const BehaviorSettings &t2) { return !t1.equals(t2); }
|
||||||
|
|
||||||
|
} // namespace TextEditor
|
||||||
|
|
||||||
|
#endif // BEHAVIORSETTINGS_H
|
@@ -28,6 +28,8 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "behaviorsettingspage.h"
|
#include "behaviorsettingspage.h"
|
||||||
|
|
||||||
|
#include "behaviorsettings.h"
|
||||||
#include "storagesettings.h"
|
#include "storagesettings.h"
|
||||||
#include "tabsettings.h"
|
#include "tabsettings.h"
|
||||||
#include "ui_behaviorsettingspage.h"
|
#include "ui_behaviorsettingspage.h"
|
||||||
@@ -45,8 +47,11 @@ struct BehaviorSettingsPage::BehaviorSettingsPagePrivate
|
|||||||
|
|
||||||
const BehaviorSettingsPageParameters m_parameters;
|
const BehaviorSettingsPageParameters m_parameters;
|
||||||
Ui::BehaviorSettingsPage m_page;
|
Ui::BehaviorSettingsPage m_page;
|
||||||
|
|
||||||
TabSettings m_tabSettings;
|
TabSettings m_tabSettings;
|
||||||
StorageSettings m_storageSettings;
|
StorageSettings m_storageSettings;
|
||||||
|
BehaviorSettings m_behaviorSettings;
|
||||||
|
|
||||||
QString m_searchKeywords;
|
QString m_searchKeywords;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -57,11 +62,12 @@ BehaviorSettingsPage::BehaviorSettingsPagePrivate::BehaviorSettingsPagePrivate
|
|||||||
if (const QSettings *s = Core::ICore::instance()->settings()) {
|
if (const QSettings *s = Core::ICore::instance()->settings()) {
|
||||||
m_tabSettings.fromSettings(m_parameters.settingsPrefix, s);
|
m_tabSettings.fromSettings(m_parameters.settingsPrefix, s);
|
||||||
m_storageSettings.fromSettings(m_parameters.settingsPrefix, s);
|
m_storageSettings.fromSettings(m_parameters.settingsPrefix, s);
|
||||||
|
m_behaviorSettings.fromSettings(m_parameters.settingsPrefix, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BehaviorSettingsPage::BehaviorSettingsPage(const BehaviorSettingsPageParameters &p,
|
BehaviorSettingsPage::BehaviorSettingsPage(const BehaviorSettingsPageParameters &p,
|
||||||
QObject *parent)
|
QObject *parent)
|
||||||
: Core::IOptionsPage(parent),
|
: Core::IOptionsPage(parent),
|
||||||
m_d(new BehaviorSettingsPagePrivate(p))
|
m_d(new BehaviorSettingsPagePrivate(p))
|
||||||
{
|
{
|
||||||
@@ -102,8 +108,10 @@ QWidget *BehaviorSettingsPage::createPage(QWidget *parent)
|
|||||||
<< ' ' << m_d->m_page.smartBackspace->text()
|
<< ' ' << m_d->m_page.smartBackspace->text()
|
||||||
<< ' ' << m_d->m_page.cleanWhitespace->text()
|
<< ' ' << m_d->m_page.cleanWhitespace->text()
|
||||||
<< ' ' << m_d->m_page.addFinalNewLine->text()
|
<< ' ' << m_d->m_page.addFinalNewLine->text()
|
||||||
|
<< ' ' << m_d->m_page.mouseNavigation->text()
|
||||||
<< ' ' << m_d->m_page.groupBoxTabAndIndentSettings->title()
|
<< ' ' << m_d->m_page.groupBoxTabAndIndentSettings->title()
|
||||||
<< ' ' << m_d->m_page.groupBoxStorageSettings->title();
|
<< ' ' << m_d->m_page.groupBoxStorageSettings->title()
|
||||||
|
<< ' ' << m_d->m_page.groupBoxNavigation->title();
|
||||||
m_d->m_searchKeywords.remove(QLatin1Char('&'));
|
m_d->m_searchKeywords.remove(QLatin1Char('&'));
|
||||||
}
|
}
|
||||||
return w;
|
return w;
|
||||||
@@ -113,8 +121,9 @@ void BehaviorSettingsPage::apply()
|
|||||||
{
|
{
|
||||||
TabSettings newTabSettings;
|
TabSettings newTabSettings;
|
||||||
StorageSettings newStorageSettings;
|
StorageSettings newStorageSettings;
|
||||||
|
BehaviorSettings newBehaviorSettings;
|
||||||
|
|
||||||
settingsFromUI(newTabSettings, newStorageSettings);
|
settingsFromUI(newTabSettings, newStorageSettings, newBehaviorSettings);
|
||||||
|
|
||||||
Core::ICore *core = Core::ICore::instance();
|
Core::ICore *core = Core::ICore::instance();
|
||||||
QSettings *s = core->settings();
|
QSettings *s = core->settings();
|
||||||
@@ -134,10 +143,19 @@ void BehaviorSettingsPage::apply()
|
|||||||
|
|
||||||
emit storageSettingsChanged(newStorageSettings);
|
emit storageSettingsChanged(newStorageSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (newBehaviorSettings != m_d->m_behaviorSettings) {
|
||||||
|
m_d->m_behaviorSettings = newBehaviorSettings;
|
||||||
|
if (s)
|
||||||
|
m_d->m_behaviorSettings.toSettings(m_d->m_parameters.settingsPrefix, s);
|
||||||
|
|
||||||
|
emit behaviorSettingsChanged(newBehaviorSettings);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BehaviorSettingsPage::settingsFromUI(TabSettings &tabSettings,
|
void BehaviorSettingsPage::settingsFromUI(TabSettings &tabSettings,
|
||||||
StorageSettings &storageSettings) const
|
StorageSettings &storageSettings,
|
||||||
|
BehaviorSettings &behaviorSettings) const
|
||||||
{
|
{
|
||||||
tabSettings.m_spacesForTabs = m_d->m_page.insertSpaces->isChecked();
|
tabSettings.m_spacesForTabs = m_d->m_page.insertSpaces->isChecked();
|
||||||
tabSettings.m_autoIndent = m_d->m_page.autoIndent->isChecked();
|
tabSettings.m_autoIndent = m_d->m_page.autoIndent->isChecked();
|
||||||
@@ -150,6 +168,8 @@ void BehaviorSettingsPage::settingsFromUI(TabSettings &tabSettings,
|
|||||||
storageSettings.m_inEntireDocument = m_d->m_page.inEntireDocument->isChecked();
|
storageSettings.m_inEntireDocument = m_d->m_page.inEntireDocument->isChecked();
|
||||||
storageSettings.m_cleanIndentation = m_d->m_page.cleanIndentation->isChecked();
|
storageSettings.m_cleanIndentation = m_d->m_page.cleanIndentation->isChecked();
|
||||||
storageSettings.m_addFinalNewLine = m_d->m_page.addFinalNewLine->isChecked();
|
storageSettings.m_addFinalNewLine = m_d->m_page.addFinalNewLine->isChecked();
|
||||||
|
|
||||||
|
behaviorSettings.m_mouseNavigation = m_d->m_page.mouseNavigation->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BehaviorSettingsPage::settingsToUI()
|
void BehaviorSettingsPage::settingsToUI()
|
||||||
@@ -167,6 +187,9 @@ void BehaviorSettingsPage::settingsToUI()
|
|||||||
m_d->m_page.inEntireDocument->setChecked(storageSettings.m_inEntireDocument);
|
m_d->m_page.inEntireDocument->setChecked(storageSettings.m_inEntireDocument);
|
||||||
m_d->m_page.cleanIndentation->setChecked(storageSettings.m_cleanIndentation);
|
m_d->m_page.cleanIndentation->setChecked(storageSettings.m_cleanIndentation);
|
||||||
m_d->m_page.addFinalNewLine->setChecked(storageSettings.m_addFinalNewLine);
|
m_d->m_page.addFinalNewLine->setChecked(storageSettings.m_addFinalNewLine);
|
||||||
|
|
||||||
|
const BehaviorSettings &behaviorSettings = m_d->m_behaviorSettings;
|
||||||
|
m_d->m_page.mouseNavigation->setChecked(behaviorSettings.m_mouseNavigation);
|
||||||
}
|
}
|
||||||
|
|
||||||
TabSettings BehaviorSettingsPage::tabSettings() const
|
TabSettings BehaviorSettingsPage::tabSettings() const
|
||||||
@@ -179,6 +202,11 @@ StorageSettings BehaviorSettingsPage::storageSettings() const
|
|||||||
return m_d->m_storageSettings;
|
return m_d->m_storageSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BehaviorSettings BehaviorSettingsPage::behaviorSettings() const
|
||||||
|
{
|
||||||
|
return m_d->m_behaviorSettings;
|
||||||
|
}
|
||||||
|
|
||||||
bool BehaviorSettingsPage::matches(const QString &s) const
|
bool BehaviorSettingsPage::matches(const QString &s) const
|
||||||
{
|
{
|
||||||
return m_d->m_searchKeywords.contains(s, Qt::CaseInsensitive);
|
return m_d->m_searchKeywords.contains(s, Qt::CaseInsensitive);
|
||||||
|
@@ -40,6 +40,7 @@ namespace TextEditor {
|
|||||||
|
|
||||||
struct TabSettings;
|
struct TabSettings;
|
||||||
struct StorageSettings;
|
struct StorageSettings;
|
||||||
|
struct BehaviorSettings;
|
||||||
|
|
||||||
struct BehaviorSettingsPageParameters
|
struct BehaviorSettingsPageParameters
|
||||||
{
|
{
|
||||||
@@ -70,16 +71,19 @@ public:
|
|||||||
|
|
||||||
TabSettings tabSettings() const;
|
TabSettings tabSettings() const;
|
||||||
StorageSettings storageSettings() const;
|
StorageSettings storageSettings() const;
|
||||||
|
BehaviorSettings behaviorSettings() const;
|
||||||
|
|
||||||
virtual bool matches(const QString &s) const;
|
virtual bool matches(const QString &s) const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void tabSettingsChanged(const TextEditor::TabSettings &);
|
void tabSettingsChanged(const TextEditor::TabSettings &);
|
||||||
void storageSettingsChanged(const TextEditor::StorageSettings &);
|
void storageSettingsChanged(const TextEditor::StorageSettings &);
|
||||||
|
void behaviorSettingsChanged(const TextEditor::BehaviorSettings &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void settingsFromUI(TabSettings &rc,
|
void settingsFromUI(TabSettings &rc,
|
||||||
StorageSettings &storageSettings) const;
|
StorageSettings &storageSettings,
|
||||||
|
BehaviorSettings &behaviorSettings) const;
|
||||||
void settingsToUI();
|
void settingsToUI();
|
||||||
struct BehaviorSettingsPagePrivate;
|
struct BehaviorSettingsPagePrivate;
|
||||||
BehaviorSettingsPagePrivate *m_d;
|
BehaviorSettingsPagePrivate *m_d;
|
||||||
|
@@ -6,11 +6,11 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>615</width>
|
<width>463</width>
|
||||||
<height>367</height>
|
<height>421</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBoxTabAndIndentSettings">
|
<widget class="QGroupBox" name="groupBoxTabAndIndentSettings">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@@ -276,6 +276,22 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBoxNavigation">
|
||||||
|
<property name="title">
|
||||||
|
<string>Navigation</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="mouseNavigation">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable &mouse navigation</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@@ -31,8 +31,6 @@
|
|||||||
|
|
||||||
#include <QtCore/QSettings>
|
#include <QtCore/QSettings>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
#include <QtGui/QTextCursor>
|
|
||||||
#include <QtGui/QTextDocument>
|
|
||||||
|
|
||||||
static const char * const displayLineNumbersKey = "DisplayLineNumbers";
|
static const char * const displayLineNumbersKey = "DisplayLineNumbers";
|
||||||
static const char * const textWrappingKey = "TextWrapping";
|
static const char * const textWrappingKey = "TextWrapping";
|
||||||
@@ -43,7 +41,6 @@ static const char * const displayFoldingMarkersKey = "DisplayFoldingMarkers";
|
|||||||
static const char * const highlightCurrentLineKey = "HighlightCurrentLine2Key";
|
static const char * const highlightCurrentLineKey = "HighlightCurrentLine2Key";
|
||||||
static const char * const highlightBlocksKey = "HighlightBlocksKey";
|
static const char * const highlightBlocksKey = "HighlightBlocksKey";
|
||||||
static const char * const animateMatchingParenthesesKey= "AnimateMatchingParenthesesKey";
|
static const char * const animateMatchingParenthesesKey= "AnimateMatchingParenthesesKey";
|
||||||
static const char * const mouseNavigationKey = "MouseNavigation";
|
|
||||||
static const char * const markTextChangesKey = "MarkTextChanges";
|
static const char * const markTextChangesKey = "MarkTextChanges";
|
||||||
static const char * const autoFoldFirstCommentKey= "AutoFoldFirstComment";
|
static const char * const autoFoldFirstCommentKey= "AutoFoldFirstComment";
|
||||||
static const char * const groupPostfix = "DisplaySettings";
|
static const char * const groupPostfix = "DisplaySettings";
|
||||||
@@ -60,7 +57,6 @@ DisplaySettings::DisplaySettings() :
|
|||||||
m_highlightCurrentLine(false),
|
m_highlightCurrentLine(false),
|
||||||
m_highlightBlocks(false),
|
m_highlightBlocks(false),
|
||||||
m_animateMatchingParentheses(true),
|
m_animateMatchingParentheses(true),
|
||||||
m_mouseNavigation(true),
|
|
||||||
m_markTextChanges(true),
|
m_markTextChanges(true),
|
||||||
m_autoFoldFirstComment(true)
|
m_autoFoldFirstComment(true)
|
||||||
{
|
{
|
||||||
@@ -81,7 +77,6 @@ void DisplaySettings::toSettings(const QString &category, QSettings *s) const
|
|||||||
s->setValue(QLatin1String(highlightCurrentLineKey), m_highlightCurrentLine);
|
s->setValue(QLatin1String(highlightCurrentLineKey), m_highlightCurrentLine);
|
||||||
s->setValue(QLatin1String(highlightBlocksKey), m_highlightBlocks);
|
s->setValue(QLatin1String(highlightBlocksKey), m_highlightBlocks);
|
||||||
s->setValue(QLatin1String(animateMatchingParenthesesKey), m_animateMatchingParentheses);
|
s->setValue(QLatin1String(animateMatchingParenthesesKey), m_animateMatchingParentheses);
|
||||||
s->setValue(QLatin1String(mouseNavigationKey), m_mouseNavigation);
|
|
||||||
s->setValue(QLatin1String(markTextChangesKey), m_markTextChanges);
|
s->setValue(QLatin1String(markTextChangesKey), m_markTextChanges);
|
||||||
s->setValue(QLatin1String(autoFoldFirstCommentKey), m_autoFoldFirstComment);
|
s->setValue(QLatin1String(autoFoldFirstCommentKey), m_autoFoldFirstComment);
|
||||||
s->endGroup();
|
s->endGroup();
|
||||||
@@ -105,7 +100,6 @@ void DisplaySettings::fromSettings(const QString &category, const QSettings *s)
|
|||||||
m_highlightCurrentLine = s->value(group + QLatin1String(highlightCurrentLineKey), m_highlightCurrentLine).toBool();
|
m_highlightCurrentLine = s->value(group + QLatin1String(highlightCurrentLineKey), m_highlightCurrentLine).toBool();
|
||||||
m_highlightBlocks = s->value(group + QLatin1String(highlightBlocksKey), m_highlightBlocks).toBool();
|
m_highlightBlocks = s->value(group + QLatin1String(highlightBlocksKey), m_highlightBlocks).toBool();
|
||||||
m_animateMatchingParentheses = s->value(group + QLatin1String(animateMatchingParenthesesKey), m_animateMatchingParentheses).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();
|
m_markTextChanges = s->value(group + QLatin1String(markTextChangesKey), m_markTextChanges).toBool();
|
||||||
m_autoFoldFirstComment = s->value(group + QLatin1String(autoFoldFirstCommentKey), m_autoFoldFirstComment).toBool();
|
m_autoFoldFirstComment = s->value(group + QLatin1String(autoFoldFirstCommentKey), m_autoFoldFirstComment).toBool();
|
||||||
}
|
}
|
||||||
@@ -121,7 +115,6 @@ bool DisplaySettings::equals(const DisplaySettings &ds) const
|
|||||||
&& m_highlightCurrentLine == ds.m_highlightCurrentLine
|
&& m_highlightCurrentLine == ds.m_highlightCurrentLine
|
||||||
&& m_highlightBlocks == ds.m_highlightBlocks
|
&& m_highlightBlocks == ds.m_highlightBlocks
|
||||||
&& m_animateMatchingParentheses == ds.m_animateMatchingParentheses
|
&& m_animateMatchingParentheses == ds.m_animateMatchingParentheses
|
||||||
&& m_mouseNavigation == ds.m_mouseNavigation
|
|
||||||
&& m_markTextChanges == ds.m_markTextChanges
|
&& m_markTextChanges == ds.m_markTextChanges
|
||||||
&& m_autoFoldFirstComment== ds.m_autoFoldFirstComment
|
&& m_autoFoldFirstComment== ds.m_autoFoldFirstComment
|
||||||
;
|
;
|
||||||
|
@@ -54,7 +54,6 @@ struct TEXTEDITOR_EXPORT DisplaySettings
|
|||||||
bool m_highlightCurrentLine;
|
bool m_highlightCurrentLine;
|
||||||
bool m_highlightBlocks;
|
bool m_highlightBlocks;
|
||||||
bool m_animateMatchingParentheses;
|
bool m_animateMatchingParentheses;
|
||||||
bool m_mouseNavigation;
|
|
||||||
bool m_markTextChanges;
|
bool m_markTextChanges;
|
||||||
bool m_autoFoldFirstComment;
|
bool m_autoFoldFirstComment;
|
||||||
|
|
||||||
|
@@ -102,7 +102,6 @@ QWidget *DisplaySettingsPage::createPage(QWidget *parent)
|
|||||||
<< ' ' << m_d->m_page.visualizeWhitespace->text()
|
<< ' ' << m_d->m_page.visualizeWhitespace->text()
|
||||||
<< ' ' << m_d->m_page.animateMatchingParentheses->text()
|
<< ' ' << m_d->m_page.animateMatchingParentheses->text()
|
||||||
<< ' ' << m_d->m_page.enableTextWrapping->text()
|
<< ' ' << m_d->m_page.enableTextWrapping->text()
|
||||||
<< ' ' << m_d->m_page.mouseNavigation->text()
|
|
||||||
<< ' ' << m_d->m_page.autoFoldFirstComment->text();
|
<< ' ' << m_d->m_page.autoFoldFirstComment->text();
|
||||||
m_d->m_searchKeywords.remove(QLatin1Char('&'));
|
m_d->m_searchKeywords.remove(QLatin1Char('&'));
|
||||||
}
|
}
|
||||||
@@ -138,7 +137,6 @@ void DisplaySettingsPage::settingsFromUI(DisplaySettings &displaySettings) const
|
|||||||
displaySettings.m_highlightCurrentLine = m_d->m_page.highlightCurrentLine->isChecked();
|
displaySettings.m_highlightCurrentLine = m_d->m_page.highlightCurrentLine->isChecked();
|
||||||
displaySettings.m_highlightBlocks = m_d->m_page.highlightBlocks->isChecked();
|
displaySettings.m_highlightBlocks = m_d->m_page.highlightBlocks->isChecked();
|
||||||
displaySettings.m_animateMatchingParentheses = m_d->m_page.animateMatchingParentheses->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();
|
displaySettings.m_markTextChanges = m_d->m_page.markTextChanges->isChecked();
|
||||||
displaySettings.m_autoFoldFirstComment = m_d->m_page.autoFoldFirstComment->isChecked();
|
displaySettings.m_autoFoldFirstComment = m_d->m_page.autoFoldFirstComment->isChecked();
|
||||||
}
|
}
|
||||||
@@ -155,7 +153,6 @@ void DisplaySettingsPage::settingsToUI()
|
|||||||
m_d->m_page.highlightCurrentLine->setChecked(displaySettings.m_highlightCurrentLine);
|
m_d->m_page.highlightCurrentLine->setChecked(displaySettings.m_highlightCurrentLine);
|
||||||
m_d->m_page.highlightBlocks->setChecked(displaySettings.m_highlightBlocks);
|
m_d->m_page.highlightBlocks->setChecked(displaySettings.m_highlightBlocks);
|
||||||
m_d->m_page.animateMatchingParentheses->setChecked(displaySettings.m_animateMatchingParentheses);
|
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);
|
m_d->m_page.markTextChanges->setChecked(displaySettings.m_markTextChanges);
|
||||||
m_d->m_page.autoFoldFirstComment->setChecked(displaySettings.m_autoFoldFirstComment);
|
m_d->m_page.autoFoldFirstComment->setChecked(displaySettings.m_autoFoldFirstComment);
|
||||||
}
|
}
|
||||||
|
@@ -7,11 +7,11 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>450</width>
|
<width>450</width>
|
||||||
<height>330</height>
|
<height>288</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="3" column="0">
|
<item row="2" column="0">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@@ -142,22 +142,6 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QGroupBox" name="groupBoxNavigation">
|
|
||||||
<property name="title">
|
|
||||||
<string>Navigation</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="mouseNavigation">
|
|
||||||
<property name="text">
|
|
||||||
<string>Enable &mouse navigation</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
@@ -9,6 +9,7 @@ SOURCES += texteditorplugin.cpp \
|
|||||||
plaintexteditorfactory.cpp \
|
plaintexteditorfactory.cpp \
|
||||||
basetextdocument.cpp \
|
basetextdocument.cpp \
|
||||||
basetexteditor.cpp \
|
basetexteditor.cpp \
|
||||||
|
behaviorsettings.cpp \
|
||||||
behaviorsettingspage.cpp \
|
behaviorsettingspage.cpp \
|
||||||
texteditoractionhandler.cpp \
|
texteditoractionhandler.cpp \
|
||||||
icompletioncollector.cpp \
|
icompletioncollector.cpp \
|
||||||
@@ -39,6 +40,7 @@ HEADERS += texteditorplugin.h \
|
|||||||
plaintexteditorfactory.h \
|
plaintexteditorfactory.h \
|
||||||
basetexteditor_p.h \
|
basetexteditor_p.h \
|
||||||
basetextdocument.h \
|
basetextdocument.h \
|
||||||
|
behaviorsettings.h \
|
||||||
behaviorsettingspage.h \
|
behaviorsettingspage.h \
|
||||||
completionsupport.h \
|
completionsupport.h \
|
||||||
completionwidget.h \
|
completionwidget.h \
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
#include "texteditorconstants.h"
|
#include "texteditorconstants.h"
|
||||||
|
|
||||||
#include "basetexteditor.h"
|
#include "basetexteditor.h"
|
||||||
|
#include "behaviorsettings.h"
|
||||||
#include "behaviorsettingspage.h"
|
#include "behaviorsettingspage.h"
|
||||||
#include "displaysettings.h"
|
#include "displaysettings.h"
|
||||||
#include "displaysettingspage.h"
|
#include "displaysettingspage.h"
|
||||||
@@ -135,6 +136,8 @@ TextEditorSettings::TextEditorSettings(QObject *parent)
|
|||||||
this, SIGNAL(tabSettingsChanged(TextEditor::TabSettings)));
|
this, SIGNAL(tabSettingsChanged(TextEditor::TabSettings)));
|
||||||
connect(m_behaviorSettingsPage, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)),
|
connect(m_behaviorSettingsPage, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)),
|
||||||
this, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)));
|
this, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)));
|
||||||
|
connect(m_behaviorSettingsPage, SIGNAL(behaviorSettingsChanged(TextEditor::BehaviorSettings)),
|
||||||
|
this, SIGNAL(behaviorSettingsChanged(TextEditor::BehaviorSettings)));
|
||||||
connect(m_displaySettingsPage, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)),
|
connect(m_displaySettingsPage, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)),
|
||||||
this, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)));
|
this, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)));
|
||||||
}
|
}
|
||||||
@@ -167,6 +170,8 @@ void TextEditorSettings::initializeEditor(BaseTextEditor *editor)
|
|||||||
editor, SLOT(setTabSettings(TextEditor::TabSettings)));
|
editor, SLOT(setTabSettings(TextEditor::TabSettings)));
|
||||||
connect(this, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)),
|
connect(this, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)),
|
||||||
editor, SLOT(setStorageSettings(TextEditor::StorageSettings)));
|
editor, SLOT(setStorageSettings(TextEditor::StorageSettings)));
|
||||||
|
connect(this, SIGNAL(behaviorSettingsChanged(TextEditor::BehaviorSettings)),
|
||||||
|
editor, SLOT(setBehaviorSettings(TextEditor::BehaviorSettings)));
|
||||||
connect(this, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)),
|
connect(this, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)),
|
||||||
editor, SLOT(setDisplaySettings(TextEditor::DisplaySettings)));
|
editor, SLOT(setDisplaySettings(TextEditor::DisplaySettings)));
|
||||||
|
|
||||||
@@ -179,6 +184,7 @@ void TextEditorSettings::initializeEditor(BaseTextEditor *editor)
|
|||||||
editor->setFontSettings(fontSettings());
|
editor->setFontSettings(fontSettings());
|
||||||
editor->setTabSettings(tabSettings());
|
editor->setTabSettings(tabSettings());
|
||||||
editor->setStorageSettings(storageSettings());
|
editor->setStorageSettings(storageSettings());
|
||||||
|
editor->setBehaviorSettings(behaviorSettings());
|
||||||
editor->setDisplaySettings(displaySettings());
|
editor->setDisplaySettings(displaySettings());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,6 +218,11 @@ StorageSettings TextEditorSettings::storageSettings() const
|
|||||||
return m_behaviorSettingsPage->storageSettings();
|
return m_behaviorSettingsPage->storageSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BehaviorSettings TextEditorSettings::behaviorSettings() const
|
||||||
|
{
|
||||||
|
return m_behaviorSettingsPage->behaviorSettings();
|
||||||
|
}
|
||||||
|
|
||||||
DisplaySettings TextEditorSettings::displaySettings() const
|
DisplaySettings TextEditorSettings::displaySettings() const
|
||||||
{
|
{
|
||||||
return m_displaySettingsPage->displaySettings();
|
return m_displaySettingsPage->displaySettings();
|
||||||
|
@@ -43,12 +43,13 @@ class FontSettingsPage;
|
|||||||
class FontSettings;
|
class FontSettings;
|
||||||
struct TabSettings;
|
struct TabSettings;
|
||||||
struct StorageSettings;
|
struct StorageSettings;
|
||||||
|
struct BehaviorSettings;
|
||||||
struct DisplaySettings;
|
struct DisplaySettings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class provides a central place for basic text editor settings. These
|
* This class provides a central place for basic text editor settings. These
|
||||||
* settings include font settings, tab settings, storage settings and display
|
* settings include font settings, tab settings, storage settings, behavior
|
||||||
* settings.
|
* settings and display settings.
|
||||||
*/
|
*/
|
||||||
class TEXTEDITOR_EXPORT TextEditorSettings : public QObject
|
class TEXTEDITOR_EXPORT TextEditorSettings : public QObject
|
||||||
{
|
{
|
||||||
@@ -65,12 +66,14 @@ public:
|
|||||||
FontSettings fontSettings() const;
|
FontSettings fontSettings() const;
|
||||||
TabSettings tabSettings() const;
|
TabSettings tabSettings() const;
|
||||||
StorageSettings storageSettings() const;
|
StorageSettings storageSettings() const;
|
||||||
|
BehaviorSettings behaviorSettings() const;
|
||||||
DisplaySettings displaySettings() const;
|
DisplaySettings displaySettings() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void fontSettingsChanged(const TextEditor::FontSettings &);
|
void fontSettingsChanged(const TextEditor::FontSettings &);
|
||||||
void tabSettingsChanged(const TextEditor::TabSettings &);
|
void tabSettingsChanged(const TextEditor::TabSettings &);
|
||||||
void storageSettingsChanged(const TextEditor::StorageSettings &);
|
void storageSettingsChanged(const TextEditor::StorageSettings &);
|
||||||
|
void behaviorSettingsChanged(const TextEditor::BehaviorSettings &);
|
||||||
void displaySettingsChanged(const TextEditor::DisplaySettings &);
|
void displaySettingsChanged(const TextEditor::DisplaySettings &);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
Reference in New Issue
Block a user