Squish: Slightly tweak the validation of Squish path

The settings validated so far only whether the given path is
an existing directory.
Check at least the most important indicator whether this path
can be considered valid or not.

Change-Id: I01a35a4e694e309b0fd304c869b6e9d31211f38d
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2022-10-14 11:39:47 +02:00
parent 06402e0dc6
commit bdf3c2d576

View File

@@ -42,6 +42,17 @@ SquishSettings::SquishSettings()
squishPath.setDisplayStyle(StringAspect::PathChooserDisplay);
squishPath.setExpectedKind(PathChooser::ExistingDirectory);
squishPath.setPlaceHolderText(Tr::tr("Path to Squish installation"));
squishPath.setValidationFunction([this](FancyLineEdit *edit, QString *error) {
QTC_ASSERT(edit, return false);
if (!squishPath.pathChooser()->defaultValidationFunction()(edit, error));
return false;
const FilePath squishServer = FilePath::fromString(edit->text())
.pathAppended(HostOsInfo::withExecutableSuffix("bin/squishserver"));
const bool valid = squishServer.isExecutableFile();
if (!valid && error)
*error = Tr::tr("Path does not contain server executable at its default location.");
return valid;
});
registerAspect(&licensePath);
licensePath.setSettingsKey("LicensePath");