Commit 7bc88000 authored by hjk's avatar hjk

ProjectExplorer: Introduce a Utils::OsType IDevice::osType() function

E.g. for easier construction of command lines in situations like

    if (isLocal())
        runnable.commandLineArguments = argumentString(Utils::HostOsInfo::hostOs());
    else
        runnable.commandLineArguments = argumentString(Utils::OsTypeLinux);

Change-Id: I5a35304e5d1b5a042952201f39f4134a5cd0ce24
Reviewed-by: Christian Kandeler's avatarChristian Kandeler <christian.kandeler@qt.io>
parent 3610b2a8
......@@ -94,6 +94,11 @@ DeviceProcessSignalOperation::Ptr AndroidDevice::signalOperation() const
return DeviceProcessSignalOperation::Ptr(new AndroidSignalOperation());
}
Utils::OsType AndroidDevice::osType() const
{
return Utils::OsTypeOtherUnix;
}
IDevice::Ptr AndroidDevice::clone() const
{
return IDevice::Ptr(new AndroidDevice(*this));
......
......@@ -44,6 +44,7 @@ public:
void executeAction(Core::Id actionId, QWidget *parent = 0) override;
bool canAutoDetectPorts() const override;
ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation() const override;
Utils::OsType osType() const override;
ProjectExplorer::IDevice::Ptr clone() const override;
ProjectExplorer::Connection toolControlChannel(const ControlChannelHint &) const override;
......
......@@ -176,6 +176,11 @@ void BareMetalDevice::executeAction(Core::Id actionId, QWidget *parent)
Q_UNUSED(parent);
}
Utils::OsType BareMetalDevice::osType() const
{
return Utils::OsTypeOther;
}
DeviceProcess *BareMetalDevice::createProcess(QObject *parent) const
{
return new GdbServerProviderProcess(sharedFromThis(), parent);
......
......@@ -50,6 +50,7 @@ public:
QList<Core::Id> actionIds() const override;
QString displayNameForActionId(Core::Id actionId) const override;
void executeAction(Core::Id actionId, QWidget *parent) override;
Utils::OsType osType() const override;
ProjectExplorer::IDevice::Ptr clone() const override;
ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation() const override;
......
......@@ -213,6 +213,11 @@ bool IosDevice::canAutoDetectPorts() const
return true;
}
Utils::OsType IosDevice::osType() const
{
return Utils::OsTypeMac;
}
// IosDeviceManager
......
......@@ -68,6 +68,7 @@ public:
QString osVersion() const;
Utils::Port nextPort() const;
bool canAutoDetectPorts() const override;
Utils::OsType osType() const override;
static QString name();
......
......@@ -154,6 +154,11 @@ bool IosSimulator::canAutoDetectPorts() const
return true;
}
Utils::OsType IosSimulator::osType() const
{
return Utils::OsTypeMac;
}
IosSimulator::ConstPtr IosKitInformation::simulator(Kit *kit)
{
if (!kit)
......
......@@ -77,6 +77,7 @@ public:
QVariantMap toMap() const override;
Utils::Port nextPort() const;
bool canAutoDetectPorts() const override;
Utils::OsType osType() const override;
ProjectExplorer::IDevice::Ptr clone() const override;
protected:
......
......@@ -142,6 +142,11 @@ Connection DesktopDevice::toolControlChannel(const ControlChannelHint &) const
return HostName("localhost");
}
Utils::OsType DesktopDevice::osType() const
{
return Utils::HostOsInfo::hostOs();
}
IDevice::Ptr DesktopDevice::clone() const
{
return Ptr(new DesktopDevice(*this));
......
......@@ -53,6 +53,7 @@ public:
DeviceProcessSignalOperation::Ptr signalOperation() const override;
DeviceEnvironmentFetcher::Ptr environmentFetcher() const override;
Connection toolControlChannel(const ControlChannelHint &) const override;
Utils::OsType osType() const override;
IDevice::Ptr clone() const override;
......
......@@ -441,6 +441,7 @@ private:
{
return DeviceProcessSignalOperation::Ptr();
}
Utils::OsType osType() const override { return Utils::HostOsInfo::hostOs(); }
};
void ProjectExplorerPlugin::testDeviceManager()
......
......@@ -278,6 +278,11 @@ DeviceTester *IDevice::createDeviceTester() const
return 0;
}
Utils::OsType IDevice::osType() const
{
return Utils::OsTypeOther;
}
DeviceProcess *IDevice::createProcess(QObject * /* parent */) const
{
QTC_CHECK(false);
......
......@@ -28,6 +28,7 @@
#include "../projectexplorer_export.h"
#include <coreplugin/id.h>
#include <utils/hostosinfo.h>
#include <QAbstractSocket>
#include <QList>
......@@ -160,6 +161,7 @@ public:
virtual DeviceProcessList *createProcessListModel(QObject *parent = 0) const;
virtual bool hasDeviceTester() const { return false; }
virtual DeviceTester *createDeviceTester() const;
virtual Utils::OsType osType() const;
virtual bool canCreateProcess() const { return false; }
virtual DeviceProcess *createProcess(QObject *parent) const;
......
......@@ -122,6 +122,11 @@ QString QnxDevice::displayType() const
return tr("QNX");
}
OsType QnxDevice::osType() const
{
return OsTypeOtherUnix;
}
int QnxDevice::qnxVersion() const
{
if (m_versionNumber == 0)
......
......@@ -56,6 +56,7 @@ public:
void executeAction(Core::Id actionId, QWidget *parent) override;
QString displayType() const override;
Utils::OsType osType() const override;
int qnxVersion() const;
......
......@@ -203,6 +203,11 @@ void LinuxDevice::executeAction(Core::Id actionId, QWidget *parent)
delete d;
}
Utils::OsType LinuxDevice::osType() const
{
return Utils::OsTypeLinux;
}
LinuxDevice::LinuxDevice(const QString &name, Core::Id type, MachineType machineType,
Origin origin, Core::Id id)
: IDevice(type, origin, machineType, id)
......
......@@ -54,6 +54,7 @@ public:
QList<Core::Id> actionIds() const;
QString displayNameForActionId(Core::Id actionId) const;
void executeAction(Core::Id actionId, QWidget *parent);
Utils::OsType osType() const override;
ProjectExplorer::IDevice::Ptr clone() const;
bool canCreateProcess() const { return true; }
......
......@@ -119,6 +119,11 @@ QVariantMap WinRtDevice::toMap() const
return map;
}
Utils::OsType WinRtDevice::osType() const
{
return Utils::OsTypeWindows;
}
IDevice::Ptr WinRtDevice::clone() const
{
return IDevice::Ptr(new WinRtDevice(*this));
......
......@@ -45,6 +45,7 @@ public:
ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation() const override;
void fromMap(const QVariantMap &map) override;
QVariantMap toMap() const override;
Utils::OsType osType() const override;
ProjectExplorer::IDevice::Ptr clone() const override;
static QString displayNameForType(Core::Id type);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment