From c8b419888a4a80d6cc166a333756a99adcc51105 Mon Sep 17 00:00:00 2001 From: RickyRister <42636155+RickyRister@users.noreply.github.com> Date: Sun, 7 Dec 2025 06:03:52 -0800 Subject: [PATCH] [DeckLoader] Extract LoadedDeck struct (#6406) * [DeckLoader] Extract LoadedDeck struct * update usages * Move enum to separate namespace * format * format * format --- cockatrice/CMakeLists.txt | 2 + .../src/game/deckview/deck_view_container.cpp | 2 +- .../deck_loader/deck_file_format.cpp | 9 ++++ .../interface/deck_loader/deck_file_format.h | 36 +++++++++++++++ .../src/interface/deck_loader/deck_loader.cpp | 42 +++++++----------- .../src/interface/deck_loader/deck_loader.h | 44 +++++-------------- .../src/interface/deck_loader/loaded_deck.cpp | 11 +++++ .../src/interface/deck_loader/loaded_deck.h | 39 ++++++++++++++++ .../interface/widgets/general/home_widget.cpp | 4 +- .../widgets/tabs/abstract_tab_deck_editor.cpp | 6 +-- .../widgets/tabs/tab_deck_storage.cpp | 6 +-- .../tab_deck_storage_visual.cpp | 2 +- .../deck_preview_deck_tags_display_widget.cpp | 4 +- .../deck_preview/deck_preview_widget.cpp | 10 ++--- 14 files changed, 143 insertions(+), 74 deletions(-) create mode 100644 cockatrice/src/interface/deck_loader/deck_file_format.cpp create mode 100644 cockatrice/src/interface/deck_loader/deck_file_format.h create mode 100644 cockatrice/src/interface/deck_loader/loaded_deck.cpp create mode 100644 cockatrice/src/interface/deck_loader/loaded_deck.h diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index 1dbeddc5e..f531bc2c8 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -19,7 +19,9 @@ set(cockatrice_SOURCES src/client/settings/card_counter_settings.cpp src/client/settings/shortcut_treeview.cpp src/client/settings/shortcuts_settings.cpp + src/interface/deck_loader/deck_file_format.cpp src/interface/deck_loader/deck_loader.cpp + src/interface/deck_loader/loaded_deck.cpp src/interface/widgets/dialogs/dlg_connect.cpp src/interface/widgets/dialogs/dlg_convert_deck_to_cod_format.cpp src/interface/widgets/dialogs/dlg_create_game.cpp diff --git a/cockatrice/src/game/deckview/deck_view_container.cpp b/cockatrice/src/game/deckview/deck_view_container.cpp index cf6ab00b8..5d4a07bdf 100644 --- a/cockatrice/src/game/deckview/deck_view_container.cpp +++ b/cockatrice/src/game/deckview/deck_view_container.cpp @@ -259,7 +259,7 @@ void DeckViewContainer::loadLocalDeck() void DeckViewContainer::loadDeckFromFile(const QString &filePath) { - DeckLoader::FileFormat fmt = DeckLoader::getFormatFromName(filePath); + DeckFileFormat::Format fmt = DeckFileFormat::getFormatFromName(filePath); DeckLoader deck(this); bool success = deck.loadFromFile(filePath, fmt, true); diff --git a/cockatrice/src/interface/deck_loader/deck_file_format.cpp b/cockatrice/src/interface/deck_loader/deck_file_format.cpp new file mode 100644 index 000000000..3c88cde4e --- /dev/null +++ b/cockatrice/src/interface/deck_loader/deck_file_format.cpp @@ -0,0 +1,9 @@ +#include "deck_file_format.h" + +DeckFileFormat::Format DeckFileFormat::getFormatFromName(const QString &fileName) +{ + if (fileName.endsWith(".cod", Qt::CaseInsensitive)) { + return Cockatrice; + } + return PlainText; +} \ No newline at end of file diff --git a/cockatrice/src/interface/deck_loader/deck_file_format.h b/cockatrice/src/interface/deck_loader/deck_file_format.h new file mode 100644 index 000000000..995de32c0 --- /dev/null +++ b/cockatrice/src/interface/deck_loader/deck_file_format.h @@ -0,0 +1,36 @@ +#ifndef COCKATRICE_DECK_FILE_FORMAT_H +#define COCKATRICE_DECK_FILE_FORMAT_H +#include + +namespace DeckFileFormat +{ + +/** + * The deck file formats that Cockatrice supports. + */ +enum Format +{ + /** + * Plaintext deck files, a format that is intended to be widely supported among different programs. + * This format does not support Cockatrice specific features such as banner cards or tags. + */ + PlainText, + + /** + * This is cockatrice's native deck file format, and supports deck metadata such as banner cards and tags. + * Stored as .cod files. + */ + Cockatrice +}; + +/** + * Determines what deck file format the given filename corresponds to. + * + * @param fileName The filename + * @return The deck format + */ +Format getFormatFromName(const QString &fileName); + +} // namespace DeckFileFormat + +#endif // COCKATRICE_DECK_FILE_FORMAT_H diff --git a/cockatrice/src/interface/deck_loader/deck_loader.cpp b/cockatrice/src/interface/deck_loader/deck_loader.cpp index eea906a97..e3d1ce965 100644 --- a/cockatrice/src/interface/deck_loader/deck_loader.cpp +++ b/cockatrice/src/interface/deck_loader/deck_loader.cpp @@ -33,7 +33,7 @@ DeckLoader::DeckLoader(QObject *parent, DeckList *_deckList) : QObject(parent), { } -bool DeckLoader::loadFromFile(const QString &fileName, FileFormat fmt, bool userRequest) +bool DeckLoader::loadFromFile(const QString &fileName, DeckFileFormat::Format fmt, bool userRequest) { QFile file(fileName); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { @@ -42,17 +42,17 @@ bool DeckLoader::loadFromFile(const QString &fileName, FileFormat fmt, bool user bool result = false; switch (fmt) { - case PlainTextFormat: + case DeckFileFormat::PlainText: result = deckList->loadFromFile_Plain(&file); break; - case CockatriceFormat: { + case DeckFileFormat::Cockatrice: { result = deckList->loadFromFile_Native(&file); qCInfo(DeckLoaderLog) << "Loaded from" << fileName << "-" << result; if (!result) { qCInfo(DeckLoaderLog) << "Retrying as plain format"; file.seek(0); result = deckList->loadFromFile_Plain(&file); - fmt = PlainTextFormat; + fmt = DeckFileFormat::PlainText; } break; } @@ -77,7 +77,7 @@ bool DeckLoader::loadFromFile(const QString &fileName, FileFormat fmt, bool user return result; } -bool DeckLoader::loadFromFileAsync(const QString &fileName, FileFormat fmt, bool userRequest) +bool DeckLoader::loadFromFileAsync(const QString &fileName, DeckFileFormat::Format fmt, bool userRequest) { auto *watcher = new QFutureWatcher(this); @@ -106,9 +106,9 @@ bool DeckLoader::loadFromFileAsync(const QString &fileName, FileFormat fmt, bool } switch (fmt) { - case PlainTextFormat: + case DeckFileFormat::PlainText: return deckList->loadFromFile_Plain(&file); - case CockatriceFormat: { + case DeckFileFormat::Cockatrice: { bool result = false; result = deckList->loadFromFile_Native(&file); if (!result) { @@ -140,7 +140,7 @@ bool DeckLoader::loadFromRemote(const QString &nativeString, int remoteDeckId) return result; } -bool DeckLoader::saveToFile(const QString &fileName, FileFormat fmt) +bool DeckLoader::saveToFile(const QString &fileName, DeckFileFormat::Format fmt) { QFile file(fileName); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { @@ -149,10 +149,10 @@ bool DeckLoader::saveToFile(const QString &fileName, FileFormat fmt) bool result = false; switch (fmt) { - case PlainTextFormat: + case DeckFileFormat::PlainText: result = deckList->saveToFile_Plain(&file); break; - case CockatriceFormat: + case DeckFileFormat::Cockatrice: result = deckList->saveToFile_Native(&file); qCInfo(DeckLoaderLog) << "Saving to " << fileName << "-" << result; break; @@ -172,7 +172,7 @@ bool DeckLoader::saveToFile(const QString &fileName, FileFormat fmt) return result; } -bool DeckLoader::updateLastLoadedTimestamp(const QString &fileName, FileFormat fmt) +bool DeckLoader::updateLastLoadedTimestamp(const QString &fileName, DeckFileFormat::Format fmt) { QFileInfo fileInfo(fileName); if (!fileInfo.exists()) { @@ -193,10 +193,10 @@ bool DeckLoader::updateLastLoadedTimestamp(const QString &fileName, FileFormat f // Perform file modifications switch (fmt) { - case PlainTextFormat: + case DeckFileFormat::PlainText: result = deckList->saveToFile_Plain(&file); break; - case CockatriceFormat: + case DeckFileFormat::Cockatrice: deckList->setLastLoadedTimestamp(QDateTime::currentDateTime().toString()); result = deckList->saveToFile_Native(&file); break; @@ -414,14 +414,6 @@ void DeckLoader::clearSetNamesAndNumbers(const DeckList *deckList) deckList->forEachCard(clearSetNameAndNumber); } -DeckLoader::FileFormat DeckLoader::getFormatFromName(const QString &fileName) -{ - if (fileName.endsWith(".cod", Qt::CaseInsensitive)) { - return CockatriceFormat; - } - return PlainTextFormat; -} - void DeckLoader::saveToClipboard(const DeckList *deckList, bool addComments, bool addSetNameAndNumber) { QString buffer; @@ -564,12 +556,12 @@ bool DeckLoader::convertToCockatriceFormat(QString fileName) bool result = false; // Perform file modifications based on the detected format - switch (getFormatFromName(fileName)) { - case PlainTextFormat: + switch (DeckFileFormat::getFormatFromName(fileName)) { + case DeckFileFormat::PlainText: // Save in Cockatrice's native format result = deckList->saveToFile_Native(&file); break; - case CockatriceFormat: + case DeckFileFormat::Cockatrice: qCInfo(DeckLoaderLog) << "File is already in Cockatrice format. No conversion needed."; result = true; break; @@ -590,7 +582,7 @@ bool DeckLoader::convertToCockatriceFormat(QString fileName) } lastLoadInfo = { .fileName = newFileName, - .fileFormat = CockatriceFormat, + .fileFormat = DeckFileFormat::Cockatrice, }; } diff --git a/cockatrice/src/interface/deck_loader/deck_loader.h b/cockatrice/src/interface/deck_loader/deck_loader.h index 00136e6bb..d356f255d 100644 --- a/cockatrice/src/interface/deck_loader/deck_loader.h +++ b/cockatrice/src/interface/deck_loader/deck_loader.h @@ -7,14 +7,16 @@ #ifndef DECK_LOADER_H #define DECK_LOADER_H +#include "loaded_deck.h" + #include #include #include #include -inline Q_LOGGING_CATEGORY(DeckLoaderLog, "deck_loader") +inline Q_LOGGING_CATEGORY(DeckLoaderLog, "deck_loader"); - class DeckLoader : public QObject +class DeckLoader : public QObject { Q_OBJECT signals: @@ -22,27 +24,6 @@ signals: void loadFinished(bool success); public: - enum FileFormat - { - PlainTextFormat, - CockatriceFormat - }; - - /** - * @brief Information about where the deck was loaded from. - * - * For local decks, the remoteDeckId field will always be -1. - * For remote decks, fileName will be empty and fileFormat will always be CockatriceFormat - */ - struct LoadInfo - { - static constexpr int NON_REMOTE_ID = -1; - - QString fileName = ""; - FileFormat fileFormat = CockatriceFormat; - int remoteDeckId = NON_REMOTE_ID; - }; - /** * Supported file extensions for decklist files */ @@ -61,7 +42,7 @@ public: private: DeckList *deckList; - LoadInfo lastLoadInfo; + LoadedDeck::LoadInfo lastLoadInfo; public: DeckLoader(QObject *parent); @@ -69,29 +50,28 @@ public: DeckLoader(const DeckLoader &) = delete; DeckLoader &operator=(const DeckLoader &) = delete; - const LoadInfo &getLastLoadInfo() const + const LoadedDeck::LoadInfo &getLastLoadInfo() const { return lastLoadInfo; } - void setLastLoadInfo(const LoadInfo &info) + void setLastLoadInfo(const LoadedDeck::LoadInfo &info) { lastLoadInfo = info; } [[nodiscard]] bool hasNotBeenLoaded() const { - return lastLoadInfo.fileName.isEmpty() && lastLoadInfo.remoteDeckId == LoadInfo::NON_REMOTE_ID; + return lastLoadInfo.isEmpty(); } static void clearSetNamesAndNumbers(const DeckList *deckList); - static FileFormat getFormatFromName(const QString &fileName); - bool loadFromFile(const QString &fileName, FileFormat fmt, bool userRequest = false); - bool loadFromFileAsync(const QString &fileName, FileFormat fmt, bool userRequest); + bool loadFromFile(const QString &fileName, DeckFileFormat::Format fmt, bool userRequest = false); + bool loadFromFileAsync(const QString &fileName, DeckFileFormat::Format fmt, bool userRequest); bool loadFromRemote(const QString &nativeString, int remoteDeckId); - bool saveToFile(const QString &fileName, FileFormat fmt); - bool updateLastLoadedTimestamp(const QString &fileName, FileFormat fmt); + bool saveToFile(const QString &fileName, DeckFileFormat::Format fmt); + bool updateLastLoadedTimestamp(const QString &fileName, DeckFileFormat::Format fmt); static QString exportDeckToDecklist(const DeckList *deckList, DecklistWebsite website); diff --git a/cockatrice/src/interface/deck_loader/loaded_deck.cpp b/cockatrice/src/interface/deck_loader/loaded_deck.cpp new file mode 100644 index 000000000..633545718 --- /dev/null +++ b/cockatrice/src/interface/deck_loader/loaded_deck.cpp @@ -0,0 +1,11 @@ +#include "loaded_deck.h" + +bool LoadedDeck::LoadInfo::isEmpty() const +{ + return fileName.isEmpty() && remoteDeckId == NON_REMOTE_ID; +} + +bool LoadedDeck::isEmpty() const +{ + return deckList.isEmpty() && lastLoadInfo.isEmpty(); +} \ No newline at end of file diff --git a/cockatrice/src/interface/deck_loader/loaded_deck.h b/cockatrice/src/interface/deck_loader/loaded_deck.h new file mode 100644 index 000000000..90f3853cf --- /dev/null +++ b/cockatrice/src/interface/deck_loader/loaded_deck.h @@ -0,0 +1,39 @@ +#ifndef COCKATRICE_LOADED_DECK_H +#define COCKATRICE_LOADED_DECK_H + +#include "deck_file_format.h" +#include "libcockatrice/deck_list/deck_list.h" + +#include + +/** + * @brief Represents a deck that was loaded from somewhere. + * Contains the DeckList itself, as well as info about where it was loaded from. + */ +struct LoadedDeck +{ + + /** + * @brief Information about where the deck was loaded from. + * + * For local decks, the remoteDeckId field will always be -1. + * For remote decks, fileName will be empty and fileFormat will always be CockatriceFormat + */ + struct LoadInfo + { + static constexpr int NON_REMOTE_ID = -1; + + QString fileName = ""; + DeckFileFormat::Format fileFormat = DeckFileFormat::Cockatrice; + int remoteDeckId = NON_REMOTE_ID; + + bool isEmpty() const; + }; + + DeckList deckList; ///< The decklist itself + LoadInfo lastLoadInfo; ///< info about where the deck was loaded from + + bool isEmpty() const; +}; + +#endif // COCKATRICE_LOADED_DECK_H diff --git a/cockatrice/src/interface/widgets/general/home_widget.cpp b/cockatrice/src/interface/widgets/general/home_widget.cpp index 88eec230c..7aa6b40c7 100644 --- a/cockatrice/src/interface/widgets/general/home_widget.cpp +++ b/cockatrice/src/interface/widgets/general/home_widget.cpp @@ -23,7 +23,7 @@ HomeWidget::HomeWidget(QWidget *parent, TabSupervisor *_tabSupervisor) backgroundSourceDeck = new DeckLoader(this); backgroundSourceDeck->loadFromFile(SettingsCache::instance().getDeckPath() + "background.cod", - DeckLoader::CockatriceFormat, false); + DeckFileFormat::Cockatrice, false); gradientColors = extractDominantColors(background); @@ -73,7 +73,7 @@ void HomeWidget::initializeBackgroundFromSource() break; case BackgroundSources::DeckFileArt: backgroundSourceDeck->loadFromFile(SettingsCache::instance().getDeckPath() + "background.cod", - DeckLoader::CockatriceFormat, false); + DeckFileFormat::Cockatrice, false); cardChangeTimer->start(SettingsCache::instance().getHomeTabBackgroundShuffleFrequency() * 1000); break; } diff --git a/cockatrice/src/interface/widgets/tabs/abstract_tab_deck_editor.cpp b/cockatrice/src/interface/widgets/tabs/abstract_tab_deck_editor.cpp index a03b79e3f..55fa0b95c 100644 --- a/cockatrice/src/interface/widgets/tabs/abstract_tab_deck_editor.cpp +++ b/cockatrice/src/interface/widgets/tabs/abstract_tab_deck_editor.cpp @@ -380,7 +380,7 @@ void AbstractTabDeckEditor::actOpenRecent(const QString &fileName) */ void AbstractTabDeckEditor::openDeckFromFile(const QString &fileName, DeckOpenLocation deckOpenLocation) { - DeckLoader::FileFormat fmt = DeckLoader::getFormatFromName(fileName); + DeckFileFormat::Format fmt = DeckFileFormat::getFormatFromName(fileName); auto *l = new DeckLoader(this); if (l->loadFromFile(fileName, fmt, true)) { @@ -406,7 +406,7 @@ void AbstractTabDeckEditor::openDeckFromFile(const QString &fileName, DeckOpenLo bool AbstractTabDeckEditor::actSaveDeck() { DeckLoader *const deck = getDeckLoader(); - if (deck->getLastLoadInfo().remoteDeckId != DeckLoader::LoadInfo::NON_REMOTE_ID) { + if (deck->getLastLoadInfo().remoteDeckId != LoadedDeck::LoadInfo::NON_REMOTE_ID) { QString deckString = deck->getDeckList()->writeToString_Native(); if (deckString.length() > MAX_FILE_LENGTH) { QMessageBox::critical(this, tr("Error"), tr("Could not save remote deck")); @@ -452,7 +452,7 @@ bool AbstractTabDeckEditor::actSaveDeckAs() return false; QString fileName = dialog.selectedFiles().at(0); - DeckLoader::FileFormat fmt = DeckLoader::getFormatFromName(fileName); + DeckFileFormat::Format fmt = DeckFileFormat::getFormatFromName(fileName); if (!getDeckLoader()->saveToFile(fileName, fmt)) { QMessageBox::critical( diff --git a/cockatrice/src/interface/widgets/tabs/tab_deck_storage.cpp b/cockatrice/src/interface/widgets/tabs/tab_deck_storage.cpp index 854990e19..a54c16258 100644 --- a/cockatrice/src/interface/widgets/tabs/tab_deck_storage.cpp +++ b/cockatrice/src/interface/widgets/tabs/tab_deck_storage.cpp @@ -242,7 +242,7 @@ void TabDeckStorage::actOpenLocalDeck() QString filePath = localDirModel->filePath(curLeft); auto deckLoader = new DeckLoader(this); - if (!deckLoader->loadFromFile(filePath, DeckLoader::CockatriceFormat, true)) + if (!deckLoader->loadFromFile(filePath, DeckFileFormat::Cockatrice, true)) continue; emit openDeckEditor(deckLoader); @@ -308,7 +308,7 @@ void TabDeckStorage::uploadDeck(const QString &filePath, const QString &targetPa QFileInfo deckFileInfo(deckFile); DeckLoader deck(this); - if (!deck.loadFromFile(filePath, DeckLoader::CockatriceFormat)) { + if (!deck.loadFromFile(filePath, DeckFileFormat::Cockatrice)) { QMessageBox::critical(this, tr("Error"), tr("Invalid deck file")); return; } @@ -493,7 +493,7 @@ void TabDeckStorage::downloadFinished(const Response &r, QString filePath = extraData.toString(); DeckLoader deck(this, new DeckList(QString::fromStdString(resp.deck()))); - deck.saveToFile(filePath, DeckLoader::CockatriceFormat); + deck.saveToFile(filePath, DeckFileFormat::Cockatrice); } void TabDeckStorage::actNewFolder() diff --git a/cockatrice/src/interface/widgets/tabs/visual_deck_storage/tab_deck_storage_visual.cpp b/cockatrice/src/interface/widgets/tabs/visual_deck_storage/tab_deck_storage_visual.cpp index 975c011dc..69c80bb35 100644 --- a/cockatrice/src/interface/widgets/tabs/visual_deck_storage/tab_deck_storage_visual.cpp +++ b/cockatrice/src/interface/widgets/tabs/visual_deck_storage/tab_deck_storage_visual.cpp @@ -25,7 +25,7 @@ TabDeckStorageVisual::TabDeckStorageVisual(TabSupervisor *_tabSupervisor) void TabDeckStorageVisual::actOpenLocalDeck(const QString &filePath) { auto deckLoader = new DeckLoader(this); - if (!deckLoader->loadFromFile(filePath, DeckLoader::getFormatFromName(filePath), true)) { + if (!deckLoader->loadFromFile(filePath, DeckFileFormat::getFormatFromName(filePath), true)) { QMessageBox::critical(this, tr("Error"), tr("Could not open deck at %1").arg(filePath)); return; } diff --git a/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_deck_tags_display_widget.cpp b/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_deck_tags_display_widget.cpp index fce0916bb..d3858a135 100644 --- a/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_deck_tags_display_widget.cpp +++ b/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_deck_tags_display_widget.cpp @@ -79,7 +79,7 @@ static QStringList findAllKnownTags() QStringList knownTags; auto loader = DeckLoader(nullptr); for (const QString &file : allFiles) { - loader.loadFromFile(file, DeckLoader::getFormatFromName(file), false); + loader.loadFromFile(file, DeckFileFormat::getFormatFromName(file), false); QStringList tags = loader.getDeckList()->getTags(); knownTags.append(tags); knownTags.removeDuplicates(); @@ -136,7 +136,7 @@ static void convertFileToCockatriceFormat(DeckPreviewWidget *deckPreviewWidget) */ bool DeckPreviewDeckTagsDisplayWidget::promptFileConversionIfRequired(DeckPreviewWidget *deckPreviewWidget) { - if (DeckLoader::getFormatFromName(deckPreviewWidget->filePath) == DeckLoader::CockatriceFormat) { + if (DeckFileFormat::getFormatFromName(deckPreviewWidget->filePath) == DeckFileFormat::Cockatrice) { return true; } diff --git a/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_widget.cpp b/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_widget.cpp index bf915bbea..1db0feb63 100644 --- a/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_widget.cpp +++ b/cockatrice/src/interface/widgets/visual_deck_storage/deck_preview/deck_preview_widget.cpp @@ -32,7 +32,7 @@ DeckPreviewWidget::DeckPreviewWidget(QWidget *_parent, many deck loads have finished already and if we've loaded all decks and THEN load all the tags at once. */ connect(deckLoader, &DeckLoader::loadFinished, visualDeckStorageWidget->tagFilterWidget, &VisualDeckStorageTagFilterWidget::refreshTags); - deckLoader->loadFromFileAsync(filePath, DeckLoader::getFormatFromName(filePath), false); + deckLoader->loadFromFileAsync(filePath, DeckFileFormat::getFormatFromName(filePath), false); bannerCardDisplayWidget = new DeckPreviewCardPictureWidget(this, false, visualDeckStorageWidget->deckPreviewSelectionAnimationEnabled); @@ -288,7 +288,7 @@ void DeckPreviewWidget::setBannerCard(int /* changedIndex */) auto [name, id] = bannerCardComboBox->currentData().value>(); CardRef cardRef = {name, id}; deckLoader->getDeckList()->setBannerCard(cardRef); - deckLoader->saveToFile(filePath, DeckLoader::getFormatFromName(filePath)); + deckLoader->saveToFile(filePath, DeckFileFormat::getFormatFromName(filePath)); bannerCardDisplayWidget->setCard(CardDatabaseManager::query()->getCard(cardRef)); } @@ -311,7 +311,7 @@ void DeckPreviewWidget::imageDoubleClickedEvent(QMouseEvent *event, DeckPreviewC void DeckPreviewWidget::setTags(const QStringList &tags) { deckLoader->getDeckList()->setTags(tags); - deckLoader->saveToFile(filePath, DeckLoader::CockatriceFormat); + deckLoader->saveToFile(filePath, DeckFileFormat::Cockatrice); } QMenu *DeckPreviewWidget::createRightClickMenu() @@ -386,7 +386,7 @@ void DeckPreviewWidget::actRenameDeck() // write change deckLoader->getDeckList()->setName(newName); - deckLoader->saveToFile(filePath, DeckLoader::getFormatFromName(filePath)); + deckLoader->saveToFile(filePath, DeckFileFormat::getFormatFromName(filePath)); // update VDS refreshBannerCardText(); @@ -416,7 +416,7 @@ void DeckPreviewWidget::actRenameFile() return; } - DeckLoader::LoadInfo lastLoadInfo = deckLoader->getLastLoadInfo(); + LoadedDeck::LoadInfo lastLoadInfo = deckLoader->getLastLoadInfo(); lastLoadInfo.fileName = newFilePath; deckLoader->setLastLoadInfo(lastLoadInfo);