mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-07 18:43:26 -08:00
[DeckSync] Prefer ctor params for set-once client/provider per review
This commit is contained in:
parent
d4ce4759c5
commit
0cd238d296
3 changed files with 8 additions and 4 deletions
|
|
@ -42,6 +42,11 @@ 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)
|
void DeckSyncManager::setClient(AbstractClient *_client)
|
||||||
{
|
{
|
||||||
client = _client;
|
client = _client;
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit DeckSyncManager(QObject *parent = nullptr);
|
explicit DeckSyncManager(QObject *parent = nullptr);
|
||||||
|
DeckSyncManager(AbstractClient *client, ColorIdentityProvider provider, QObject *parent = nullptr);
|
||||||
|
|
||||||
void setClient(AbstractClient *_client);
|
void setClient(AbstractClient *_client);
|
||||||
void setProfile(const DeckSyncProfile &_profile);
|
void setProfile(const DeckSyncProfile &_profile);
|
||||||
|
|
|
||||||
|
|
@ -254,10 +254,8 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor,
|
||||||
rightToolBar->addAction(aNewFolder);
|
rightToolBar->addAction(aNewFolder);
|
||||||
rightToolBar->addAction(aDeleteRemoteDeck);
|
rightToolBar->addAction(aDeleteRemoteDeck);
|
||||||
|
|
||||||
syncManager = new DeckSyncManager(this);
|
syncManager = new DeckSyncManager(
|
||||||
syncManager->setClient(client);
|
client, [](const DeckList &deck) { return getDeckColorIdentity(deck, CardDatabaseManager::query()); }, this);
|
||||||
syncManager->setColorIdentityProvider(
|
|
||||||
[](const DeckList &deck) { return getDeckColorIdentity(deck, CardDatabaseManager::query()); });
|
|
||||||
connect(syncManager, &DeckSyncManager::statusMessage, this, &TabDeckStorage::onSyncStatusMessage);
|
connect(syncManager, &DeckSyncManager::statusMessage, this, &TabDeckStorage::onSyncStatusMessage);
|
||||||
connect(syncManager, &DeckSyncManager::syncFinished, this, &TabDeckStorage::onSyncFinished);
|
connect(syncManager, &DeckSyncManager::syncFinished, this, &TabDeckStorage::onSyncFinished);
|
||||||
if (currentUserInfo != nullptr) {
|
if (currentUserInfo != nullptr) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue