BareMetal: Don't rely on global object pool anymore

Change-Id: Iaaf0828cbcc3b3df9ec1774579381e36be82e3c7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2018-01-26 17:23:45 +01:00
parent 2052d6fc03
commit 8a8426d7ba
6 changed files with 40 additions and 33 deletions

View File

@@ -41,17 +41,21 @@
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/coreconstants.h>
#include <QAction>
#include <QMessageBox>
#include <QMainWindow>
#include <QMenu>
#include <QtPlugin>
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<BareMetalDebugSupport>
(ProjectExplorer::Constants::NORMAL_RUN_MODE, constraint);
RunControl::registerWorker<BareMetalDebugSupport>
(ProjectExplorer::Constants::DEBUG_RUN_MODE, constraint);
RunControl::registerWorker<BareMetalDebugSupport>
(ProjectExplorer::Constants::NORMAL_RUN_MODE, constraint);
RunControl::registerWorker<BareMetalDebugSupport>
(ProjectExplorer::Constants::DEBUG_RUN_MODE, constraint);
return true;
return true;
}
void BareMetalPlugin::extensionsInitialized()