fix: Always prefer local cards if available (#5762)

* Try to better reproduce pre-provider ID behavior

If "override all card art with personal preference" setting is set, look
for custom art for all sets instead of just the most preferred set.

* Warning when using both custom art and the printing selector

* QDirIterator::nextFileInfo is Qt 6.3+

* Translation
This commit is contained in:
Basile Clement 2025-03-26 02:23:09 +01:00 committed by GitHub
parent 91ee6097d2
commit 1ada5ea424
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 305 additions and 205 deletions

View file

@ -1,12 +1,15 @@
#include "printing_selector.h"
#include "../../../../settings/cache_settings.h"
#include "../../picture_loader/picture_loader.h"
#include "printing_selector_card_display_widget.h"
#include "printing_selector_card_search_widget.h"
#include "printing_selector_card_selection_widget.h"
#include "printing_selector_card_sorting_widget.h"
#include <QFrame>
#include <QScrollBar>
#include <qboxlayout.h>
/**
* @brief Constructs a PrintingSelector widget to display and manage card printings.
@ -29,6 +32,24 @@ PrintingSelector::PrintingSelector(QWidget *parent, AbstractTabDeckEditor *_deck
layout = new QVBoxLayout(this);
setLayout(layout);
if (PictureLoader::hasCustomArt()) {
QFrame *warningFrame = new QFrame(this);
warningFrame->setFrameShape(QFrame::StyledPanel);
warningLabel = new QLabel(this);
warningLabel->setTextFormat(Qt::RichText);
warningLabel->setWordWrap(true);
auto *warningLayout = new QVBoxLayout(warningFrame);
warningFrame->setLayout(warningLayout);
warningLayout->addWidget(warningLabel);
layout->addWidget(warningFrame);
} else {
warningLabel = nullptr;
}
widgetLoadingBufferTimer = new QTimer(this);
flowWidget = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAsNeeded);
@ -83,6 +104,12 @@ PrintingSelector::PrintingSelector(QWidget *parent, AbstractTabDeckEditor *_deck
void PrintingSelector::retranslateUi()
{
navigationCheckBox->setText(tr("Display Navigation Buttons"));
if (warningLabel) {
warningLabel->setText(
tr("<b>Warning:</b> You appear to be using custom card art, which has known bugs when also "
"using the printing selector in this version of Cockatrice."));
}
}
void PrintingSelector::printingsInDeckChanged()

View file

@ -46,6 +46,7 @@ private:
QWidget *sortAndOptionsContainer;
QHBoxLayout *sortAndOptionsLayout;
QCheckBox *navigationCheckBox;
QLabel *warningLabel;
PrintingSelectorCardSortingWidget *sortToolBar;
PrintingSelectorCardSearchWidget *searchBar;
FlowWidget *flowWidget;