Visual deck storage v2 (#5427)

* Restore some button states (ready/sideboard locked) to sensible defaults when unloading a deck.

* Update last loaded timestamp in decklist file and then restore original last modified timestamp if a user requests a deck load.

* Add some todos.

* Loading a deck from local file dialog should swap out scenes, enable unload button.

* Lint.

* Shuffle some classes and signals around.

* More sort options, sort widgets directly.

* Banner cards should respect providerIds.

* Properly updateSortOrder on load.

* Add the color identity to the Deck Preview Widget.

* Properly set sort indices.

* Change replace visualDeckStorageWidget with deckView to be in deckSelectFinished so that it also works on remote deck load.

* Include settings for unused color identities display.

* Change opacity scaling.

* Overload for Qt.

* Lint.

* Lint.

* Include QMouseEvent

* Template because MacOs.

* Include a quick filter for color identities.

* Include a quick filter for color identities.

* Save some space.

* Refactor DeckPreviewWidgets to reside in their own folder.

* Add Deck Loader logging category.

* Introduce a tagging system.

* Add some more default tags.

* Even more default tags.

* Lint.

* Lint a comma.

* Remove extra set of braces.

* Lint some stuff.

* Refresh banner cards when tags are added.

* Lint.

* Wrestle with Qt Checkboxes.

* Lint.

* Adjust some sizes, relayout.

* Address comments.

* Lint.

* Reorder kindred types.

* Add a search bar for tags.

* Remove close button (for now) and change "Add tags ..." to "Edit tags ..."

* Retranslate window title for Deck Tag Manager Dialog.

* Style tag addition widget to be consistent.

* Lint.

* Override paintEvent.

* Override sizeHint

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2025-01-12 23:46:22 +01:00 committed by GitHub
parent 9bd024d39f
commit dd8ac14f99
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
46 changed files with 1899 additions and 153 deletions

View file

@ -145,7 +145,7 @@ DeckViewContainer::DeckViewContainer(int _playerId, TabGame *parent)
deckView->setVisible(false);
visualDeckStorageWidget = new VisualDeckStorageWidget(this);
connect(visualDeckStorageWidget, &VisualDeckStorageWidget::imageDoubleClicked, this,
connect(visualDeckStorageWidget, &VisualDeckStorageWidget::deckPreviewDoubleClicked, this,
&DeckViewContainer::replaceDeckStorageWithDeckView);
deckViewLayout = new QVBoxLayout;
@ -299,20 +299,12 @@ void TabGame::refreshShortcuts()
}
}
void DeckViewContainer::replaceDeckStorageWithDeckView(QMouseEvent *event, DeckPreviewCardPictureWidget *instance)
void DeckViewContainer::replaceDeckStorageWithDeckView(QMouseEvent *event, DeckPreviewWidget *instance)
{
Q_UNUSED(event);
QString fileName = instance->filePath;
DeckLoader::FileFormat fmt = DeckLoader::getFormatFromName(fileName);
QString deckString;
DeckLoader deck;
QString deckString = instance->deckLoader->writeToString_Native();
bool error = !deck.loadFromFile(fileName, fmt);
if (!error) {
deckString = deck.writeToString_Native();
error = deckString.length() > MAX_FILE_LENGTH;
}
if (error) {
if (deckString.length() > MAX_FILE_LENGTH) {
QMessageBox::critical(this, tr("Error"), tr("The selected file could not be loaded."));
return;
}
@ -335,6 +327,11 @@ void DeckViewContainer::unloadDeck()
visualDeckStorageWidget->setVisible(true);
deckViewLayout->update();
unloadDeckButton->setEnabled(false);
readyStartButton->setEnabled(false);
readyStartButton->setState(false);
sideboardLockButton->setEnabled(false);
sideboardLockButton->setState(false);
setReadyStart(false);
}
void DeckViewContainer::loadLocalDeck()
@ -352,7 +349,7 @@ void DeckViewContainer::loadDeckFromFile(const QString &filePath)
QString deckString;
DeckLoader deck;
bool error = !deck.loadFromFile(filePath, fmt);
bool error = !deck.loadFromFile(filePath, fmt, true);
if (!error) {
deckString = deck.writeToString_Native();
error = deckString.length() > MAX_FILE_LENGTH;
@ -390,6 +387,9 @@ void DeckViewContainer::deckSelectFinished(const Response &r)
// TODO CHANGE THIS TO BE SELECTED BY UUID
PictureLoader::cacheCardPixmaps(CardDatabaseManager::getInstance()->getCards(newDeck.getCardList()));
setDeck(newDeck);
deckView->setVisible(true);
visualDeckStorageWidget->setVisible(false);
unloadDeckButton->setEnabled(true);
}
void DeckViewContainer::readyStart()