RemoteLinux et al: Use functor for deploy step polishing

More compact.

Change-Id: I8adc63aec71de1e57640911300f2699598ef1a01
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-06-07 16:43:06 +02:00
parent 00b692e67e
commit d747be71f5
18 changed files with 84 additions and 110 deletions

View File

@@ -40,6 +40,7 @@ class AbstractRemoteLinuxDeployStepPrivate
{
public:
bool hasError;
std::function<CheckResult()> internalInit;
};
} // namespace Internal
@@ -49,6 +50,11 @@ AbstractRemoteLinuxDeployStep::AbstractRemoteLinuxDeployStep(BuildStepList *bsl,
{
}
void AbstractRemoteLinuxDeployStep::setInternalInitializer(const std::function<CheckResult ()> &init)
{
d->internalInit = init;
}
AbstractRemoteLinuxDeployStep::~AbstractRemoteLinuxDeployStep()
{
delete d;
@@ -70,7 +76,9 @@ QVariantMap AbstractRemoteLinuxDeployStep::toMap() const
bool AbstractRemoteLinuxDeployStep::init()
{
deployService()->setTarget(target());
const CheckResult canDeploy = initInternal();
QTC_ASSERT(d->internalInit, return false);
const CheckResult canDeploy = d->internalInit();
if (!canDeploy) {
emit addOutput(tr("Cannot deploy: %1").arg(canDeploy.errorMessage()),
OutputFormat::ErrorMessage);