mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-10 12:03:25 -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>
|
#include <QString>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class DeckSyncProfile
|
* @struct 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.
|
||||||
*/
|
*/
|
||||||
class DeckSyncProfile
|
struct 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,12 +37,11 @@ bool DeckSyncSidecar::load()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const QJsonObject entry = it.value().toObject();
|
const QJsonObject entry = it.value().toObject();
|
||||||
DeckSyncRecord record;
|
const DeckSyncRecord record{.guid = entry.value("guid").toString(),
|
||||||
record.guid = entry.value("guid").toString();
|
.remoteId = entry.value("remoteId").toInt(-1),
|
||||||
record.remoteId = entry.value("remoteId").toInt(-1);
|
.baseHash = entry.value("baseHash").toString(),
|
||||||
record.baseHash = entry.value("baseHash").toString();
|
.lastSyncSecs = static_cast<qint64>(entry.value("lastSync").toDouble()),
|
||||||
record.lastSyncSecs = static_cast<qint64>(entry.value("lastSync").toDouble());
|
.deleted = entry.value("deleted").toBool(false)};
|
||||||
record.deleted = entry.value("deleted").toBool(false);
|
|
||||||
recordMap.insert(it.key(), record);
|
recordMap.insert(it.key(), record);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -70,14 +70,13 @@ 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) {
|
||||||
DeckCardChange change;
|
const DeckCardChange change{.zone = key.first,
|
||||||
change.zone = key.first;
|
.cardName = key.second,
|
||||||
change.cardName = key.second;
|
.oldCount = oldCount,
|
||||||
change.oldCount = oldCount;
|
.newCount = newInfo.count,
|
||||||
change.newCount = newInfo.count;
|
.cardSetShortName = newInfo.cardSetShortName,
|
||||||
change.cardSetShortName = newInfo.cardSetShortName;
|
.cardSetNumber = newInfo.cardSetNumber,
|
||||||
change.cardSetNumber = newInfo.cardSetNumber;
|
.cardProviderId = newInfo.cardProviderId};
|
||||||
change.cardProviderId = newInfo.cardProviderId;
|
|
||||||
result.changes.append(change);
|
result.changes.append(change);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue