[DeckSync] Address tombstone review nits: log category and designated initializer

This commit is contained in:
Lukas Brübach 2026-11-06 09:15:28 +01:00
parent a94db4171b
commit b9270ecbeb

View file

@ -8,6 +8,7 @@
#include <QDirIterator> #include <QDirIterator>
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>
#include <QLoggingCategory>
#include <QSaveFile> #include <QSaveFile>
#include <QStringList> #include <QStringList>
#include <QUuid> #include <QUuid>
@ -27,6 +28,8 @@
#include <libcockatrice/protocol/pending_command.h> #include <libcockatrice/protocol/pending_command.h>
#include <libcockatrice/utility/string_limits.h> #include <libcockatrice/utility/string_limits.h>
inline Q_LOGGING_CATEGORY(DeckSyncLog, "deck_sync");
namespace namespace
{ {
constexpr const char *SYNC_META_DIR = ".sync"; constexpr const char *SYNC_META_DIR = ".sync";
@ -492,11 +495,11 @@ void DeckSyncManager::onUploadFinished(const Response &response,
if (response.response_code() == Response::RespNameNotFound && deckId != -1) { if (response.response_code() == Response::RespNameNotFound && deckId != -1) {
// The server row is gone (purged tombstone or removed elsewhere): // The server row is gone (purged tombstone or removed elsewhere):
// upload the deck as new instead of updating a dead id. // upload the deck as new instead of updating a dead id.
UploadOp retry; const UploadOp retry{.relativePath = relativePath,
retry.relativePath = relativePath; .serverPath = context.value("serverPath").toString(),
retry.serverPath = context.value("serverPath").toString(); .serverDir = {},
retry.deckId = -1; .deckId = -1,
retry.guid = context.value("guid").toString(); .guid = context.value("guid").toString()};
pendingUploads.prepend(retry); pendingUploads.prepend(retry);
processNext(); processNext();
return; return;
@ -693,7 +696,7 @@ void DeckSyncManager::snapshotLocalFile(const QString &relativePath, const QStri
} }
snapshot.write(source.readAll()); snapshot.write(source.readAll());
if (!snapshot.commit()) { if (!snapshot.commit()) {
qWarning() << "DeckSync: could not write the base snapshot for" << relativePath; qCWarning(DeckSyncLog) << "DeckSync: could not write the base snapshot for" << relativePath;
} }
} }