diff --git a/src/plugins/remotelinux/makeinstallstep.cpp b/src/plugins/remotelinux/makeinstallstep.cpp index 6b3b5342362..4ea910daa4d 100644 --- a/src/plugins/remotelinux/makeinstallstep.cpp +++ b/src/plugins/remotelinux/makeinstallstep.cpp @@ -51,6 +51,7 @@ const char MakeAspectId[] = "RemoteLinux.MakeInstall.Make"; const char InstallRootAspectId[] = "RemoteLinux.MakeInstall.InstallRoot"; const char CleanInstallRootAspectId[] = "RemoteLinux.MakeInstall.CleanInstallRoot"; const char FullCommandLineAspectId[] = "RemoteLinux.MakeInstall.FullCommandLine"; +const char CustomCommandLineAspectId[] = "RemoteLinux.MakeInstall.CustomCommandLine"; MakeInstallStep::MakeInstallStep(BuildStepList *parent) : MakeStep(parent, stepId()) { @@ -76,8 +77,8 @@ MakeInstallStep::MakeInstallStep(BuildStepList *parent) : MakeStep(parent, stepI const auto cleanInstallRootAspect = addAspect(); cleanInstallRootAspect->setId(CleanInstallRootAspectId); cleanInstallRootAspect->setSettingsKey(CleanInstallRootAspectId); - cleanInstallRootAspect->setLabel(tr("Clean install root first"), - BaseBoolAspect::LabelPlacement::AtCheckBox); + cleanInstallRootAspect->setLabel(tr("Clean install root first:"), + BaseBoolAspect::LabelPlacement::InExtraLabel); cleanInstallRootAspect->setValue(false); const auto commandLineAspect = addAspect(); @@ -85,6 +86,23 @@ MakeInstallStep::MakeInstallStep(BuildStepList *parent) : MakeStep(parent, stepI commandLineAspect->setDisplayStyle(BaseStringAspect::LabelDisplay); commandLineAspect->setLabelText(tr("Full command line:")); + const auto customCommandLineAspect = addAspect(); + customCommandLineAspect->setId(CustomCommandLineAspectId); + customCommandLineAspect->setSettingsKey(CustomCommandLineAspectId); + customCommandLineAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay); + customCommandLineAspect->setLabelText(tr("Custom command line:")); + customCommandLineAspect->makeCheckable(BaseStringAspect::CheckBoxPlacement::Top, + tr("Use custom command line instead:"), + "RemoteLinux.MakeInstall.EnableCustomCommandLine"); + connect(customCommandLineAspect, &BaseStringAspect::checkedChanged, + this, &MakeInstallStep::updateCommandFromAspect); + connect(customCommandLineAspect, &BaseStringAspect::checkedChanged, + this, &MakeInstallStep::updateArgsFromAspect); + connect(customCommandLineAspect, &BaseStringAspect::checkedChanged, + this, &MakeInstallStep::updateFromCustomCommandLineAspect); + connect(customCommandLineAspect, &BaseStringAspect::changed, + this, &MakeInstallStep::updateFromCustomCommandLineAspect); + QTemporaryDir tmpDir; installRootAspect->setFilePath(FilePath::fromString(tmpDir.path())); const MakeInstallCommand cmd = target()->makeInstallCommand(tmpDir.path()); @@ -199,12 +217,16 @@ bool MakeInstallStep::cleanInstallRoot() const void MakeInstallStep::updateCommandFromAspect() { + if (customCommandLineAspect()->isChecked()) + return; setMakeCommand(aspect()->executable()); updateFullCommandLine(); } void MakeInstallStep::updateArgsFromAspect() { + if (customCommandLineAspect()->isChecked()) + return; setUserArguments(QtcProcess::joinArgs(target()->makeInstallCommand( static_cast(aspect(InstallRootAspectId))->filePath().toString()) .arguments)); @@ -220,12 +242,28 @@ void MakeInstallStep::updateFullCommandLine() + ' ' + userArguments()); } +void MakeInstallStep::updateFromCustomCommandLineAspect() +{ + const BaseStringAspect * const aspect = customCommandLineAspect(); + if (!aspect->isChecked()) + return; + const QStringList tokens = QtcProcess::splitArgs(aspect->value()); + setMakeCommand(tokens.isEmpty() ? FilePath() : FilePath::fromString(tokens.first())); + setUserArguments(QtcProcess::joinArgs(tokens.mid(1))); +} + +BaseStringAspect *MakeInstallStep::customCommandLineAspect() const +{ + return static_cast(aspect(CustomCommandLineAspectId)); +} + bool MakeInstallStep::fromMap(const QVariantMap &map) { if (!MakeStep::fromMap(map)) return false; updateCommandFromAspect(); updateArgsFromAspect(); + updateFromCustomCommandLineAspect(); return true; } diff --git a/src/plugins/remotelinux/makeinstallstep.h b/src/plugins/remotelinux/makeinstallstep.h index 9cc27c3435d..feec859c8bc 100644 --- a/src/plugins/remotelinux/makeinstallstep.h +++ b/src/plugins/remotelinux/makeinstallstep.h @@ -30,6 +30,7 @@ #include #include +namespace ProjectExplorer { class BaseStringAspect; } namespace Utils { class FilePath; } namespace RemoteLinux { @@ -57,6 +58,9 @@ private: void updateCommandFromAspect(); void updateArgsFromAspect(); void updateFullCommandLine(); + void updateFromCustomCommandLineAspect(); + + ProjectExplorer::BaseStringAspect *customCommandLineAspect() const; ProjectExplorer::DeploymentData m_deploymentData; bool m_noInstallTarget = false;