AppMan: Use FilePathAspect::setDefaultPathValue(FilePath)

Change-Id: Ia8025bc707fd1d87b4066fcee98b8566f13726d6
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Dominik Holland
2024-01-25 10:09:50 +01:00
parent 07d347a0c3
commit 1deb31f295
5 changed files with 11 additions and 11 deletions

View File

@@ -40,7 +40,7 @@ public:
setDisplayName(Tr::tr("Create Application Manager package")); setDisplayName(Tr::tr("Create Application Manager package"));
packager.setSettingsKey(SETTINGSPREFIX "Executable"); packager.setSettingsKey(SETTINGSPREFIX "Executable");
packager.setDefaultValue(getToolFilePath(Constants::APPMAN_PACKAGER, kit())); packager.setDefaultPathValue(getToolFilePath(Constants::APPMAN_PACKAGER, kit()));
arguments.setSettingsKey(SETTINGSPREFIX "Arguments"); arguments.setSettingsKey(SETTINGSPREFIX "Arguments");
arguments.setResetter([] { return QLatin1String(ArgumentsDefault); }); arguments.setResetter([] { return QLatin1String(ArgumentsDefault); });

View File

@@ -54,9 +54,9 @@ AppManagerInstallPackageStep::AppManagerInstallPackageStep(BuildStepList *bsl, I
{ {
setDisplayName(tr("Install Application Manager package")); setDisplayName(tr("Install Application Manager package"));
controller.setDefaultValue(getToolFilePath(Constants::APPMAN_CONTROLLER, controller.setDefaultPathValue(getToolFilePath(Constants::APPMAN_CONTROLLER,
target()->kit(), target()->kit(),
DeviceKitAspect::device(target()->kit()))); DeviceKitAspect::device(target()->kit())));
arguments.setSettingsKey(SETTINGSPREFIX "Arguments"); arguments.setSettingsKey(SETTINGSPREFIX "Arguments");
arguments.setResetter([] { return QLatin1String(ArgumentsDefault); }); arguments.setResetter([] { return QLatin1String(ArgumentsDefault); });
@@ -75,11 +75,11 @@ AppManagerInstallPackageStep::AppManagerInstallPackageStep(BuildStepList *bsl, I
const TargetInformation targetInformation(target()); const TargetInformation targetInformation(target());
if (DeviceKitAspect::device(kit())->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) { if (DeviceKitAspect::device(kit())->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
packageFile.setDefaultValue(targetInformation.packageFilePath.toUserOutput()); packageFile.setDefaultPathValue(targetInformation.packageFilePath);
} else { } else {
const Utils::FilePath packageFilePath = targetInformation.runDirectory.pathAppended( const Utils::FilePath packageFilePath = targetInformation.runDirectory.pathAppended(
targetInformation.packageFilePath.fileName()); targetInformation.packageFilePath.fileName());
packageFile.setDefaultValue(packageFilePath.toUserOutput()); packageFile.setDefaultPathValue(packageFilePath);
} }
setEnabled(!targetInformation.isBuiltin); setEnabled(!targetInformation.isBuiltin);

View File

@@ -41,8 +41,8 @@ public:
return; return;
const TargetInformation targetInformation = tis.at(0); const TargetInformation targetInformation = tis.at(0);
controller.setValue(FilePath::fromString(getToolFilePath(Constants::APPMAN_CONTROLLER, kit(), controller.setValue(getToolFilePath(Constants::APPMAN_CONTROLLER, kit(),
DeviceKitAspect::device(kit())))); DeviceKitAspect::device(kit())));
appId.setValue(targetInformation.manifest.id); appId.setValue(targetInformation.manifest.id);
appId.setReadOnly(true); appId.setReadOnly(true);

View File

@@ -38,14 +38,14 @@ static FilePath getToolPathByQtVersion(const QtVersion *qtVersion,
return {}; return {};
} }
QString getToolFilePath(const QString &toolname, const Kit *kit, const IDevice::ConstPtr &device) FilePath getToolFilePath(const QString &toolname, const Kit *kit, const IDevice::ConstPtr &device)
{ {
const bool local = !device || device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE; const bool local = !device || device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
const FilePath path = local ? getToolPathByQtVersion(QtKitAspect::qtVersion(kit)) const FilePath path = local ? getToolPathByQtVersion(QtKitAspect::qtVersion(kit))
: FilePath(Constants::REMOTE_DEFAULT_BIN_PATH); : FilePath(Constants::REMOTE_DEFAULT_BIN_PATH);
const QString name = getToolNameByDevice(toolname, device); const QString name = getToolNameByDevice(toolname, device);
const QString filePath = !path.isEmpty() ? path.pathAppended(name).toString() : name; const QString filePath = !path.isEmpty() ? path.pathAppended(name).toString() : name;
return !device ? filePath : device->filePath(filePath).toUserOutput(); return !device ? FilePath::fromString(filePath) : device->filePath(filePath);
} }
QString getToolNameByDevice(const QString &baseName, const QSharedPointer<const IDevice> &device) QString getToolNameByDevice(const QString &baseName, const QSharedPointer<const IDevice> &device)

View File

@@ -10,6 +10,6 @@
namespace AppManager::Internal { namespace AppManager::Internal {
QString getToolNameByDevice(const QString &baseName, const QSharedPointer<const ProjectExplorer::IDevice> &device = nullptr); QString getToolNameByDevice(const QString &baseName, const QSharedPointer<const ProjectExplorer::IDevice> &device = nullptr);
QString getToolFilePath(const QString &toolname, const ProjectExplorer::Kit *kit, const ProjectExplorer::IDevice::ConstPtr &device = nullptr); Utils::FilePath getToolFilePath(const QString &toolname, const ProjectExplorer::Kit *kit, const ProjectExplorer::IDevice::ConstPtr &device = nullptr);
} // AppManager::Internal } // AppManager::Internal