forked from qt-creator/qt-creator
ProjectExplorer: FilePathify IDevice::qmlRunCommand
And remove a few unnecessary namespace qualifications nearby. Change-Id: Iea866c98f13fe02e1ce29b855632beeaeeb8cd4f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -100,13 +100,13 @@
|
|||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
static Utils::Id newId()
|
|
||||||
{
|
|
||||||
return Utils::Id::fromString(QUuid::createUuid().toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
|
static Id newId()
|
||||||
|
{
|
||||||
|
return Id::fromString(QUuid::createUuid().toString());
|
||||||
|
}
|
||||||
|
|
||||||
const char DisplayNameKey[] = "Name";
|
const char DisplayNameKey[] = "Name";
|
||||||
const char TypeKey[] = "OsType";
|
const char TypeKey[] = "OsType";
|
||||||
const char IdKey[] = "InternalId";
|
const char IdKey[] = "InternalId";
|
||||||
@@ -140,23 +140,23 @@ class IDevicePrivate
|
|||||||
public:
|
public:
|
||||||
IDevicePrivate() = default;
|
IDevicePrivate() = default;
|
||||||
|
|
||||||
Utils::DisplayName displayName;
|
DisplayName displayName;
|
||||||
QString displayType;
|
QString displayType;
|
||||||
Utils::Id type;
|
Id type;
|
||||||
IDevice::Origin origin = IDevice::AutoDetected;
|
IDevice::Origin origin = IDevice::AutoDetected;
|
||||||
Utils::Id id;
|
Id id;
|
||||||
IDevice::DeviceState deviceState = IDevice::DeviceStateUnknown;
|
IDevice::DeviceState deviceState = IDevice::DeviceStateUnknown;
|
||||||
IDevice::MachineType machineType = IDevice::Hardware;
|
IDevice::MachineType machineType = IDevice::Hardware;
|
||||||
Utils::OsType osType = Utils::OsTypeOther;
|
OsType osType = OsTypeOther;
|
||||||
int version = 0; // This is used by devices that have been added by the SDK.
|
int version = 0; // This is used by devices that have been added by the SDK.
|
||||||
|
|
||||||
QSsh::SshConnectionParameters sshParameters;
|
QSsh::SshConnectionParameters sshParameters;
|
||||||
Utils::PortList freePorts;
|
PortList freePorts;
|
||||||
Utils::FilePath debugServerPath;
|
FilePath debugServerPath;
|
||||||
QString qmlRunCommand;
|
FilePath qmlRunCommand;
|
||||||
bool emptyCommandAllowed = false;
|
bool emptyCommandAllowed = false;
|
||||||
|
|
||||||
QList<Utils::Icon> deviceIcons;
|
QList<Icon> deviceIcons;
|
||||||
QList<IDevice::DeviceAction> deviceActions;
|
QList<IDevice::DeviceAction> deviceActions;
|
||||||
QVariantMap extraData;
|
QVariantMap extraData;
|
||||||
IDevice::OpenTerminal openTerminal;
|
IDevice::OpenTerminal openTerminal;
|
||||||
@@ -174,7 +174,7 @@ void IDevice::setOpenTerminal(const IDevice::OpenTerminal &openTerminal)
|
|||||||
d->openTerminal = openTerminal;
|
d->openTerminal = openTerminal;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IDevice::setupId(Origin origin, Utils::Id id)
|
void IDevice::setupId(Origin origin, Id id)
|
||||||
{
|
{
|
||||||
d->origin = origin;
|
d->origin = origin;
|
||||||
QTC_CHECK(origin == ManuallyAdded || id.isValid());
|
QTC_CHECK(origin == ManuallyAdded || id.isValid());
|
||||||
@@ -232,7 +232,7 @@ bool IDevice::isReadableFile(const FilePath &filePath) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IDevice::isWritableFile(const Utils::FilePath &filePath) const
|
bool IDevice::isWritableFile(const FilePath &filePath) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(filePath);
|
Q_UNUSED(filePath);
|
||||||
QTC_CHECK(false);
|
QTC_CHECK(false);
|
||||||
@@ -390,7 +390,7 @@ QDateTime IDevice::lastModified(const FilePath &filePath) const
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QFileDevice::Permissions IDevice::permissions(const Utils::FilePath &filePath) const
|
QFileDevice::Permissions IDevice::permissions(const FilePath &filePath) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(filePath);
|
Q_UNUSED(filePath);
|
||||||
QTC_CHECK(false);
|
QTC_CHECK(false);
|
||||||
@@ -446,7 +446,7 @@ void IDevice::setDisplayType(const QString &type)
|
|||||||
d->displayType = type;
|
d->displayType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IDevice::setOsType(Utils::OsType osType)
|
void IDevice::setOsType(OsType osType)
|
||||||
{
|
{
|
||||||
d->osType = osType;
|
d->osType = osType;
|
||||||
}
|
}
|
||||||
@@ -464,12 +464,12 @@ IDevice::DeviceInfo IDevice::deviceInformation() const
|
|||||||
\sa ProjectExplorer::IDeviceFactory
|
\sa ProjectExplorer::IDeviceFactory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Utils::Id IDevice::type() const
|
Id IDevice::type() const
|
||||||
{
|
{
|
||||||
return d->type;
|
return d->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IDevice::setType(Utils::Id type)
|
void IDevice::setType(Id type)
|
||||||
{
|
{
|
||||||
d->type = type;
|
d->type = type;
|
||||||
}
|
}
|
||||||
@@ -495,7 +495,7 @@ bool IDevice::isAutoDetected() const
|
|||||||
\sa ProjectExplorer::DeviceManager::findInactiveAutoDetectedDevice()
|
\sa ProjectExplorer::DeviceManager::findInactiveAutoDetectedDevice()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Utils::Id IDevice::id() const
|
Id IDevice::id() const
|
||||||
{
|
{
|
||||||
return d->id;
|
return d->id;
|
||||||
}
|
}
|
||||||
@@ -538,7 +538,7 @@ DeviceTester *IDevice::createDeviceTester() const
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::OsType IDevice::osType() const
|
OsType IDevice::osType() const
|
||||||
{
|
{
|
||||||
return d->osType;
|
return d->osType;
|
||||||
}
|
}
|
||||||
@@ -566,14 +566,14 @@ void IDevice::setDeviceState(const IDevice::DeviceState state)
|
|||||||
d->deviceState = state;
|
d->deviceState = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::Id IDevice::typeFromMap(const QVariantMap &map)
|
Id IDevice::typeFromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
return Utils::Id::fromSetting(map.value(QLatin1String(TypeKey)));
|
return Id::fromSetting(map.value(QLatin1String(TypeKey)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::Id IDevice::idFromMap(const QVariantMap &map)
|
Id IDevice::idFromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
return Utils::Id::fromSetting(map.value(QLatin1String(IdKey)));
|
return Id::fromSetting(map.value(QLatin1String(IdKey)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -586,7 +586,7 @@ void IDevice::fromMap(const QVariantMap &map)
|
|||||||
{
|
{
|
||||||
d->type = typeFromMap(map);
|
d->type = typeFromMap(map);
|
||||||
d->displayName.fromMap(map, DisplayNameKey);
|
d->displayName.fromMap(map, DisplayNameKey);
|
||||||
d->id = Utils::Id::fromSetting(map.value(QLatin1String(IdKey)));
|
d->id = Id::fromSetting(map.value(QLatin1String(IdKey)));
|
||||||
if (!d->id.isValid())
|
if (!d->id.isValid())
|
||||||
d->id = newId();
|
d->id = newId();
|
||||||
d->origin = static_cast<Origin>(map.value(QLatin1String(OriginKey), ManuallyAdded).toInt());
|
d->origin = static_cast<Origin>(map.value(QLatin1String(OriginKey), ManuallyAdded).toInt());
|
||||||
@@ -611,12 +611,12 @@ void IDevice::fromMap(const QVariantMap &map)
|
|||||||
QString portsSpec = map.value(PortsSpecKey).toString();
|
QString portsSpec = map.value(PortsSpecKey).toString();
|
||||||
if (portsSpec.isEmpty())
|
if (portsSpec.isEmpty())
|
||||||
portsSpec = "10000-10100";
|
portsSpec = "10000-10100";
|
||||||
d->freePorts = Utils::PortList::fromString(portsSpec);
|
d->freePorts = PortList::fromString(portsSpec);
|
||||||
d->machineType = static_cast<MachineType>(map.value(QLatin1String(MachineTypeKey), DefaultMachineType).toInt());
|
d->machineType = static_cast<MachineType>(map.value(QLatin1String(MachineTypeKey), DefaultMachineType).toInt());
|
||||||
d->version = map.value(QLatin1String(VersionKey), 0).toInt();
|
d->version = map.value(QLatin1String(VersionKey), 0).toInt();
|
||||||
|
|
||||||
d->debugServerPath = FilePath::fromVariant(map.value(QLatin1String(DebugServerKey)));
|
d->debugServerPath = FilePath::fromVariant(map.value(QLatin1String(DebugServerKey)));
|
||||||
d->qmlRunCommand = map.value(QLatin1String(QmlRuntimeKey)).toString();
|
d->qmlRunCommand = FilePath::fromVariant(map.value(QLatin1String(QmlRuntimeKey)));
|
||||||
d->extraData = map.value(ExtraDataKey).toMap();
|
d->extraData = map.value(ExtraDataKey).toMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -647,7 +647,7 @@ QVariantMap IDevice::toMap() const
|
|||||||
map.insert(QLatin1String(VersionKey), d->version);
|
map.insert(QLatin1String(VersionKey), d->version);
|
||||||
|
|
||||||
map.insert(QLatin1String(DebugServerKey), d->debugServerPath.toVariant());
|
map.insert(QLatin1String(DebugServerKey), d->debugServerPath.toVariant());
|
||||||
map.insert(QLatin1String(QmlRuntimeKey), d->qmlRunCommand);
|
map.insert(QLatin1String(QmlRuntimeKey), d->qmlRunCommand.toVariant());
|
||||||
map.insert(ExtraDataKey, d->extraData);
|
map.insert(ExtraDataKey, d->extraData);
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
@@ -700,12 +700,12 @@ QUrl IDevice::toolControlChannel(const ControlChannelHint &) const
|
|||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IDevice::setFreePorts(const Utils::PortList &freePorts)
|
void IDevice::setFreePorts(const PortList &freePorts)
|
||||||
{
|
{
|
||||||
d->freePorts = freePorts;
|
d->freePorts = freePorts;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::PortList IDevice::freePorts() const
|
PortList IDevice::freePorts() const
|
||||||
{
|
{
|
||||||
return d->freePorts;
|
return d->freePorts;
|
||||||
}
|
}
|
||||||
@@ -730,22 +730,22 @@ void IDevice::setDebugServerPath(const FilePath &path)
|
|||||||
d->debugServerPath = path;
|
d->debugServerPath = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString IDevice::qmlRunCommand() const
|
FilePath IDevice::qmlRunCommand() const
|
||||||
{
|
{
|
||||||
return d->qmlRunCommand;
|
return d->qmlRunCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IDevice::setQmlRunCommand(const QString &path)
|
void IDevice::setQmlRunCommand(const FilePath &path)
|
||||||
{
|
{
|
||||||
d->qmlRunCommand = path;
|
d->qmlRunCommand = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IDevice::setExtraData(Utils::Id kind, const QVariant &data)
|
void IDevice::setExtraData(Id kind, const QVariant &data)
|
||||||
{
|
{
|
||||||
d->extraData.insert(kind.toString(), data);
|
d->extraData.insert(kind.toString(), data);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant IDevice::extraData(Utils::Id kind) const
|
QVariant IDevice::extraData(Id kind) const
|
||||||
{
|
{
|
||||||
return d->extraData.value(kind.toString());
|
return d->extraData.value(kind.toString());
|
||||||
}
|
}
|
||||||
|
@@ -214,8 +214,8 @@ public:
|
|||||||
Utils::FilePath debugServerPath() const;
|
Utils::FilePath debugServerPath() const;
|
||||||
void setDebugServerPath(const Utils::FilePath &path);
|
void setDebugServerPath(const Utils::FilePath &path);
|
||||||
|
|
||||||
QString qmlRunCommand() const;
|
Utils::FilePath qmlRunCommand() const;
|
||||||
void setQmlRunCommand(const QString &path);
|
void setQmlRunCommand(const Utils::FilePath &path);
|
||||||
|
|
||||||
void setExtraData(Utils::Id kind, const QVariant &data);
|
void setExtraData(Utils::Id kind, const QVariant &data);
|
||||||
QVariant extraData(Utils::Id kind) const;
|
QVariant extraData(Utils::Id kind) const;
|
||||||
|
@@ -197,9 +197,9 @@ FilePath QmlProjectRunConfiguration::qmlRuntimeFilePath() const
|
|||||||
if (dev.isNull()) // No device set. We don't know where a QML utility is.
|
if (dev.isNull()) // No device set. We don't know where a QML utility is.
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
const QString qmlRuntime = dev->qmlRunCommand();
|
const FilePath qmlRuntime = dev->qmlRunCommand();
|
||||||
// If not given explicitly by device, try to pick it from $PATH.
|
// If not given explicitly by device, try to pick it from $PATH.
|
||||||
return FilePath::fromString(qmlRuntime.isEmpty() ? QString("qmlscene") : qmlRuntime);
|
return qmlRuntime.isEmpty() ? "qmlscene" : qmlRuntime;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmlProjectRunConfiguration::commandLineArguments() const
|
QString QmlProjectRunConfiguration::commandLineArguments() const
|
||||||
|
Reference in New Issue
Block a user