-
Notifications
You must be signed in to change notification settings - Fork 0
/
torrent_files_model.h
44 lines (33 loc) · 1.18 KB
/
torrent_files_model.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
41
42
43
44
#ifndef TORRENT_FILES_MODEL
#define TORRENT_FILES_MODEL
#include<QAbstractItemModel>
#include"file_model.h"
#include<memory>
class torrent_files_model : public QAbstractItemModel {
Q_OBJECT
public:
enum column {
col_basename,
num_columns
};
private:
std::vector<std::shared_ptr<file_model_t> > files;
file_model_t placeholder_root;
file_model_t* root;
public:
torrent_files_model();
// QAbstractItemModel interface
public:
QModelIndex index(int row, int column, const QModelIndex &parent) const override;
QModelIndex parent(const QModelIndex &child) const override;
//QModelIndex sibling(int row, int column, const QModelIndex &idx) const;
int rowCount(const QModelIndex &parent) const override;
int columnCount(const QModelIndex &parent) const override;
bool hasChildren(const QModelIndex &parent) const override;
QVariant data(const QModelIndex &index, int role) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
public slots:
void set_files(std::vector<std::shared_ptr<file_model_t> > files,
file_model_t *root);
};
#endif // TORRENT_FILES_MODEL