Qnx: Use new setup scheme for most factories

Change-Id: Ie6154d816fb9d77948d73416b43bb933a56f6bbb
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2023-11-17 13:18:39 +01:00
parent 65dbc1eaf6
commit 43f1281674
13 changed files with 134 additions and 111 deletions

View File

@@ -48,11 +48,20 @@ public:
}
};
QnxQmlProfilerWorkerFactory::QnxQmlProfilerWorkerFactory()
class QnxQmlProfilerWorkerFactory final : public RunWorkerFactory
{
setProduct<QnxQmlProfilerSupport>();
// FIXME: Shouldn't this use the run mode id somehow?
addSupportedRunConfig(Constants::QNX_RUNCONFIG_ID);
public:
QnxQmlProfilerWorkerFactory()
{
setProduct<QnxQmlProfilerSupport>();
// FIXME: Shouldn't this use the run mode id somehow?
addSupportedRunConfig(Constants::QNX_RUNCONFIG_ID);
}
};
void setupQnxQmlProfiler()
{
static QnxQmlProfilerWorkerFactory theQnxQmlProfilerWorkerFactory;
}
} // Qnx::Internal

View File

@@ -3,14 +3,8 @@
#pragma once
#include <projectexplorer/runcontrol.h>
namespace Qnx::Internal {
class QnxQmlProfilerWorkerFactory final : public ProjectExplorer::RunWorkerFactory
{
public:
QnxQmlProfilerWorkerFactory();
};
void setupQnxQmlProfiler();
} // Qnx::Internal

View File

@@ -252,11 +252,20 @@ void showAttachToProcessDialog()
// QnxDebugWorkerFactory
QnxDebugWorkerFactory::QnxDebugWorkerFactory()
class QnxDebugWorkerFactory final : public RunWorkerFactory
{
setProduct<QnxDebugSupport>();
addSupportedRunMode(ProjectExplorer::Constants::DEBUG_RUN_MODE);
addSupportedRunConfig(Constants::QNX_RUNCONFIG_ID);
public:
QnxDebugWorkerFactory()
{
setProduct<QnxDebugSupport>();
addSupportedRunMode(ProjectExplorer::Constants::DEBUG_RUN_MODE);
addSupportedRunConfig(Constants::QNX_RUNCONFIG_ID);
}
};
void setupQnxDebugging()
{
static QnxDebugWorkerFactory theQnxDebugWorkerFactory;
}
} // Qnx::Internal

View File

@@ -3,16 +3,9 @@
#pragma once
#include <debugger/debuggerruncontrol.h>
namespace Qnx::Internal {
void showAttachToProcessDialog();
class QnxDebugWorkerFactory final : public ProjectExplorer::RunWorkerFactory
{
public:
QnxDebugWorkerFactory();
};
void setupQnxDebugging();
} // Qnx::Internal

View File

@@ -10,6 +10,7 @@
#include <coreplugin/icore.h>
#include <projectexplorer/devicesupport/idevicefactory.h>
#include <projectexplorer/devicesupport/sshparameters.h>
#include <remotelinux/linuxdevice.h>
@@ -86,20 +87,29 @@ public:
DeviceTester *createDeviceTester() const final { return new QnxDeviceTester; }
};
QnxDeviceFactory::QnxDeviceFactory() : IDeviceFactory(Constants::QNX_QNX_OS_TYPE)
class QnxDeviceFactory final : public IDeviceFactory
{
setDisplayName(Tr::tr("QNX Device"));
setCombinedIcon(":/qnx/images/qnxdevicesmall.png",
":/qnx/images/qnxdevice.png");
setQuickCreationAllowed(true);
setConstructionFunction([] { return IDevice::Ptr(new QnxDevice); });
setCreator([]() -> IDevice::Ptr {
const IDevice::Ptr device = IDevice::Ptr(new QnxDevice);
SshDeviceWizard wizard(Tr::tr("New QNX Device Configuration Setup"), device);
if (wizard.exec() != QDialog::Accepted)
return {};
return device;
});
public:
QnxDeviceFactory() : IDeviceFactory(Constants::QNX_QNX_OS_TYPE)
{
setDisplayName(Tr::tr("QNX Device"));
setCombinedIcon(":/qnx/images/qnxdevicesmall.png",
":/qnx/images/qnxdevice.png");
setQuickCreationAllowed(true);
setConstructionFunction([] { return IDevice::Ptr(new QnxDevice); });
setCreator([]() -> IDevice::Ptr {
const IDevice::Ptr device = IDevice::Ptr(new QnxDevice);
SshDeviceWizard wizard(Tr::tr("New QNX Device Configuration Setup"), device);
if (wizard.exec() != QDialog::Accepted)
return {};
return device;
});
}
};
void setupQnxDevice()
{
static QnxDeviceFactory theQnxDeviceFactory;
}
} // Qnx::Internal

