diff options
13 files changed, 29 insertions, 55 deletions
diff --git a/src/plugins/debugger/analyzer/analyzerrunconfigwidget.cpp b/src/plugins/debugger/analyzer/analyzerrunconfigwidget.cpp index 34d44c5b20..b1e898c144 100644 --- a/src/plugins/debugger/analyzer/analyzerrunconfigwidget.cpp +++ b/src/plugins/debugger/analyzer/analyzerrunconfigwidget.cpp @@ -79,11 +79,6 @@ AnalyzerRunConfigWidget::AnalyzerRunConfigWidget(ProjectExplorer::IRunConfigurat chooseSettings(m_aspect->isUsingGlobalSettings() ? 0 : 1); } -QString AnalyzerRunConfigWidget::displayName() const -{ - return m_aspect->displayName(); -} - void AnalyzerRunConfigWidget::chooseSettings(int setting) { QTC_ASSERT(m_aspect, return); diff --git a/src/plugins/debugger/analyzer/analyzerrunconfigwidget.h b/src/plugins/debugger/analyzer/analyzerrunconfigwidget.h index a41f21a778..f7d8c6397e 100644 --- a/src/plugins/debugger/analyzer/analyzerrunconfigwidget.h +++ b/src/plugins/debugger/analyzer/analyzerrunconfigwidget.h @@ -39,15 +39,13 @@ namespace Utils { class DetailsWidget; } namespace Debugger { -class DEBUGGER_EXPORT AnalyzerRunConfigWidget : public ProjectExplorer::RunConfigWidget +class DEBUGGER_EXPORT AnalyzerRunConfigWidget : public QWidget { Q_OBJECT public: AnalyzerRunConfigWidget(ProjectExplorer::IRunConfigurationAspect *aspect); - QString displayName() const override; - private: void chooseSettings(int setting); void restoreGlobal(); diff --git a/src/plugins/debugger/debuggerrunconfigurationaspect.cpp b/src/plugins/debugger/debuggerrunconfigurationaspect.cpp index fa1b4e7cfd..764e885ac2 100644 --- a/src/plugins/debugger/debuggerrunconfigurationaspect.cpp +++ b/src/plugins/debugger/debuggerrunconfigurationaspect.cpp @@ -63,13 +63,12 @@ namespace Internal { // //////////////////////////////////////////////////////////////////////// -class DebuggerRunConfigWidget : public RunConfigWidget +class DebuggerRunConfigWidget : public QWidget { Q_DECLARE_TR_FUNCTIONS(Debugger::Internal::RunConfigWidget) public: explicit DebuggerRunConfigWidget(DebuggerRunConfigurationAspect *aspect); - QString displayName() const override { return tr("Debugger Settings"); } void showEvent(QShowEvent *event) override; void update(); @@ -153,7 +152,7 @@ void DebuggerRunConfigWidget::showEvent(QShowEvent *event) if (!event->spontaneous()) update(); - RunConfigWidget::showEvent(event); + QWidget::showEvent(event); } void DebuggerRunConfigWidget::update() @@ -215,7 +214,7 @@ DebuggerRunConfigurationAspect::DebuggerRunConfigurationAspect( { setId("DebuggerAspect"); setDisplayName(tr("Debugger settings")); - setRunConfigWidgetCreator([this] { return new Internal::DebuggerRunConfigWidget(this); }); + setConfigWidgetCreator([this] { return new Internal::DebuggerRunConfigWidget(this); }); } void DebuggerRunConfigurationAspect::setUseQmlDebugger(bool value) diff --git a/src/plugins/projectexplorer/environmentaspect.cpp b/src/plugins/projectexplorer/environmentaspect.cpp index 555a12db16..02f36d8120 100644 --- a/src/plugins/projectexplorer/environmentaspect.cpp +++ b/src/plugins/projectexplorer/environmentaspect.cpp @@ -44,7 +44,7 @@ EnvironmentAspect::EnvironmentAspect(RunConfiguration *runConfig) : { setDisplayName(tr("Run Environment")); setId("EnvironmentAspect"); - setRunConfigWidgetCreator([this] { return new EnvironmentAspectWidget(this); }); + setConfigWidgetCreator([this] { return new EnvironmentAspectWidget(this); }); } int EnvironmentAspect::baseEnvironmentBase() const diff --git a/src/plugins/projectexplorer/environmentaspectwidget.cpp b/src/plugins/projectexplorer/environmentaspectwidget.cpp index e6f66d4963..7b5c9e5e5f 100644 --- a/src/plugins/projectexplorer/environmentaspectwidget.cpp +++ b/src/plugins/projectexplorer/environmentaspectwidget.cpp @@ -42,7 +42,6 @@ namespace ProjectExplorer { // -------------------------------------------------------------------- EnvironmentAspectWidget::EnvironmentAspectWidget(EnvironmentAspect *aspect, QWidget *additionalWidget) : - RunConfigWidget(), m_aspect(aspect), m_additionalWidget(additionalWidget) { @@ -98,11 +97,6 @@ EnvironmentAspectWidget::EnvironmentAspectWidget(EnvironmentAspect *aspect, QWid this, &EnvironmentAspectWidget::environmentChanged); } -QString EnvironmentAspectWidget::displayName() const -{ - return m_aspect->displayName(); -} - EnvironmentAspect *EnvironmentAspectWidget::aspect() const { return m_aspect; diff --git a/src/plugins/projectexplorer/environmentaspectwidget.h b/src/plugins/projectexplorer/environmentaspectwidget.h index 55bf8fefaa..b5127d889e 100644 --- a/src/plugins/projectexplorer/environmentaspectwidget.h +++ b/src/plugins/projectexplorer/environmentaspectwidget.h @@ -45,14 +45,13 @@ namespace ProjectExplorer { class EnvironmentWidget; -class PROJECTEXPLORER_EXPORT EnvironmentAspectWidget : public RunConfigWidget +class PROJECTEXPLORER_EXPORT EnvironmentAspectWidget : public QWidget { Q_OBJECT public: explicit EnvironmentAspectWidget(EnvironmentAspect *aspect, QWidget *additionalWidget = nullptr); - QString displayName() const override; virtual EnvironmentAspect *aspect() const; QWidget *additionalWidget() const; diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp index 567505afe4..96072b4f0f 100644 --- a/src/plugins/projectexplorer/runconfiguration.cpp +++ b/src/plugins/projectexplorer/runconfiguration.cpp @@ -107,9 +107,9 @@ IRunConfigurationAspect::~IRunConfigurationAspect() transferred to the caller. */ -RunConfigWidget *IRunConfigurationAspect::createConfigurationWidget() const +QWidget *IRunConfigurationAspect::createConfigWidget() const { - return m_runConfigWidgetCreator ? m_runConfigWidgetCreator() : nullptr; + return m_configWidgetCreator ? m_configWidgetCreator() : nullptr; } void IRunConfigurationAspect::copyFrom(IRunConfigurationAspect *source) @@ -159,9 +159,9 @@ void IRunConfigurationAspect::addToConfigurationLayout(QFormLayout *layout) Q_UNUSED(layout); } -void IRunConfigurationAspect::setRunConfigWidgetCreator(const RunConfigWidgetCreator &runConfigWidgetCreator) +void IRunConfigurationAspect::setConfigWidgetCreator(const ConfigWidgetCreator &runConfigWidgetCreator) { - m_runConfigWidgetCreator = runConfigWidgetCreator; + m_configWidgetCreator = runConfigWidgetCreator; } void IRunConfigurationAspect::resetProjectToGlobalSettings() diff --git a/src/plugins/projectexplorer/runconfiguration.h b/src/plugins/projectexplorer/runconfiguration.h index 4b10e7d0e4..2568747466 100644 --- a/src/plugins/projectexplorer/runconfiguration.h +++ b/src/plugins/projectexplorer/runconfiguration.h @@ -57,7 +57,6 @@ class Node; class RunConfigurationFactory; class RunConfiguration; class RunConfigurationCreationInfo; -class RunConfigWidget; class RunControl; class RunWorkerFactory; class Target; @@ -111,9 +110,9 @@ public: explicit IRunConfigurationAspect(RunConfiguration *runConfig); ~IRunConfigurationAspect() override; - using RunConfigWidgetCreator = std::function<RunConfigWidget *()>; - void setRunConfigWidgetCreator(const RunConfigWidgetCreator &runConfigWidgetCreator); - RunConfigWidget *createConfigurationWidget() const; + using ConfigWidgetCreator = std::function<QWidget *()>; + void setConfigWidgetCreator(const ConfigWidgetCreator &configWidgetCreator); + QWidget *createConfigWidget() const; void copyFrom(IRunConfigurationAspect *other); void setId(Core::Id id) { m_id = id; } @@ -154,7 +153,7 @@ private: RunConfiguration *m_runConfiguration = nullptr; ISettingsAspect *m_projectSettings = nullptr; // Owned if present. ISettingsAspect *m_globalSettings = nullptr; // Not owned. - RunConfigWidgetCreator m_runConfigWidgetCreator; + ConfigWidgetCreator m_configWidgetCreator; }; class PROJECTEXPLORER_EXPORT Runnable @@ -353,17 +352,6 @@ private: const bool m_decorateTargetName; }; -class PROJECTEXPLORER_EXPORT RunConfigWidget : public QWidget -{ - Q_OBJECT - -public: - virtual QString displayName() const = 0; - -signals: - void displayNameChanged(const QString &); -}; - class PROJECTEXPLORER_EXPORT RunWorker : public QObject { Q_OBJECT diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.cpp b/src/plugins/projectexplorer/runsettingspropertiespage.cpp index a7bf42fc02..4a5c60d556 100644 --- a/src/plugins/projectexplorer/runsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/runsettingspropertiespage.cpp @@ -529,19 +529,21 @@ QString RunSettingsWidget::uniqueRCName(const QString &name) void RunSettingsWidget::addRunControlWidgets() { for (IRunConfigurationAspect *aspect : m_runConfiguration->aspects()) { - if (RunConfigWidget *rcw = aspect->createConfigurationWidget()) - addSubWidget(rcw); + if (QWidget *rcw = aspect->createConfigWidget()) { + auto label = new QLabel(this); + label->setText(aspect->displayName()); + connect(aspect, &IRunConfigurationAspect::changed, label, [label, aspect] { + label->setText(aspect->displayName()); + }); + addSubWidget(rcw, label); + } } } -void RunSettingsWidget::addSubWidget(RunConfigWidget *widget) +void RunSettingsWidget::addSubWidget(QWidget *widget, QLabel *label) { widget->setContentsMargins(0, 10, 0, 0); - auto label = new QLabel(this); - label->setText(widget->displayName()); - connect(widget, &RunConfigWidget::displayNameChanged, - label, &QLabel::setText); QFont f = label->font(); f.setBold(true); f.setPointSizeF(f.pointSizeF() * 1.2); @@ -558,8 +560,7 @@ void RunSettingsWidget::addSubWidget(RunConfigWidget *widget) void RunSettingsWidget::removeSubWidgets() { - // foreach does not like commas in types, it's only a macro after all - foreach (const RunConfigItem &item, m_subWidgets) { + for (const RunConfigItem &item : m_subWidgets) { delete item.first; delete item.second; } diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.h b/src/plugins/projectexplorer/runsettingspropertiespage.h index 5a551f9421..6442fb1441 100644 --- a/src/plugins/projectexplorer/runsettingspropertiespage.h +++ b/src/plugins/projectexplorer/runsettingspropertiespage.h @@ -77,7 +77,7 @@ private: void setConfigurationWidget(RunConfiguration *rc); void addRunControlWidgets(); - void addSubWidget(RunConfigWidget *subWidget); + void addSubWidget(QWidget *subWidget, QLabel *label); void removeSubWidgets(); void updateEnabledState(); @@ -94,7 +94,7 @@ private: QMenu *m_addRunMenu; QMenu *m_addDeployMenu; bool m_ignoreChange = false; - typedef QPair<RunConfigWidget *, QLabel *> RunConfigItem; + typedef QPair<QWidget *, QLabel *> RunConfigItem; QList<RunConfigItem> m_subWidgets; QGridLayout *m_gridLayout; diff --git a/src/plugins/qmlprofiler/qmlprofilerrunconfigurationaspect.cpp b/src/plugins/qmlprofiler/qmlprofilerrunconfigurationaspect.cpp index d513ee0ad5..33e75ab321 100644 --- a/src/plugins/qmlprofiler/qmlprofilerrunconfigurationaspect.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerrunconfigurationaspect.cpp @@ -43,7 +43,7 @@ QmlProfilerRunConfigurationAspect::QmlProfilerRunConfigurationAspect( setDisplayName(QCoreApplication::translate("QmlProfilerRunConfiguration", "QML Profiler Settings")); setUsingGlobalSettings(true); resetProjectToGlobalSettings(); - setRunConfigWidgetCreator([this] { return new Debugger::AnalyzerRunConfigWidget(this); }); + setConfigWidgetCreator([this] { return new Debugger::AnalyzerRunConfigWidget(this); }); } } // Internal diff --git a/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp b/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp index 385c9f4f36..ccc4670b5e 100644 --- a/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp +++ b/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp @@ -53,7 +53,7 @@ RemoteLinuxEnvironmentAspect::RemoteLinuxEnvironmentAspect(ProjectExplorer::RunC addSupportedBaseEnvironment(CleanBaseEnvironment, tr("Clean Environment")); addPreferredBaseEnvironment(RemoteBaseEnvironment, tr("System Environment")); - setRunConfigWidgetCreator([this, rc] { + setConfigWidgetCreator([this, rc] { return new RemoteLinuxEnvironmentAspectWidget(this, rc->target()); }); } diff --git a/src/plugins/valgrind/valgrindplugin.cpp b/src/plugins/valgrind/valgrindplugin.cpp index 718f284350..12b377481b 100644 --- a/src/plugins/valgrind/valgrindplugin.cpp +++ b/src/plugins/valgrind/valgrindplugin.cpp @@ -102,7 +102,7 @@ public: "Valgrind Settings")); setUsingGlobalSettings(true); resetProjectToGlobalSettings(); - setRunConfigWidgetCreator([this] { return new Debugger::AnalyzerRunConfigWidget(this); }); + setConfigWidgetCreator([this] { return new Debugger::AnalyzerRunConfigWidget(this); }); } }; |