mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-02 19:43:55 -07:00
new decklist file format
This commit is contained in:
parent
c756762171
commit
0ef00dd437
8 changed files with 311 additions and 97 deletions
55
cockatrice/src/decklist.h
Normal file
55
cockatrice/src/decklist.h
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#ifndef DECKLIST_H
|
||||
#define DECKLIST_H
|
||||
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
|
||||
class CardDatabase;
|
||||
class QIODevice;
|
||||
|
||||
class DecklistRow {
|
||||
private:
|
||||
int number;
|
||||
QString card;
|
||||
bool sideboard;
|
||||
public:
|
||||
DecklistRow(int _number, const QString &_card, bool _sideboard) : number(_number), card(_card), sideboard(_sideboard) { }
|
||||
int getNumber() const { return number; }
|
||||
QString getCard() const { return card; }
|
||||
bool isSideboard() const { return sideboard; }
|
||||
};
|
||||
|
||||
class DeckList : public QList<DecklistRow *> {
|
||||
public:
|
||||
enum FileFormat { PlainTextFormat, CockatriceFormat };
|
||||
private:
|
||||
static const QStringList fileNameFilters;
|
||||
void cacheCardPictures();
|
||||
CardDatabase *db;
|
||||
QString name, comments;
|
||||
QString lastFileName;
|
||||
FileFormat lastFileFormat;
|
||||
public:
|
||||
|
||||
DeckList(CardDatabase *_db);
|
||||
~DeckList();
|
||||
void setName(const QString &_name) { name = _name; }
|
||||
QString getName() const { return name; }
|
||||
void setComments(const QString &_comments) { comments = _comments; }
|
||||
QString getComments() const { return comments; }
|
||||
QString getLastFileName() const { return lastFileName; }
|
||||
FileFormat getLastFileFormat() const { return lastFileFormat; }
|
||||
|
||||
bool loadFromFile_Native(QIODevice *device);
|
||||
bool saveToFile_Native(QIODevice *device);
|
||||
bool loadFromFile_Plain(QIODevice *device);
|
||||
bool saveToFile_Plain(QIODevice *device);
|
||||
bool loadFromFile(const QString &fileName, FileFormat fmt);
|
||||
bool saveToFile(const QString &fileName, FileFormat fmt);
|
||||
bool loadDialog(QWidget *parent = 0);
|
||||
bool saveDialog(QWidget *parent = 0);
|
||||
|
||||
void cleanList();
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue