Compare commits

..

No commits in common. "d3b9ac2b431f492898c6440396ced68fe009783f" and "bdb9de0e6ee2979f2a289081bbc1cd2148669c10" have entirely different histories.

4 changed files with 17 additions and 25 deletions

View file

@ -42,11 +42,6 @@ DeckSyncManager::DeckSyncManager(QObject *parent) : QObject(parent)
{
}
DeckSyncManager::DeckSyncManager(AbstractClient *_client, ColorIdentityProvider provider, QObject *parent)
: QObject(parent), client(_client), colorIdentityProvider(std::move(provider))
{
}
void DeckSyncManager::setClient(AbstractClient *_client)
{
client = _client;
@ -150,12 +145,11 @@ void DeckSyncManager::collectServerFiles(const ServerInfo_DeckStorage_Folder &fo
} else if (item.has_file()) {
const QString path = prefix.isEmpty() ? name : prefix + "/" + name;
const ServerInfo_DeckStorage_File &file = item.file();
ServerFile entry{
.id = item.id(),
.guid = QString::fromStdString(file.guid()),
.hash = QString::fromStdString(file.hash()),
.lastModifiedSecs = file.has_last_modified() ? static_cast<qint64>(file.last_modified()) : 0,
};
ServerFile entry;
entry.id = item.id();
entry.guid = QString::fromStdString(file.guid());
entry.hash = QString::fromStdString(file.hash());
entry.lastModifiedSecs = file.has_last_modified() ? static_cast<qint64>(file.last_modified()) : 0;
files.insert(path, entry);
}
}

View file

@ -44,17 +44,7 @@ public:
/** @brief Computes the color identity string uploaded alongside a deck. May be empty. */
using ColorIdentityProvider = std::function<QString(const DeckList &)>;
/** @brief Outcome counts for a finished sync run; mirrors syncFinished() parameters. */
struct SyncSummary
{
int uploaded = 0;
int downloaded = 0;
int unchanged = 0;
int skipped = 0;
};
explicit DeckSyncManager(QObject *parent = nullptr);
DeckSyncManager(AbstractClient *client, ColorIdentityProvider provider, QObject *parent = nullptr);
void setClient(AbstractClient *_client);
void setProfile(const DeckSyncProfile &_profile);

View file

@ -255,8 +255,10 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor,
rightToolBar->addAction(aNewFolder);
rightToolBar->addAction(aDeleteRemoteDeck);
syncManager = new DeckSyncManager(
client, [](const DeckList &deck) { return getDeckColorIdentity(deck, CardDatabaseManager::query()); }, this);
syncManager = new DeckSyncManager(this);
syncManager->setClient(client);
syncManager->setColorIdentityProvider(
[](const DeckList &deck) { return getDeckColorIdentity(deck, CardDatabaseManager::query()); });
connect(syncManager, &DeckSyncManager::statusMessage, this, &TabDeckStorage::onSyncStatusMessage);
connect(syncManager, &DeckSyncManager::syncFinished, this, &TabDeckStorage::onSyncFinished);
if (currentUserInfo != nullptr) {

View file

@ -8,7 +8,6 @@
#ifndef TAB_DECK_STORAGE_H
#define TAB_DECK_STORAGE_H
#include "../deck_sync/deck_sync_manager.h"
#include "../interface/widgets/server/remote/remote_decklist_tree_widget.h"
#include "tab.h"
@ -30,6 +29,7 @@ class QLabel;
class CommandContainer;
class Response;
class ShareBarWidget;
class DeckSyncManager;
class QAction;
class QModelIndex;
class TabSupervisor;
@ -64,7 +64,13 @@ private:
Finished,
Failed
};
using SyncSummary = DeckSyncManager::SyncSummary;
struct SyncSummary
{
int uploaded = 0;
int downloaded = 0;
int unchanged = 0;
int skipped = 0;
};
SyncStatusType syncStatusType = SyncStatusType::Idle;
QString syncStatusDetail;
SyncSummary lastSyncSummary;