14 # include "mediakeysobserver.h"
19 class QAbstractKineticScroller;
23 /** Visual representation of a book. */
24 class BookView: public QWebView
29 explicit BookView(QWidget *parent = 0);
31 /** Set current book. */
32 void setBook(Book *book);
34 /** Get current book. */
37 /** Go to the position decribed by "bookmark". */
38 void goToBookmark(const Book::Bookmark &bookmark);
40 /** Add bookmark to book at the current position. */
41 void addBookmark(const QString ¬e);
43 /** Save current reading position into book. */
44 void setLastBookmark(bool fast = false);
46 /** Go to given part + part fragment URL. */
47 void goToPart(int part, const QString &fragment);
49 /** Go to given fragment URL in current part. */
50 void goToFragment(const QString &fragment);
52 /** If grab is true, volume keys will generate act as page up/down. */
53 void grabVolumeKeys(bool grab);
56 /** Part loading started. */
57 void partLoadStart(int index);
59 /** Part loading finished. */
60 void partLoadEnd(int index);
62 /** Signal progress in reading the book. */
63 void progress(qreal p);
66 /** Go to next part. */
69 /** Go to previous part. */
72 /** Actions to perform after URL loading finished. */
73 void onLoadFinished(bool ok);
75 /** Handle settings changes. */
76 void onSettingsChanged(const QString &key);
78 /** Add QObjects to the main frame. */
79 void addJavaScriptObjects();
81 /** Go to previous page. */
82 void goPreviousPage();
84 /** Go to next page. */
87 /** Restore saved position after URL loading finished. */
88 void restoreAfterLoad();
90 /** Restore book's last reading position. */
91 void restoreLastBookmark();
95 /** Observe media keys. */
96 void onMediaKeysPressed(MediaKeysObserver::MediaKeys key);
100 void paintEvent(QPaintEvent *e);
101 void mousePressEvent(QMouseEvent *e);
102 void wheelEvent(QWheelEvent *);
103 bool eventFilter(QObject *o, QEvent *e);
104 void timerEvent(QTimerEvent *e);
105 void hideEvent(QHideEvent *e);
107 /** Load given part. */
108 void loadContent(int index);
110 /** Get temporary directory for extracting book contents. */
113 /** Go to a given (relative) position in current part. */
114 void goToPosition(qreal position);
116 /** Show reading progress. */
120 int contentIndex; /**< Current part in book. */
121 Book *mBook; /**< Book to show. */
122 bool restorePositionAfterLoad;
123 /**< If true, restore current position after load. */
124 qreal positionAfterLoad;/**< Position to be restored after load. */
125 bool restoreFragmentAfterLoad;
126 /**< If true, restore fragment location after load. */
127 QString fragmentAfterLoad;
128 /**< Fragment location to be restored after load. */
129 QImage bookmarkImage; /**< Bookmark icon pre-loaded. */
130 bool loaded; /**< True, if content has been loaded. */
131 bool mousePressed; /**< Event filter's mouse button state. */
132 bool grabbingVolumeKeys;/**< True, if volume keys should be grabbed. */
134 #if defined(Q_WS_MAEMO_5) || defined(Q_OS_SYMBIAN)
135 int scrollerMonitor; /**< ID of timer monitoring kinetic scroll. */
138 #if defined(Q_WS_MAEMO_5)
139 QAbstractKineticScroller *scroller;
142 #if defined(Q_OS_SYMBIAN)
143 FlickCharm *charm; /**< Kinetic scroller. */