mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 17:43:23 -08:00
Compare commits
5 commits
fa4c5766eb
...
0c6d64c565
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c6d64c565 | ||
|
|
507a80f0b2 | ||
|
|
02ccad2374 | ||
|
|
473b255959 | ||
|
|
1e97ab086b |
3 changed files with 14 additions and 17 deletions
|
|
@ -9,16 +9,15 @@
|
|||
#include <QString>
|
||||
|
||||
/**
|
||||
* @class DeckSyncProfile
|
||||
* @struct DeckSyncProfile
|
||||
* @brief Identifies which server and login a sync sidecar belongs to.
|
||||
*
|
||||
* A local deck folder can sync against several servers. Every server login
|
||||
* gets its own profile, and every profile gets its own sidecar file, so
|
||||
* switching servers never mixes up remote deck ids.
|
||||
*/
|
||||
class DeckSyncProfile
|
||||
struct DeckSyncProfile
|
||||
{
|
||||
public:
|
||||
QString host; ///< Server hostname as entered by the user.
|
||||
int port = 0; ///< Server port.
|
||||
QString username; ///< Login name on that server.
|
||||
|
|
|
|||
|
|
@ -37,12 +37,11 @@ bool DeckSyncSidecar::load()
|
|||
continue;
|
||||
}
|
||||
const QJsonObject entry = it.value().toObject();
|
||||
DeckSyncRecord record;
|
||||
record.guid = entry.value("guid").toString();
|
||||
record.remoteId = entry.value("remoteId").toInt(-1);
|
||||
record.baseHash = entry.value("baseHash").toString();
|
||||
record.lastSyncSecs = static_cast<qint64>(entry.value("lastSync").toDouble());
|
||||
record.deleted = entry.value("deleted").toBool(false);
|
||||
const DeckSyncRecord record{.guid = entry.value("guid").toString(),
|
||||
.remoteId = entry.value("remoteId").toInt(-1),
|
||||
.baseHash = entry.value("baseHash").toString(),
|
||||
.lastSyncSecs = static_cast<qint64>(entry.value("lastSync").toDouble()),
|
||||
.deleted = entry.value("deleted").toBool(false)};
|
||||
recordMap.insert(it.key(), record);
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -70,14 +70,13 @@ DeckDiffResult diff(const DeckList &oldDeck, const DeckList &newDeck)
|
|||
const int oldCount = oldCounts.value(key, 0);
|
||||
const ZoneCardInfo newInfo = newInfos.value(key, ZoneCardInfo());
|
||||
if (oldCount != newInfo.count) {
|
||||
DeckCardChange change;
|
||||
change.zone = key.first;
|
||||
change.cardName = key.second;
|
||||
change.oldCount = oldCount;
|
||||
change.newCount = newInfo.count;
|
||||
change.cardSetShortName = newInfo.cardSetShortName;
|
||||
change.cardSetNumber = newInfo.cardSetNumber;
|
||||
change.cardProviderId = newInfo.cardProviderId;
|
||||
const DeckCardChange change{.zone = key.first,
|
||||
.cardName = key.second,
|
||||
.oldCount = oldCount,
|
||||
.newCount = newInfo.count,
|
||||
.cardSetShortName = newInfo.cardSetShortName,
|
||||
.cardSetNumber = newInfo.cardSetNumber,
|
||||
.cardProviderId = newInfo.cardProviderId};
|
||||
result.changes.append(change);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue