mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 09:05:10 -07:00
[DeckShare] Adapt deck upload to the server-derived banner and tag protocol
The server now derives the banner card and tags from the uploaded deck list itself, so Command_DeckUpload only carries the client-computed color identity. Drop the reserved banner/tag setters from the editor and storage uploads, send the color identity on remote saves, and read tags from the now-repeated ServerInfo_DeckStorage_TreeItem field.
This commit is contained in:
parent
bb23bc0aa3
commit
8aedee2b4e
3 changed files with 7 additions and 7 deletions
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "../../../client/settings/cache_settings.h"
|
||||
#include "../../../client/settings/shortcuts_settings.h"
|
||||
#include "../cards/additional_info/deck_color_identity.h"
|
||||
#include "../client/network/interfaces/deck_stats_interface.h"
|
||||
#include "../client/network/interfaces/tapped_out_interface.h"
|
||||
#include "../deck_editor/deck_state_manager.h"
|
||||
|
|
@ -324,7 +325,7 @@ bool AbstractTabDeckEditor::actSaveDeck()
|
|||
Command_DeckUpload cmd;
|
||||
cmd.set_deck_id(static_cast<google::protobuf::uint32>(loadedDeck.lastLoadInfo.remoteDeckId));
|
||||
cmd.set_deck_list(deckString.toStdString());
|
||||
cmd.set_tags(loadedDeck.deckList.getTags().join(QStringLiteral(",")).toStdString());
|
||||
cmd.set_color_identity(getDeckColorIdentity(loadedDeck.deckList, CardDatabaseManager::query()).toStdString());
|
||||
|
||||
PendingCommand *pend = AbstractClient::prepareSessionCommand(cmd);
|
||||
connect(pend, &PendingCommand::finished, this, &AbstractTabDeckEditor::saveDeckRemoteFinished);
|
||||
|
|
|
|||
|
|
@ -394,11 +394,7 @@ void TabDeckStorage::uploadDeck(const QString &filePath, const QString &targetPa
|
|||
cmd.set_path(targetPath.toStdString());
|
||||
cmd.set_deck_list(deckString.toStdString());
|
||||
|
||||
const CardRef bannerCard = deck.getBannerCard();
|
||||
cmd.set_banner_card_name(bannerCard.name.toStdString());
|
||||
cmd.set_banner_card_provider(bannerCard.providerId.toStdString());
|
||||
cmd.set_color_identity(getDeckColorIdentity(deck, CardDatabaseManager::query()).toStdString());
|
||||
cmd.set_tags(deck.getTags().join(QStringLiteral(",")).toStdString());
|
||||
|
||||
PendingCommand *pend = client->prepareSessionCommand(cmd);
|
||||
connect(pend, &PendingCommand::finished, this, &TabDeckStorage::uploadFinished);
|
||||
|
|
|
|||
|
|
@ -196,7 +196,10 @@ void RemotePublicDecksModel::addTreeItem(const ServerInfo_DeckStorage_TreeItem &
|
|||
entry.bannerCardName = QString::fromStdString(file.banner_card_name());
|
||||
entry.bannerCardProvider = QString::fromStdString(file.banner_card_provider());
|
||||
entry.colorIdentity = QString::fromStdString(file.color_identity());
|
||||
const QString tagsString = QString::fromStdString(file.tags());
|
||||
entry.tags = tagsString.split(QLatin1Char(','), Qt::SkipEmptyParts);
|
||||
QStringList tags;
|
||||
for (const auto &tag : file.tags()) {
|
||||
tags.append(QString::fromStdString(tag));
|
||||
}
|
||||
entry.tags = tags;
|
||||
decks.append(entry);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue