mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-06 01:53:25 -08:00
[Client+Server] Auto deck sync with change polling
This commit is contained in:
parent
829d378640
commit
477605d1e0
18 changed files with 448 additions and 18 deletions
|
|
@ -4,7 +4,6 @@
|
|||
#include "../../deck_loader/deck_loader.h"
|
||||
#include "../../deck_sync/deck_sync_conflict.h"
|
||||
#include "../../deck_sync/deck_sync_manager.h"
|
||||
#include "../../deck_sync/deck_sync_profile.h"
|
||||
#include "../../pixel_map_generator.h"
|
||||
#include "../cards/additional_info/deck_color_identity.h"
|
||||
#include "../deck_share/deck_share_utils.h"
|
||||
|
|
@ -262,8 +261,14 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor,
|
|||
syncManager = new DeckSyncManager(
|
||||
client, [](const DeckList &deck) { return getDeckColorIdentity(deck, CardDatabaseManager::query()); }, this);
|
||||
syncManager->setConflictDefault(SettingsCache::instance().deckSync().getConflictDefault());
|
||||
syncManager->setAutoSyncEnabled(SettingsCache::instance().deckSync().getAutoSync());
|
||||
syncManager->setSyncIntervalMinutes(SettingsCache::instance().deckSync().getSyncIntervalMinutes());
|
||||
connect(&SettingsCache::instance().deckSync(), &DeckSyncSettings::conflictDefaultChanged, syncManager,
|
||||
&DeckSyncManager::setConflictDefault);
|
||||
connect(&SettingsCache::instance().deckSync(), &DeckSyncSettings::autoSyncChanged, syncManager,
|
||||
&DeckSyncManager::setAutoSyncEnabled);
|
||||
connect(&SettingsCache::instance().deckSync(), &DeckSyncSettings::syncIntervalMinutesChanged, syncManager,
|
||||
&DeckSyncManager::setSyncIntervalMinutes);
|
||||
connect(syncManager, &DeckSyncManager::statusMessage, this, &TabDeckStorage::onSyncStatusMessage);
|
||||
connect(syncManager, &DeckSyncManager::syncFinished, this, &TabDeckStorage::onSyncFinished);
|
||||
connect(syncManager, &DeckSyncManager::firstSyncDetected, this, &TabDeckStorage::onFirstSyncDetected);
|
||||
|
|
@ -271,6 +276,7 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor,
|
|||
if (currentUserInfo != nullptr) {
|
||||
syncUsername = QString::fromStdString(currentUserInfo->name());
|
||||
}
|
||||
syncManager->setServerIdentity(client->serverName(), client->serverPort(), syncUsername);
|
||||
|
||||
retranslateUi();
|
||||
|
||||
|
|
@ -330,6 +336,7 @@ QString TabDeckStorage::getTargetPath() const
|
|||
void TabDeckStorage::handleConnected(const ServerInfo_User &userInfo)
|
||||
{
|
||||
syncUsername = QString::fromStdString(userInfo.name());
|
||||
syncManager->setServerIdentity(client->serverName(), client->serverPort(), syncUsername);
|
||||
setRemoteEnabled(userInfo.user_level() & ServerInfo_User::IsRegistered);
|
||||
}
|
||||
|
||||
|
|
@ -561,8 +568,6 @@ void TabDeckStorage::actOpenDecksFolder()
|
|||
|
||||
void TabDeckStorage::actSyncNow()
|
||||
{
|
||||
DeckSyncProfile profile(client->serverName(), client->serverPort(), syncUsername);
|
||||
syncManager->setProfile(profile);
|
||||
syncManager->setDeckPath(SettingsCache::instance().paths().getDeckPath());
|
||||
aSyncNow->setEnabled(false);
|
||||
syncManager->syncNow();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue