mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 08:22:15 -07:00
Warning when using both custom art and the printing selector
This commit is contained in:
parent
b233743825
commit
53cd3dffeb
3 changed files with 44 additions and 0 deletions
|
|
@ -195,3 +195,25 @@ void PictureLoader::picsPathChanged()
|
||||||
{
|
{
|
||||||
QPixmapCache::clear();
|
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()) {
|
||||||
|
QFileInfo dir = it.nextFileInfo();
|
||||||
|
|
||||||
|
if (it.fileName() == "downloadedPics")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
QDirIterator subIt(it.filePath(), QDir::Files, QDirIterator::Subdirectories | QDirIterator::FollowSymlinks);
|
||||||
|
if (subIt.hasNext()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ public:
|
||||||
static void clearPixmapCache(CardInfoPtr card);
|
static void clearPixmapCache(CardInfoPtr card);
|
||||||
static void clearPixmapCache();
|
static void clearPixmapCache();
|
||||||
static void cacheCardPixmaps(QList<CardInfoPtr> cards);
|
static void cacheCardPixmaps(QList<CardInfoPtr> cards);
|
||||||
|
static bool hasCustomArt();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
static void clearNetworkCache();
|
static void clearNetworkCache();
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,15 @@
|
||||||
#include "printing_selector.h"
|
#include "printing_selector.h"
|
||||||
|
|
||||||
#include "../../../../settings/cache_settings.h"
|
#include "../../../../settings/cache_settings.h"
|
||||||
|
#include "../../picture_loader/picture_loader.h"
|
||||||
#include "printing_selector_card_display_widget.h"
|
#include "printing_selector_card_display_widget.h"
|
||||||
#include "printing_selector_card_search_widget.h"
|
#include "printing_selector_card_search_widget.h"
|
||||||
#include "printing_selector_card_selection_widget.h"
|
#include "printing_selector_card_selection_widget.h"
|
||||||
#include "printing_selector_card_sorting_widget.h"
|
#include "printing_selector_card_sorting_widget.h"
|
||||||
|
|
||||||
|
#include <QFrame>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
#include <qboxlayout.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Constructs a PrintingSelector widget to display and manage card printings.
|
* @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);
|
layout = new QVBoxLayout(this);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
|
if (PictureLoader::hasCustomArt()) {
|
||||||
|
QFrame *warningFrame = new QFrame(this);
|
||||||
|
warningFrame->setFrameShape(QFrame::StyledPanel);
|
||||||
|
|
||||||
|
QLabel *warningLabel = new QLabel(this);
|
||||||
|
warningLabel->setTextFormat(Qt::RichText);
|
||||||
|
warningLabel->setText("<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.");
|
||||||
|
warningLabel->setWordWrap(true);
|
||||||
|
|
||||||
|
auto *warningLayout = new QVBoxLayout(warningFrame);
|
||||||
|
warningFrame->setLayout(warningLayout);
|
||||||
|
|
||||||
|
warningLayout->addWidget(warningLabel);
|
||||||
|
|
||||||
|
layout->addWidget(warningFrame);
|
||||||
|
}
|
||||||
|
|
||||||
widgetLoadingBufferTimer = new QTimer(this);
|
widgetLoadingBufferTimer = new QTimer(this);
|
||||||
|
|
||||||
flowWidget = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAsNeeded);
|
flowWidget = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAsNeeded);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue