forked from qt-creator/qt-creator
Qnx: Pimpl and remove unneeded use of global object pool
Change-Id: I0029b151e34e2e7498afd8e410dfc617282bed49 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -42,10 +42,9 @@ static Utils::FileName qnxConfigSettingsFileName()
|
|||||||
+ QLatin1String(Constants::QNX_CONFIGS_FILENAME));
|
+ QLatin1String(Constants::QNX_CONFIGS_FILENAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
QnxConfigurationManager *QnxConfigurationManager::m_instance = 0;
|
static QnxConfigurationManager *m_instance = nullptr;
|
||||||
|
|
||||||
QnxConfigurationManager::QnxConfigurationManager(QObject *parent)
|
QnxConfigurationManager::QnxConfigurationManager()
|
||||||
: QObject(parent)
|
|
||||||
{
|
{
|
||||||
m_instance = this;
|
m_instance = this;
|
||||||
m_writer = new Utils::PersistentSettingsWriter(qnxConfigSettingsFileName(),
|
m_writer = new Utils::PersistentSettingsWriter(qnxConfigSettingsFileName(),
|
||||||
|
@@ -38,8 +38,10 @@ class QnxConfigurationManager: public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
static QnxConfigurationManager *instance();
|
QnxConfigurationManager();
|
||||||
~QnxConfigurationManager();
|
~QnxConfigurationManager();
|
||||||
|
|
||||||
|
static QnxConfigurationManager *instance();
|
||||||
QList<QnxConfiguration*> configurations() const;
|
QList<QnxConfiguration*> configurations() const;
|
||||||
void removeConfiguration(QnxConfiguration *config);
|
void removeConfiguration(QnxConfiguration *config);
|
||||||
bool addConfiguration(QnxConfiguration *config);
|
bool addConfiguration(QnxConfiguration *config);
|
||||||
@@ -52,13 +54,9 @@ signals:
|
|||||||
void configurationsListUpdated();
|
void configurationsListUpdated();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QnxConfigurationManager(QObject *parent = 0);
|
|
||||||
static QnxConfigurationManager *m_instance;
|
|
||||||
QList<QnxConfiguration*> m_configurations;
|
QList<QnxConfiguration*> m_configurations;
|
||||||
Utils::PersistentSettingsWriter *m_writer;
|
Utils::PersistentSettingsWriter *m_writer;
|
||||||
void restoreConfigurations();
|
void restoreConfigurations();
|
||||||
|
|
||||||
friend class QnxPlugin;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,6 @@
|
|||||||
#include <projectexplorer/kitinformation.h>
|
#include <projectexplorer/kitinformation.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/taskhub.h>
|
|
||||||
#include <projectexplorer/kitmanager.h>
|
#include <projectexplorer/kitmanager.h>
|
||||||
#include <projectexplorer/environmentaspect.h>
|
#include <projectexplorer/environmentaspect.h>
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
@@ -60,25 +59,42 @@
|
|||||||
#include <qtsupport/qtkitinformation.h>
|
#include <qtsupport/qtkitinformation.h>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QtPlugin>
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
class QnxPluginPrivate
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void updateDebuggerActions();
|
||||||
|
|
||||||
|
QAction *m_debugSeparator = nullptr;
|
||||||
|
QAction m_attachToQnxApplication{QnxPlugin::tr("Attach to remote QNX application..."), nullptr};
|
||||||
|
|
||||||
|
QnxConfigurationManager configurationFactory;
|
||||||
|
QnxQtVersionFactory qtVersionFactory;
|
||||||
|
QnxDeviceFactory deviceFactory;
|
||||||
|
QnxDeployConfigurationFactory deployConfigFactory;
|
||||||
|
QnxRunConfigurationFactory runConfigFactory;
|
||||||
|
QnxSettingsPage settingsPage;
|
||||||
|
QnxToolChainFactory toolChainFactory;
|
||||||
|
};
|
||||||
|
|
||||||
|
static QnxPluginPrivate *dd = nullptr;
|
||||||
|
|
||||||
|
QnxPlugin::~QnxPlugin()
|
||||||
|
{
|
||||||
|
delete dd;
|
||||||
|
}
|
||||||
|
|
||||||
bool QnxPlugin::initialize(const QStringList &arguments, QString *errorString)
|
bool QnxPlugin::initialize(const QStringList &arguments, QString *errorString)
|
||||||
{
|
{
|
||||||
Q_UNUSED(arguments)
|
Q_UNUSED(arguments)
|
||||||
Q_UNUSED(errorString)
|
Q_UNUSED(errorString)
|
||||||
|
|
||||||
// Handles QNX
|
dd = new QnxPluginPrivate;
|
||||||
addAutoReleasedObject(new QnxConfigurationManager);
|
|
||||||
addAutoReleasedObject(new QnxQtVersionFactory);
|
|
||||||
addAutoReleasedObject(new QnxDeviceFactory);
|
|
||||||
addAutoReleasedObject(new QnxDeployConfigurationFactory);
|
|
||||||
addAutoReleasedObject(new QnxRunConfigurationFactory);
|
|
||||||
addAutoReleasedObject(new QnxSettingsPage);
|
|
||||||
|
|
||||||
auto constraint = [](RunConfiguration *runConfig) {
|
auto constraint = [](RunConfiguration *runConfig) {
|
||||||
if (!runConfig->isEnabled()
|
if (!runConfig->isEnabled()
|
||||||
@@ -98,34 +114,29 @@ bool QnxPlugin::initialize(const QStringList &arguments, QString *errorString)
|
|||||||
RunControl::registerWorker<QnxQmlProfilerSupport>
|
RunControl::registerWorker<QnxQmlProfilerSupport>
|
||||||
(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE, constraint);
|
(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE, constraint);
|
||||||
|
|
||||||
addAutoReleasedObject(new QnxToolChainFactory);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QnxPlugin::extensionsInitialized()
|
void QnxPlugin::extensionsInitialized()
|
||||||
{
|
{
|
||||||
// Attach support
|
// Attach support
|
||||||
m_attachToQnxApplication = new QAction(this);
|
connect(&dd->m_attachToQnxApplication, &QAction::triggered,
|
||||||
m_attachToQnxApplication->setText(tr("Attach to remote QNX application..."));
|
this, [] { QnxAttachDebugSupport::showProcessesDialog(); });
|
||||||
connect(m_attachToQnxApplication, &QAction::triggered, this, [] { QnxAttachDebugSupport::showProcessesDialog(); });
|
|
||||||
|
|
||||||
Core::ActionContainer *mstart = Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_DEBUG_STARTDEBUGGING);
|
Core::ActionContainer *mstart = Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_DEBUG_STARTDEBUGGING);
|
||||||
mstart->appendGroup(Constants::QNX_DEBUGGING_GROUP);
|
mstart->appendGroup(Constants::QNX_DEBUGGING_GROUP);
|
||||||
mstart->addSeparator(Core::Context(Core::Constants::C_GLOBAL), Constants::QNX_DEBUGGING_GROUP, &m_debugSeparator);
|
mstart->addSeparator(Core::Context(Core::Constants::C_GLOBAL), Constants::QNX_DEBUGGING_GROUP,
|
||||||
|
&dd->m_debugSeparator);
|
||||||
|
|
||||||
Core::Command *cmd = Core::ActionManager::registerAction(m_attachToQnxApplication, "Debugger.AttachToQnxApplication");
|
Core::Command *cmd = Core::ActionManager::registerAction
|
||||||
|
(&dd->m_attachToQnxApplication, "Debugger.AttachToQnxApplication");
|
||||||
mstart->addAction(cmd, Constants::QNX_DEBUGGING_GROUP);
|
mstart->addAction(cmd, Constants::QNX_DEBUGGING_GROUP);
|
||||||
|
|
||||||
connect(KitManager::instance(), &KitManager::kitsChanged, this, &QnxPlugin::updateDebuggerActions);
|
connect(KitManager::instance(), &KitManager::kitsChanged,
|
||||||
|
this, [this] { dd->updateDebuggerActions(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtensionSystem::IPlugin::ShutdownFlag QnxPlugin::aboutToShutdown()
|
void QnxPluginPrivate::updateDebuggerActions()
|
||||||
{
|
|
||||||
return SynchronousShutdown;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QnxPlugin::updateDebuggerActions()
|
|
||||||
{
|
{
|
||||||
bool hasValidQnxKit = false;
|
bool hasValidQnxKit = false;
|
||||||
|
|
||||||
@@ -137,7 +148,7 @@ void QnxPlugin::updateDebuggerActions()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_attachToQnxApplication->setVisible(hasValidQnxKit);
|
m_attachToQnxApplication.setVisible(hasValidQnxKit);
|
||||||
m_debugSeparator->setVisible(hasValidQnxKit);
|
m_debugSeparator->setVisible(hasValidQnxKit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -27,10 +27,6 @@
|
|||||||
|
|
||||||
#include <extensionsystem/iplugin.h>
|
#include <extensionsystem/iplugin.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QAction;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -41,16 +37,11 @@ class QnxPlugin : public ExtensionSystem::IPlugin
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
QnxPlugin() {}
|
QnxPlugin() {}
|
||||||
|
~QnxPlugin() final;
|
||||||
bool initialize(const QStringList &arguments, QString *errorString);
|
|
||||||
void extensionsInitialized();
|
|
||||||
ShutdownFlag aboutToShutdown();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateDebuggerActions();
|
bool initialize(const QStringList &arguments, QString *errorString) final;
|
||||||
|
void extensionsInitialized() final;
|
||||||
QAction *m_debugSeparator = nullptr;
|
|
||||||
QAction *m_attachToQnxApplication = nullptr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user