ProjectExplorer: Use FilePathAspect for some FilePaths

Change-Id: I35d55c82217e9ef9bbcf215c8360a111931c822c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2023-05-23 14:42:41 +02:00
parent 75710fa369
commit 01019dfdb8
4 changed files with 5 additions and 10 deletions

View File

@@ -41,7 +41,6 @@ BuildDirectoryAspect::BuildDirectoryAspect(const BuildConfiguration *bc)
{ {
setSettingsKey("ProjectExplorer.BuildConfiguration.BuildDirectory"); setSettingsKey("ProjectExplorer.BuildConfiguration.BuildDirectory");
setLabelText(Tr::tr("Build directory:")); setLabelText(Tr::tr("Build directory:"));
setDisplayStyle(PathChooserDisplay);
setExpectedKind(Utils::PathChooser::Directory); setExpectedKind(Utils::PathChooser::Directory);
setValidationFunction([this](FancyLineEdit *edit, QString *error) { setValidationFunction([this](FancyLineEdit *edit, QString *error) {
const FilePath fixedDir = fixupDir(FilePath::fromUserInput(edit->text())); const FilePath fixedDir = fixupDir(FilePath::fromUserInput(edit->text()));

View File

@@ -7,12 +7,11 @@
#include <utils/aspects.h> #include <utils/aspects.h>
namespace Utils { class FilePath; }
namespace ProjectExplorer { namespace ProjectExplorer {
class BuildConfiguration; class BuildConfiguration;
class PROJECTEXPLORER_EXPORT BuildDirectoryAspect : public Utils::StringAspect class PROJECTEXPLORER_EXPORT BuildDirectoryAspect : public Utils::FilePathAspect
{ {
Q_OBJECT Q_OBJECT
public: public:

View File

@@ -46,9 +46,8 @@ MakeStep::MakeStep(BuildStepList *parent, Id id)
setCommandLineProvider([this] { return effectiveMakeCommand(Execution); }); setCommandLineProvider([this] { return effectiveMakeCommand(Execution); });
m_makeCommandAspect = addAspect<StringAspect>(); m_makeCommandAspect = addAspect<FilePathAspect>();
m_makeCommandAspect->setSettingsKey(id.withSuffix(MAKE_COMMAND_SUFFIX).toString()); m_makeCommandAspect->setSettingsKey(id.withSuffix(MAKE_COMMAND_SUFFIX).toString());
m_makeCommandAspect->setDisplayStyle(StringAspect::PathChooserDisplay);
m_makeCommandAspect->setExpectedKind(PathChooser::ExistingCommand); m_makeCommandAspect->setExpectedKind(PathChooser::ExistingCommand);
m_makeCommandAspect->setBaseFileName(PathChooser::homePath()); m_makeCommandAspect->setBaseFileName(PathChooser::homePath());
m_makeCommandAspect->setHistoryCompleter("PE.MakeCommand.History"); m_makeCommandAspect->setHistoryCompleter("PE.MakeCommand.History");

View File

@@ -34,9 +34,8 @@ public:
ProcessStep::ProcessStep(BuildStepList *bsl, Id id) ProcessStep::ProcessStep(BuildStepList *bsl, Id id)
: AbstractProcessStep(bsl, id) : AbstractProcessStep(bsl, id)
{ {
auto command = addAspect<StringAspect>(); auto command = addAspect<FilePathAspect>();
command->setSettingsKey(PROCESS_COMMAND_KEY); command->setSettingsKey(PROCESS_COMMAND_KEY);
command->setDisplayStyle(StringAspect::PathChooserDisplay);
command->setLabelText(Tr::tr("Command:")); command->setLabelText(Tr::tr("Command:"));
command->setExpectedKind(PathChooser::Command); command->setExpectedKind(PathChooser::Command);
command->setHistoryCompleter("PE.ProcessStepCommand.History"); command->setHistoryCompleter("PE.ProcessStepCommand.History");
@@ -46,10 +45,9 @@ ProcessStep::ProcessStep(BuildStepList *bsl, Id id)
arguments->setDisplayStyle(StringAspect::LineEditDisplay); arguments->setDisplayStyle(StringAspect::LineEditDisplay);
arguments->setLabelText(Tr::tr("Arguments:")); arguments->setLabelText(Tr::tr("Arguments:"));
auto workingDirectory = addAspect<StringAspect>(); auto workingDirectory = addAspect<FilePathAspect>();
workingDirectory->setSettingsKey(PROCESS_WORKINGDIRECTORY_KEY); workingDirectory->setSettingsKey(PROCESS_WORKINGDIRECTORY_KEY);
workingDirectory->setValue(Constants::DEFAULT_WORKING_DIR); workingDirectory->setValue(Constants::DEFAULT_WORKING_DIR);
workingDirectory->setDisplayStyle(StringAspect::PathChooserDisplay);
workingDirectory->setLabelText(Tr::tr("Working directory:")); workingDirectory->setLabelText(Tr::tr("Working directory:"));
workingDirectory->setExpectedKind(PathChooser::Directory); workingDirectory->setExpectedKind(PathChooser::Directory);