mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-22 02:12:14 -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());
|
sortedSets << CardSet::newInstance("", "", "", QDate());
|
||||||
}
|
}
|
||||||
std::sort(sortedSets.begin(), sortedSets.end(), SetDownloadPriorityComparator());
|
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()) {
|
// If the user hasn't disabled arts other than their personal preference...
|
||||||
for (const auto &set : x) {
|
if (!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
|
||||||
if (QLatin1String("card_") + card->getName() + QString("_") + QString(set.getProperty("uuid")) ==
|
// If the pixmapCacheKey corresponds to a specific set, we have to try to load it first.
|
||||||
card->getPixmapCacheKey()) {
|
for (const auto &x : card->getSets()) {
|
||||||
long long setIndex = sortedSets.indexOf(set.getPtr());
|
for (const auto &set : x) {
|
||||||
CardSetPtr setForCardProviderID = sortedSets.takeAt(setIndex);
|
if (QLatin1String("card_") + card->getName() + QString("_") + QString(set.getProperty("uuid")) ==
|
||||||
sortedSets.prepend(setForCardProviderID);
|
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());
|
displayCardNamesCheckBox.setChecked(settings.getDisplayCardNames());
|
||||||
connect(&displayCardNamesCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, &SettingsCache::setDisplayCardNames);
|
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());
|
cardScalingCheckBox.setChecked(settings.getScaleCards());
|
||||||
connect(&cardScalingCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, &SettingsCache::setCardScaling);
|
connect(&cardScalingCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, &SettingsCache::setCardScaling);
|
||||||
|
|
||||||
|
|
@ -354,6 +358,7 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||||
auto *cardsGrid = new QGridLayout;
|
auto *cardsGrid = new QGridLayout;
|
||||||
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(&verticalCardOverlapPercentLabel, 2, 0, 1, 1);
|
cardsGrid->addWidget(&verticalCardOverlapPercentLabel, 2, 0, 1, 1);
|
||||||
cardsGrid->addWidget(&verticalCardOverlapPercentBox, 2, 1, 1, 1);
|
cardsGrid->addWidget(&verticalCardOverlapPercentBox, 2, 1, 1, 1);
|
||||||
cardsGrid->addWidget(&cardViewInitialRowsMaxLabel, 3, 0);
|
cardsGrid->addWidget(&cardViewInitialRowsMaxLabel, 3, 0);
|
||||||
|
|
@ -452,6 +457,9 @@ void AppearanceSettingsPage::retranslateUi()
|
||||||
|
|
||||||
cardsGroupBox->setTitle(tr("Card rendering"));
|
cardsGroupBox->setTitle(tr("Card rendering"));
|
||||||
displayCardNamesCheckBox.setText(tr("Display card names on cards having a picture"));
|
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"));
|
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"));
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,7 @@ private:
|
||||||
QLabel maxFontSizeForCardsLabel;
|
QLabel maxFontSizeForCardsLabel;
|
||||||
QCheckBox showShortcutsCheckBox;
|
QCheckBox showShortcutsCheckBox;
|
||||||
QCheckBox displayCardNamesCheckBox;
|
QCheckBox displayCardNamesCheckBox;
|
||||||
|
QCheckBox overrideAllCardArtWithPersonalPreferenceCheckBox;
|
||||||
QCheckBox cardScalingCheckBox;
|
QCheckBox cardScalingCheckBox;
|
||||||
QLabel verticalCardOverlapPercentLabel;
|
QLabel verticalCardOverlapPercentLabel;
|
||||||
QSpinBox verticalCardOverlapPercentBox;
|
QSpinBox verticalCardOverlapPercentBox;
|
||||||
|
|
|
||||||
|
|
@ -242,6 +242,8 @@ SettingsCache::SettingsCache()
|
||||||
|
|
||||||
showShortcuts = settings->value("menu/showshortcuts", true).toBool();
|
showShortcuts = settings->value("menu/showshortcuts", true).toBool();
|
||||||
displayCardNames = settings->value("cards/displaycardnames", true).toBool();
|
displayCardNames = settings->value("cards/displaycardnames", true).toBool();
|
||||||
|
overrideAllCardArtWithPersonalPreference =
|
||||||
|
settings->value("cards/overrideallcardartwithpersonalpreference", false).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();
|
||||||
|
|
@ -527,6 +529,13 @@ void SettingsCache::setDisplayCardNames(QT_STATE_CHANGED_T _displayCardNames)
|
||||||
emit displayCardNamesChanged();
|
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)
|
void SettingsCache::setHorizontalHand(QT_STATE_CHANGED_T _horizontalHand)
|
||||||
{
|
{
|
||||||
horizontalHand = static_cast<bool>(_horizontalHand);
|
horizontalHand = static_cast<bool>(_horizontalHand);
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ signals:
|
||||||
void themeChanged();
|
void themeChanged();
|
||||||
void picDownloadChanged();
|
void picDownloadChanged();
|
||||||
void displayCardNamesChanged();
|
void displayCardNamesChanged();
|
||||||
|
void overrideAllCardArtWithPersonalPreferenceChanged();
|
||||||
void horizontalHandChanged();
|
void horizontalHandChanged();
|
||||||
void handJustificationChanged();
|
void handJustificationChanged();
|
||||||
void invertVerticalCoordinateChanged();
|
void invertVerticalCoordinateChanged();
|
||||||
|
|
@ -99,6 +100,7 @@ private:
|
||||||
QByteArray tabGameSplitterSizes;
|
QByteArray tabGameSplitterSizes;
|
||||||
bool showShortcuts;
|
bool showShortcuts;
|
||||||
bool displayCardNames;
|
bool displayCardNames;
|
||||||
|
bool overrideAllCardArtWithPersonalPreference;
|
||||||
bool horizontalHand;
|
bool horizontalHand;
|
||||||
bool invertVerticalCoordinate;
|
bool invertVerticalCoordinate;
|
||||||
int minPlayersForMultiColumnLayout;
|
int minPlayersForMultiColumnLayout;
|
||||||
|
|
@ -299,6 +301,10 @@ public:
|
||||||
{
|
{
|
||||||
return displayCardNames;
|
return displayCardNames;
|
||||||
}
|
}
|
||||||
|
bool getOverrideAllCardArtWithPersonalPreference() const
|
||||||
|
{
|
||||||
|
return overrideAllCardArtWithPersonalPreference;
|
||||||
|
}
|
||||||
bool getHorizontalHand() const
|
bool getHorizontalHand() const
|
||||||
{
|
{
|
||||||
return horizontalHand;
|
return horizontalHand;
|
||||||
|
|
@ -578,6 +584,7 @@ public slots:
|
||||||
void setTabGameSplitterSizes(const QByteArray &_tabGameSplitterSizes);
|
void setTabGameSplitterSizes(const QByteArray &_tabGameSplitterSizes);
|
||||||
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 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