mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 00:12:15 -07:00
Consolidate accepted decklist file extensions
This commit is contained in:
parent
42301d4f1a
commit
1d5a08a709
3 changed files with 10 additions and 4 deletions
|
|
@ -71,7 +71,7 @@ static QStringList getAllFiles(const QString &filePath, bool recursive)
|
||||||
// QDirIterator with QDir::Files ensures only files are listed (no directories)
|
// QDirIterator with QDir::Files ensures only files are listed (no directories)
|
||||||
auto flags =
|
auto flags =
|
||||||
recursive ? QDirIterator::Subdirectories | QDirIterator::FollowSymlinks : QDirIterator::NoIteratorFlags;
|
recursive ? QDirIterator::Subdirectories | QDirIterator::FollowSymlinks : QDirIterator::NoIteratorFlags;
|
||||||
QDirIterator it(filePath, {"*.txt", "*.cod"}, QDir::Files, flags);
|
QDirIterator it(filePath, DeckLoader::ACCEPTED_FILE_EXTENSIONS, QDir::Files, flags);
|
||||||
|
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
allFiles << it.next(); // Add each file path to the list
|
allFiles << it.next(); // Add each file path to the list
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,10 @@
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QtConcurrentRun>
|
#include <QtConcurrentRun>
|
||||||
|
|
||||||
const QStringList DeckLoader::fileNameFilters = QStringList()
|
const QStringList DeckLoader::ACCEPTED_FILE_EXTENSIONS = {"*.cod", "*.dec", "*.dek", "*.txt", "*.mwDeck"};
|
||||||
<< QObject::tr("Common deck formats (*.cod *.dec *.dek *.txt *.mwDeck)")
|
|
||||||
<< QObject::tr("All files (*.*)");
|
const QStringList DeckLoader::fileNameFilters = {tr("Common deck formats (%1)").arg(ACCEPTED_FILE_EXTENSIONS.join(" ")),
|
||||||
|
tr("All files (*.*)")};
|
||||||
|
|
||||||
DeckLoader::DeckLoader() : DeckList(), lastFileName(QString()), lastFileFormat(CockatriceFormat), lastRemoteDeckId(-1)
|
DeckLoader::DeckLoader() : DeckList(), lastFileName(QString()), lastFileFormat(CockatriceFormat), lastRemoteDeckId(-1)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,11 @@ public:
|
||||||
PlainTextFormat,
|
PlainTextFormat,
|
||||||
CockatriceFormat
|
CockatriceFormat
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Supported file extensions for decklist files
|
||||||
|
*/
|
||||||
|
static const QStringList ACCEPTED_FILE_EXTENSIONS;
|
||||||
static const QStringList fileNameFilters;
|
static const QStringList fileNameFilters;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue