forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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
|
||||
|
@@ -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"));
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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()
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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()
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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()
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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()
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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 \
|
||||
|
@@ -143,8 +143,6 @@ Project {
|
||||
"texteditoractionhandler.h",
|
||||
"texteditorconstants.cpp",
|
||||
"texteditorconstants.h",
|
||||
"texteditoroptionspage.cpp",
|
||||
"texteditoroptionspage.h",
|
||||
"texteditoroverlay.cpp",
|
||||
"texteditoroverlay.h",
|
||||
"texteditorplugin.cpp",
|
||||
|
@@ -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";
|
||||
|
@@ -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");
|
||||
}
|
@@ -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
|
Reference in New Issue
Block a user