-
Notifications
You must be signed in to change notification settings - Fork 2
/
indexlist.h
55 lines (44 loc) · 1.49 KB
/
indexlist.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
45
46
47
48
49
50
51
52
53
54
55
#ifndef INDEXLIST_H
#define INDEXLIST_H
#include <QWidget>
#include <QListWidget>
#include <QListWidgetItem>
#include <QResizeEvent>
#include <zimfilewrapper.h>
enum ArticleListItemDataRole {
ArticleUrlRole=Qt::UserRole,
ArticleIndexRole,
ArticleTitleRole
};
class IndexList : public QListWidget
{
Q_OBJECT
public:
explicit IndexList(QWidget *parent = 0, ZimFileWrapper* zimFileWrapper = 0, bool hasTouchScreen = true);
void setZimFileWrapper(ZimFileWrapper* zimFileWrapper) {
this->zimFileWrapper = zimFileWrapper;
}
std::pair<bool, QListWidgetItem *> getArticleListItem(zim::File::const_iterator it);
void populateArticleList(QString articleName);
void populateArticleList(QString articleName, int ignoreFirstN, bool direction_up, bool noDelete=false);
void articleListSelectPreviousEntry();
void articleListSelectNextEntry();
QString articleListItemToString(QListWidgetItem *item);
QUrl currentItemUrl();
void resizeEvent ( QResizeEvent * event );
public slots:
int addItemsToArticleList(bool up, int addCount=100, int maxCount=120);
private:
ZimFileWrapper* zimFileWrapper;
bool hasTouchScreen;
};
class ArticleListFilter : public QObject {
Q_OBJECT
public:
ArticleListFilter(QObject *parent=0) : QObject(parent) {}
protected:
bool eventFilter(QObject *o, QEvent *e);
signals:
bool approachingEndOfList(bool up);
};
#endif // INDEXLIST_H