mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-21 01:42:15 -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 "../../../../utility/card_set_comparator.h"
|
||||||
#include "printing_selector_card_display_widget.h"
|
#include "printing_selector_card_display_widget.h"
|
||||||
|
#include "../../../../settings/cache_settings.h"
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
@ -306,22 +307,28 @@ void PrintingSelector::getAllSetsForCurrentCard()
|
||||||
{
|
{
|
||||||
const QList<CardInfoPerSet> sortedSets = sortSets();
|
const QList<CardInfoPerSet> sortedSets = sortSets();
|
||||||
const QList<CardInfoPerSet> filteredSets = filterSets(sortedSets);
|
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
|
// Defer widget creation
|
||||||
currentIndex = 0;
|
currentIndex = 0;
|
||||||
|
|
||||||
connect(timer, &QTimer::timeout, this, [=]() mutable {
|
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 =
|
auto *cardDisplayWidget =
|
||||||
new PrintingSelectorCardDisplayWidget(this, deckEditor, deckModel, deckView, cardSizeSlider,
|
new PrintingSelectorCardDisplayWidget(this, deckEditor, deckModel, deckView, cardSizeSlider,
|
||||||
selectedCard, prependedSets[currentIndex], currentZone);
|
selectedCard, setsToUse[currentIndex], currentZone);
|
||||||
flowWidget->addWidget(cardDisplayWidget);
|
flowWidget->addWidget(cardDisplayWidget);
|
||||||
cardDisplayWidget->clampSetNameToPicture();
|
cardDisplayWidget->clampSetNameToPicture();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop timer when done
|
// Stop timer when done
|
||||||
if (currentIndex >= prependedSets.size()) {
|
if (currentIndex >= setsToUse.size()) {
|
||||||
timer->stop();
|
timer->stop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -339,8 +339,12 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||||
connect(&displayCardNamesCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, &SettingsCache::setDisplayCardNames);
|
connect(&displayCardNamesCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, &SettingsCache::setDisplayCardNames);
|
||||||
|
|
||||||
overrideAllCardArtWithPersonalPreferenceCheckBox.setChecked(settings.getOverrideAllCardArtWithPersonalPreference());
|
overrideAllCardArtWithPersonalPreferenceCheckBox.setChecked(settings.getOverrideAllCardArtWithPersonalPreference());
|
||||||
connect(&overrideAllCardArtWithPersonalPreferenceCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &settings,
|
connect(&overrideAllCardArtWithPersonalPreferenceCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
|
||||||
SLOT(setOverrideAllCardArtWithPersonalPreference(QT_STATE_CHANGED_T)));
|
&SettingsCache::setOverrideAllCardArtWithPersonalPreference);
|
||||||
|
|
||||||
|
bumpSetsWithCardsInDeckToTopCheckBox.setChecked(settings.getBumpSetsWithCardsInDeckToTop());
|
||||||
|
connect(&bumpSetsWithCardsInDeckToTopCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
|
||||||
|
&SettingsCache::setBumpSetsWithCardsInDeckToTop);
|
||||||
|
|
||||||
cardScalingCheckBox.setChecked(settings.getScaleCards());
|
cardScalingCheckBox.setChecked(settings.getScaleCards());
|
||||||
connect(&cardScalingCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, &SettingsCache::setCardScaling);
|
connect(&cardScalingCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, &SettingsCache::setCardScaling);
|
||||||
|
|
@ -359,10 +363,11 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||||
cardsGrid->addWidget(&displayCardNamesCheckBox, 0, 0, 1, 2);
|
cardsGrid->addWidget(&displayCardNamesCheckBox, 0, 0, 1, 2);
|
||||||
cardsGrid->addWidget(&cardScalingCheckBox, 1, 0, 1, 2);
|
cardsGrid->addWidget(&cardScalingCheckBox, 1, 0, 1, 2);
|
||||||
cardsGrid->addWidget(&overrideAllCardArtWithPersonalPreferenceCheckBox, 2, 0, 1, 2);
|
cardsGrid->addWidget(&overrideAllCardArtWithPersonalPreferenceCheckBox, 2, 0, 1, 2);
|
||||||
cardsGrid->addWidget(&verticalCardOverlapPercentLabel, 2, 0, 1, 1);
|
cardsGrid->addWidget(&bumpSetsWithCardsInDeckToTopCheckBox, 3, 0, 1, 2);
|
||||||
cardsGrid->addWidget(&verticalCardOverlapPercentBox, 2, 1, 1, 1);
|
cardsGrid->addWidget(&verticalCardOverlapPercentLabel, 4, 0, 1, 1);
|
||||||
cardsGrid->addWidget(&cardViewInitialRowsMaxLabel, 3, 0);
|
cardsGrid->addWidget(&verticalCardOverlapPercentBox, 4, 1, 1, 1);
|
||||||
cardsGrid->addWidget(&cardViewInitialRowsMaxBox, 3, 1);
|
cardsGrid->addWidget(&cardViewInitialRowsMaxLabel, 5, 0);
|
||||||
|
cardsGrid->addWidget(&cardViewInitialRowsMaxBox, 5, 1);
|
||||||
|
|
||||||
cardsGroupBox = new QGroupBox;
|
cardsGroupBox = new QGroupBox;
|
||||||
cardsGroupBox->setLayout(cardsGrid);
|
cardsGroupBox->setLayout(cardsGrid);
|
||||||
|
|
@ -460,6 +465,7 @@ void AppearanceSettingsPage::retranslateUi()
|
||||||
overrideAllCardArtWithPersonalPreferenceCheckBox.setText(
|
overrideAllCardArtWithPersonalPreferenceCheckBox.setText(
|
||||||
tr("Override all card art with personal set preference (Pre-ProviderID change behavior) [Requires Client "
|
tr("Override all card art with personal set preference (Pre-ProviderID change behavior) [Requires Client "
|
||||||
"restart]"));
|
"restart]"));
|
||||||
|
bumpSetsWithCardsInDeckToTopCheckBox.setText(tr("Bump sets that the deck contains cards from to the top in the printing selector"));
|
||||||
cardScalingCheckBox.setText(tr("Scale cards on mouse over"));
|
cardScalingCheckBox.setText(tr("Scale cards on mouse over"));
|
||||||
verticalCardOverlapPercentLabel.setText(
|
verticalCardOverlapPercentLabel.setText(
|
||||||
tr("Minimum overlap percentage of cards on the stack and in vertical hand"));
|
tr("Minimum overlap percentage of cards on the stack and in vertical hand"));
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,7 @@ private:
|
||||||
QCheckBox showShortcutsCheckBox;
|
QCheckBox showShortcutsCheckBox;
|
||||||
QCheckBox displayCardNamesCheckBox;
|
QCheckBox displayCardNamesCheckBox;
|
||||||
QCheckBox overrideAllCardArtWithPersonalPreferenceCheckBox;
|
QCheckBox overrideAllCardArtWithPersonalPreferenceCheckBox;
|
||||||
|
QCheckBox bumpSetsWithCardsInDeckToTopCheckBox;
|
||||||
QCheckBox cardScalingCheckBox;
|
QCheckBox cardScalingCheckBox;
|
||||||
QLabel verticalCardOverlapPercentLabel;
|
QLabel verticalCardOverlapPercentLabel;
|
||||||
QSpinBox verticalCardOverlapPercentBox;
|
QSpinBox verticalCardOverlapPercentBox;
|
||||||
|
|
|
||||||
|
|
@ -244,6 +244,7 @@ SettingsCache::SettingsCache()
|
||||||
displayCardNames = settings->value("cards/displaycardnames", true).toBool();
|
displayCardNames = settings->value("cards/displaycardnames", true).toBool();
|
||||||
overrideAllCardArtWithPersonalPreference =
|
overrideAllCardArtWithPersonalPreference =
|
||||||
settings->value("cards/overrideallcardartwithpersonalpreference", false).toBool();
|
settings->value("cards/overrideallcardartwithpersonalpreference", false).toBool();
|
||||||
|
bumpSetsWithCardsInDeckToTop = settings->value("cards/bumpsetswithcardsindecktotop", true).toBool();
|
||||||
horizontalHand = settings->value("hand/horizontal", true).toBool();
|
horizontalHand = settings->value("hand/horizontal", true).toBool();
|
||||||
invertVerticalCoordinate = settings->value("table/invert_vertical", false).toBool();
|
invertVerticalCoordinate = settings->value("table/invert_vertical", false).toBool();
|
||||||
minPlayersForMultiColumnLayout = settings->value("interface/min_players_multicolumn", 4).toInt();
|
minPlayersForMultiColumnLayout = settings->value("interface/min_players_multicolumn", 4).toInt();
|
||||||
|
|
@ -536,6 +537,13 @@ void SettingsCache::setOverrideAllCardArtWithPersonalPreference(QT_STATE_CHANGED
|
||||||
emit overrideAllCardArtWithPersonalPreferenceChanged();
|
emit overrideAllCardArtWithPersonalPreferenceChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setBumpSetsWithCardsInDeckToTop(QT_STATE_CHANGED_T _bumpSetsWithCardsInDeckToTop)
|
||||||
|
{
|
||||||
|
bumpSetsWithCardsInDeckToTop = static_cast<bool>(_bumpSetsWithCardsInDeckToTop);
|
||||||
|
settings->setValue("cards/bumpsetswithcardsindecktotop", bumpSetsWithCardsInDeckToTop);
|
||||||
|
emit bumpSetsWithCardsInDeckToTopChanged();
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsCache::setHorizontalHand(QT_STATE_CHANGED_T _horizontalHand)
|
void SettingsCache::setHorizontalHand(QT_STATE_CHANGED_T _horizontalHand)
|
||||||
{
|
{
|
||||||
horizontalHand = static_cast<bool>(_horizontalHand);
|
horizontalHand = static_cast<bool>(_horizontalHand);
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ signals:
|
||||||
void picDownloadChanged();
|
void picDownloadChanged();
|
||||||
void displayCardNamesChanged();
|
void displayCardNamesChanged();
|
||||||
void overrideAllCardArtWithPersonalPreferenceChanged();
|
void overrideAllCardArtWithPersonalPreferenceChanged();
|
||||||
|
void bumpSetsWithCardsInDeckToTopChanged();
|
||||||
void horizontalHandChanged();
|
void horizontalHandChanged();
|
||||||
void handJustificationChanged();
|
void handJustificationChanged();
|
||||||
void invertVerticalCoordinateChanged();
|
void invertVerticalCoordinateChanged();
|
||||||
|
|
@ -101,6 +102,7 @@ private:
|
||||||
bool showShortcuts;
|
bool showShortcuts;
|
||||||
bool displayCardNames;
|
bool displayCardNames;
|
||||||
bool overrideAllCardArtWithPersonalPreference;
|
bool overrideAllCardArtWithPersonalPreference;
|
||||||
|
bool bumpSetsWithCardsInDeckToTop;
|
||||||
bool horizontalHand;
|
bool horizontalHand;
|
||||||
bool invertVerticalCoordinate;
|
bool invertVerticalCoordinate;
|
||||||
int minPlayersForMultiColumnLayout;
|
int minPlayersForMultiColumnLayout;
|
||||||
|
|
@ -305,6 +307,10 @@ public:
|
||||||
{
|
{
|
||||||
return overrideAllCardArtWithPersonalPreference;
|
return overrideAllCardArtWithPersonalPreference;
|
||||||
}
|
}
|
||||||
|
bool getBumpSetsWithCardsInDeckToTop() const
|
||||||
|
{
|
||||||
|
return bumpSetsWithCardsInDeckToTop;
|
||||||
|
}
|
||||||
bool getHorizontalHand() const
|
bool getHorizontalHand() const
|
||||||
{
|
{
|
||||||
return horizontalHand;
|
return horizontalHand;
|
||||||
|
|
@ -585,6 +591,7 @@ public slots:
|
||||||
void setShowShortcuts(QT_STATE_CHANGED_T _showShortcuts);
|
void setShowShortcuts(QT_STATE_CHANGED_T _showShortcuts);
|
||||||
void setDisplayCardNames(QT_STATE_CHANGED_T _displayCardNames);
|
void setDisplayCardNames(QT_STATE_CHANGED_T _displayCardNames);
|
||||||
void setOverrideAllCardArtWithPersonalPreference(QT_STATE_CHANGED_T _overrideAllCardArt);
|
void setOverrideAllCardArtWithPersonalPreference(QT_STATE_CHANGED_T _overrideAllCardArt);
|
||||||
|
void setBumpSetsWithCardsInDeckToTop(QT_STATE_CHANGED_T _bumpSetsWithCardsInDeckToTop);
|
||||||
void setHorizontalHand(QT_STATE_CHANGED_T _horizontalHand);
|
void setHorizontalHand(QT_STATE_CHANGED_T _horizontalHand);
|
||||||
void setInvertVerticalCoordinate(QT_STATE_CHANGED_T _invertVerticalCoordinate);
|
void setInvertVerticalCoordinate(QT_STATE_CHANGED_T _invertVerticalCoordinate);
|
||||||
void setMinPlayersForMultiColumnLayout(int _minPlayersForMultiColumnLayout);
|
void setMinPlayersForMultiColumnLayout(int _minPlayersForMultiColumnLayout);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue