Move impl to cpp, fix lifetime issues.

Took 11 minutes

Took 2 minutes
This commit is contained in:
Lukas Brübach 2026-08-03 14:30:45 +02:00
parent 961a973772
commit a9077aa65b
27 changed files with 442 additions and 281 deletions

View file

@ -1 +1,29 @@
#include "intent_disconnect_from_server.h"
IntentDisconnectFromServer::IntentDisconnectFromServer(RemoteClient *_remoteClient)
: Intent(), remoteClient(_remoteClient)
{
}
bool IntentDisconnectFromServer::checkPrecondition() const
{
return remoteClient->getStatus() == ClientStatus::StatusDisconnected;
}
void IntentDisconnectFromServer::onPreconditionSatisfied()
{
emit finished();
}
void IntentDisconnectFromServer::onPreconditionNotSatisfied()
{
connect(remoteClient, &RemoteClient::statusChanged, this, &IntentDisconnectFromServer::onStatusChanged);
remoteClient->disconnectFromServer();
}
void IntentDisconnectFromServer::onStatusChanged(ClientStatus status)
{
if (status == ClientStatus::StatusDisconnected) {
emit finished();
}
}