14 # include "mediakeysobserver.h"
19 class QAbstractKineticScroller;
23 /** Visual representation of a book. */
24 class BookView: public QWebView
29 explicit BookView(QWidget *parent = 0);
30 void setBook(Book *book);
32 void goToBookmark(const Book::Bookmark &bookmark);
33 void addBookmark(const QString ¬e);
34 void setLastBookmark();
35 void restoreLastBookmark();
36 void goToPart(int part, const QString &fragment);
37 void goToFragment(const QString &fragment);
39 /** If grab is true, volume keys will generate act as page up/down. */
40 void grabVolumeKeys(bool grab);
43 void partLoadStart(int index);
44 void partLoadEnd(int index);
46 /** Signal button press, when the real event has been suppressed. */
47 void suppressedMouseButtonPress();
49 /** Signal progress in reading the book. */
50 void progress(qreal p);
53 /** Go to next part. */
56 /** Go to previous part. */
59 void onLoadFinished(bool ok);
60 void onSettingsChanged(const QString &key);
62 /** Add QObjects to the main frame. */
63 void addJavaScriptObjects();
65 /** Handle main frame contents size changes. */
66 void onContentsSizeChanged(const QSize &size);
68 /** Go to previous page. */
69 void goPreviousPage();
71 /** Go to next page. */
76 /** Observe media keys. */
77 void onMediaKeysPressed(MediaKeysObserver::MediaKeys key);
81 void paintEvent(QPaintEvent *e);
82 void mousePressEvent(QMouseEvent *e);
83 void wheelEvent(QWheelEvent *);
84 bool eventFilter(QObject *o, QEvent *e);
85 void timerEvent(QTimerEvent *e);
87 void leaveEvent(QEvent *e);
88 void enterEvent(QEvent *e);
89 #endif // Q_WS_MAEMO_5
91 /** Load given part. */
92 void loadContent(int index);
94 /** Get temporary directory for extracting book contents. */
97 /** Go to a given (relative) position in current part. */
98 void goToPosition(qreal position);
100 /** Show reading progress. */
103 int contentIndex; /**< Current part in book. */
104 Book *mBook; /**< Book to show. */
105 bool restorePositionAfterLoad;
106 /**< If true, restore current position after load. */
107 qreal positionAfterLoad;/**< Position to be restored after load. */
108 bool restoreFragmentAfterLoad;
109 /**< If true, restore fragment location after load. */
110 QString fragmentAfterLoad;
111 /**< Fragment location to be restored after load. */
112 QImage bookmarkImage; /**< Bookmark icon pre-loaded. */
113 bool loaded; /**< True, if content has been loaded. */
114 bool mousePressed; /**< Event filter's mouse button state. */
115 int contentsHeight; /**< Last know height of the frame. */
116 bool grabbingVolumeKeys;/**< True, if volume keys should be grabbed. */
118 #if defined(Q_WS_MAEMO_5) || defined(Q_OS_SYMBIAN)
119 int scrollerMonitor; /**< ID of timer monitoring kinetic scroll. */
121 #if defined(Q_WS_MAEMO_5)
122 QAbstractKineticScroller *scroller;
123 #elif defined(Q_OS_SYMBIAN)