RemoteLinux: Slimmer interface of custom command deploy step handling

Change-Id: Iad10d6bd111c9f06adb510aae19e861bbce3425d
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2022-06-02 18:16:46 +02:00
parent fe63fb2881
commit 8d659cb7db
3 changed files with 45 additions and 43 deletions

View File

@@ -26,6 +26,7 @@
#include "customcommanddeploystep.h"
#include "abstractremotelinuxdeployservice.h"
#include "abstractremotelinuxdeploystep.h"
#include "remotelinux_constants.h"
#include <projectexplorer/devicesupport/idevice.h>
@@ -108,35 +109,41 @@ void CustomCommandDeployService::stopDeployment()
handleDeploymentDone();
}
class CustomCommandDeployStep : public AbstractRemoteLinuxDeployStep
{
Q_DECLARE_TR_FUNCTIONS(RemoteLinux::Internal::CustomCommandDeployStep)
public:
CustomCommandDeployStep(BuildStepList *bsl, Id id)
: AbstractRemoteLinuxDeployStep(bsl, id)
{
auto service = createDeployService<CustomCommandDeployService>();
auto commandLine = addAspect<StringAspect>();
commandLine->setSettingsKey("RemoteLinuxCustomCommandDeploymentStep.CommandLine");
commandLine->setLabelText(tr("Command line:"));
commandLine->setDisplayStyle(StringAspect::LineEditDisplay);
commandLine->setHistoryCompleter("RemoteLinuxCustomCommandDeploymentStep.History");
setInternalInitializer([service, commandLine] {
service->setCommandLine(commandLine->value().trimmed());
return service->isDeploymentPossible();
});
addMacroExpander();
}
};
// CustomCommandDeployStepFactory
CustomCommandDeployStepFactory::CustomCommandDeployStepFactory()
{
registerStep<CustomCommandDeployStep>(Constants::CustomCommandDeployStepId);
setDisplayName(CustomCommandDeployStep::tr("Run custom remote command"));
setSupportedConfiguration(RemoteLinux::Constants::DeployToGenericLinux);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
}
} // Internal
CustomCommandDeployStep::CustomCommandDeployStep(BuildStepList *bsl, Utils::Id id)
: AbstractRemoteLinuxDeployStep(bsl, id)
{
auto service = createDeployService<Internal::CustomCommandDeployService>();
auto commandLine = addAspect<StringAspect>();
commandLine->setSettingsKey("RemoteLinuxCustomCommandDeploymentStep.CommandLine");
commandLine->setLabelText(tr("Command line:"));
commandLine->setDisplayStyle(StringAspect::LineEditDisplay);
commandLine->setHistoryCompleter("RemoteLinuxCustomCommandDeploymentStep.History");
setInternalInitializer([service, commandLine] {
service->setCommandLine(commandLine->value().trimmed());
return service->isDeploymentPossible();
});
addMacroExpander();
}
Utils::Id CustomCommandDeployStep::stepId()
{
return Constants::CustomCommandDeployStepId;
}
QString CustomCommandDeployStep::displayName()
{
return tr("Run custom remote command");
}
} // namespace RemoteLinux
} // RemoteLinux

View File

@@ -25,21 +25,16 @@
#pragma once
#include "remotelinux_export.h"
#include "abstractremotelinuxdeploystep.h"
#include <projectexplorer/buildstep.h>
namespace RemoteLinux {
namespace Internal {
class REMOTELINUX_EXPORT CustomCommandDeployStep : public AbstractRemoteLinuxDeployStep
class CustomCommandDeployStepFactory : public ProjectExplorer::BuildStepFactory
{
Q_OBJECT
public:
CustomCommandDeployStep(ProjectExplorer::BuildStepList *bsl, Utils::Id id);
static Utils::Id stepId();
static QString displayName();
CustomCommandDeployStepFactory();
};
} // namespace RemoteLinux
} // Internal
} // RemoteLinux

View File

@@ -78,7 +78,7 @@ public:
TarPackageDeployStepFactory tarPackageDeployStepFactory;
GenericDeployStepFactory<GenericDirectUploadStep> genericDirectUploadStepFactory;
GenericDeployStepFactory<RsyncDeployStep> rsyncDeployStepFactory;
GenericDeployStepFactory<CustomCommandDeployStep> customCommandDeployStepFactory;
CustomCommandDeployStepFactory customCommandDeployStepFactory;
GenericDeployStepFactory<CheckForFreeDiskSpaceStep> checkForFreeDiskSpaceStepFactory;
GenericDeployStepFactory<KillAppStep> killAppStepFactory;
GenericDeployStepFactory<MakeInstallStep> makeInstallStepFactory;