diff --git a/src/plugins/baremetal/baremetaldeviceconfigurationfactory.cpp b/src/plugins/baremetal/baremetaldeviceconfigurationfactory.cpp index 04e2f50048a..6272450fdb3 100644 --- a/src/plugins/baremetal/baremetaldeviceconfigurationfactory.cpp +++ b/src/plugins/baremetal/baremetaldeviceconfigurationfactory.cpp @@ -39,8 +39,7 @@ using namespace ProjectExplorer; namespace BareMetal { namespace Internal { -BareMetalDeviceConfigurationFactory::BareMetalDeviceConfigurationFactory(QObject *parent) - : IDeviceFactory(parent) +BareMetalDeviceConfigurationFactory::BareMetalDeviceConfigurationFactory() { } diff --git a/src/plugins/baremetal/baremetaldeviceconfigurationfactory.h b/src/plugins/baremetal/baremetaldeviceconfigurationfactory.h index 0139cd24a20..d5203bd6eee 100644 --- a/src/plugins/baremetal/baremetaldeviceconfigurationfactory.h +++ b/src/plugins/baremetal/baremetaldeviceconfigurationfactory.h @@ -36,7 +36,7 @@ class BareMetalDeviceConfigurationFactory Q_OBJECT public: - BareMetalDeviceConfigurationFactory(QObject *parent = 0); + BareMetalDeviceConfigurationFactory(); QString displayNameForId(Core::Id type) const; QList availableCreationIds() const; diff --git a/src/plugins/baremetal/baremetalplugin.cpp b/src/plugins/baremetal/baremetalplugin.cpp index 0bee8a70e9e..2ee3afb458b 100644 --- a/src/plugins/baremetal/baremetalplugin.cpp +++ b/src/plugins/baremetal/baremetalplugin.cpp @@ -41,17 +41,21 @@ #include #include -#include -#include -#include -#include -#include - using namespace ProjectExplorer; namespace BareMetal { namespace Internal { +class BareMetalPluginRunData +{ +public: + BareMetalDeviceConfigurationFactory deviceConfigurationFactory; + BareMetalRunConfigurationFactory runConfigurationFactory; + BareMetalCustomRunConfigurationFactory customRunConfigurationFactory; + GdbServerProvidersSettingsPage gdbServerProviderSettinsPage; + GdbServerProviderManager gdbServerProviderManager; +}; + BareMetalPlugin::BareMetalPlugin() { setObjectName(QLatin1String("BareMetalPlugin")); @@ -59,30 +63,27 @@ BareMetalPlugin::BareMetalPlugin() BareMetalPlugin::~BareMetalPlugin() { + delete m_runData; } bool BareMetalPlugin::initialize(const QStringList &arguments, QString *errorString) { - Q_UNUSED(arguments) - Q_UNUSED(errorString) + Q_UNUSED(arguments) + Q_UNUSED(errorString) - addAutoReleasedObject(new BareMetalDeviceConfigurationFactory); - addAutoReleasedObject(new BareMetalRunConfigurationFactory); - addAutoReleasedObject(new BareMetalCustomRunConfigurationFactory); - addAutoReleasedObject(new GdbServerProvidersSettingsPage); - addAutoReleasedObject(new GdbServerProviderManager); + m_runData = new BareMetalPluginRunData; - auto constraint = [](RunConfiguration *runConfig) { - const QByteArray idStr = runConfig->id().name(); - return runConfig->isEnabled() && idStr.startsWith(BareMetalRunConfiguration::IdPrefix); - }; + auto constraint = [](RunConfiguration *runConfig) { + const QByteArray idStr = runConfig->id().name(); + return runConfig->isEnabled() && idStr.startsWith(BareMetalRunConfiguration::IdPrefix); + }; - RunControl::registerWorker - (ProjectExplorer::Constants::NORMAL_RUN_MODE, constraint); - RunControl::registerWorker - (ProjectExplorer::Constants::DEBUG_RUN_MODE, constraint); + RunControl::registerWorker + (ProjectExplorer::Constants::NORMAL_RUN_MODE, constraint); + RunControl::registerWorker + (ProjectExplorer::Constants::DEBUG_RUN_MODE, constraint); - return true; + return true; } void BareMetalPlugin::extensionsInitialized() diff --git a/src/plugins/baremetal/baremetalplugin.h b/src/plugins/baremetal/baremetalplugin.h index 92cb604a824..17ecbcc85d9 100644 --- a/src/plugins/baremetal/baremetalplugin.h +++ b/src/plugins/baremetal/baremetalplugin.h @@ -31,6 +31,8 @@ namespace BareMetal { namespace Internal { +class BareMetalPluginRunData; + class BareMetalPlugin : public ExtensionSystem::IPlugin { Q_OBJECT @@ -38,10 +40,14 @@ class BareMetalPlugin : public ExtensionSystem::IPlugin public: BareMetalPlugin(); - ~BareMetalPlugin(); - bool initialize(const QStringList &arguments, QString *errorString); - void extensionsInitialized(); +private: + ~BareMetalPlugin() final; + + bool initialize(const QStringList &arguments, QString *errorString) final; + void extensionsInitialized() final; + + BareMetalPluginRunData *m_runData; }; } // namespace Internal diff --git a/src/plugins/baremetal/gdbserverprovidermanager.cpp b/src/plugins/baremetal/gdbserverprovidermanager.cpp index fa18a024001..08a3dcade17 100644 --- a/src/plugins/baremetal/gdbserverprovidermanager.cpp +++ b/src/plugins/baremetal/gdbserverprovidermanager.cpp @@ -51,9 +51,8 @@ const char fileNameKeyC[] = "/gdbserverproviders.xml"; static GdbServerProviderManager *m_instance = 0; -GdbServerProviderManager::GdbServerProviderManager(QObject *parent) - : QObject(parent) - , m_configFile(Utils::FileName::fromString(Core::ICore::userResourcePath() + fileNameKeyC)) +GdbServerProviderManager::GdbServerProviderManager() + : m_configFile(Utils::FileName::fromString(Core::ICore::userResourcePath() + fileNameKeyC)) , m_factories({new DefaultGdbServerProviderFactory, new OpenOcdGdbServerProviderFactory, new StLinkUtilGdbServerProviderFactory}) diff --git a/src/plugins/baremetal/gdbserverprovidermanager.h b/src/plugins/baremetal/gdbserverprovidermanager.h index 6cac1928926..a26c5bfe13f 100644 --- a/src/plugins/baremetal/gdbserverprovidermanager.h +++ b/src/plugins/baremetal/gdbserverprovidermanager.h @@ -36,6 +36,7 @@ namespace BareMetal { namespace Internal { class BareMetalPlugin; +class BareMetalPluginRunData; class GdbServerProvider; class GdbServerProviderFactory; @@ -63,7 +64,7 @@ signals: private: void saveProviders(); - explicit GdbServerProviderManager(QObject *parent = 0); + GdbServerProviderManager(); void restoreProviders(); static void notifyAboutUpdate(GdbServerProvider *); @@ -73,7 +74,8 @@ private: const Utils::FileName m_configFile; const QList m_factories; - friend class BareMetalPlugin; // for constructor + friend class BareMetalPlugin; // for restoreProviders + friend class BareMetalPluginRunData; // for constructor friend class GdbServerProvider; };