mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-20 09:22:15 -07:00
Add ability to force preferred set art to be loaded for every card.
This commit is contained in:
parent
f12259500e
commit
b07fecb370
5 changed files with 37 additions and 8 deletions
|
|
@ -41,14 +41,18 @@ PictureToLoad::PictureToLoad(CardInfoPtr _card)
|
|||
sortedSets << CardSet::newInstance("", "", "", QDate());
|
||||
}
|
||||
std::sort(sortedSets.begin(), sortedSets.end(), SetDownloadPriorityComparator());
|
||||
// If the pixmapCacheKey corresponds to a specific set, we have to try to load it first.
|
||||
for (const auto &x : card->getSets()) {
|
||||
for (const auto &set : x) {
|
||||
if (QLatin1String("card_") + card->getName() + QString("_") + QString(set.getProperty("uuid")) ==
|
||||
card->getPixmapCacheKey()) {
|
||||
long long setIndex = sortedSets.indexOf(set.getPtr());
|
||||
CardSetPtr setForCardProviderID = sortedSets.takeAt(setIndex);
|
||||
sortedSets.prepend(setForCardProviderID);
|
||||
|
||||
// If the user hasn't disabled arts other than their personal preference...
|
||||
if (!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
|
||||
// If the pixmapCacheKey corresponds to a specific set, we have to try to load it first.
|
||||
for (const auto &x : card->getSets()) {
|
||||
for (const auto &set : x) {
|
||||
if (QLatin1String("card_") + card->getName() + QString("_") + QString(set.getProperty("uuid")) ==
|
||||
card->getPixmapCacheKey()) {
|
||||
long long setIndex = sortedSets.indexOf(set.getPtr());
|
||||
CardSetPtr setForCardProviderID = sortedSets.takeAt(setIndex);
|
||||
sortedSets.prepend(setForCardProviderID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -338,6 +338,10 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
|||
displayCardNamesCheckBox.setChecked(settings.getDisplayCardNames());
|
||||
connect(&displayCardNamesCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, &SettingsCache::setDisplayCardNames);
|
||||
|
||||
overrideAllCardArtWithPersonalPreferenceCheckBox.setChecked(settings.getOverrideAllCardArtWithPersonalPreference());
|
||||
connect(&overrideAllCardArtWithPersonalPreferenceCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &settings,
|
||||
SLOT(setOverrideAllCardArtWithPersonalPreference(QT_STATE_CHANGED_T)));
|
||||
|
||||
cardScalingCheckBox.setChecked(settings.getScaleCards());
|
||||
connect(&cardScalingCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, &SettingsCache::setCardScaling);
|
||||
|
||||
|
|
@ -354,6 +358,7 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
|||
auto *cardsGrid = new QGridLayout;
|
||||
cardsGrid->addWidget(&displayCardNamesCheckBox, 0, 0, 1, 2);
|
||||
cardsGrid->addWidget(&cardScalingCheckBox, 1, 0, 1, 2);
|
||||
cardsGrid->addWidget(&overrideAllCardArtWithPersonalPreferenceCheckBox, 2, 0, 1, 2);
|
||||
cardsGrid->addWidget(&verticalCardOverlapPercentLabel, 2, 0, 1, 1);
|
||||
cardsGrid->addWidget(&verticalCardOverlapPercentBox, 2, 1, 1, 1);
|
||||
cardsGrid->addWidget(&cardViewInitialRowsMaxLabel, 3, 0);
|
||||
|
|
@ -452,6 +457,9 @@ void AppearanceSettingsPage::retranslateUi()
|
|||
|
||||
cardsGroupBox->setTitle(tr("Card rendering"));
|
||||
displayCardNamesCheckBox.setText(tr("Display card names on cards having a picture"));
|
||||
overrideAllCardArtWithPersonalPreferenceCheckBox.setText(
|
||||
tr("Override all card art with personal set preference (Pre-ProviderID change behavior) [Requires Client "
|
||||
"restart]"));
|
||||
cardScalingCheckBox.setText(tr("Scale cards on mouse over"));
|
||||
verticalCardOverlapPercentLabel.setText(
|
||||
tr("Minimum overlap percentage of cards on the stack and in vertical hand"));
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ private:
|
|||
QLabel maxFontSizeForCardsLabel;
|
||||
QCheckBox showShortcutsCheckBox;
|
||||
QCheckBox displayCardNamesCheckBox;
|
||||
QCheckBox overrideAllCardArtWithPersonalPreferenceCheckBox;
|
||||
QCheckBox cardScalingCheckBox;
|
||||
QLabel verticalCardOverlapPercentLabel;
|
||||
QSpinBox verticalCardOverlapPercentBox;
|
||||
|
|
|
|||
|
|
@ -242,6 +242,8 @@ SettingsCache::SettingsCache()
|
|||
|
||||
showShortcuts = settings->value("menu/showshortcuts", true).toBool();
|
||||
displayCardNames = settings->value("cards/displaycardnames", true).toBool();
|
||||
overrideAllCardArtWithPersonalPreference =
|
||||
settings->value("cards/overrideallcardartwithpersonalpreference", false).toBool();
|
||||
horizontalHand = settings->value("hand/horizontal", true).toBool();
|
||||
invertVerticalCoordinate = settings->value("table/invert_vertical", false).toBool();
|
||||
minPlayersForMultiColumnLayout = settings->value("interface/min_players_multicolumn", 4).toInt();
|
||||
|
|
@ -527,6 +529,13 @@ void SettingsCache::setDisplayCardNames(QT_STATE_CHANGED_T _displayCardNames)
|
|||
emit displayCardNamesChanged();
|
||||
}
|
||||
|
||||
void SettingsCache::setOverrideAllCardArtWithPersonalPreference(QT_STATE_CHANGED_T _overrideAllCardArt)
|
||||
{
|
||||
overrideAllCardArtWithPersonalPreference = static_cast<bool>(_overrideAllCardArt);
|
||||
settings->setValue("cards/overrideallcardartwithpersonalpreference", overrideAllCardArtWithPersonalPreference);
|
||||
emit overrideAllCardArtWithPersonalPreferenceChanged();
|
||||
}
|
||||
|
||||
void SettingsCache::setHorizontalHand(QT_STATE_CHANGED_T _horizontalHand)
|
||||
{
|
||||
horizontalHand = static_cast<bool>(_horizontalHand);
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ signals:
|
|||
void themeChanged();
|
||||
void picDownloadChanged();
|
||||
void displayCardNamesChanged();
|
||||
void overrideAllCardArtWithPersonalPreferenceChanged();
|
||||
void horizontalHandChanged();
|
||||
void handJustificationChanged();
|
||||
void invertVerticalCoordinateChanged();
|
||||
|
|
@ -99,6 +100,7 @@ private:
|
|||
QByteArray tabGameSplitterSizes;
|
||||
bool showShortcuts;
|
||||
bool displayCardNames;
|
||||
bool overrideAllCardArtWithPersonalPreference;
|
||||
bool horizontalHand;
|
||||
bool invertVerticalCoordinate;
|
||||
int minPlayersForMultiColumnLayout;
|
||||
|
|
@ -299,6 +301,10 @@ public:
|
|||
{
|
||||
return displayCardNames;
|
||||
}
|
||||
bool getOverrideAllCardArtWithPersonalPreference() const
|
||||
{
|
||||
return overrideAllCardArtWithPersonalPreference;
|
||||
}
|
||||
bool getHorizontalHand() const
|
||||
{
|
||||
return horizontalHand;
|
||||
|
|
@ -578,6 +584,7 @@ public slots:
|
|||
void setTabGameSplitterSizes(const QByteArray &_tabGameSplitterSizes);
|
||||
void setShowShortcuts(QT_STATE_CHANGED_T _showShortcuts);
|
||||
void setDisplayCardNames(QT_STATE_CHANGED_T _displayCardNames);
|
||||
void setOverrideAllCardArtWithPersonalPreference(QT_STATE_CHANGED_T _overrideAllCardArt);
|
||||
void setHorizontalHand(QT_STATE_CHANGED_T _horizontalHand);
|
||||
void setInvertVerticalCoordinate(QT_STATE_CHANGED_T _invertVerticalCoordinate);
|
||||
void setMinPlayersForMultiColumnLayout(int _minPlayersForMultiColumnLayout);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue