Add option to disable bumping sets to the front of the list if the deck contains cards from the set.

This commit is contained in:
Lukas Brübach 2024-11-27 23:54:19 +01:00 committed by ZeldaZach
parent 3195a5ab68
commit 34bec790c7
No known key found for this signature in database
5 changed files with 39 additions and 10 deletions

View file

@ -2,6 +2,7 @@
#include "../../../../utility/card_set_comparator.h"
#include "printing_selector_card_display_widget.h"
#include "../../../../settings/cache_settings.h"
#include <QComboBox>
#include <QDebug>
@ -306,22 +307,28 @@ void PrintingSelector::getAllSetsForCurrentCard()
{
const QList<CardInfoPerSet> sortedSets = sortSets();
const QList<CardInfoPerSet> filteredSets = filterSets(sortedSets);
const QList<CardInfoPerSet> prependedSets = prependPrintingsInDeck(filteredSets);
QList<CardInfoPerSet> setsToUse;
if (SettingsCache::instance().getBumpSetsWithCardsInDeckToTop()) {
setsToUse = prependPrintingsInDeck(filteredSets);
} else {
setsToUse = filteredSets;
}
// Defer widget creation
currentIndex = 0;
connect(timer, &QTimer::timeout, this, [=]() mutable {
for (int i = 0; i < BATCH_SIZE && currentIndex < prependedSets.size(); ++i, ++currentIndex) {
for (int i = 0; i < BATCH_SIZE && currentIndex < setsToUse.size(); ++i, ++currentIndex) {
auto *cardDisplayWidget =
new PrintingSelectorCardDisplayWidget(this, deckEditor, deckModel, deckView, cardSizeSlider,
selectedCard, prependedSets[currentIndex], currentZone);
selectedCard, setsToUse[currentIndex], currentZone);
flowWidget->addWidget(cardDisplayWidget);
cardDisplayWidget->clampSetNameToPicture();
}
// Stop timer when done
if (currentIndex >= prependedSets.size()) {
if (currentIndex >= setsToUse.size()) {
timer->stop();
}
});