mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 00:24:47 -07:00
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:
parent
91ee6097d2
commit
1ada5ea424
9 changed files with 305 additions and 205 deletions
|
|
@ -195,3 +195,31 @@ void PictureLoader::picsPathChanged()
|
|||
{
|
||||
QPixmapCache::clear();
|
||||
}
|
||||
|
||||
bool PictureLoader::hasCustomArt()
|
||||
{
|
||||
auto picsPath = SettingsCache::instance().getPicsPath();
|
||||
QDirIterator it(picsPath, QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
|
||||
// Check if there is at least one non-directory file in the pics path, other
|
||||
// than in the "downloadedPics" subdirectory.
|
||||
while (it.hasNext()) {
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 3, 0))
|
||||
QFileInfo dir(it.nextFileInfo());
|
||||
#else
|
||||
// nextFileInfo() is only available in Qt 6.3+, for previous versions, we build
|
||||
// the QFileInfo from a QString which requires more system calls.
|
||||
QFileInfo dir(it.next());
|
||||
#endif
|
||||
|
||||
if (it.fileName() == "downloadedPics")
|
||||
continue;
|
||||
|
||||
QDirIterator subIt(it.filePath(), QDir::Files, QDirIterator::Subdirectories | QDirIterator::FollowSymlinks);
|
||||
if (subIt.hasNext()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue