From 6fb0bebba9b362e7ed8f008de6d37f9799e377e1 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 24 Nov 2022 12:42:50 +0100 Subject: [PATCH] AbstractRemoteLinuxDeployService: Simplify internal data Replace stopRequested field with Stopping state. Change-Id: I75d098e5913b59fd7ace2881c6e0c42e70c06667 Reviewed-by: Christian Kandeler Reviewed-by: --- .../abstractremotelinuxdeployservice.cpp | 15 +++++---------- .../abstractremotelinuxdeployservice.h | 2 -- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp b/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp index 46ff793ac3d..0da7bfe405b 100644 --- a/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp +++ b/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp @@ -23,7 +23,7 @@ namespace RemoteLinux { namespace Internal { namespace { -enum State { Inactive, Deploying }; +enum State { Inactive, Deploying, Stopping }; } // anonymous namespace class AbstractRemoteLinuxDeployServicePrivate @@ -34,7 +34,6 @@ public: DeploymentTimeInfo deployTimes; State state = Inactive; - bool stopRequested = false; }; } // namespace Internal @@ -117,13 +116,10 @@ void AbstractRemoteLinuxDeployService::start() void AbstractRemoteLinuxDeployService::stop() { - if (d->stopRequested) + if (d->state != Deploying) return; - - if (d->state == Deploying) { - d->stopRequested = true; - stopDeployment(); - } + d->state = Stopping; + stopDeployment(); } CheckResult AbstractRemoteLinuxDeployService::isDeploymentPossible() const @@ -145,9 +141,8 @@ void AbstractRemoteLinuxDeployService::importDeployTimes(const QVariantMap &map) void AbstractRemoteLinuxDeployService::handleDeploymentDone() { - QTC_ASSERT(d->state == Deploying, return); + QTC_ASSERT(d->state != Inactive, return); d->state = Inactive; - d->stopRequested = false; emit finished(); } diff --git a/src/plugins/remotelinux/abstractremotelinuxdeployservice.h b/src/plugins/remotelinux/abstractremotelinuxdeployservice.h index 2ebf3062902..fd77fc58de4 100644 --- a/src/plugins/remotelinux/abstractremotelinuxdeployservice.h +++ b/src/plugins/remotelinux/abstractremotelinuxdeployservice.h @@ -69,7 +69,6 @@ protected: void saveDeploymentTimeStamp(const ProjectExplorer::DeployableFile &deployableFile, const QDateTime &remoteTimestamp); - bool hasLocalFileChanged(const ProjectExplorer::DeployableFile &deployableFile) const; bool hasRemoteFileChanged(const ProjectExplorer::DeployableFile &deployableFile, const QDateTime &remoteTimestamp) const; @@ -81,7 +80,6 @@ private: virtual void doDeploy() = 0; virtual void stopDeployment() = 0; - Internal::AbstractRemoteLinuxDeployServicePrivate * const d; };