-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtournamentsmodel.h
40 lines (32 loc) · 1.33 KB
/
tournamentsmodel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef TOURNAMENTSMODEL_H
#define TOURNAMENTSMODEL_H
#include <QAbstractItemModel>
#include "tournamentsitem.h"
#include "tournament.h"
#include "rootitem.h"
class Chess24Manager;
class TournamentsModel : public QAbstractItemModel
{
Q_OBJECT
public:
explicit TournamentsModel(QObject *parent, Chess24Manager &);
~TournamentsModel();
// QAbstractItemModel interface
QModelIndex index(int row, int column, const QModelIndex &parent) const override;
QModelIndex parent(const QModelIndex &child) const override;
int rowCount(const QModelIndex &parent) const override;
int columnCount(const QModelIndex &parent) const override;
QVariant data(const QModelIndex &index, int role) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
bool hasChildren(const QModelIndex &parent) const override;
void httpFinished();
Chess24Manager &c24Manager;
TournamentsItem root{TournamentsItem::ItemType::Root};
bool addChild(const QModelIndex &parent,TournamentsItem *);
bool addTournament(QString name, int originalOrder);
bool addTournaments(QVariantList names);
void updateTournamentDetails(QJsonObject json);
void onCurrentTournamentChanged(int row);
};
#endif // TOURNAMENTSMODEL_H