diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 7b571175d70c5d332eb81dd5358aa4caacad940d..6fe00f0189b179244c656836555b07deaa614be9 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -34,6 +34,7 @@ #include "texteditorplugin.h" #include "completionsupport.h" #endif +#include "behaviorsettings.h" #include "basetextdocument.h" #include "basetexteditor_p.h" #include "codecselector.h" @@ -48,8 +49,8 @@ #include <extensionsystem/pluginmanager.h> #include <find/basetextfind.h> #include <utils/stylehelper.h> - #endif + #include <utils/linecolumnlabel.h> #include <utils/qtcassert.h> @@ -4659,7 +4660,6 @@ void BaseTextEditor::setDisplaySettings(const DisplaySettings &ds) setCodeFoldingVisible(ds.m_displayFoldingMarkers); setHighlightCurrentLine(ds.m_highlightCurrentLine); setRevisionsVisible(ds.m_markTextChanges); - setMouseNavigationEnabled(ds.m_mouseNavigation); if (d->m_displaySettings.m_visualizeWhitespace != ds.m_visualizeWhitespace) { if (QSyntaxHighlighter *highlighter = baseTextDocument()->syntaxHighlighter()) @@ -4684,6 +4684,11 @@ void BaseTextEditor::setDisplaySettings(const DisplaySettings &ds) extraArea()->update(); } +void BaseTextEditor::setBehaviorSettings(const TextEditor::BehaviorSettings &bs) +{ + setMouseNavigationEnabled(bs.m_mouseNavigation); +} + void BaseTextEditor::setStorageSettings(const StorageSettings &storageSettings) { d->m_document->setStorageSettings(storageSettings); diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h index 65a74bb01ebc6793b6729d9cd34280f4e7db7776..4a64f19306203273502fed2b1f5825274b96108a 100644 --- a/src/plugins/texteditor/basetexteditor.h +++ b/src/plugins/texteditor/basetexteditor.h @@ -62,6 +62,7 @@ class ITextMarkable; class TextEditorActionHandler; class BaseTextDocument; class FontSettings; +struct BehaviorSettings; struct StorageSettings; struct Parenthesis; @@ -505,6 +506,7 @@ public slots: void setFontSettingsIfVisible(const TextEditor::FontSettings &); virtual void setTabSettings(const TextEditor::TabSettings &); virtual void setDisplaySettings(const TextEditor::DisplaySettings &); + virtual void setBehaviorSettings(const TextEditor::BehaviorSettings &); virtual void setStorageSettings(const TextEditor::StorageSettings &); protected: diff --git a/src/plugins/texteditor/behaviorsettings.cpp b/src/plugins/texteditor/behaviorsettings.cpp new file mode 100644 index 0000000000000000000000000000000000000000..32ecc500bc4f5a762a7f1526e18ce219168c6327 --- /dev/null +++ b/src/plugins/texteditor/behaviorsettings.cpp @@ -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 + diff --git a/src/plugins/texteditor/behaviorsettings.h b/src/plugins/texteditor/behaviorsettings.h new file mode 100644 index 0000000000000000000000000000000000000000..27b07e34e6bb28e3eaacb89a4a7172f89815931b --- /dev/null +++ b/src/plugins/texteditor/behaviorsettings.h @@ -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 diff --git a/src/plugins/texteditor/behaviorsettingspage.cpp b/src/plugins/texteditor/behaviorsettingspage.cpp index f68a8c917c5e243afb1b70be637650ea263999a5..aaa38951546bb14b0ed2a295bb179e99880d142f 100644 --- a/src/plugins/texteditor/behaviorsettingspage.cpp +++ b/src/plugins/texteditor/behaviorsettingspage.cpp @@ -28,6 +28,8 @@ **************************************************************************/ #include "behaviorsettingspage.h" + +#include "behaviorsettings.h" #include "storagesettings.h" #include "tabsettings.h" #include "ui_behaviorsettingspage.h" @@ -45,8 +47,11 @@ struct BehaviorSettingsPage::BehaviorSettingsPagePrivate const BehaviorSettingsPageParameters m_parameters; Ui::BehaviorSettingsPage m_page; + TabSettings m_tabSettings; StorageSettings m_storageSettings; + BehaviorSettings m_behaviorSettings; + QString m_searchKeywords; }; @@ -57,11 +62,12 @@ BehaviorSettingsPage::BehaviorSettingsPagePrivate::BehaviorSettingsPagePrivate if (const QSettings *s = Core::ICore::instance()->settings()) { m_tabSettings.fromSettings(m_parameters.settingsPrefix, s); m_storageSettings.fromSettings(m_parameters.settingsPrefix, s); + m_behaviorSettings.fromSettings(m_parameters.settingsPrefix, s); } } BehaviorSettingsPage::BehaviorSettingsPage(const BehaviorSettingsPageParameters &p, - QObject *parent) + QObject *parent) : Core::IOptionsPage(parent), m_d(new BehaviorSettingsPagePrivate(p)) { @@ -102,8 +108,10 @@ QWidget *BehaviorSettingsPage::createPage(QWidget *parent) << ' ' << m_d->m_page.smartBackspace->text() << ' ' << m_d->m_page.cleanWhitespace->text() << ' ' << m_d->m_page.addFinalNewLine->text() + << ' ' << m_d->m_page.mouseNavigation->text() << ' ' << 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('&')); } return w; @@ -113,8 +121,9 @@ void BehaviorSettingsPage::apply() { TabSettings newTabSettings; StorageSettings newStorageSettings; + BehaviorSettings newBehaviorSettings; - settingsFromUI(newTabSettings, newStorageSettings); + settingsFromUI(newTabSettings, newStorageSettings, newBehaviorSettings); Core::ICore *core = Core::ICore::instance(); QSettings *s = core->settings(); @@ -134,10 +143,19 @@ void BehaviorSettingsPage::apply() 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, - StorageSettings &storageSettings) const + StorageSettings &storageSettings, + BehaviorSettings &behaviorSettings) const { tabSettings.m_spacesForTabs = m_d->m_page.insertSpaces->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_cleanIndentation = m_d->m_page.cleanIndentation->isChecked(); storageSettings.m_addFinalNewLine = m_d->m_page.addFinalNewLine->isChecked(); + + behaviorSettings.m_mouseNavigation = m_d->m_page.mouseNavigation->isChecked(); } void BehaviorSettingsPage::settingsToUI() @@ -167,6 +187,9 @@ void BehaviorSettingsPage::settingsToUI() m_d->m_page.inEntireDocument->setChecked(storageSettings.m_inEntireDocument); m_d->m_page.cleanIndentation->setChecked(storageSettings.m_cleanIndentation); 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 @@ -179,6 +202,11 @@ StorageSettings BehaviorSettingsPage::storageSettings() const return m_d->m_storageSettings; } +BehaviorSettings BehaviorSettingsPage::behaviorSettings() const +{ + return m_d->m_behaviorSettings; +} + bool BehaviorSettingsPage::matches(const QString &s) const { return m_d->m_searchKeywords.contains(s, Qt::CaseInsensitive); diff --git a/src/plugins/texteditor/behaviorsettingspage.h b/src/plugins/texteditor/behaviorsettingspage.h index 98e7025bcf8758e5008116b1a820bbe0aacbe2cb..a07eb24ef7a9d4508dae4aa57d742fee8ca1c675 100644 --- a/src/plugins/texteditor/behaviorsettingspage.h +++ b/src/plugins/texteditor/behaviorsettingspage.h @@ -40,6 +40,7 @@ namespace TextEditor { struct TabSettings; struct StorageSettings; +struct BehaviorSettings; struct BehaviorSettingsPageParameters { @@ -70,16 +71,19 @@ public: TabSettings tabSettings() const; StorageSettings storageSettings() const; + BehaviorSettings behaviorSettings() const; virtual bool matches(const QString &s) const; signals: void tabSettingsChanged(const TextEditor::TabSettings &); void storageSettingsChanged(const TextEditor::StorageSettings &); + void behaviorSettingsChanged(const TextEditor::BehaviorSettings &); private: void settingsFromUI(TabSettings &rc, - StorageSettings &storageSettings) const; + StorageSettings &storageSettings, + BehaviorSettings &behaviorSettings) const; void settingsToUI(); struct BehaviorSettingsPagePrivate; BehaviorSettingsPagePrivate *m_d; diff --git a/src/plugins/texteditor/behaviorsettingspage.ui b/src/plugins/texteditor/behaviorsettingspage.ui index 8ba86f0f59ce0cdf84f3e3d585500ccfb8b46d42..70490383b8c4798373c3838e1ca7d0e43dd511ce 100644 --- a/src/plugins/texteditor/behaviorsettingspage.ui +++ b/src/plugins/texteditor/behaviorsettingspage.ui @@ -6,11 +6,11 @@ <rect> <x>0</x> <y>0</y> - <width>615</width> - <height>367</height> + <width>463</width> + <height>421</height> </rect> </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> + <layout class="QVBoxLayout" name="verticalLayout_4"> <item> <widget class="QGroupBox" name="groupBoxTabAndIndentSettings"> <property name="title"> @@ -276,6 +276,22 @@ </layout> </widget> </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> <spacer name="verticalSpacer"> <property name="orientation"> diff --git a/src/plugins/texteditor/displaysettings.cpp b/src/plugins/texteditor/displaysettings.cpp index 8bbee972a59046ea84439394884f5dd214e80883..2a800bb9c9fcbf7eebff67c12d50c3cd106d4fca 100644 --- a/src/plugins/texteditor/displaysettings.cpp +++ b/src/plugins/texteditor/displaysettings.cpp @@ -31,8 +31,6 @@ #include <QtCore/QSettings> #include <QtCore/QString> -#include <QtGui/QTextCursor> -#include <QtGui/QTextDocument> static const char * const displayLineNumbersKey = "DisplayLineNumbers"; 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 highlightBlocksKey = "HighlightBlocksKey"; static const char * const animateMatchingParenthesesKey= "AnimateMatchingParenthesesKey"; -static const char * const mouseNavigationKey = "MouseNavigation"; static const char * const markTextChangesKey = "MarkTextChanges"; static const char * const autoFoldFirstCommentKey= "AutoFoldFirstComment"; static const char * const groupPostfix = "DisplaySettings"; @@ -60,7 +57,6 @@ DisplaySettings::DisplaySettings() : m_highlightCurrentLine(false), m_highlightBlocks(false), m_animateMatchingParentheses(true), - m_mouseNavigation(true), m_markTextChanges(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(highlightBlocksKey), m_highlightBlocks); s->setValue(QLatin1String(animateMatchingParenthesesKey), m_animateMatchingParentheses); - s->setValue(QLatin1String(mouseNavigationKey), m_mouseNavigation); s->setValue(QLatin1String(markTextChangesKey), m_markTextChanges); s->setValue(QLatin1String(autoFoldFirstCommentKey), m_autoFoldFirstComment); 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_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(); 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_highlightBlocks == ds.m_highlightBlocks && m_animateMatchingParentheses == ds.m_animateMatchingParentheses - && m_mouseNavigation == ds.m_mouseNavigation && m_markTextChanges == ds.m_markTextChanges && m_autoFoldFirstComment== ds.m_autoFoldFirstComment ; diff --git a/src/plugins/texteditor/displaysettings.h b/src/plugins/texteditor/displaysettings.h index 4b0eddc6a11de79417afda16fcb26a51f38ea602..0691cb65f13a6d52c391ff000ad2d7595a146aad 100644 --- a/src/plugins/texteditor/displaysettings.h +++ b/src/plugins/texteditor/displaysettings.h @@ -54,7 +54,6 @@ struct TEXTEDITOR_EXPORT DisplaySettings bool m_highlightCurrentLine; bool m_highlightBlocks; bool m_animateMatchingParentheses; - bool m_mouseNavigation; bool m_markTextChanges; bool m_autoFoldFirstComment; diff --git a/src/plugins/texteditor/displaysettingspage.cpp b/src/plugins/texteditor/displaysettingspage.cpp index 4995371f52f4aad9c1a7489cc329965ca5bb06ba..19efd49f27a5f62dc45bb29f0b7bd1aeb74495ef 100644 --- a/src/plugins/texteditor/displaysettingspage.cpp +++ b/src/plugins/texteditor/displaysettingspage.cpp @@ -102,7 +102,6 @@ QWidget *DisplaySettingsPage::createPage(QWidget *parent) << ' ' << m_d->m_page.visualizeWhitespace->text() << ' ' << m_d->m_page.animateMatchingParentheses->text() << ' ' << m_d->m_page.enableTextWrapping->text() - << ' ' << m_d->m_page.mouseNavigation->text() << ' ' << m_d->m_page.autoFoldFirstComment->text(); 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_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(); 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.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); m_d->m_page.autoFoldFirstComment->setChecked(displaySettings.m_autoFoldFirstComment); } diff --git a/src/plugins/texteditor/displaysettingspage.ui b/src/plugins/texteditor/displaysettingspage.ui index 8a8170029155067067d1376b7a650b977965a1b1..8836a47b4f48bfd6a8fd7c159585db9294991cf5 100644 --- a/src/plugins/texteditor/displaysettingspage.ui +++ b/src/plugins/texteditor/displaysettingspage.ui @@ -7,11 +7,11 @@ <x>0</x> <y>0</y> <width>450</width> - <height>330</height> + <height>288</height> </rect> </property> <layout class="QGridLayout" name="gridLayout_3"> - <item row="3" column="0"> + <item row="2" column="0"> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -142,22 +142,6 @@ </layout> </widget> </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> </widget> <resources/> diff --git a/src/plugins/texteditor/texteditor.pro b/src/plugins/texteditor/texteditor.pro index db06739e63969e96afd64f737fe8ce552928e96c..bcaa2c32ee168b84baf1611a195f2a4782f90f73 100644 --- a/src/plugins/texteditor/texteditor.pro +++ b/src/plugins/texteditor/texteditor.pro @@ -9,6 +9,7 @@ SOURCES += texteditorplugin.cpp \ plaintexteditorfactory.cpp \ basetextdocument.cpp \ basetexteditor.cpp \ + behaviorsettings.cpp \ behaviorsettingspage.cpp \ texteditoractionhandler.cpp \ icompletioncollector.cpp \ @@ -39,6 +40,7 @@ HEADERS += texteditorplugin.h \ plaintexteditorfactory.h \ basetexteditor_p.h \ basetextdocument.h \ + behaviorsettings.h \ behaviorsettingspage.h \ completionsupport.h \ completionwidget.h \ diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp index 52ab3bb24add7cf843a6ddc89c7991e7e2cf263e..7047ee1bcddd8bae485adf48af207e2489937d55 100644 --- a/src/plugins/texteditor/texteditorsettings.cpp +++ b/src/plugins/texteditor/texteditorsettings.cpp @@ -31,6 +31,7 @@ #include "texteditorconstants.h" #include "basetexteditor.h" +#include "behaviorsettings.h" #include "behaviorsettingspage.h" #include "displaysettings.h" #include "displaysettingspage.h" @@ -135,6 +136,8 @@ TextEditorSettings::TextEditorSettings(QObject *parent) this, SIGNAL(tabSettingsChanged(TextEditor::TabSettings))); connect(m_behaviorSettingsPage, 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)), this, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings))); } @@ -167,6 +170,8 @@ void TextEditorSettings::initializeEditor(BaseTextEditor *editor) editor, SLOT(setTabSettings(TextEditor::TabSettings))); connect(this, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)), editor, SLOT(setStorageSettings(TextEditor::StorageSettings))); + connect(this, SIGNAL(behaviorSettingsChanged(TextEditor::BehaviorSettings)), + editor, SLOT(setBehaviorSettings(TextEditor::BehaviorSettings))); connect(this, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)), editor, SLOT(setDisplaySettings(TextEditor::DisplaySettings))); @@ -179,6 +184,7 @@ void TextEditorSettings::initializeEditor(BaseTextEditor *editor) editor->setFontSettings(fontSettings()); editor->setTabSettings(tabSettings()); editor->setStorageSettings(storageSettings()); + editor->setBehaviorSettings(behaviorSettings()); editor->setDisplaySettings(displaySettings()); } @@ -212,6 +218,11 @@ StorageSettings TextEditorSettings::storageSettings() const return m_behaviorSettingsPage->storageSettings(); } +BehaviorSettings TextEditorSettings::behaviorSettings() const +{ + return m_behaviorSettingsPage->behaviorSettings(); +} + DisplaySettings TextEditorSettings::displaySettings() const { return m_displaySettingsPage->displaySettings(); diff --git a/src/plugins/texteditor/texteditorsettings.h b/src/plugins/texteditor/texteditorsettings.h index 14912d69562028c2b01f95e52bae5138a56d6b47..d1e1219a2498734d91e4bb9bff7d12c33e9bd394 100644 --- a/src/plugins/texteditor/texteditorsettings.h +++ b/src/plugins/texteditor/texteditorsettings.h @@ -43,12 +43,13 @@ class FontSettingsPage; class FontSettings; struct TabSettings; struct StorageSettings; +struct BehaviorSettings; struct DisplaySettings; /** * This class provides a central place for basic text editor settings. These - * settings include font settings, tab settings, storage settings and display - * settings. + * settings include font settings, tab settings, storage settings, behavior + * settings and display settings. */ class TEXTEDITOR_EXPORT TextEditorSettings : public QObject { @@ -65,12 +66,14 @@ public: FontSettings fontSettings() const; TabSettings tabSettings() const; StorageSettings storageSettings() const; + BehaviorSettings behaviorSettings() const; DisplaySettings displaySettings() const; signals: void fontSettingsChanged(const TextEditor::FontSettings &); void tabSettingsChanged(const TextEditor::TabSettings &); void storageSettingsChanged(const TextEditor::StorageSettings &); + void behaviorSettingsChanged(const TextEditor::BehaviorSettings &); void displaySettingsChanged(const TextEditor::DisplaySettings &); private slots: