Qnx: use dedicated classes to create run worker

Change-Id: I43178d543509dcb561fffb25741b0e3dd8d95cb1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2023-01-06 15:00:10 +01:00
parent 2bb029c7e3
commit 67733f1edd
7 changed files with 88 additions and 80 deletions

View File

@@ -3,6 +3,7 @@
#include "qnxanalyzesupport.h" #include "qnxanalyzesupport.h"
#include "qnxconstants.h"
#include "qnxtr.h" #include "qnxtr.h"
#include "slog2inforunner.h" #include "slog2inforunner.h"
@@ -18,11 +19,14 @@ using namespace Utils;
namespace Qnx::Internal { namespace Qnx::Internal {
QnxQmlProfilerSupport::QnxQmlProfilerSupport(RunControl *runControl) class QnxQmlProfilerSupport final : public SimpleTargetRunner
{
public:
explicit QnxQmlProfilerSupport(RunControl *runControl)
: SimpleTargetRunner(runControl) : SimpleTargetRunner(runControl)
{ {
setId("QnxQmlProfilerSupport"); setId("QnxQmlProfilerSupport");
appendMessage(Tr::tr("Preparing remote side..."), Utils::LogMessageFormat); appendMessage(Tr::tr("Preparing remote side..."), LogMessageFormat);
auto portsGatherer = new PortsGatherer(runControl); auto portsGatherer = new PortsGatherer(runControl);
addStartDependency(portsGatherer); addStartDependency(portsGatherer);
@@ -43,5 +47,13 @@ QnxQmlProfilerSupport::QnxQmlProfilerSupport(RunControl *runControl)
setCommandLine(cmd); setCommandLine(cmd);
}); });
} }
};
QnxQmlProfilerWorkerFactory::QnxQmlProfilerWorkerFactory()
{
setProduct<QnxQmlProfilerSupport>();
// FIXME: Shouldn't this use the run mode id somehow?
addSupportedRunConfig(Constants::QNX_RUNCONFIG_ID);
}
} // Qnx::Internal } // Qnx::Internal

View File

@@ -7,10 +7,10 @@
namespace Qnx::Internal { namespace Qnx::Internal {
class QnxQmlProfilerSupport : public ProjectExplorer::SimpleTargetRunner class QnxQmlProfilerWorkerFactory final : public ProjectExplorer::RunWorkerFactory
{ {
public: public:
explicit QnxQmlProfilerSupport(ProjectExplorer::RunControl *runControl); QnxQmlProfilerWorkerFactory();
}; };
} // Qnx::Internal } // Qnx::Internal

View File

@@ -5,18 +5,13 @@
#include <QtGlobal> #include <QtGlobal>
namespace Qnx { namespace Qnx::Constants {
namespace Constants {
const char QNX_QNX_QT[] = "Qt4ProjectManager.QtVersion.QNX.QNX"; const char QNX_QNX_QT[] = "Qt4ProjectManager.QtVersion.QNX.QNX";
const char QNX_QNX_FEATURE[] = "QtSupport.Wizards.FeatureQNX"; const char QNX_QNX_FEATURE[] = "QtSupport.Wizards.FeatureQNX";
const char QNX_QNX_DEPLOYCONFIGURATION_ID[] = "Qt4ProjectManager.QNX.QNXDeployConfiguration"; const char QNX_QNX_DEPLOYCONFIGURATION_ID[] = "Qt4ProjectManager.QNX.QNXDeployConfiguration";
const char QNX_RUNCONFIG_ID[] = "Qt4ProjectManager.QNX.QNXRunConfiguration.";
const char QNX_QNX_OS_TYPE[] = "QnxOsType"; // Also used for device type. const char QNX_QNX_OS_TYPE[] = "QnxOsType"; // Also used for device type.
const char QNX_TOOLCHAIN_ID[] = "Qnx.QccToolChain"; const char QNX_TOOLCHAIN_ID[] = "Qnx.QccToolChain";
} // namespace Constants } // Qnx::Constants
} // namespace Qnx

View File

@@ -102,7 +102,10 @@ public:
// QnxDebugSupport // QnxDebugSupport
QnxDebugSupport::QnxDebugSupport(RunControl *runControl) class QnxDebugSupport : public Debugger::DebuggerRunTool
{
public:
explicit QnxDebugSupport(ProjectExplorer::RunControl *runControl)
: DebuggerRunTool(runControl) : DebuggerRunTool(runControl)
{ {
setId("QnxDebugSupport"); setId("QnxDebugSupport");
@@ -129,6 +132,7 @@ QnxDebugSupport::QnxDebugSupport(RunControl *runControl)
modifyDebuggerEnvironment(qtVersion->environment()); modifyDebuggerEnvironment(qtVersion->environment());
} }
} }
};
// QnxAttachDebugDialog // QnxAttachDebugDialog
@@ -183,7 +187,10 @@ public:
} }
}; };
QnxAttachDebugSupport::QnxAttachDebugSupport(RunControl *runControl) class QnxAttachDebugSupport : public Debugger::DebuggerRunTool
{
public:
explicit QnxAttachDebugSupport(ProjectExplorer::RunControl *runControl)
: DebuggerRunTool(runControl) : DebuggerRunTool(runControl)
{ {
setId("QnxAttachDebugSupport"); setId("QnxAttachDebugSupport");
@@ -195,8 +202,9 @@ QnxAttachDebugSupport::QnxAttachDebugSupport(RunControl *runControl)
addStartDependency(pdebugRunner); addStartDependency(pdebugRunner);
} }
} }
};
void QnxAttachDebugSupport::showProcessesDialog() void showAttachToProcessDialog()
{ {
auto kitChooser = new KitChooser; auto kitChooser = new KitChooser;
kitChooser->setKitPredicate([](const Kit *k) { kitChooser->setKitPredicate([](const Kit *k) {
@@ -242,4 +250,13 @@ void QnxAttachDebugSupport::showProcessesDialog()
ProjectExplorerPlugin::startRunControl(runControl); ProjectExplorerPlugin::startRunControl(runControl);
} }
// QnxDebugWorkerFactory
QnxDebugWorkerFactory::QnxDebugWorkerFactory()
{
setProduct<QnxDebugSupport>();
addSupportedRunMode(ProjectExplorer::Constants::DEBUG_RUN_MODE);
addSupportedRunConfig(Constants::QNX_RUNCONFIG_ID);
}
} // Qnx::Internal } // Qnx::Internal

View File

@@ -7,18 +7,12 @@
namespace Qnx::Internal { namespace Qnx::Internal {
class QnxDebugSupport : public Debugger::DebuggerRunTool void showAttachToProcessDialog();
class QnxDebugWorkerFactory final : public ProjectExplorer::RunWorkerFactory
{ {
public: public:
explicit QnxDebugSupport(ProjectExplorer::RunControl *runControl); QnxDebugWorkerFactory();
};
class QnxAttachDebugSupport : public Debugger::DebuggerRunTool
{
public:
explicit QnxAttachDebugSupport(ProjectExplorer::RunControl *runControl);
static void showProcessesDialog();
}; };
} // Qnx::Internal } // Qnx::Internal

View File

@@ -103,17 +103,8 @@ public:
QnxSettingsPage settingsPage; QnxSettingsPage settingsPage;
QnxToolChainFactory toolChainFactory; QnxToolChainFactory toolChainFactory;
SimpleTargetRunnerFactory runWorkerFactory{{runConfigFactory.runConfigurationId()}}; SimpleTargetRunnerFactory runWorkerFactory{{runConfigFactory.runConfigurationId()}};
QnxDebugWorkerFactory debugWorkerFactory;
RunWorkerFactory debugWorkerFactory{ QnxQmlProfilerWorkerFactory qmlProfilerWorkerFactory;
RunWorkerFactory::make<QnxDebugSupport>(),
{ProjectExplorer::Constants::DEBUG_RUN_MODE},
{runConfigFactory.runConfigurationId()}
};
RunWorkerFactory qmlProfilerWorkerFactory{
RunWorkerFactory::make<QnxQmlProfilerSupport>(),
{}, // FIXME: Shouldn't this use the run mode id somehow?
{runConfigFactory.runConfigurationId()}
};
}; };
static QnxPluginPrivate *dd = nullptr; static QnxPluginPrivate *dd = nullptr;
@@ -136,8 +127,7 @@ bool QnxPlugin::initialize(const QStringList &arguments, QString *errorString)
void QnxPlugin::extensionsInitialized() void QnxPlugin::extensionsInitialized()
{ {
// Attach support // Attach support
connect(&dd->m_attachToQnxApplication, &QAction::triggered, connect(&dd->m_attachToQnxApplication, &QAction::triggered, this, &showAttachToProcessDialog);
this, [] { QnxAttachDebugSupport::showProcessesDialog(); });
const char QNX_DEBUGGING_GROUP[] = "Debugger.Group.Qnx"; const char QNX_DEBUGGING_GROUP[] = "Debugger.Group.Qnx";

View File

@@ -80,7 +80,7 @@ QnxRunConfiguration::QnxRunConfiguration(Target *target, Id id)
QnxRunConfigurationFactory::QnxRunConfigurationFactory() QnxRunConfigurationFactory::QnxRunConfigurationFactory()
{ {
registerRunConfiguration<QnxRunConfiguration>("Qt4ProjectManager.QNX.QNXRunConfiguration."); registerRunConfiguration<QnxRunConfiguration>(Constants::QNX_RUNCONFIG_ID);
addSupportedTargetDeviceType(Constants::QNX_QNX_OS_TYPE); addSupportedTargetDeviceType(Constants::QNX_QNX_OS_TYPE);
} }