View File

@@ -3,14 +3,8 @@
#pragma once
#include <projectexplorer/devicesupport/idevicefactory.h>
namespace Qnx::Internal {
class QnxDeviceFactory final : public ProjectExplorer::IDeviceFactory
{
public:
QnxDeviceFactory();
};
void setupQnxDevice();
} // Qnx::Internal

View File

@@ -71,6 +71,14 @@ public:
}
};
void setupQnxDeployment()
{
static QnxDeployConfigurationFactory deployConfigFactory;
static QnxDeployStepFactory directUploadDeployFactory{RemoteLinux::Constants::DirectUploadStepId,
Constants::QNX_DIRECT_UPLOAD_STEP_ID};
static QnxDeployStepFactory makeInstallStepFactory{RemoteLinux::Constants::MakeInstallStepId};
}
class QnxPluginPrivate
{
public:
@@ -80,17 +88,6 @@ public:
QAction m_attachToQnxApplication{Tr::tr("Attach to remote QNX application..."), nullptr};
QnxSettingsPage settingsPage;
QnxQtVersionFactory qtVersionFactory;
QnxDeviceFactory deviceFactory;
QnxDeployConfigurationFactory deployConfigFactory;
QnxDeployStepFactory directUploadDeployFactory{RemoteLinux::Constants::DirectUploadStepId,
Constants::QNX_DIRECT_UPLOAD_STEP_ID};
QnxDeployStepFactory makeInstallStepFactory{RemoteLinux::Constants::MakeInstallStepId};
QnxRunConfigurationFactory runConfigFactory;
QnxToolChainFactory toolChainFactory;
SimpleTargetRunnerFactory runWorkerFactory{{runConfigFactory.runConfigurationId()}};
QnxDebugWorkerFactory debugWorkerFactory;
QnxQmlProfilerWorkerFactory qmlProfilerWorkerFactory;
};
class QnxPlugin final : public ExtensionSystem::IPlugin
@@ -102,7 +99,19 @@ public:
~QnxPlugin() final { delete d; }
private:
void initialize() final { d = new QnxPluginPrivate; }
void initialize() final
{
d = new QnxPluginPrivate;
setupQnxDevice();
setupQnxToolChain();
setupQnxQtVersion();
setupQnxDeployment();
setupQnxRunnning();
setupQnxDebugging();
setupQnxQmlProfiler();
}
void extensionsInitialized() final;
QnxPluginPrivate *d = nullptr;

View File

@@ -190,12 +190,21 @@ EnvironmentItems QnxQtVersion::environment() const
// Factory
QnxQtVersionFactory::QnxQtVersionFactory()
class QnxQtVersionFactory : public QtSupport::QtVersionFactory
{
setQtVersionCreator([] { return new QnxQtVersion; });
setSupportedType(Constants::QNX_QNX_QT);
setPriority(50);
setRestrictionChecker([](const SetupData &setup) { return setup.isQnx; });
public:
QnxQtVersionFactory()
{
setQtVersionCreator([] { return new QnxQtVersion; });
setSupportedType(Constants::QNX_QNX_QT);
setPriority(50);
setRestrictionChecker([](const SetupData &setup) { return setup.isQnx; });
}
};
void setupQnxQtVersion()
{
static QnxQtVersionFactory theQnxQtVersionFactory;
}
} // Qnx::Internal

View File

@@ -57,10 +57,6 @@ private:
mutable Utils::EnvironmentItems m_qnxEnv;
};
class QnxQtVersionFactory : public QtSupport::QtVersionFactory
{
public:
QnxQtVersionFactory();
};
void setupQnxQtVersion();
} // Qnx::Internal

