mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-23 10:52:16 -07:00
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:
parent
3195a5ab68
commit
34bec790c7
5 changed files with 39 additions and 10 deletions
|
|
@ -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();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue