mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-20 01:12:15 -07:00
Refactor local batch variables to be class variables/defines.
This commit is contained in:
parent
f8ce97d598
commit
929789bcf9
2 changed files with 6 additions and 3 deletions
|
|
@ -300,11 +300,10 @@ void PrintingSelector::getAllSetsForCurrentCard()
|
|||
const QList<CardInfoPerSet> prependedSets = prependPrintingsInDeck(filteredSets);
|
||||
|
||||
// Defer widget creation
|
||||
int batchSize = 10;
|
||||
int currentIndex = 0;
|
||||
currentIndex = 0;
|
||||
QTimer *timer = new QTimer(this);
|
||||
connect(timer, &QTimer::timeout, this, [=]() mutable {
|
||||
for (int i = 0; i < batchSize && currentIndex < prependedSets.size(); ++i, ++currentIndex) {
|
||||
for (int i = 0; i < BATCH_SIZE && currentIndex < prependedSets.size(); ++i, ++currentIndex) {
|
||||
auto *cardDisplayWidget =
|
||||
new PrintingSelectorCardDisplayWidget(this, deckEditor, deckModel, deckView, cardSizeSlider,
|
||||
selectedCard, prependedSets[currentIndex], currentZone);
|
||||
|
|
@ -317,5 +316,6 @@ void PrintingSelector::getAllSetsForCurrentCard()
|
|||
timer->deleteLater();
|
||||
}
|
||||
});
|
||||
currentIndex = 0;
|
||||
timer->start(0); // Process as soon as possible
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
#define BATCH_SIZE 10
|
||||
|
||||
class TabDeckEditor;
|
||||
class PrintingSelector : public QWidget
|
||||
{
|
||||
|
|
@ -61,6 +63,7 @@ private:
|
|||
QTreeView *deckView;
|
||||
CardInfoPtr selectedCard;
|
||||
QString currentZone;
|
||||
int currentIndex = 0;
|
||||
void selectCard(int changeBy);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue