diff --git a/src/plugins/debugger/CMakeLists.txt b/src/plugins/debugger/CMakeLists.txt index 4dc258ac67f..7ce22ed3821 100644 --- a/src/plugins/debugger/CMakeLists.txt +++ b/src/plugins/debugger/CMakeLists.txt @@ -8,7 +8,6 @@ add_qtc_plugin(Debugger SOURCES analyzer/analyzerbase.qrc analyzer/analyzericons.h - analyzer/analyzerrunconfigwidget.cpp analyzer/analyzerrunconfigwidget.h analyzer/analyzerutils.cpp analyzer/analyzerutils.h analyzer/detailederrorview.cpp analyzer/detailederrorview.h analyzer/diagnosticlocation.cpp analyzer/diagnosticlocation.h diff --git a/src/plugins/debugger/analyzer/analyzerrunconfigwidget.cpp b/src/plugins/debugger/analyzer/analyzerrunconfigwidget.cpp deleted file mode 100644 index 61f81f46ce3..00000000000 --- a/src/plugins/debugger/analyzer/analyzerrunconfigwidget.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#include "analyzerrunconfigwidget.h" - -#include "../debuggertr.h" - -#include -#include - -#include -#include -#include - -using namespace Utils; - -namespace Debugger { - -AnalyzerRunConfigWidget::AnalyzerRunConfigWidget(ProjectExplorer::GlobalOrProjectAspect *aspect) -{ - using namespace Layouting; - - auto settingsCombo = new QComboBox; - settingsCombo->addItem(Tr::tr("Global")); - settingsCombo->addItem(Tr::tr("Custom")); - - auto restoreButton = new QPushButton(Tr::tr("Restore Global")); - - auto innerPane = new QWidget; - auto configWidget = aspect->projectSettings()->layouter()().emerge(); - - auto details = new DetailsWidget; - details->setWidget(innerPane); - - Column { - Row { settingsCombo, restoreButton, st }, - configWidget - }.attachTo(innerPane); - - Column { details }.attachTo(this); - - details->layout()->setContentsMargins(0, 0, 0, 0); - innerPane->layout()->setContentsMargins(0, 0, 0, 0); - layout()->setContentsMargins(0, 0, 0, 0); - - auto chooseSettings = [=](int setting) { - const bool isCustom = (setting == 1); - - settingsCombo->setCurrentIndex(setting); - aspect->setUsingGlobalSettings(!isCustom); - configWidget->setEnabled(isCustom); - restoreButton->setEnabled(isCustom); - details->setSummaryText(isCustom - ? Tr::tr("Use Customized Settings") - : Tr::tr("Use Global Settings")); - }; - - chooseSettings(aspect->isUsingGlobalSettings() ? 0 : 1); - - connect(settingsCombo, &QComboBox::activated, this, chooseSettings); - connect(restoreButton, &QPushButton::clicked, - aspect, &ProjectExplorer::GlobalOrProjectAspect::resetProjectToGlobalSettings); -} - -} // namespace Debugger diff --git a/src/plugins/debugger/analyzer/analyzerrunconfigwidget.h b/src/plugins/debugger/analyzer/analyzerrunconfigwidget.h deleted file mode 100644 index e6167f49880..00000000000 --- a/src/plugins/debugger/analyzer/analyzerrunconfigwidget.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#pragma once - -#include - -#include - -namespace Debugger { - -class DEBUGGER_EXPORT AnalyzerRunConfigWidget : public QWidget -{ -public: - AnalyzerRunConfigWidget(ProjectExplorer::GlobalOrProjectAspect *aspect); -}; - -} // namespace Debugger diff --git a/src/plugins/debugger/debugger.qbs b/src/plugins/debugger/debugger.qbs index 9f9401801c2..34192c5dcc0 100644 --- a/src/plugins/debugger/debugger.qbs +++ b/src/plugins/debugger/debugger.qbs @@ -231,8 +231,6 @@ QtcPlugin { files: [ "analyzerbase.qrc", "analyzericons.h", - "analyzerrunconfigwidget.cpp", - "analyzerrunconfigwidget.h", "analyzerutils.cpp", "analyzerutils.h", "detailederrorview.cpp", diff --git a/src/plugins/perfprofiler/perfrunconfigurationaspect.cpp b/src/plugins/perfprofiler/perfrunconfigurationaspect.cpp index d1062ed732e..0b9781c867a 100644 --- a/src/plugins/perfprofiler/perfrunconfigurationaspect.cpp +++ b/src/plugins/perfprofiler/perfrunconfigurationaspect.cpp @@ -6,11 +6,13 @@ #include "perfrunconfigurationaspect.h" #include "perfsettings.h" -#include +#include + +using namespace ProjectExplorer; namespace PerfProfiler::Internal { -PerfRunConfigurationAspect::PerfRunConfigurationAspect(ProjectExplorer::Target *target) +PerfRunConfigurationAspect::PerfRunConfigurationAspect(Target *target) { setProjectSettings(new PerfSettings(target)); setGlobalSettings(&PerfProfiler::globalSettings()); @@ -18,7 +20,7 @@ PerfRunConfigurationAspect::PerfRunConfigurationAspect(ProjectExplorer::Target * setDisplayName(Tr::tr("Performance Analyzer Settings")); setUsingGlobalSettings(true); resetProjectToGlobalSettings(); - setConfigWidgetCreator([this] { return new Debugger::AnalyzerRunConfigWidget(this); }); + setConfigWidgetCreator([this] { return createRunConfigAspectWidget(this); }); } } // PerfProfiler::Internal diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp index 22c6282c698..2aed8850d20 100644 --- a/src/plugins/projectexplorer/runconfiguration.cpp +++ b/src/plugins/projectexplorer/runconfiguration.cpp @@ -32,9 +32,10 @@ #include #include +#include #include +#include #include -#include #include using namespace Utils; @@ -119,6 +120,62 @@ void GlobalOrProjectAspect::resetProjectToGlobalSettings() } +class RunConfigAspectWidget : public QWidget +{ +public: + explicit RunConfigAspectWidget(GlobalOrProjectAspect *aspect) + { + using namespace Layouting; + + auto settingsCombo = new QComboBox; + settingsCombo->addItem(Tr::tr("Global")); + settingsCombo->addItem(Tr::tr("Custom")); + + auto restoreButton = new QPushButton(Tr::tr("Restore Global")); + + auto innerPane = new QWidget; + auto configWidget = aspect->projectSettings()->layouter()().emerge(); + + auto details = new DetailsWidget; + details->setWidget(innerPane); + + Column { + Row { settingsCombo, restoreButton, st }, + configWidget + }.attachTo(innerPane); + + Column { details }.attachTo(this); + + details->layout()->setContentsMargins(0, 0, 0, 0); + innerPane->layout()->setContentsMargins(0, 0, 0, 0); + layout()->setContentsMargins(0, 0, 0, 0); + + auto chooseSettings = [=](int setting) { + const bool isCustom = (setting == 1); + + settingsCombo->setCurrentIndex(setting); + aspect->setUsingGlobalSettings(!isCustom); + configWidget->setEnabled(isCustom); + restoreButton->setEnabled(isCustom); + details->setSummaryText(isCustom + ? Tr::tr("Use Customized Settings") + : Tr::tr("Use Global Settings")); + }; + + chooseSettings(aspect->isUsingGlobalSettings() ? 0 : 1); + + connect(settingsCombo, &QComboBox::activated, this, chooseSettings); + connect(restoreButton, &QPushButton::clicked, + aspect, &ProjectExplorer::GlobalOrProjectAspect::resetProjectToGlobalSettings); + } +}; + +QWidget *createRunConfigAspectWidget(GlobalOrProjectAspect *aspect) +{ + return new RunConfigAspectWidget(aspect); +} + + /*! \class ProjectExplorer::RunConfiguration \inmodule QtCreator diff --git a/src/plugins/projectexplorer/runconfiguration.h b/src/plugins/projectexplorer/runconfiguration.h index ca78c0ee056..31489706c17 100644 --- a/src/plugins/projectexplorer/runconfiguration.h +++ b/src/plugins/projectexplorer/runconfiguration.h @@ -115,6 +115,8 @@ private: Utils::AspectContainer *m_globalSettings = nullptr; // Not owned. }; +PROJECTEXPLORER_EXPORT QWidget *createRunConfigAspectWidget(GlobalOrProjectAspect *); + // Documentation inside. class PROJECTEXPLORER_EXPORT RunConfiguration : public ProjectConfiguration { diff --git a/src/plugins/qmlprofiler/qmlprofilerrunconfigurationaspect.cpp b/src/plugins/qmlprofiler/qmlprofilerrunconfigurationaspect.cpp index e513e3fe6fd..89fa5817ae4 100644 --- a/src/plugins/qmlprofiler/qmlprofilerrunconfigurationaspect.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerrunconfigurationaspect.cpp @@ -7,11 +7,13 @@ #include "qmlprofilersettings.h" #include "qmlprofilertr.h" -#include +#include + +using namespace ProjectExplorer; namespace QmlProfiler::Internal { -QmlProfilerRunConfigurationAspect::QmlProfilerRunConfigurationAspect(ProjectExplorer::Target *) +QmlProfilerRunConfigurationAspect::QmlProfilerRunConfigurationAspect(Target *) { setProjectSettings(new QmlProfilerSettings); setGlobalSettings(&Internal::globalSettings()); @@ -19,7 +21,7 @@ QmlProfilerRunConfigurationAspect::QmlProfilerRunConfigurationAspect(ProjectExpl setDisplayName(Tr::tr("QML Profiler Settings")); setUsingGlobalSettings(true); resetProjectToGlobalSettings(); - setConfigWidgetCreator([this] { return new Debugger::AnalyzerRunConfigWidget(this); }); + setConfigWidgetCreator([this] { return createRunConfigAspectWidget(this); }); } } // QmlProfiler::Internal diff --git a/src/plugins/valgrind/valgrindplugin.cpp b/src/plugins/valgrind/valgrindplugin.cpp index 59b495f6adb..99e8209f82c 100644 --- a/src/plugins/valgrind/valgrindplugin.cpp +++ b/src/plugins/valgrind/valgrindplugin.cpp @@ -9,12 +9,12 @@ #include #include -#include #include #include #include +#include #ifdef WITH_TESTS # include "valgrindmemcheckparsertest.h" @@ -37,7 +37,7 @@ public: setDisplayName(Tr::tr("Valgrind Settings")); setUsingGlobalSettings(true); resetProjectToGlobalSettings(); - setConfigWidgetCreator([this] { return new Debugger::AnalyzerRunConfigWidget(this); }); + setConfigWidgetCreator([this] { return createRunConfigAspectWidget(this); }); } };