mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-15 11:38:49 -07:00
initial commit
This commit is contained in:
commit
a11f93df4d
99 changed files with 7493 additions and 0 deletions
36
cockatrice/src/decklistmodel.h
Normal file
36
cockatrice/src/decklistmodel.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#ifndef DECKLISTMODEL_H
|
||||
#define DECKLISTMODEL_H
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QList>
|
||||
|
||||
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 DeckListModel : public QAbstractListModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
DeckListModel(QObject *parent = 0)
|
||||
: QAbstractListModel(parent) { }
|
||||
~DeckListModel();
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
||||
void loadFromFile(const QString &fileName);
|
||||
DecklistRow *getRow(int row) const;
|
||||
private:
|
||||
QList<DecklistRow *> deckList;
|
||||
void cleanList();
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue