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