add some file
[mdictionary] / src / plugins / xdxf / DictsListModel.h
1 #ifndef DICTSLISTMODEL_H
2 #define DICTSLISTMODEL_H
3
4 #include <QAbstractListModel>
5 #include <QDebug>
6 #include "DownloadDict.h"
7
8
9 class DictsListModel : public QAbstractListModel
10 {
11     Q_OBJECT
12 public:
13     enum DictTypeRoles {
14         NumberRole=Qt::UserRole + 1,
15         FromRole,
16         ToRole,
17         NameRole,
18         SizeRole,
19         LinkRole
20     };
21     explicit DictsListModel(QList<DownloadDict> dicts, QObject *parent = 0);
22     int rowCount(const QModelIndex &) const;
23     QVariant data(const QModelIndex & index, int role) const;
24     QVariant headerData(int section, Qt::Orientation orientation, int role) const;
25     Qt::ItemFlags flags(const QModelIndex &index) const;
26     DownloadDict currentDict();
27     QList<DownloadDict> dictionaries();
28
29 public Q_SLOTS:
30     void itemSelected(int index);
31
32
33 private:
34     QList<DownloadDict> dicts;
35     int _currentIndex;
36 };
37
38 #endif // DICTSLISTMODEL_H