diff options
author | hjk <hjk@qt.io> | 2020-01-15 15:00:57 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2020-01-16 12:09:26 +0000 |
commit | 07b04c20560abed63240095094a2b95114ec61ad (patch) | |
tree | f9e7dc0a8467ec177e49dfd6d40a6736bb782c18 /src/plugins/texteditor | |
parent | ed7fb30e66a1d9e9501b1bc5fc4a0593566398dc (diff) |
TextEditor: Dissolve TextEditorOptionsPage intermediate hierarchy level
It's effectively setting only three properties nowadays, not enough
to justify a case of reuse-by-inheritance anymore.
Change-Id: I947fbc51e76c8d908da662dd58dce91614c28e08
Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/texteditor')
18 files changed, 44 insertions, 110 deletions
diff --git a/src/plugins/texteditor/CMakeLists.txt b/src/plugins/texteditor/CMakeLists.txt index 23145ac72e..6874a3a83f 100644 --- a/src/plugins/texteditor/CMakeLists.txt +++ b/src/plugins/texteditor/CMakeLists.txt @@ -92,7 +92,6 @@ add_qtc_plugin(TextEditor texteditor_p.h texteditoractionhandler.cpp texteditoractionhandler.h texteditorconstants.cpp texteditorconstants.h - texteditoroptionspage.cpp texteditoroptionspage.h texteditoroverlay.cpp texteditoroverlay.h texteditorplugin.cpp texteditorplugin.h texteditorsettings.cpp texteditorsettings.h diff --git a/src/plugins/texteditor/behaviorsettingspage.cpp b/src/plugins/texteditor/behaviorsettingspage.cpp index bbe420a5bf..5cc5fcacbc 100644 --- a/src/plugins/texteditor/behaviorsettingspage.cpp +++ b/src/plugins/texteditor/behaviorsettingspage.cpp @@ -88,9 +88,13 @@ void BehaviorSettingsPage::BehaviorSettingsPagePrivate::init() BehaviorSettingsPage::BehaviorSettingsPage(const BehaviorSettingsPageParameters &p, QObject *parent) - : TextEditorOptionsPage(parent), + : Core::IOptionsPage(parent), d(new BehaviorSettingsPagePrivate(p)) { + setCategory(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY); + setDisplayCategory(QCoreApplication::translate("TextEditor", "Text Editor")); + setCategoryIconPath(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY_ICON_PATH); + // global tab preferences for all other languages d->m_codeStyle = new SimpleCodeStylePreferences(this); d->m_codeStyle->setDisplayName(tr("Global", "Settings")); diff --git a/src/plugins/texteditor/behaviorsettingspage.h b/src/plugins/texteditor/behaviorsettingspage.h index 04b3250c3b..e164157736 100644 --- a/src/plugins/texteditor/behaviorsettingspage.h +++ b/src/plugins/texteditor/behaviorsettingspage.h @@ -27,9 +27,10 @@ #include "texteditor_global.h" -#include "texteditoroptionspage.h" #include "tabsettingswidget.h" +#include <coreplugin/dialogs/ioptionspage.h> + namespace TextEditor { class TabSettings; @@ -48,7 +49,7 @@ public: QString settingsPrefix; }; -class BehaviorSettingsPage : public TextEditorOptionsPage +class BehaviorSettingsPage : public Core::IOptionsPage { Q_OBJECT diff --git a/src/plugins/texteditor/completionsettingspage.cpp b/src/plugins/texteditor/completionsettingspage.cpp index 6c5253ebc6..2f516a8977 100644 --- a/src/plugins/texteditor/completionsettingspage.cpp +++ b/src/plugins/texteditor/completionsettingspage.cpp @@ -24,8 +24,10 @@ ****************************************************************************/ #include "completionsettingspage.h" -#include "ui_completionsettingspage.h" + #include "texteditorsettings.h" +#include "texteditorconstants.h" +#include "ui_completionsettingspage.h" #include <cpptools/cpptoolssettings.h> @@ -38,10 +40,13 @@ using namespace TextEditor::Internal; using namespace CppTools; CompletionSettingsPage::CompletionSettingsPage(QObject *parent) - : TextEditor::TextEditorOptionsPage(parent) + : Core::IOptionsPage(parent) { setId("P.Completion"); setDisplayName(tr("Completion")); + setCategory(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY); + setDisplayCategory(QCoreApplication::translate("TextEditor", "Text Editor")); + setCategoryIconPath(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY_ICON_PATH); QSettings *s = Core::ICore::settings(); m_completionSettings.fromSettings(s); diff --git a/src/plugins/texteditor/completionsettingspage.h b/src/plugins/texteditor/completionsettingspage.h index bf0ac7638b..41ef73e8ec 100644 --- a/src/plugins/texteditor/completionsettingspage.h +++ b/src/plugins/texteditor/completionsettingspage.h @@ -27,8 +27,8 @@ #include "commentssettings.h" #include "completionsettings.h" -#include "texteditoroptionspage.h" +#include <coreplugin/dialogs/ioptionspage.h> #include <QPointer> @@ -37,7 +37,7 @@ namespace Internal { namespace Ui { class CompletionSettingsPage; } -class CompletionSettingsPage : public TextEditorOptionsPage +class CompletionSettingsPage : public Core::IOptionsPage { Q_OBJECT diff --git a/src/plugins/texteditor/displaysettingspage.cpp b/src/plugins/texteditor/displaysettingspage.cpp index ddc7595e03..d2c07f08f6 100644 --- a/src/plugins/texteditor/displaysettingspage.cpp +++ b/src/plugins/texteditor/displaysettingspage.cpp @@ -24,8 +24,10 @@ ****************************************************************************/ #include "displaysettingspage.h" + #include "displaysettings.h" #include "marginsettings.h" +#include "texteditorconstants.h" #include "ui_displaysettingspage.h" #include <coreplugin/icore.h> @@ -56,11 +58,14 @@ DisplaySettingsPage::DisplaySettingsPagePrivate::DisplaySettingsPagePrivate DisplaySettingsPage::DisplaySettingsPage(const DisplaySettingsPageParameters &p, QObject *parent) - : TextEditorOptionsPage(parent), + : Core::IOptionsPage(parent), d(new DisplaySettingsPagePrivate(p)) { setId(p.id); setDisplayName(p.displayName); + setCategory(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY); + setDisplayCategory(QCoreApplication::translate("TextEditor", "Text Editor")); + setCategoryIconPath(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY_ICON_PATH); } DisplaySettingsPage::~DisplaySettingsPage() diff --git a/src/plugins/texteditor/displaysettingspage.h b/src/plugins/texteditor/displaysettingspage.h index 8f937c0236..a488810762 100644 --- a/src/plugins/texteditor/displaysettingspage.h +++ b/src/plugins/texteditor/displaysettingspage.h @@ -27,7 +27,7 @@ #include "texteditor_global.h" -#include "texteditoroptionspage.h" +#include <coreplugin/dialogs/ioptionspage.h> namespace TextEditor { @@ -42,7 +42,7 @@ public: QString settingsPrefix; }; -class DisplaySettingsPage : public TextEditorOptionsPage +class DisplaySettingsPage : public Core::IOptionsPage { Q_OBJECT diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp index 5b77f8d972..0e463adfe7 100644 --- a/src/plugins/texteditor/fontsettingspage.cpp +++ b/src/plugins/texteditor/fontsettingspage.cpp @@ -330,11 +330,14 @@ bool FormatDescription::showControl(FormatDescription::ShowControls showControl) FontSettingsPage::FontSettingsPage(const FormatDescriptions &fd, Core::Id id, QObject *parent) : - TextEditorOptionsPage(parent), + Core::IOptionsPage(parent), d_ptr(new FontSettingsPagePrivate(fd, id, tr("Font && Colors"), category().toString())) { setId(d_ptr->m_id); setDisplayName(d_ptr->m_displayName); + setCategory(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY); + setDisplayCategory(QCoreApplication::translate("TextEditor", "Text Editor")); + setCategoryIconPath(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY_ICON_PATH); } FontSettingsPage::~FontSettingsPage() diff --git a/src/plugins/texteditor/fontsettingspage.h b/src/plugins/texteditor/fontsettingspage.h index 4e78cf0353..4ff91f22b6 100644 --- a/src/plugins/texteditor/fontsettingspage.h +++ b/src/plugins/texteditor/fontsettingspage.h @@ -30,13 +30,12 @@ #include "texteditorconstants.h" #include "colorscheme.h" -#include "texteditoroptionspage.h" +#include <coreplugin/dialogs/ioptionspage.h> #include <QList> #include <QString> QT_BEGIN_NAMESPACE -class QWidget; class QColor; QT_END_NAMESPACE @@ -119,7 +118,7 @@ private: using FormatDescriptions = std::vector<FormatDescription>; -class TEXTEDITOR_EXPORT FontSettingsPage : public TextEditorOptionsPage +class TEXTEDITOR_EXPORT FontSettingsPage : public Core::IOptionsPage { Q_OBJECT diff --git a/src/plugins/texteditor/highlightersettingspage.cpp b/src/plugins/texteditor/highlightersettingspage.cpp index 20cfa591ea..66cf1c4365 100644 --- a/src/plugins/texteditor/highlightersettingspage.cpp +++ b/src/plugins/texteditor/highlightersettingspage.cpp @@ -84,11 +84,14 @@ void HighlighterSettingsPage::HighlighterSettingsPagePrivate::ensureInitialized( } HighlighterSettingsPage::HighlighterSettingsPage(Core::Id id, QObject *parent) : - TextEditorOptionsPage(parent), + Core::IOptionsPage(parent), m_d(new HighlighterSettingsPagePrivate(id)) { setId(m_d->m_id); setDisplayName(m_d->m_displayName); + setCategory(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY); + setDisplayCategory(QCoreApplication::translate("TextEditor", "Text Editor")); + setCategoryIconPath(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY_ICON_PATH); } HighlighterSettingsPage::~HighlighterSettingsPage() diff --git a/src/plugins/texteditor/highlightersettingspage.h b/src/plugins/texteditor/highlightersettingspage.h index c8fccdbb8b..5321f4b3a1 100644 --- a/src/plugins/texteditor/highlightersettingspage.h +++ b/src/plugins/texteditor/highlightersettingspage.h @@ -25,13 +25,13 @@ #pragma once -#include "texteditoroptionspage.h" +#include <coreplugin/dialogs/ioptionspage.h> namespace TextEditor { class HighlighterSettings; -class HighlighterSettingsPage : public TextEditorOptionsPage +class HighlighterSettingsPage : public Core::IOptionsPage { Q_OBJECT diff --git a/src/plugins/texteditor/snippets/snippetssettingspage.cpp b/src/plugins/texteditor/snippets/snippetssettingspage.cpp index c90a13c976..d7e2756c03 100644 --- a/src/plugins/texteditor/snippets/snippetssettingspage.cpp +++ b/src/plugins/texteditor/snippets/snippetssettingspage.cpp @@ -549,11 +549,14 @@ void SnippetsSettingsPagePrivate::decorateEditors(const TextEditor::FontSettings // SnippetsSettingsPage SnippetsSettingsPage::SnippetsSettingsPage(Core::Id id, QObject *parent) : - TextEditorOptionsPage(parent), + Core::IOptionsPage(parent), d(new SnippetsSettingsPagePrivate(id)) { setId(d->id()); setDisplayName(d->displayName()); + setCategory(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY); + setDisplayCategory(QCoreApplication::translate("TextEditor", "Text Editor")); + setCategoryIconPath(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY_ICON_PATH); } SnippetsSettingsPage::~SnippetsSettingsPage() diff --git a/src/plugins/texteditor/snippets/snippetssettingspage.h b/src/plugins/texteditor/snippets/snippetssettingspage.h index 9c2df195fd..21a47d68bd 100644 --- a/src/plugins/texteditor/snippets/snippetssettingspage.h +++ b/src/plugins/texteditor/snippets/snippetssettingspage.h @@ -25,14 +25,14 @@ #pragma once -#include "../texteditoroptionspage.h" +#include <coreplugin/dialogs/ioptionspage.h> namespace TextEditor { namespace Internal { class SnippetsSettingsPagePrivate; -class SnippetsSettingsPage : public TextEditorOptionsPage +class SnippetsSettingsPage : public Core::IOptionsPage { Q_OBJECT diff --git a/src/plugins/texteditor/texteditor.pro b/src/plugins/texteditor/texteditor.pro index a0182a6f08..1075a7e817 100644 --- a/src/plugins/texteditor/texteditor.pro +++ b/src/plugins/texteditor/texteditor.pro @@ -39,7 +39,6 @@ SOURCES += texteditorplugin.cpp \ colorscheme.cpp \ colorschemeedit.cpp \ texteditoroverlay.cpp \ - texteditoroptionspage.cpp \ textdocumentlayout.cpp \ completionsettings.cpp \ normalindenter.cpp \ @@ -128,7 +127,6 @@ HEADERS += texteditorplugin.h \ colorscheme.h \ colorschemeedit.h \ texteditoroverlay.h \ - texteditoroptionspage.h \ textdocumentlayout.h \ completionsettings.h \ normalindenter.h \ diff --git a/src/plugins/texteditor/texteditor.qbs b/src/plugins/texteditor/texteditor.qbs index 475e414dbc..8928cf7a27 100644 --- a/src/plugins/texteditor/texteditor.qbs +++ b/src/plugins/texteditor/texteditor.qbs @@ -143,8 +143,6 @@ Project { "texteditoractionhandler.h", "texteditorconstants.cpp", "texteditorconstants.h", - "texteditoroptionspage.cpp", - "texteditoroptionspage.h", "texteditoroverlay.cpp", "texteditoroverlay.h", "texteditorplugin.cpp", diff --git a/src/plugins/texteditor/texteditorconstants.h b/src/plugins/texteditor/texteditorconstants.h index b3905b5192..cc0d79020c 100644 --- a/src/plugins/texteditor/texteditorconstants.h +++ b/src/plugins/texteditor/texteditorconstants.h @@ -209,6 +209,7 @@ const char SCROLL_BAR_CURRENT_LINE[] = "TextEditor.ScrollBarCurrentLine"; const TEXTEDITOR_EXPORT char *nameForStyle(TextStyle style); TextStyle styleFromName(const char *name); +const char TEXT_EDITOR_SETTINGS_CATEGORY_ICON_PATH[] = ":/texteditor/images/settingscategory_texteditor.png"; const char TEXT_EDITOR_SETTINGS_CATEGORY[] = "C.TextEditor"; const char TEXT_EDITOR_FONT_SETTINGS[] = "A.FontSettings"; const char TEXT_EDITOR_BEHAVIOR_SETTINGS[] = "B.BehaviourSettings"; diff --git a/src/plugins/texteditor/texteditoroptionspage.cpp b/src/plugins/texteditor/texteditoroptionspage.cpp deleted file mode 100644 index c95d65daee..0000000000 --- a/src/plugins/texteditor/texteditoroptionspage.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "texteditoroptionspage.h" - -#include "texteditorconstants.h" - -#include <QCoreApplication> - -using namespace TextEditor; - -TextEditorOptionsPage::TextEditorOptionsPage(QObject *parent) : - Core::IOptionsPage(parent) -{ - setCategory(Constants::TEXT_EDITOR_SETTINGS_CATEGORY); - setDisplayCategory(QCoreApplication::translate("TextEditor", "Text Editor")); - setCategoryIconPath(":/texteditor/images/settingscategory_texteditor.png"); -} diff --git a/src/plugins/texteditor/texteditoroptionspage.h b/src/plugins/texteditor/texteditoroptionspage.h deleted file mode 100644 index 3ba17d61a9..0000000000 --- a/src/plugins/texteditor/texteditoroptionspage.h +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include "texteditor_global.h" - -#include <coreplugin/dialogs/ioptionspage.h> - -namespace TextEditor { - -/** - * An abstract options page in the Text Editor category. - */ -class TEXTEDITOR_EXPORT TextEditorOptionsPage : public Core::IOptionsPage -{ - Q_OBJECT - -public: - explicit TextEditorOptionsPage(QObject *parent = nullptr); -}; - -} // namespace TextEditor |