AbstractRemoteLinuxDeployService: Simplify internal data

Replace stopRequested field with Stopping state.

Change-Id: I75d098e5913b59fd7ace2881c6e0c42e70c06667
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2022-11-24 12:42:50 +01:00
parent d2408fd389
commit 6fb0bebba9
2 changed files with 5 additions and 12 deletions

View File

@@ -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();
}

View File

@@ -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;
};