mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-08 19:13:25 -08:00
[DeckSync] Move the client signal handlers out of the constructor lambdas
This commit is contained in:
parent
63f57fae7d
commit
f52431cf96
2 changed files with 30 additions and 20 deletions
|
|
@ -108,25 +108,32 @@ DeckSyncManager::DeckSyncManager(AbstractClient *_client, ColorIdentityProvider
|
||||||
if (client == nullptr) {
|
if (client == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
connect(client, &AbstractClient::statusChanged, this, [this](ClientStatus status) {
|
connect(client, &AbstractClient::statusChanged, this, &DeckSyncManager::onClientStatusChanged);
|
||||||
if (status == StatusDisconnected) {
|
connect(client, &AbstractClient::userInfoChanged, this, &DeckSyncManager::onUserInfoChanged);
|
||||||
offline = true;
|
}
|
||||||
debounceTimer->stop();
|
|
||||||
// A run cannot survive the session it was started on: the in-flight
|
void DeckSyncManager::onClientStatusChanged(ClientStatus status)
|
||||||
// command comes back RespNotConnected, the remaining queue would be
|
{
|
||||||
// sent on a dead client, and a re-login as another account would
|
if (status != StatusDisconnected) {
|
||||||
// receive this profile's uploads and deletes.
|
return;
|
||||||
if (syncing) {
|
}
|
||||||
activeConflict = ActiveConflict();
|
offline = true;
|
||||||
failSync(tr("Disconnected."));
|
debounceTimer->stop();
|
||||||
}
|
// A run cannot survive the session it was started on: the in-flight
|
||||||
}
|
// command comes back RespNotConnected, the remaining queue would be
|
||||||
});
|
// sent on a dead client, and a re-login as another account would
|
||||||
connect(client, &AbstractClient::userInfoChanged, this, [this](const ServerInfo_User &userInfo) {
|
// receive this profile's uploads and deletes.
|
||||||
offline = false;
|
if (syncing) {
|
||||||
serverUsername = QString::fromStdString(userInfo.name());
|
activeConflict = ActiveConflict();
|
||||||
autoSyncSoon();
|
failSync(tr("Disconnected."));
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeckSyncManager::onUserInfoChanged(const ServerInfo_User &userInfo)
|
||||||
|
{
|
||||||
|
offline = false;
|
||||||
|
serverUsername = QString::fromStdString(userInfo.name());
|
||||||
|
autoSyncSoon();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckSyncManager::setServerIdentity(const QString &host, int port, const QString &username)
|
void DeckSyncManager::setServerIdentity(const QString &host, int port, const QString &username)
|
||||||
|
|
|
||||||
|
|
@ -17,15 +17,16 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <libcockatrice/network/client/abstract/abstract_client.h>
|
||||||
#include <libcockatrice/settings/deck_sync_settings.h>
|
#include <libcockatrice/settings/deck_sync_settings.h>
|
||||||
|
|
||||||
class AbstractClient;
|
|
||||||
class CommandContainer;
|
class CommandContainer;
|
||||||
class DeckList;
|
class DeckList;
|
||||||
class QFileSystemWatcher;
|
class QFileSystemWatcher;
|
||||||
class QTimer;
|
class QTimer;
|
||||||
class Response;
|
class Response;
|
||||||
class ServerInfo_DeckStorage_Folder;
|
class ServerInfo_DeckStorage_Folder;
|
||||||
|
class ServerInfo_User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class DeckSyncManager
|
* @class DeckSyncManager
|
||||||
|
|
@ -169,6 +170,8 @@ private:
|
||||||
[[nodiscard]] bool canAutoRun() const;
|
[[nodiscard]] bool canAutoRun() const;
|
||||||
void onDebounceTimeout();
|
void onDebounceTimeout();
|
||||||
void onWatchedPathChanged(const QString &path);
|
void onWatchedPathChanged(const QString &path);
|
||||||
|
void onClientStatusChanged(ClientStatus status);
|
||||||
|
void onUserInfoChanged(const ServerInfo_User &userInfo);
|
||||||
void refreshWatcher();
|
void refreshWatcher();
|
||||||
void refreshInterval();
|
void refreshInterval();
|
||||||
[[nodiscard]] DeckSyncProfile buildProfile() const;
|
[[nodiscard]] DeckSyncProfile buildProfile() const;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue