diff --git a/src/plugins/debugger/analyzer/analyzerrunconfigwidget.cpp b/src/plugins/debugger/analyzer/analyzerrunconfigwidget.cpp index c74ea44a06b..61f81f46ce3 100644 --- a/src/plugins/debugger/analyzer/analyzerrunconfigwidget.cpp +++ b/src/plugins/debugger/analyzer/analyzerrunconfigwidget.cpp @@ -27,7 +27,7 @@ AnalyzerRunConfigWidget::AnalyzerRunConfigWidget(ProjectExplorer::GlobalOrProjec auto restoreButton = new QPushButton(Tr::tr("Restore Global")); auto innerPane = new QWidget; - auto configWidget = aspect->projectSettings()->createConfigWidget(); + auto configWidget = aspect->projectSettings()->layouter()().emerge(); auto details = new DetailsWidget; details->setWidget(innerPane); diff --git a/src/plugins/perfprofiler/perfsettings.cpp b/src/plugins/perfprofiler/perfsettings.cpp index e737031a3fe..7d71de3504c 100644 --- a/src/plugins/perfprofiler/perfsettings.cpp +++ b/src/plugins/perfprofiler/perfsettings.cpp @@ -27,13 +27,6 @@ PerfSettings &globalSettings() PerfSettings::PerfSettings(ProjectExplorer::Target *target) { - setConfigWidgetCreator([this, target] { - auto widget = new Internal::PerfConfigWidget(this); - widget->setTracePointsButtonVisible(target != nullptr); - widget->setTarget(target); - return widget; - }); - period.setSettingsKey("Analyzer.Perf.Frequency"); period.setRange(250, 2147483647); period.setDefaultValue(250); @@ -71,11 +64,12 @@ PerfSettings::PerfSettings(ProjectExplorer::Target *target) stackSize.setEnabled(callgraphMode.volatileValue() == 0); }); - setLayouter([this] { + setLayouter([this, target] { using namespace Layouting; - return Column { - createConfigWidget() - }; + auto widget = new Internal::PerfConfigWidget(this); + widget->setTracePointsButtonVisible(target != nullptr); + widget->setTarget(target); + return Column { widget }; }); readSettings(); diff --git a/src/plugins/perfprofiler/perfsettings.h b/src/plugins/perfprofiler/perfsettings.h index 8b38f1015ea..bef4d996071 100644 --- a/src/plugins/perfprofiler/perfsettings.h +++ b/src/plugins/perfprofiler/perfsettings.h @@ -9,7 +9,7 @@ namespace PerfProfiler { -class PERFPROFILER_EXPORT PerfSettings final : public ProjectExplorer::ISettingsAspect +class PERFPROFILER_EXPORT PerfSettings final : public Utils::AspectContainer { Q_OBJECT diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp index 716bff52a3e..5fe190a5139 100644 --- a/src/plugins/projectexplorer/runconfiguration.cpp +++ b/src/plugins/projectexplorer/runconfiguration.cpp @@ -47,25 +47,6 @@ namespace ProjectExplorer { const char BUILD_KEY[] = "ProjectExplorer.RunConfiguration.BuildKey"; const char CUSTOMIZED_KEY[] = "ProjectExplorer.RunConfiguration.Customized"; -/////////////////////////////////////////////////////////////////////// -// -// ISettingsAspect -// -/////////////////////////////////////////////////////////////////////// - -ISettingsAspect::ISettingsAspect() = default; - -QWidget *ISettingsAspect::createConfigWidget() const -{ - QTC_ASSERT(m_configWidgetCreator, return nullptr); - return m_configWidgetCreator(); -} - -void ISettingsAspect::setConfigWidgetCreator(const ConfigWidgetCreator &configWidgetCreator) -{ - m_configWidgetCreator = configWidgetCreator; -} - /////////////////////////////////////////////////////////////////////// // @@ -83,13 +64,13 @@ GlobalOrProjectAspect::~GlobalOrProjectAspect() delete m_projectSettings; } -void GlobalOrProjectAspect::setProjectSettings(ISettingsAspect *settings) +void GlobalOrProjectAspect::setProjectSettings(AspectContainer *settings) { m_projectSettings = settings; m_projectSettings->setAutoApply(true); } -void GlobalOrProjectAspect::setGlobalSettings(ISettingsAspect *settings) +void GlobalOrProjectAspect::setGlobalSettings(AspectContainer *settings) { m_globalSettings = settings; m_projectSettings->setAutoApply(false); @@ -100,7 +81,7 @@ void GlobalOrProjectAspect::setUsingGlobalSettings(bool value) m_useGlobalSettings = value; } -ISettingsAspect *GlobalOrProjectAspect::currentSettings() const +AspectContainer *GlobalOrProjectAspect::currentSettings() const { return m_useGlobalSettings ? m_globalSettings : m_projectSettings; } diff --git a/src/plugins/projectexplorer/runconfiguration.h b/src/plugins/projectexplorer/runconfiguration.h index c4bba4760c8..ba4fb4d4c95 100644 --- a/src/plugins/projectexplorer/runconfiguration.h +++ b/src/plugins/projectexplorer/runconfiguration.h @@ -11,8 +11,6 @@ #include #include -#include - #include #include @@ -29,32 +27,6 @@ class RunConfiguration; class RunConfigurationCreationInfo; class Target; -/** - * An interface for a hunk of global or per-project - * configuration data. - * - */ - -class PROJECTEXPLORER_EXPORT ISettingsAspect : public Utils::AspectContainer -{ - Q_OBJECT - -public: - ISettingsAspect(); - - /// Create a configuration widget for this settings aspect. - QWidget *createConfigWidget() const; - -protected: - using ConfigWidgetCreator = std::function; - void setConfigWidgetCreator(const ConfigWidgetCreator &configWidgetCreator); - - friend class GlobalOrProjectAspect; - - ConfigWidgetCreator m_configWidgetCreator; -}; - - /** * An interface to facilitate switching between hunks of * global and per-project configuration data. @@ -69,19 +41,19 @@ public: GlobalOrProjectAspect(); ~GlobalOrProjectAspect() override; - void setProjectSettings(ISettingsAspect *settings); - void setGlobalSettings(ISettingsAspect *settings); + void setProjectSettings(Utils::AspectContainer *settings); + void setGlobalSettings(Utils::AspectContainer *settings); bool isUsingGlobalSettings() const { return m_useGlobalSettings; } void setUsingGlobalSettings(bool value); void resetProjectToGlobalSettings(); - ISettingsAspect *projectSettings() const { return m_projectSettings; } - ISettingsAspect *currentSettings() const; + Utils::AspectContainer *projectSettings() const { return m_projectSettings; } + Utils::AspectContainer *currentSettings() const; struct Data : Utils::BaseAspect::Data { - ISettingsAspect *currentSettings = nullptr; + Utils::AspectContainer *currentSettings = nullptr; }; protected: @@ -92,8 +64,8 @@ protected: private: bool m_useGlobalSettings = false; - ISettingsAspect *m_projectSettings = nullptr; // Owned if present. - ISettingsAspect *m_globalSettings = nullptr; // Not owned. + Utils::AspectContainer *m_projectSettings = nullptr; // Owned if present. + Utils::AspectContainer *m_globalSettings = nullptr; // Not owned. }; // Documentation inside. @@ -133,7 +105,7 @@ public: ProjectExplorer::ProjectNode *productNode() const; - template T *currentSettings(Utils::Id id) const + template T *currentSettings(Utils::Id id) const { if (auto a = qobject_cast(aspect(id))) return qobject_cast(a->currentSettings()); @@ -264,5 +236,3 @@ private: }; } // namespace ProjectExplorer - -Q_DECLARE_METATYPE(ProjectExplorer::ISettingsAspect *); diff --git a/src/plugins/qmlprofiler/qmlprofilersettings.cpp b/src/plugins/qmlprofiler/qmlprofilersettings.cpp index a5c1352fcaf..9bbac157414 100644 --- a/src/plugins/qmlprofiler/qmlprofilersettings.cpp +++ b/src/plugins/qmlprofiler/qmlprofilersettings.cpp @@ -62,8 +62,6 @@ QmlProfilerSettings::QmlProfilerSettings() }; }); - setConfigWidgetCreator([this] { return layouter()().emerge(); }); - readSettings(); } diff --git a/src/plugins/qmlprofiler/qmlprofilersettings.h b/src/plugins/qmlprofiler/qmlprofilersettings.h index 2b0329e4f5e..0336aee31a7 100644 --- a/src/plugins/qmlprofiler/qmlprofilersettings.h +++ b/src/plugins/qmlprofiler/qmlprofilersettings.h @@ -3,11 +3,11 @@ #pragma once -#include +#include namespace QmlProfiler::Internal { -class QmlProfilerSettings : public ProjectExplorer::ISettingsAspect +class QmlProfilerSettings : public Utils::AspectContainer { public: QmlProfilerSettings(); diff --git a/src/plugins/valgrind/valgrindsettings.cpp b/src/plugins/valgrind/valgrindsettings.cpp index 82160908b72..702e0561eb0 100644 --- a/src/plugins/valgrind/valgrindsettings.cpp +++ b/src/plugins/valgrind/valgrindsettings.cpp @@ -176,14 +176,6 @@ void SuppressionAspect::bufferToGui() d->m_model.appendRow(new QStandardItem(file.toUserOutput())); } -// ValgrindConfigWidget - - -QWidget *createSettingsWidget(ValgrindBaseSettings *settings) -{ - return settings->layouter()().emerge(); -} - ////////////////////////////////////////////////////////////////// // // ValgrindBaseSettings @@ -414,8 +406,6 @@ ValgrindGlobalSettings::ValgrindGlobalSettings() shortenTemplates.setLabelText("<>"); // FIXME: Create a real icon shortenTemplates.setToolTip(Tr::tr("Remove template parameter lists when displaying function names.")); - setConfigWidgetCreator([this] { return createSettingsWidget(this); }); - setSettingsGroup("Analyzer"); readSettings(); setAutoApply(false); @@ -434,8 +424,6 @@ ValgrindGlobalSettings::ValgrindGlobalSettings() ValgrindProjectSettings::ValgrindProjectSettings() : ValgrindBaseSettings(false) { - setConfigWidgetCreator([this] { return createSettingsWidget(this); }); - connect(this, &AspectContainer::fromMapFinished, [this] { // FIXME: Update project page e.g. on "Restore Global", aspects // there are 'autoapply', and Aspect::cancel() is normally part of diff --git a/src/plugins/valgrind/valgrindsettings.h b/src/plugins/valgrind/valgrindsettings.h index 68e6d21969d..ca85a2d92f9 100644 --- a/src/plugins/valgrind/valgrindsettings.h +++ b/src/plugins/valgrind/valgrindsettings.h @@ -38,7 +38,7 @@ private: /** * Valgrind settings shared for global and per-project. */ -class ValgrindBaseSettings : public ProjectExplorer::ISettingsAspect +class ValgrindBaseSettings : public Utils::AspectContainer { Q_OBJECT