From bdf3c2d57669fa43bfd10a671059f41b6c99d404 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 14 Oct 2022 11:39:47 +0200 Subject: [PATCH] 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 --- src/plugins/squish/squishsettings.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/plugins/squish/squishsettings.cpp b/src/plugins/squish/squishsettings.cpp index 58fad483e77..e763db9f80a 100644 --- a/src/plugins/squish/squishsettings.cpp +++ b/src/plugins/squish/squishsettings.cpp @@ -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");