diff --git a/src/plugins/perfprofiler/CMakeLists.txt b/src/plugins/perfprofiler/CMakeLists.txt index b7ae8e6c9cf..7140042f565 100644 --- a/src/plugins/perfprofiler/CMakeLists.txt +++ b/src/plugins/perfprofiler/CMakeLists.txt @@ -15,7 +15,6 @@ set(PERFPROFILER_CPP_SOURCES perfevent.h perfeventtype.h perfloaddialog.cpp perfloaddialog.h - perfoptionspage.cpp perfoptionspage.h perfprofiler.qrc perfprofilerconstants.h perfprofilerflamegraphmodel.cpp perfprofilerflamegraphmodel.h @@ -29,7 +28,7 @@ set(PERFPROFILER_CPP_SOURCES perfprofilertracemanager.cpp perfprofilertracemanager.h perfprofilertraceview.cpp perfprofilertraceview.h perfprofiler_global.h - perfprofilertr.h + perfprofilertr.h perfresourcecounter.cpp perfresourcecounter.h perfrunconfigurationaspect.cpp perfrunconfigurationaspect.h perfsettings.cpp perfsettings.h diff --git a/src/plugins/perfprofiler/perfoptionspage.cpp b/src/plugins/perfprofiler/perfoptionspage.cpp deleted file mode 100644 index e295a5be489..00000000000 --- a/src/plugins/perfprofiler/perfoptionspage.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#include "perfconfigwidget.h" -#include "perfoptionspage.h" -#include "perfprofilerconstants.h" -#include "perfprofilertr.h" - -#include -#include - -namespace PerfProfiler { -namespace Internal { - -PerfOptionsPage::PerfOptionsPage(PerfSettings *settings) -{ - setId(Constants::PerfSettingsId); - setDisplayName(Tr::tr("CPU Usage")); - setCategory("T.Analyzer"); - setDisplayCategory(::Debugger::Tr::tr("Analyzer")); - setCategoryIconPath(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER); - setWidgetCreator([settings] { return new PerfConfigWidget(settings); }); -} - -} // namespace Internal -} // namespace PerfProfiler diff --git a/src/plugins/perfprofiler/perfoptionspage.h b/src/plugins/perfprofiler/perfoptionspage.h deleted file mode 100644 index ae87f031ed0..00000000000 --- a/src/plugins/perfprofiler/perfoptionspage.h +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#pragma once - -#include - -namespace PerfProfiler { - -class PerfSettings; - -namespace Internal { - -class PerfOptionsPage final : public Core::IOptionsPage -{ -public: - explicit PerfOptionsPage(PerfSettings *settings); -}; - -} // namespace Internal -} // namespace PerfProfiler diff --git a/src/plugins/perfprofiler/perfprofiler.qbs b/src/plugins/perfprofiler/perfprofiler.qbs index 68d8452ffc1..4604a2e2099 100644 --- a/src/plugins/perfprofiler/perfprofiler.qbs +++ b/src/plugins/perfprofiler/perfprofiler.qbs @@ -26,8 +26,6 @@ QtcPlugin { "perfeventtype.h", "perfloaddialog.cpp", "perfloaddialog.h", - "perfoptionspage.cpp", - "perfoptionspage.h", "perfprofiler_global.h", "perfprofilertr.h", "perfprofilerconstants.h", "perfprofilerplugin.cpp", diff --git a/src/plugins/perfprofiler/perfprofilerplugin.cpp b/src/plugins/perfprofiler/perfprofilerplugin.cpp index 1293d84f436..f7ac90eaa9a 100644 --- a/src/plugins/perfprofiler/perfprofilerplugin.cpp +++ b/src/plugins/perfprofiler/perfprofilerplugin.cpp @@ -1,8 +1,8 @@ // Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -#include "perfoptionspage.h" #include "perfprofilerplugin.h" + #include "perfprofilerruncontrol.h" #include "perfprofilertool.h" #include "perfrunconfigurationaspect.h" @@ -17,8 +17,6 @@ using namespace ProjectExplorer; namespace PerfProfiler::Internal { -Q_GLOBAL_STATIC(PerfSettings, perfGlobalSettings) - class PerfProfilerPluginPrivate { public: @@ -28,7 +26,6 @@ public: } PerfProfilerRunWorkerFactory profilerWorkerFactory; - PerfOptionsPage optionsPage{perfGlobalSettings()}; PerfProfilerTool profilerTool; }; @@ -47,9 +44,4 @@ void PerfProfilerPlugin::initialize() #endif // WITH_TESTS } -PerfSettings *PerfProfilerPlugin::globalSettings() -{ - return perfGlobalSettings(); -} - } // PerfProfiler::Internal diff --git a/src/plugins/perfprofiler/perfprofilerplugin.h b/src/plugins/perfprofiler/perfprofilerplugin.h index afb6ea0936d..8421884f0fe 100644 --- a/src/plugins/perfprofiler/perfprofilerplugin.h +++ b/src/plugins/perfprofiler/perfprofilerplugin.h @@ -3,8 +3,6 @@ #pragma once -#include "perfsettings.h" - #include namespace PerfProfiler::Internal { @@ -19,8 +17,6 @@ public: void initialize() final; - static PerfSettings *globalSettings(); - class PerfProfilerPluginPrivate *d = nullptr; }; diff --git a/src/plugins/perfprofiler/perfprofilertool.cpp b/src/plugins/perfprofiler/perfprofilertool.cpp index d4a06a249e3..6e530e77689 100644 --- a/src/plugins/perfprofiler/perfprofilertool.cpp +++ b/src/plugins/perfprofiler/perfprofilertool.cpp @@ -237,7 +237,7 @@ void PerfProfilerTool::createViews() } PerfConfigWidget *widget = new PerfConfigWidget( - settings ? settings : PerfProfilerPlugin::globalSettings(), + settings ? settings : &globalSettings(), Core::ICore::dialogParent()); widget->setTracePointsButtonVisible(true); widget->setTarget(target); diff --git a/src/plugins/perfprofiler/perfrunconfigurationaspect.cpp b/src/plugins/perfprofiler/perfrunconfigurationaspect.cpp index 2196d8be2a0..d801af2104c 100644 --- a/src/plugins/perfprofiler/perfrunconfigurationaspect.cpp +++ b/src/plugins/perfprofiler/perfrunconfigurationaspect.cpp @@ -14,7 +14,7 @@ namespace PerfProfiler { PerfRunConfigurationAspect::PerfRunConfigurationAspect(ProjectExplorer::Target *target) { setProjectSettings(new PerfSettings(target)); - setGlobalSettings(Internal::PerfProfilerPlugin::globalSettings()); + setGlobalSettings(&PerfProfiler::globalSettings()); setId(Constants::PerfSettingsId); setDisplayName(Tr::tr("Performance Analyzer Settings")); setUsingGlobalSettings(true); diff --git a/src/plugins/perfprofiler/perfsettings.cpp b/src/plugins/perfprofiler/perfsettings.cpp index 6322f77fa12..e737031a3fe 100644 --- a/src/plugins/perfprofiler/perfsettings.cpp +++ b/src/plugins/perfprofiler/perfsettings.cpp @@ -6,16 +6,25 @@ #include "perfprofilertr.h" #include "perfsettings.h" +#include #include -#include +#include +#include +#include #include using namespace Utils; namespace PerfProfiler { +PerfSettings &globalSettings() +{ + static PerfSettings theSettings(nullptr); + return theSettings; +} + PerfSettings::PerfSettings(ProjectExplorer::Target *target) { setConfigWidgetCreator([this, target] { @@ -62,6 +71,14 @@ PerfSettings::PerfSettings(ProjectExplorer::Target *target) stackSize.setEnabled(callgraphMode.volatileValue() == 0); }); + setLayouter([this] { + using namespace Layouting; + return Column { + createConfigWidget() + }; + }); + + readSettings(); readGlobalSettings(); } @@ -125,4 +142,22 @@ void PerfSettings::resetToDefault() fromMap(map); } +// PerfSettingsPage + +class PerfSettingsPage final : public Core::IOptionsPage +{ +public: + PerfSettingsPage() + { + setId(Constants::PerfSettingsId); + setDisplayName(Tr::tr("CPU Usage")); + setCategory("T.Analyzer"); + setDisplayCategory(::Debugger::Tr::tr("Analyzer")); + setCategoryIconPath(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER); + setSettingsProvider([] { return &globalSettings(); }); + } +}; + +const PerfSettingsPage settingsPage; + } // namespace PerfProfiler diff --git a/src/plugins/perfprofiler/perfsettings.h b/src/plugins/perfprofiler/perfsettings.h index 7c10706098b..8b38f1015ea 100644 --- a/src/plugins/perfprofiler/perfsettings.h +++ b/src/plugins/perfprofiler/perfsettings.h @@ -7,8 +7,6 @@ #include -#include - namespace PerfProfiler { class PERFPROFILER_EXPORT PerfSettings final : public ProjectExplorer::ISettingsAspect @@ -34,4 +32,6 @@ public: Utils::StringAspect extraArguments{this}; }; +PerfSettings &globalSettings(); + } // namespace PerfProfiler