View File

@@ -84,10 +84,20 @@ public:
// QnxRunConfigurationFactory
QnxRunConfigurationFactory::QnxRunConfigurationFactory()
class QnxRunConfigurationFactory final : public ProjectExplorer::RunConfigurationFactory
{
registerRunConfiguration<QnxRunConfiguration>(Constants::QNX_RUNCONFIG_ID);
addSupportedTargetDeviceType(Constants::QNX_QNX_OS_TYPE);
public:
QnxRunConfigurationFactory()
{
registerRunConfiguration<QnxRunConfiguration>(Constants::QNX_RUNCONFIG_ID);
addSupportedTargetDeviceType(Constants::QNX_QNX_OS_TYPE);
}
};
void setupQnxRunnning()
{
static QnxRunConfigurationFactory theQnxRunConfigurationFactory;
static SimpleTargetRunnerFactory theQnxRunWorkerFactory({Constants::QNX_RUNCONFIG_ID});
}
} // Qnx::Internal

View File

@@ -3,14 +3,8 @@
#pragma once
#include <projectexplorer/runconfiguration.h>
namespace Qnx::Internal {
class QnxRunConfigurationFactory final : public ProjectExplorer::RunConfigurationFactory
{
public:
QnxRunConfigurationFactory();
};
void setupQnxRunnning();
} // Qnx::Internal

View File

@@ -162,30 +162,6 @@ bool QnxToolChain::operator ==(const ToolChain &other) const
return sdpPath() == qnxTc->sdpPath() && cpuDir() == qnxTc->cpuDir();
}
// --------------------------------------------------------------------------
// QnxToolChainFactory
// --------------------------------------------------------------------------
QnxToolChainFactory::QnxToolChainFactory()
{
setDisplayName(Tr::tr("QCC"));
setSupportedToolChainType(Constants::QNX_TOOLCHAIN_ID);
setSupportedLanguages({ProjectExplorer::Constants::C_LANGUAGE_ID,
ProjectExplorer::Constants::CXX_LANGUAGE_ID});
setToolchainConstructor([] { return new QnxToolChain; });
setUserCreatable(true);
}
Toolchains QnxToolChainFactory::autoDetect(const ToolchainDetector &detector) const
{
// FIXME: Support detecting toolchains on remote devices
if (detector.device)
return {};
Toolchains tcs = QnxSettingsPage::autoDetect(detector.alreadyKnown);
return tcs;
}
//---------------------------------------------------------------------------------
// QnxToolChainConfigWidget
//---------------------------------------------------------------------------------
@@ -275,4 +251,35 @@ void QnxToolChainConfigWidget::handleSdpPathChange()
emit dirty();
}
// QnxToolChainFactory
class QnxToolChainFactory : public ToolChainFactory
{
public:
QnxToolChainFactory()
{
setDisplayName(Tr::tr("QCC"));
setSupportedToolChainType(Constants::QNX_TOOLCHAIN_ID);
setSupportedLanguages({ProjectExplorer::Constants::C_LANGUAGE_ID,
ProjectExplorer::Constants::CXX_LANGUAGE_ID});
setToolchainConstructor([] { return new QnxToolChain; });
setUserCreatable(true);
}
Toolchains autoDetect(const ToolchainDetector &detector) const final
{
// FIXME: Support detecting toolchains on remote devices
if (detector.device)
return {};
Toolchains tcs = QnxSettingsPage::autoDetect(detector.alreadyKnown);
return tcs;
}
};
void setupQnxToolChain()
{
static QnxToolChainFactory theQnxToolChainFactory;
}
} // Qnx::Internal

View File

@@ -26,17 +26,6 @@ protected:
DetectedAbisResult detectSupportedAbis() const override;
};
// --------------------------------------------------------------------------
// QnxToolChainFactory
// --------------------------------------------------------------------------
class QnxToolChainFactory : public ProjectExplorer::ToolChainFactory
{
public:
QnxToolChainFactory();
ProjectExplorer::Toolchains autoDetect(
const ProjectExplorer::ToolchainDetector &detector) const final;
};
void setupQnxToolChain();
} // Qnx::Internal