Fix progress and bookmark positions. Fix runaway scroll monitor timer.
[dorian] / bookview.h
index 66422d7..e3c7700 100644 (file)
@@ -10,6 +10,8 @@
 #include "book.h"
 
 class QModelIndex;
+class Progress;
+class QAbstractKineticScroller;
 
 /** Visual representation of a book. */
 class BookView: public QWebView
@@ -27,15 +29,22 @@ public:
     void restoreLastBookmark();
 
 signals:
-    void chapterLoadStart(int index);
-    void chapterLoadEnd(int index);
+    void partLoadStart(int index);
+    void partLoadEnd(int index);
 
     /** Signal button press when the real event has been suppressed. */
     void suppressedMouseButtonPress();
 
+    /** Signal progress in reading the book. */
+    void progress(qreal p);
+
 public slots:
+    /** Go to next part. */
     void goPrevious();
+
+    /** Go to previous part. */
     void goNext();
+
     void onLoadFinished(bool ok);
     void onSettingsChanged(const QString &key);
 
@@ -45,33 +54,36 @@ public slots:
     /** Handle main frame contents size changes. */
     void onContentsSizeChanged(const QSize &size);
 
+    /** Go to previous page. */
+    void goPreviousPage();
+
+    /** Go to next page. */
+    void goNextPage();
+
 protected:
-    virtual void paintEvent(QPaintEvent *e);
-    virtual void mousePressEvent(QMouseEvent *e);
+    void paintEvent(QPaintEvent *e);
+    void mousePressEvent(QMouseEvent *e);
+    void wheelEvent(QWheelEvent *);
     bool eventFilter(QObject *o, QEvent *e);
-    virtual void leaveEvent(QEvent *);
-    virtual void enterEvent(QEvent *);
+    void leaveEvent(QEvent *e);
+    void enterEvent(QEvent *e);
+    void timerEvent(QTimerEvent *e);
+    void keyPressEvent(QKeyEvent *e);
 
 private:
-    /** Save navigation icons from resource to the file system. */
-    void extractIcons();
-
-    /** Remove extracted icons. */
-    void removeIcons();
-
-    /** Load given chapter. */
+    /** Load given part. */
     void loadContent(int index);
 
-    /** Decorate web page frame with navigation icons. */
-    void addNavigationBar();
-
     /** Get temporary directory for extracting book contents. */
     QString tmpPath();
 
-    /** Go to a given (relative) position in current chapter. */
+    /** Go to a given (relative) position in current part. */
     void goToPosition(qreal position);
 
-    int contentIndex;   /**< Current chapter in book. */
+    /** Show progress. */
+    void showProgress();
+
+    int contentIndex;   /**< Current part in book. */
     Book *mBook;        /**< Book to show. */
     bool restorePositionAfterLoad;
                         /**< If true, restoring position after load is needed. */
@@ -82,7 +94,11 @@ private:
     bool loaded;        /**< True if content has been loaded. */
     bool mousePressed;
     int contentsHeight; /**< Last know height of the frame. */
-    bool decorated;     /**< True after adding the arrows to the frame contents. */
+
+#ifdef Q_WS_MAEMO_5
+    int scrollerMonitor;
+    QAbstractKineticScroller *scroller;
+#endif
 };
 
 #endif // BOOKVIEW_H