diff options
author | hjk <hjk@qt.io> | 2019-03-13 13:07:09 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2019-03-13 16:02:48 +0000 |
commit | d0c052d23ae6f9fe14823668db93048b29fb6795 (patch) | |
tree | cbcdbada16d3486594421f679857123110cb448b /src/plugins/perfprofiler/perfprofilerplugin.cpp | |
parent | 164ae1428ed450703dbc89e367bbc2afa91476cf (diff) |
PerfProfiler: Move towards the canonical plugin setup pattern
Change-Id: I5d2f468c35c154664550175aefd21307b8107bba
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/perfprofiler/perfprofilerplugin.cpp')
-rw-r--r-- | src/plugins/perfprofiler/perfprofilerplugin.cpp | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/src/plugins/perfprofiler/perfprofilerplugin.cpp b/src/plugins/perfprofiler/perfprofilerplugin.cpp index a6fc393cabe..087fd0d7651 100644 --- a/src/plugins/perfprofiler/perfprofilerplugin.cpp +++ b/src/plugins/perfprofiler/perfprofilerplugin.cpp @@ -52,32 +52,44 @@ #include <QAction> #include <QDebug> #include <QMenu> -#include <QtPlugin> using namespace ProjectExplorer; namespace PerfProfiler { +namespace Internal { Q_GLOBAL_STATIC(PerfSettings, perfGlobalSettings) -bool PerfProfilerPlugin::initialize(const QStringList &arguments, QString *errorString) +class PerfProfilerPluginPrivate { - Q_UNUSED(arguments) - Q_UNUSED(errorString) +public: + PerfProfilerPluginPrivate() + { + RunConfiguration::registerAspect<PerfRunConfigurationAspect>(); - (void) new Internal::PerfOptionsPage(this); + RunControl::registerWorkerCreator(ProjectExplorer::Constants::PERFPROFILER_RUN_MODE, + [](RunControl *runControl){ return new PerfProfilerRunner(runControl); }); - RunConfiguration::registerAspect<PerfRunConfigurationAspect>(); + auto constraint = [](RunConfiguration *) { return true; }; + RunControl::registerWorker<PerfProfilerRunner> + (ProjectExplorer::Constants::PERFPROFILER_RUN_MODE, constraint); + } - (void) new Internal::PerfProfilerTool(this); + PerfOptionsPage optionsPage; + PerfProfilerTool profilerTool; +}; - RunControl::registerWorkerCreator(ProjectExplorer::Constants::PERFPROFILER_RUN_MODE, - [](RunControl *runControl){ return new Internal::PerfProfilerRunner(runControl); }); +PerfProfilerPlugin::~PerfProfilerPlugin() +{ + delete d; +} - auto constraint = [](RunConfiguration *) { return true; }; - RunControl::registerWorker<Internal::PerfProfilerRunner> - (ProjectExplorer::Constants::PERFPROFILER_RUN_MODE, constraint); +bool PerfProfilerPlugin::initialize(const QStringList &arguments, QString *errorString) +{ + Q_UNUSED(arguments) + Q_UNUSED(errorString) + d = new PerfProfilerPluginPrivate; return true; } @@ -85,19 +97,20 @@ void PerfProfilerPlugin::extensionsInitialized() { } -PerfProfiler::PerfSettings *PerfProfilerPlugin::globalSettings() +PerfSettings *PerfProfilerPlugin::globalSettings() { return perfGlobalSettings(); } -QList<QObject *> PerfProfiler::PerfProfilerPlugin::createTestObjects() const +QList<QObject *> PerfProfilerPlugin::createTestObjects() const { QList<QObject *> tests; #if WITH_TESTS - tests << new Internal::PerfProfilerTraceFileTest; - tests << new Internal::PerfResourceCounterTest; + tests << new PerfProfilerTraceFileTest; + tests << new PerfResourceCounterTest; #endif // WITH_TESTS return tests; } +} // namespace Internal } // namespace PerfProfiler |