Remember reading progress in scrolling mode. Basic nightmode.
[mebook:mebook.git] / ui / bookview.h
1 #ifndef BOOKVIEW_H
2 #define BOOKVIEW_H
3
4 #include <QWebView>
5 #include "book.h"
6 #include "shared.h"
7
8 enum BookViewMode{ScrollingBookMode, ScrollingSectionMode, PageMode};
9
10 class BookView : public QWebView
11 {
12     Q_OBJECT
13 public:
14     BookView(QWidget *parent = 0);
15     ~BookView();
16     void setBook(Book*);
17     void goToSection(int);
18
19     void setFont(const QString&, int);
20     void setNightMode(bool);
21
22 protected:
23     void mousePressEvent(QMouseEvent*);
24     void mouseMoveEvent(QMouseEvent*);
25
26 private:
27     Book *book;
28     QString currentChapter;
29     int currentSection;
30     QPoint swipeStart;
31     BookViewMode viewMode;
32     bool snapEnabled;
33
34     QPoint previousOffset;
35
36     QList<QWebElement> hitElements(const QLine&);
37
38     void setContent(QString);
39
40     void parseLinks(QString&);
41 //    void setCSSWhiteSpaceProperty(QString);
42 //    void setCSSWhiteSpaceProperty(QWebElement&, QString);
43     void setCSSSetting(QString, QString);
44     void setHTMLAttribute(QString, QString);
45     void makeDOMChangesEffective();
46     void setDOMElementSettings(QWebElement&);
47
48     QHash<QString, QString> cssSettings;
49     QHash<QString, QString> htmlAttributes;
50
51 public slots:
52     void goToChapter(QString);
53     void volumeUpPressed();
54     void volumeDownPressed();
55     void saveProgress();
56     void loadingPageFinished(bool);
57
58 };
59
60 #endif