X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=bookview.h;h=5c0e1cd25f4fc9ab4cd9dac66e4fecb61178cb4b;hb=fad075543c2b4a647ccab41bd30f2671bf57185b;hp=fc42344f8221a15e99a5cdf26590414edccd980e;hpb=fcba4b509d5a87930d0b707c7690df2fbaad49c1;p=dorian diff --git a/bookview.h b/bookview.h index fc42344..5c0e1cd 100644 --- a/bookview.h +++ b/bookview.h @@ -6,10 +6,13 @@ #include #include #include +#include #include "book.h" class QModelIndex; +class Progress; +class QAbstractKineticScroller; /** Visual representation of a book. */ class BookView: public QWebView @@ -22,35 +25,81 @@ public: void setBook(Book *book); Book *book(); void goToBookmark(const Book::Bookmark &bookmark); - void addBookmark(); + void addBookmark(const QString ¬e); void setLastBookmark(); + void restoreLastBookmark(); signals: - void chapterLoaded(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); + /** Add QObjects to the main frame. */ + void addJavaScriptObjects(); + + /** 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); + void leaveEvent(QEvent *e); + void enterEvent(QEvent *e); + void timerEvent(QTimerEvent *e); + void keyPressEvent(QKeyEvent *e); private: + /** Load given part. */ void loadContent(int index); - void addNavigationBar(); - void extractIcons(); - void removeIcons(); + + /** Get temporary directory for extracting book contents. */ QString tmpPath(); - int contentIndex; - Book *mBook; - bool restore; - qreal restorePos; + /** Go to a given (relative) position in current part. */ + void goToPosition(qreal position); + + /** 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. */ + qreal positionAfterLoad; + /**< Position to be restored after load. */ QImage bookmarkImage; - bool loadFinished; + /**< Bookmark icon pre-loaded. */ + bool loaded; /**< True if content has been loaded. */ + bool mousePressed; + int contentsHeight; /**< Last know height of the frame. */ + +#if defined(Q_WS_MAEMO_5) + int scrollerMonitor; + QAbstractKineticScroller *scroller; +#endif }; #endif // BOOKVIEW_H