[DeckSync] Pass the sync summary through the signal and tidy the manager API

- Emit SyncSummary from syncFinished() instead of four positional ints, and
  build it from a single currentSummary() helper, so the counts cannot drift
  between the status message and the signal.
- Use a designated initializer for LocalFile, like the other records.
- Drop setClient() and setColorIdentityProvider(): both fields are already
  constructor parameters and the setters had no callers. setProfile() and
  setDeckPath() stay, since the tab re-reads them before every run.
- Fix the include paths in tab_deck_storage.h and the narrowing conversion of
  the tree item id, so the branch builds again.
This commit is contained in:
Lukas Brübach 2026-11-01 12:41:00 +01:00 • committed by Lukas Brübach
parent 8367deefaf
commit aa0ab333f6
4 changed files with 31 additions and 33 deletions

View file

@ -44,7 +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. */
/** @brief Outcome counts for a finished sync run, carried by syncFinished(). */
struct SyncSummary
{
int uploaded = 0;
@ -56,10 +56,8 @@ public:
explicit DeckSyncManager(QObject *parent = nullptr);
DeckSyncManager(AbstractClient *client, ColorIdentityProvider provider, QObject *parent = nullptr);
void setClient(AbstractClient *_client);
void setProfile(const DeckSyncProfile &_profile);
void setDeckPath(const QString &path);
void setColorIdentityProvider(ColorIdentityProvider provider);
[[nodiscard]] bool isSyncing() const;
public slots:
@ -68,7 +66,7 @@ public slots:
signals:
void syncStarted();
void statusMessage(const QString &message);
void syncFinished(int uploaded, int downloaded, int unchanged, int skipped, const QString &error);
void syncFinished(const SyncSummary &summary, const QString &error);
private slots:
void onListFinished(const Response &response, const CommandContainer &commandContainer);
@ -111,6 +109,7 @@ private:
void failSync(const QString &error);
void finishSync();
[[nodiscard]] SyncSummary currentSummary() const;
void collectServerFiles(const ServerInfo_DeckStorage_Folder &folder,
const QString &prefix,
QMap<QString, ServerFile> &files,