[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
This commit is contained in:
Lukas Brübach 2025-10-03 12:52:21 +02:00
parent 30e6b52783
commit 3f168b9e5d
7 changed files with 91 additions and 18 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,41 @@ 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);
PictureLoader::clearNetworkCache(); // PixmapCache is no longer valid.
} else {
// If user cancels, revert the checkbox/state back
overrideAllCardArtWithPersonalPreferenceCheckBox.blockSignals(true);
overrideAllCardArtWithPersonalPreferenceCheckBox.setChecked(!enable);
overrideAllCardArtWithPersonalPreferenceCheckBox.blockSignals(false);
}
}
/**
* Updates the settings for cardViewInitialRowsMax.
* Forces expanded rows max to always be >= initial rows max

View file

@ -105,6 +105,7 @@ private slots:
void themeBoxChanged(int index);
void openThemeLocation();
void showShortcutsChanged(QT_STATE_CHANGED_T enabled);
void overrideAllCardArtWithPersonalPreferenceToggled(QT_STATE_CHANGED_T enabled);
void cardViewInitialRowsMaxChanged(int value);
void cardViewExpandedRowsMaxChanged(int value);

View file

@ -203,7 +203,10 @@ void DeckEditorDatabaseDisplayWidget::databaseCustomMenu(QPoint point)
QAction *addToDeck, *addToSideboard, *selectPrinting, *edhRecCommander, *edhRecCard;
addToDeck = menu.addAction(tr("Add to Deck"));
addToSideboard = menu.addAction(tr("Add to Sideboard"));
selectPrinting = menu.addAction(tr("Select Printing"));
if (!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
selectPrinting = menu.addAction(tr("Select Printing"));
connect(selectPrinting, &QAction::triggered, this, [this, card] { deckEditor->showPrintingSelector(); });
}
if (canBeCommander(card.getInfo())) {
edhRecCommander = menu.addAction(tr("Show on EDHRec (Commander)"));
connect(edhRecCommander, &QAction::triggered, this,
@ -213,7 +216,6 @@ void DeckEditorDatabaseDisplayWidget::databaseCustomMenu(QPoint point)
connect(addToDeck, &QAction::triggered, this, &DeckEditorDatabaseDisplayWidget::actAddCardToMainDeck);
connect(addToSideboard, &QAction::triggered, this, &DeckEditorDatabaseDisplayWidget::actAddCardToSideboard);
connect(selectPrinting, &QAction::triggered, this, [this, card] { deckEditor->showPrintingSelector(); });
connect(edhRecCard, &QAction::triggered, this,
[this, card] { deckEditor->getTabSupervisor()->addEdhrecTab(card.getCardPtr()); });

View file

@ -37,12 +37,14 @@ void DeckEditorDeckDockWidget::createDeckDock()
deckView->sortByColumn(1, Qt::AscendingOrder);
deckView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
deckView->installEventFilter(&deckViewKeySignals);
deckView->setContextMenuPolicy(Qt::CustomContextMenu);
deckView->setSelectionMode(QAbstractItemView::ExtendedSelection);
connect(deckView->selectionModel(), &QItemSelectionModel::currentRowChanged, this,
&DeckEditorDeckDockWidget::updateCard);
connect(deckView, &QTreeView::doubleClicked, this, &DeckEditorDeckDockWidget::actSwapCard);
connect(deckView, &QTreeView::customContextMenuRequested, this, &DeckEditorDeckDockWidget::decklistCustomMenu);
if (!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
deckView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(deckView, &QTreeView::customContextMenuRequested, this, &DeckEditorDeckDockWidget::decklistCustomMenu);
}
connect(&deckViewKeySignals, &KeySignals::onShiftS, this, &DeckEditorDeckDockWidget::actSwapCard);
connect(&deckViewKeySignals, &KeySignals::onEnter, this, &DeckEditorDeckDockWidget::actIncrement);
connect(&deckViewKeySignals, &KeySignals::onCtrlAltEqual, this, &DeckEditorDeckDockWidget::actIncrement);
@ -579,9 +581,10 @@ void DeckEditorDeckDockWidget::decklistCustomMenu(QPoint point)
{
QMenu menu;
QAction *selectPrinting = menu.addAction(tr("Select Printing"));
connect(selectPrinting, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::showPrintingSelector);
if (!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
QAction *selectPrinting = menu.addAction(tr("Select Printing"));
connect(selectPrinting, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::showPrintingSelector);
}
menu.exec(deckView->mapToGlobal(point));
}

View file

@ -49,6 +49,9 @@ AbstractTabDeckEditor::AbstractTabDeckEditor(TabSupervisor *_tabSupervisor) : Ta
cardInfoDockWidget = new DeckEditorCardInfoDockWidget(this);
filterDockWidget = new DeckEditorFilterDockWidget(this);
printingSelectorDockWidget = new DeckEditorPrintingSelectorDockWidget(this);
connect(&SettingsCache::instance(), &SettingsCache::overrideAllCardArtWithPersonalPreferenceChanged, this, [this] {
printingSelectorDockWidget->setHidden(SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference());
});
connect(deckDockWidget, &DeckEditorDeckDockWidget::deckChanged, this, &AbstractTabDeckEditor::onDeckChanged);
connect(deckDockWidget, &DeckEditorDeckDockWidget::deckModified, this, &AbstractTabDeckEditor::onDeckModified);

View file

@ -93,6 +93,13 @@ void TabDeckEditor::createMenus()
aPrintingSelectorDockFloating->setCheckable(true);
connect(aPrintingSelectorDockFloating, &QAction::triggered, this, &TabDeckEditor::dockFloatingTriggered);
if (SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
printingSelectorDockMenu->setEnabled(false);
}
connect(&SettingsCache::instance(), &SettingsCache::overrideAllCardArtWithPersonalPreferenceChanged, this,
[this](bool enabled) { printingSelectorDockMenu->setEnabled(!enabled); });
viewMenu->addSeparator();
aResetLayout = viewMenu->addAction(QString());
@ -171,6 +178,13 @@ void TabDeckEditor::loadLayout()
restoreGeometry(layouts.getDeckEditorGeometry());
}
if (SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
if (!printingSelectorDockWidget->isHidden()) {
printingSelectorDockWidget->setHidden(true);
aPrintingSelectorDockVisible->setChecked(false);
}
}
aCardInfoDockVisible->setChecked(!cardInfoDockWidget->isHidden());
aFilterDockVisible->setChecked(!filterDockWidget->isHidden());
aDeckDockVisible->setChecked(!deckDockWidget->isHidden());
@ -203,10 +217,11 @@ void TabDeckEditor::loadLayout()
void TabDeckEditor::restartLayout()
{
aCardInfoDockVisible->setChecked(true);
aDeckDockVisible->setChecked(true);
aFilterDockVisible->setChecked(true);
aPrintingSelectorDockVisible->setChecked(true);
aPrintingSelectorDockVisible->setChecked(!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference());
aCardInfoDockFloating->setChecked(false);
aDeckDockFloating->setChecked(false);
@ -227,7 +242,8 @@ void TabDeckEditor::restartLayout()
deckDockWidget->setVisible(true);
cardInfoDockWidget->setVisible(true);
filterDockWidget->setVisible(true);
printingSelectorDockWidget->setVisible(true);
printingSelectorDockWidget->setVisible(!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference());
splitDockWidget(cardInfoDockWidget, printingSelectorDockWidget, Qt::Horizontal);
splitDockWidget(printingSelectorDockWidget, deckDockWidget, Qt::Horizontal);

View file

@ -126,6 +126,13 @@ void TabDeckEditorVisual::createMenus()
aPrintingSelectorDockFloating->setCheckable(true);
connect(aPrintingSelectorDockFloating, SIGNAL(triggered()), this, SLOT(dockFloatingTriggered()));
if (SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
printingSelectorDockMenu->setEnabled(false);
}
connect(&SettingsCache::instance(), &SettingsCache::overrideAllCardArtWithPersonalPreferenceChanged, this,
[this](bool enabled) { printingSelectorDockMenu->setEnabled(!enabled); });
viewMenu->addSeparator();
aResetLayout = viewMenu->addAction(QString());
@ -236,6 +243,13 @@ void TabDeckEditorVisual::loadLayout()
restoreGeometry(layouts.getDeckEditorGeometry());
}
if (SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
if (!printingSelectorDockWidget->isHidden()) {
printingSelectorDockWidget->setHidden(true);
aPrintingSelectorDockVisible->setChecked(false);
}
}
aCardInfoDockVisible->setChecked(!cardInfoDockWidget->isHidden());
aFilterDockVisible->setChecked(!filterDockWidget->isHidden());
aDeckDockVisible->setChecked(!deckDockWidget->isHidden());
@ -271,7 +285,7 @@ void TabDeckEditorVisual::restartLayout()
aCardInfoDockVisible->setChecked(true);
aDeckDockVisible->setChecked(true);
aFilterDockVisible->setChecked(false);
aPrintingSelectorDockVisible->setChecked(true);
aPrintingSelectorDockVisible->setChecked(!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference());
aCardInfoDockFloating->setChecked(false);
aDeckDockFloating->setChecked(false);
@ -279,22 +293,21 @@ void TabDeckEditorVisual::restartLayout()
aPrintingSelectorDockFloating->setChecked(false);
setCentralWidget(centralWidget);
addDockWidget(Qt::RightDockWidgetArea, deckDockWidget);
addDockWidget(Qt::RightDockWidgetArea, cardInfoDockWidget);
addDockWidget(Qt::RightDockWidgetArea, filterDockWidget);
addDockWidget(Qt::RightDockWidgetArea, printingSelectorDockWidget);
deckDockWidget->setVisible(true);
cardInfoDockWidget->setVisible(true);
filterDockWidget->setVisible(false);
printingSelectorDockWidget->setVisible(!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference());
deckDockWidget->setFloating(false);
cardInfoDockWidget->setFloating(false);
filterDockWidget->setFloating(false);
printingSelectorDockWidget->setFloating(false);
deckDockWidget->setVisible(true);
cardInfoDockWidget->setVisible(true);
filterDockWidget->setVisible(false);
printingSelectorDockWidget->setVisible(true);
splitDockWidget(cardInfoDockWidget, printingSelectorDockWidget, Qt::Vertical);
splitDockWidget(cardInfoDockWidget, deckDockWidget, Qt::Horizontal);
splitDockWidget(cardInfoDockWidget, filterDockWidget, Qt::Horizontal);