ProjectExplorer: Use FilePathAspect for IDevice::debugServerPath

... and IDevice::qmlRunCommand, currently for storage only.

Leave the GUI side as-is for now, as this synchronizes the widget
content with the local copy of the device data to allow the
device tester to be run with the visible data.

Change-Id: Ie8fb967c9a7f8246eec71d52c9b714ca3b3f5acd
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2024-08-05 13:31:43 +02:00
parent 6b2ff42f0d
commit 08d6b86162
3 changed files with 8 additions and 35 deletions

View File

@@ -138,8 +138,6 @@ public:
Utils::SynchronizedValue<SshParameters> sshParameters; Utils::SynchronizedValue<SshParameters> sshParameters;
PortList freePorts; PortList freePorts;
FilePath debugServerPath;
FilePath qmlRunCommand;
bool emptyCommandAllowed = false; bool emptyCommandAllowed = false;
QList<Icon> deviceIcons; QList<Icon> deviceIcons;
@@ -160,6 +158,10 @@ IDevice::IDevice()
displayName.setSettingsKey(DisplayNameKey); displayName.setSettingsKey(DisplayNameKey);
displayName.setDisplayStyle(StringAspect::DisplayStyle::LineEditDisplay); displayName.setDisplayStyle(StringAspect::DisplayStyle::LineEditDisplay);
debugServerPath.setSettingsKey(DebugServerKey);
qmlRunCommand.setSettingsKey(QmlRuntimeKey);
auto validateDisplayName = [](const QString &old, auto validateDisplayName = [](const QString &old,
const QString &newValue) -> expected_str<void> { const QString &newValue) -> expected_str<void> {
if (old == newValue) if (old == newValue)
@@ -512,9 +514,6 @@ void IDevice::fromMap(const Store &map)
d->machineType = static_cast<MachineType>(map.value(MachineTypeKey, DefaultMachineType).toInt()); d->machineType = static_cast<MachineType>(map.value(MachineTypeKey, DefaultMachineType).toInt());
d->version = map.value(VersionKey, 0).toInt(); d->version = map.value(VersionKey, 0).toInt();
d->debugServerPath = FilePath::fromSettings(map.value(DebugServerKey));
const FilePath qmlRunCmd = FilePath::fromSettings(map.value(QmlRuntimeKey));
d->qmlRunCommand = qmlRunCmd;
d->extraData = storeFromVariant(map.value(ExtraDataKey)); d->extraData = storeFromVariant(map.value(ExtraDataKey));
} }
@@ -548,9 +547,6 @@ void IDevice::toMap(Store &map) const
map.insert(PortsSpecKey, d->freePorts.toString()); map.insert(PortsSpecKey, d->freePorts.toString());
map.insert(VersionKey, d->version); map.insert(VersionKey, d->version);
map.insert(DebugServerKey, d->debugServerPath.toSettings());
map.insert(QmlRuntimeKey, d->qmlRunCommand.toSettings());
map.insert(ExtraDataKey, variantFromStore(d->extraData)); map.insert(ExtraDataKey, variantFromStore(d->extraData));
} }
@@ -635,26 +631,6 @@ FilePath IDevice::rootPath() const
return FilePath::fromParts(u"device", id().toString(), u"/"); return FilePath::fromParts(u"device", id().toString(), u"/");
} }
FilePath IDevice::debugServerPath() const
{
return d->debugServerPath;
}
void IDevice::setDebugServerPath(const FilePath &path)
{
d->debugServerPath = path;
}
FilePath IDevice::qmlRunCommand() const
{
return d->qmlRunCommand;
}
void IDevice::setQmlRunCommand(const FilePath &path)
{
d->qmlRunCommand = path;
}
void IDevice::setExtraData(Id kind, const QVariant &data) void IDevice::setExtraData(Id kind, const QVariant &data)
{ {
d->extraData.insert(keyFromString(kind.toString()), data); d->extraData.insert(keyFromString(kind.toString()), data);

View File

@@ -173,11 +173,8 @@ public:
virtual Utils::FilePath rootPath() const; virtual Utils::FilePath rootPath() const;
virtual Utils::FilePath filePath(const QString &pathOnDevice) const; virtual Utils::FilePath filePath(const QString &pathOnDevice) const;
Utils::FilePath debugServerPath() const; Utils::FilePathAspect debugServerPath{this};
void setDebugServerPath(const Utils::FilePath &path); Utils::FilePathAspect qmlRunCommand{this};
Utils::FilePath qmlRunCommand() const;
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;

View File

@@ -217,12 +217,12 @@ void GenericLinuxDeviceConfigurationWidget::keyFileEditingFinished()
void GenericLinuxDeviceConfigurationWidget::gdbServerEditingFinished() void GenericLinuxDeviceConfigurationWidget::gdbServerEditingFinished()
{ {
device()->setDebugServerPath(m_gdbServerLineEdit->filePath()); device()->debugServerPath.setValue(m_gdbServerLineEdit->filePath());
} }
void GenericLinuxDeviceConfigurationWidget::qmlRuntimeEditingFinished() void GenericLinuxDeviceConfigurationWidget::qmlRuntimeEditingFinished()
{ {
device()->setQmlRunCommand(m_qmlRuntimeLineEdit->filePath()); device()->qmlRunCommand.setValue(m_qmlRuntimeLineEdit->filePath());
} }
void GenericLinuxDeviceConfigurationWidget::handleFreePortsChanged() void GenericLinuxDeviceConfigurationWidget::handleFreePortsChanged()