forked from qt-creator/qt-creator
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:
@@ -39,8 +39,7 @@ using namespace ProjectExplorer;
|
|||||||
namespace BareMetal {
|
namespace BareMetal {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
BareMetalDeviceConfigurationFactory::BareMetalDeviceConfigurationFactory(QObject *parent)
|
BareMetalDeviceConfigurationFactory::BareMetalDeviceConfigurationFactory()
|
||||||
: IDeviceFactory(parent)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class BareMetalDeviceConfigurationFactory
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BareMetalDeviceConfigurationFactory(QObject *parent = 0);
|
BareMetalDeviceConfigurationFactory();
|
||||||
|
|
||||||
QString displayNameForId(Core::Id type) const;
|
QString displayNameForId(Core::Id type) const;
|
||||||
QList<Core::Id> availableCreationIds() const;
|
QList<Core::Id> availableCreationIds() const;
|
||||||
|
|||||||
@@ -41,17 +41,21 @@
|
|||||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
|
|
||||||
#include <QAction>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QMainWindow>
|
|
||||||
#include <QMenu>
|
|
||||||
#include <QtPlugin>
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace BareMetal {
|
namespace BareMetal {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
class BareMetalPluginRunData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BareMetalDeviceConfigurationFactory deviceConfigurationFactory;
|
||||||
|
BareMetalRunConfigurationFactory runConfigurationFactory;
|
||||||
|
BareMetalCustomRunConfigurationFactory customRunConfigurationFactory;
|
||||||
|
GdbServerProvidersSettingsPage gdbServerProviderSettinsPage;
|
||||||
|
GdbServerProviderManager gdbServerProviderManager;
|
||||||
|
};
|
||||||
|
|
||||||
BareMetalPlugin::BareMetalPlugin()
|
BareMetalPlugin::BareMetalPlugin()
|
||||||
{
|
{
|
||||||
setObjectName(QLatin1String("BareMetalPlugin"));
|
setObjectName(QLatin1String("BareMetalPlugin"));
|
||||||
@@ -59,6 +63,7 @@ BareMetalPlugin::BareMetalPlugin()
|
|||||||
|
|
||||||
BareMetalPlugin::~BareMetalPlugin()
|
BareMetalPlugin::~BareMetalPlugin()
|
||||||
{
|
{
|
||||||
|
delete m_runData;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BareMetalPlugin::initialize(const QStringList &arguments, QString *errorString)
|
bool BareMetalPlugin::initialize(const QStringList &arguments, QString *errorString)
|
||||||
@@ -66,11 +71,7 @@ bool BareMetalPlugin::initialize(const QStringList &arguments, QString *errorStr
|
|||||||
Q_UNUSED(arguments)
|
Q_UNUSED(arguments)
|
||||||
Q_UNUSED(errorString)
|
Q_UNUSED(errorString)
|
||||||
|
|
||||||
addAutoReleasedObject(new BareMetalDeviceConfigurationFactory);
|
m_runData = new BareMetalPluginRunData;
|
||||||
addAutoReleasedObject(new BareMetalRunConfigurationFactory);
|
|
||||||
addAutoReleasedObject(new BareMetalCustomRunConfigurationFactory);
|
|
||||||
addAutoReleasedObject(new GdbServerProvidersSettingsPage);
|
|
||||||
addAutoReleasedObject(new GdbServerProviderManager);
|
|
||||||
|
|
||||||
auto constraint = [](RunConfiguration *runConfig) {
|
auto constraint = [](RunConfiguration *runConfig) {
|
||||||
const QByteArray idStr = runConfig->id().name();
|
const QByteArray idStr = runConfig->id().name();
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
namespace BareMetal {
|
namespace BareMetal {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
class BareMetalPluginRunData;
|
||||||
|
|
||||||
class BareMetalPlugin : public ExtensionSystem::IPlugin
|
class BareMetalPlugin : public ExtensionSystem::IPlugin
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -38,10 +40,14 @@ class BareMetalPlugin : public ExtensionSystem::IPlugin
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
BareMetalPlugin();
|
BareMetalPlugin();
|
||||||
~BareMetalPlugin();
|
|
||||||
|
|
||||||
bool initialize(const QStringList &arguments, QString *errorString);
|
private:
|
||||||
void extensionsInitialized();
|
~BareMetalPlugin() final;
|
||||||
|
|
||||||
|
bool initialize(const QStringList &arguments, QString *errorString) final;
|
||||||
|
void extensionsInitialized() final;
|
||||||
|
|
||||||
|
BareMetalPluginRunData *m_runData;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -51,9 +51,8 @@ const char fileNameKeyC[] = "/gdbserverproviders.xml";
|
|||||||
|
|
||||||
static GdbServerProviderManager *m_instance = 0;
|
static GdbServerProviderManager *m_instance = 0;
|
||||||
|
|
||||||
GdbServerProviderManager::GdbServerProviderManager(QObject *parent)
|
GdbServerProviderManager::GdbServerProviderManager()
|
||||||
: QObject(parent)
|
: m_configFile(Utils::FileName::fromString(Core::ICore::userResourcePath() + fileNameKeyC))
|
||||||
, m_configFile(Utils::FileName::fromString(Core::ICore::userResourcePath() + fileNameKeyC))
|
|
||||||
, m_factories({new DefaultGdbServerProviderFactory,
|
, m_factories({new DefaultGdbServerProviderFactory,
|
||||||
new OpenOcdGdbServerProviderFactory,
|
new OpenOcdGdbServerProviderFactory,
|
||||||
new StLinkUtilGdbServerProviderFactory})
|
new StLinkUtilGdbServerProviderFactory})
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ namespace BareMetal {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class BareMetalPlugin;
|
class BareMetalPlugin;
|
||||||
|
class BareMetalPluginRunData;
|
||||||
class GdbServerProvider;
|
class GdbServerProvider;
|
||||||
class GdbServerProviderFactory;
|
class GdbServerProviderFactory;
|
||||||
|
|
||||||
@@ -63,7 +64,7 @@ signals:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void saveProviders();
|
void saveProviders();
|
||||||
explicit GdbServerProviderManager(QObject *parent = 0);
|
GdbServerProviderManager();
|
||||||
|
|
||||||
void restoreProviders();
|
void restoreProviders();
|
||||||
static void notifyAboutUpdate(GdbServerProvider *);
|
static void notifyAboutUpdate(GdbServerProvider *);
|
||||||
@@ -73,7 +74,8 @@ private:
|
|||||||
const Utils::FileName m_configFile;
|
const Utils::FileName m_configFile;
|
||||||
const QList<GdbServerProviderFactory *> m_factories;
|
const QList<GdbServerProviderFactory *> m_factories;
|
||||||
|
|
||||||
friend class BareMetalPlugin; // for constructor
|
friend class BareMetalPlugin; // for restoreProviders
|
||||||
|
friend class BareMetalPluginRunData; // for constructor
|
||||||
friend class GdbServerProvider;
|
friend class GdbServerProvider;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user