add some file
[mdictionary] / src / plugins / xdxf / DictsListModel.h
diff --git a/src/plugins/xdxf/DictsListModel.h b/src/plugins/xdxf/DictsListModel.h
new file mode 100644 (file)
index 0000000..84ff859
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef DICTSLISTMODEL_H
+#define DICTSLISTMODEL_H
+
+#include <QAbstractListModel>
+#include <QDebug>
+#include "DownloadDict.h"
+
+
+class DictsListModel : public QAbstractListModel
+{
+    Q_OBJECT
+public:
+    enum DictTypeRoles {
+        NumberRole=Qt::UserRole + 1,
+        FromRole,
+        ToRole,
+        NameRole,
+        SizeRole,
+        LinkRole
+    };
+    explicit DictsListModel(QList<DownloadDict> dicts, QObject *parent = 0);
+    int rowCount(const QModelIndex &) const;
+    QVariant data(const QModelIndex & index, int role) const;
+    QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+    Qt::ItemFlags flags(const QModelIndex &index) const;
+    DownloadDict currentDict();
+    QList<DownloadDict> dictionaries();
+
+public Q_SLOTS:
+    void itemSelected(int index);
+
+
+private:
+    QList<DownloadDict> dicts;
+    int _currentIndex;
+};
+
+#endif // DICTSLISTMODEL_H