[PrintingSelector] Sync PrintingSelector availability to OverrideAllCardArtWithPersonalPreference setting. (#6218)

* [PrintingSelector] Clearly warn users about disabling the providerId change, hide and disable the printingSelector, clear the networkCache.

Took 56 minutes

Took 4 seconds

Took 9 minutes

* Defer rollback so the rollback isn't swallowed logically.

Took 7 minutes

* Immediately enable select printing action.

Took 7 minutes

* Remove restart label.

Took 8 seconds

* Clear PixmapCache as well as NetworkCache.

Took 4 minutes

* Lint.

Took 3 minutes

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2025-10-07 20:59:16 +02:00 committed by GitHub
parent 3cff55b0bb
commit ca1b9bf75f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 94 additions and 21 deletions

View file

@ -478,8 +478,8 @@ AppearanceSettingsPage::AppearanceSettingsPage()
&SettingsCache::setAutoRotateSidewaysLayoutCards);
overrideAllCardArtWithPersonalPreferenceCheckBox.setChecked(settings.getOverrideAllCardArtWithPersonalPreference());
connect(&overrideAllCardArtWithPersonalPreferenceCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
&SettingsCache::setOverrideAllCardArtWithPersonalPreference);
connect(&overrideAllCardArtWithPersonalPreferenceCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
&AppearanceSettingsPage::overrideAllCardArtWithPersonalPreferenceToggled);
bumpSetsWithCardsInDeckToTopCheckBox.setChecked(settings.getBumpSetsWithCardsInDeckToTop());
connect(&bumpSetsWithCardsInDeckToTopCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
@ -652,6 +652,45 @@ void AppearanceSettingsPage::showShortcutsChanged(QT_STATE_CHANGED_T value)
qApp->setAttribute(Qt::AA_DontShowShortcutsInContextMenus, value == 0); // 0 = unchecked
}
void AppearanceSettingsPage::overrideAllCardArtWithPersonalPreferenceToggled(QT_STATE_CHANGED_T value)
{
bool enable = static_cast<bool>(value);
QString message;
if (enable) {
message = tr("Enabling this feature will disable the use of the Printing Selector.\n\n"
"You will not be able to manage printing preferences on a per-deck basis, "
"or see printings other people have selected for their decks.\n\n"
"You will have to use the Set Manager, available through Card Database -> Manage Sets.\n\n"
"Are you sure you would like to enable this feature?");
} else {
message =
tr("Disabling this feature will enable the Printing Selector.\n\n"
"You can now choose printings on a per-deck basis in the Deck Editor and configure which printing "
"gets added to a deck by default by pinning it in the Printing Selector.\n\n"
"You can also use the Set Manager to adjust custom sort order for printings in the Printing Selector"
" (other sort orders like alphabetical or release date are available).\n\n"
"Are you sure you would like to disable this feature?");
}
QMessageBox::StandardButton result =
QMessageBox::question(this, tr("Confirm Change"), message, QMessageBox::Yes | QMessageBox::No);
if (result == QMessageBox::Yes) {
SettingsCache::instance().setOverrideAllCardArtWithPersonalPreference(value);
// Caches are now invalid.
PictureLoader::clearPixmapCache();
PictureLoader::clearNetworkCache();
} else {
// If user cancels, revert the checkbox/state back
QTimer::singleShot(0, this, [this, enable]() {
overrideAllCardArtWithPersonalPreferenceCheckBox.blockSignals(true);
overrideAllCardArtWithPersonalPreferenceCheckBox.setChecked(!enable);
overrideAllCardArtWithPersonalPreferenceCheckBox.blockSignals(false);
});
}
}
/**
* Updates the settings for cardViewInitialRowsMax.
* Forces expanded rows max to always be >= initial rows max
@ -694,8 +733,7 @@ void AppearanceSettingsPage::retranslateUi()
displayCardNamesCheckBox.setText(tr("Display card names on cards having a picture"));
autoRotateSidewaysLayoutCardsCheckBox.setText(tr("Auto-Rotate cards with sideways layout"));
overrideAllCardArtWithPersonalPreferenceCheckBox.setText(
tr("Override all card art with personal set preference (Pre-ProviderID change behavior) [Requires Client "
"restart]"));
tr("Override all card art with personal set preference (Pre-ProviderID change behavior)"));
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"));