forked from qt-creator/qt-creator
ProjectExplorer: Make Device::displayType a data member
Change-Id: If650f660e3b10bc28d575ded07a854f59be26f87 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -50,6 +50,7 @@ AndroidDevice::AndroidDevice()
|
||||
setupId(IDevice::AutoDetected, Constants::ANDROID_DEVICE_ID);
|
||||
setType(Constants::ANDROID_DEVICE_TYPE);
|
||||
setDisplayName(QCoreApplication::translate("Android::Internal::AndroidDevice", "Run on Android"));
|
||||
setDisplayType(QCoreApplication::translate("Android::Internal::AndroidDevice", "Android"));
|
||||
setMachineType(IDevice::Hardware);
|
||||
setDeviceState(DeviceReadyToUse);
|
||||
QString activityPath;
|
||||
@@ -65,11 +66,6 @@ IDevice::DeviceInfo AndroidDevice::deviceInformation() const
|
||||
return IDevice::DeviceInfo();
|
||||
}
|
||||
|
||||
QString AndroidDevice::displayType() const
|
||||
{
|
||||
return QCoreApplication::translate("Android::Internal::AndroidDevice", "Android");
|
||||
}
|
||||
|
||||
IDeviceWidget *AndroidDevice::createWidget()
|
||||
{
|
||||
return nullptr;
|
||||
|
@@ -41,7 +41,6 @@ private:
|
||||
|
||||
ProjectExplorer::IDevice::DeviceInfo deviceInformation() const override;
|
||||
|
||||
QString displayType() const override;
|
||||
ProjectExplorer::IDeviceWidget *createWidget() override;
|
||||
bool canAutoDetectPorts() const override;
|
||||
ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation() const override;
|
||||
|
@@ -52,6 +52,8 @@ const char gdbServerProviderIdKeyC[] = "GdbServerProviderId";
|
||||
|
||||
BareMetalDevice::~BareMetalDevice()
|
||||
{
|
||||
setDisplayType(QCoreApplication::translate("BareMetal::Internal::BareMetalDevice", "Bare Metal"));
|
||||
|
||||
if (GdbServerProvider *provider = GdbServerProviderManager::findProvider(m_gdbServerProviderId))
|
||||
provider->unregisterDevice(this);
|
||||
}
|
||||
@@ -135,11 +137,6 @@ DeviceProcessSignalOperation::Ptr BareMetalDevice::signalOperation() const
|
||||
return DeviceProcessSignalOperation::Ptr();
|
||||
}
|
||||
|
||||
QString BareMetalDevice::displayType() const
|
||||
{
|
||||
return QCoreApplication::translate("BareMetal::Internal::BareMetalDevice", "Bare Metal");
|
||||
}
|
||||
|
||||
IDeviceWidget *BareMetalDevice::createWidget()
|
||||
{
|
||||
return new BareMetalDeviceConfigurationWidget(sharedFromThis());
|
||||
|
@@ -45,7 +45,6 @@ public:
|
||||
static Ptr create() { return Ptr(new BareMetalDevice); }
|
||||
~BareMetalDevice() final;
|
||||
|
||||
QString displayType() const final;
|
||||
ProjectExplorer::IDeviceWidget *createWidget() final;
|
||||
Utils::OsType osType() const final;
|
||||
|
||||
|
@@ -141,6 +141,8 @@ private:
|
||||
|
||||
QdbDevice::QdbDevice()
|
||||
{
|
||||
setDisplayType(tr("Boot2Qt Device"));
|
||||
|
||||
addDeviceAction({tr("Reboot Device"), [](const IDevice::Ptr &device, QWidget *) {
|
||||
CommandLine cmd{FilePath::fromString("reboot")};
|
||||
(void) new DeviceApplicationObserver(device, cmd);
|
||||
@@ -152,11 +154,6 @@ QdbDevice::QdbDevice()
|
||||
}});
|
||||
}
|
||||
|
||||
QString QdbDevice::displayType() const
|
||||
{
|
||||
return tr("Boot2Qt Device");
|
||||
}
|
||||
|
||||
ProjectExplorer::IDeviceWidget *QdbDevice::createWidget()
|
||||
{
|
||||
ProjectExplorer::IDeviceWidget *w = RemoteLinux::LinuxDevice::createWidget();
|
||||
|
@@ -40,7 +40,6 @@ public:
|
||||
|
||||
static Ptr create() { return Ptr(new QdbDevice); }
|
||||
|
||||
QString displayType() const final;
|
||||
ProjectExplorer::IDeviceWidget *createWidget() final;
|
||||
|
||||
ProjectExplorer::DeviceProcess *createProcess(QObject *parent) const final;
|
||||
|
@@ -84,6 +84,7 @@ IosDevice::IosDevice()
|
||||
setupId(IDevice::AutoDetected, Constants::IOS_DEVICE_ID);
|
||||
setType(Constants::IOS_DEVICE_TYPE);
|
||||
setDisplayName(IosDevice::name());
|
||||
setDisplayType(QCoreApplication::translate("Ios::Internal::IosDevice", "iOS"));
|
||||
setMachineType(IDevice::Hardware);
|
||||
setDeviceState(DeviceDisconnected);
|
||||
Utils::PortList ports;
|
||||
@@ -98,6 +99,7 @@ IosDevice::IosDevice(const QString &uid)
|
||||
setupId(IDevice::AutoDetected, Core::Id(Constants::IOS_DEVICE_ID).withSuffix(uid));
|
||||
setType(Constants::IOS_DEVICE_TYPE);
|
||||
setDisplayName(IosDevice::name());
|
||||
setDisplayType(QCoreApplication::translate("Ios::Internal::IosDevice", "iOS"));
|
||||
setMachineType(IDevice::Hardware);
|
||||
setDeviceState(DeviceDisconnected);
|
||||
}
|
||||
@@ -116,11 +118,6 @@ IDevice::DeviceInfo IosDevice::deviceInformation() const
|
||||
return res;
|
||||
}
|
||||
|
||||
QString IosDevice::displayType() const
|
||||
{
|
||||
return QCoreApplication::translate("Ios::Internal::IosDevice", "iOS");
|
||||
}
|
||||
|
||||
IDeviceWidget *IosDevice::createWidget()
|
||||
{
|
||||
return nullptr;
|
||||
|
@@ -52,7 +52,6 @@ public:
|
||||
ProjectExplorer::IDevice::DeviceInfo deviceInformation() const override;
|
||||
ProjectExplorer::IDeviceWidget *createWidget() override;
|
||||
ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation() const override;
|
||||
QString displayType() const override;
|
||||
|
||||
void fromMap(const QVariantMap &map) override;
|
||||
QVariantMap toMap() const override;
|
||||
|
@@ -51,29 +51,19 @@ IosSimulator::IosSimulator(Core::Id id)
|
||||
setType(Constants::IOS_SIMULATOR_TYPE);
|
||||
setMachineType(IDevice::Emulator);
|
||||
setDisplayName(QCoreApplication::translate("Ios::Internal::IosSimulator", "iOS Simulator"));
|
||||
setDisplayType(QCoreApplication::translate("Ios::Internal::IosSimulator", "iOS Simulator"));
|
||||
setDeviceState(DeviceReadyToUse);
|
||||
}
|
||||
|
||||
IosSimulator::IosSimulator()
|
||||
: m_lastPort(Constants::IOS_SIMULATOR_PORT_START)
|
||||
{
|
||||
setupId(IDevice::AutoDetected, Constants::IOS_SIMULATOR_DEVICE_ID);
|
||||
setType(Constants::IOS_SIMULATOR_TYPE);
|
||||
setMachineType(IDevice::Emulator);
|
||||
setDisplayName(QCoreApplication::translate("Ios::Internal::IosSimulator", "iOS Simulator"));
|
||||
setDeviceState(DeviceReadyToUse);
|
||||
}
|
||||
: IosSimulator(Constants::IOS_SIMULATOR_DEVICE_ID)
|
||||
{}
|
||||
|
||||
IDevice::DeviceInfo IosSimulator::deviceInformation() const
|
||||
{
|
||||
return IDevice::DeviceInfo();
|
||||
}
|
||||
|
||||
QString IosSimulator::displayType() const
|
||||
{
|
||||
return QCoreApplication::translate("Ios::Internal::IosSimulator", "iOS Simulator");
|
||||
}
|
||||
|
||||
IDeviceWidget *IosSimulator::createWidget()
|
||||
{
|
||||
return nullptr;
|
||||
|
@@ -69,7 +69,6 @@ public:
|
||||
using Ptr = QSharedPointer<IosSimulator>;
|
||||
ProjectExplorer::IDevice::DeviceInfo deviceInformation() const override;
|
||||
|
||||
QString displayType() const override;
|
||||
ProjectExplorer::IDeviceWidget *createWidget() override;
|
||||
ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation() const override;
|
||||
Utils::Port nextPort() const;
|
||||
|
@@ -55,6 +55,8 @@ DesktopDevice::DesktopDevice()
|
||||
setupId(IDevice::AutoDetected, DESKTOP_DEVICE_ID);
|
||||
setType(DESKTOP_DEVICE_TYPE);
|
||||
setDisplayName(QCoreApplication::translate("ProjectExplorer::DesktopDevice", "Local PC"));
|
||||
setDisplayType(QCoreApplication::translate("ProjectExplorer::DesktopDevice", "Desktop"));
|
||||
|
||||
setDeviceState(IDevice::DeviceStateUnknown);
|
||||
setMachineType(IDevice::Hardware);
|
||||
const QString portRange =
|
||||
@@ -70,11 +72,6 @@ IDevice::DeviceInfo DesktopDevice::deviceInformation() const
|
||||
return DeviceInfo();
|
||||
}
|
||||
|
||||
QString DesktopDevice::displayType() const
|
||||
{
|
||||
return QCoreApplication::translate("ProjectExplorer::DesktopDevice", "Desktop");
|
||||
}
|
||||
|
||||
IDeviceWidget *DesktopDevice::createWidget()
|
||||
{
|
||||
return nullptr;
|
||||
|
@@ -40,7 +40,6 @@ class PROJECTEXPLORER_EXPORT DesktopDevice : public IDevice
|
||||
public:
|
||||
IDevice::DeviceInfo deviceInformation() const override;
|
||||
|
||||
QString displayType() const override;
|
||||
IDeviceWidget *createWidget() override;
|
||||
bool canAutoDetectPorts() const override;
|
||||
bool canCreateProcessModel() const override;
|
||||
|
@@ -410,11 +410,11 @@ public:
|
||||
setupId(AutoDetected, Core::Id::fromString(QUuid::createUuid().toString()));
|
||||
setType(testTypeId());
|
||||
setMachineType(Hardware);
|
||||
setDisplayType("blubb");
|
||||
}
|
||||
|
||||
static Core::Id testTypeId() { return "TestType"; }
|
||||
private:
|
||||
QString displayType() const override { return QLatin1String("blubb"); }
|
||||
IDeviceWidget *createWidget() override { return nullptr; }
|
||||
DeviceProcessSignalOperation::Ptr signalOperation() const override
|
||||
{
|
||||
|
@@ -138,6 +138,7 @@ public:
|
||||
IDevicePrivate() = default;
|
||||
|
||||
QString displayName;
|
||||
QString displayType;
|
||||
Core::Id type;
|
||||
IDevice::Origin origin = IDevice::AutoDetected;
|
||||
Core::Id id;
|
||||
@@ -199,11 +200,19 @@ QString IDevice::displayName() const
|
||||
|
||||
void IDevice::setDisplayName(const QString &name)
|
||||
{
|
||||
if (d->displayName == name)
|
||||
return;
|
||||
d->displayName = name;
|
||||
}
|
||||
|
||||
QString IDevice::displayType() const
|
||||
{
|
||||
return d->displayType;
|
||||
}
|
||||
|
||||
void IDevice::setDisplayType(const QString &type)
|
||||
{
|
||||
d->displayType = type;
|
||||
}
|
||||
|
||||
IDevice::DeviceInfo IDevice::deviceInformation() const
|
||||
{
|
||||
const QString key = QCoreApplication::translate("ProjectExplorer::IDevice", "Device");
|
||||
|
@@ -155,7 +155,8 @@ public:
|
||||
|
||||
virtual bool isCompatibleWith(const Kit *k) const;
|
||||
|
||||
virtual QString displayType() const = 0;
|
||||
QString displayType() const;
|
||||
|
||||
virtual IDeviceWidget *createWidget() = 0;
|
||||
|
||||
struct DeviceAction {
|
||||
@@ -227,6 +228,7 @@ protected:
|
||||
|
||||
using OpenTerminal = std::function<void(const Utils::Environment &, const QString &)>;
|
||||
void setOpenTerminal(const OpenTerminal &openTerminal);
|
||||
void setDisplayType(const QString &type);
|
||||
|
||||
private:
|
||||
IDevice(const IDevice &) = delete;
|
||||
|
@@ -82,17 +82,13 @@ class QnxPortsGatheringMethod : public PortsGatheringMethod
|
||||
|
||||
QnxDevice::QnxDevice()
|
||||
{
|
||||
setDisplayType(tr("QNX"));
|
||||
addDeviceAction({tr("Deploy Qt libraries..."), [](const IDevice::Ptr &device, QWidget *parent) {
|
||||
QnxDeployQtLibrariesDialog dialog(device, parent);
|
||||
dialog.exec();
|
||||
}});
|
||||
}
|
||||
|
||||
QString QnxDevice::displayType() const
|
||||
{
|
||||
return tr("QNX");
|
||||
}
|
||||
|
||||
OsType QnxDevice::osType() const
|
||||
{
|
||||
return OsTypeOtherUnix;
|
||||
|
@@ -49,7 +49,6 @@ public:
|
||||
ProjectExplorer::DeviceTester *createDeviceTester() const override;
|
||||
ProjectExplorer::DeviceProcess *createProcess(QObject *parent) const override;
|
||||
|
||||
QString displayType() const override;
|
||||
Utils::OsType osType() const override;
|
||||
|
||||
int qnxVersion() const;
|
||||
|
@@ -172,11 +172,6 @@ class LinuxPortsGatheringMethod : public PortsGatheringMethod
|
||||
}
|
||||
};
|
||||
|
||||
QString LinuxDevice::displayType() const
|
||||
{
|
||||
return tr("Generic Linux");
|
||||
}
|
||||
|
||||
IDeviceWidget *LinuxDevice::createWidget()
|
||||
{
|
||||
return new GenericLinuxDeviceConfigurationWidget(sharedFromThis());
|
||||
@@ -189,6 +184,8 @@ Utils::OsType LinuxDevice::osType() const
|
||||
|
||||
LinuxDevice::LinuxDevice()
|
||||
{
|
||||
setDisplayType(tr("Generic Linux"));
|
||||
|
||||
addDeviceAction({tr("Deploy Public Key..."), [](const IDevice::Ptr &device, QWidget *parent) {
|
||||
if (auto d = PublicKeyDeploymentDialog::createDialog(device, parent)) {
|
||||
d->exec();
|
||||
|
@@ -44,7 +44,6 @@ public:
|
||||
|
||||
static Ptr create() { return Ptr(new LinuxDevice); }
|
||||
|
||||
QString displayType() const override;
|
||||
ProjectExplorer::IDeviceWidget *createWidget() override;
|
||||
Utils::OsType osType() const override;
|
||||
|
||||
|
@@ -60,17 +60,13 @@ Q_LOGGING_CATEGORY(winrtDeviceLog, "qtc.winrt.deviceParser", QtWarningMsg)
|
||||
|
||||
WinRtDevice::WinRtDevice()
|
||||
{
|
||||
setDisplayType(displayNameForType(type()));
|
||||
Utils::PortList portList;
|
||||
portList.addRange(Utils::Port(ProjectExplorer::Constants::DESKTOP_PORT_START),
|
||||
Utils::Port(ProjectExplorer::Constants::DESKTOP_PORT_END));
|
||||
setFreePorts(portList);
|
||||
}
|
||||
|
||||
QString WinRtDevice::displayType() const
|
||||
{
|
||||
return displayNameForType(type());
|
||||
}
|
||||
|
||||
IDeviceWidget *WinRtDevice::createWidget()
|
||||
{
|
||||
return nullptr;
|
||||
|
@@ -41,7 +41,6 @@ public:
|
||||
|
||||
static Ptr create() { return Ptr(new WinRtDevice); }
|
||||
|
||||
QString displayType() const override;
|
||||
ProjectExplorer::IDeviceWidget *createWidget() override;
|
||||
ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation() const override;
|
||||
void fromMap(const QVariantMap &map) override;
|
||||
|
Reference in New Issue
Block a user