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 /** Part loading started. */
44 void partLoadStart(int index);
46 /** Part loading finished. */
47 void partLoadEnd(int index);
49 /** Signal button press, when the real event has been suppressed. */
50 void suppressedMouseButtonPress();
52 /** Signal progress in reading the book. */
53 void progress(qreal p);
56 /** Go to next part. */
59 /** Go to previous part. */
62 /** Actions to perform after URL loading finished. */
63 void onLoadFinished(bool ok);
65 /** Handle settings changes. */
66 void onSettingsChanged(const QString &key);
68 /** Add QObjects to the main frame. */
69 void addJavaScriptObjects();
71 /** Go to previous page. */
72 void goPreviousPage();
74 /** Go to next page. */
77 /** Restore saved position after URL loading finished. */
78 void restoreAfterLoad();
82 /** Observe media keys. */
83 void onMediaKeysPressed(MediaKeysObserver::MediaKeys key);
87 void paintEvent(QPaintEvent *e);
88 void mousePressEvent(QMouseEvent *e);
89 void wheelEvent(QWheelEvent *);
90 bool eventFilter(QObject *o, QEvent *e);
91 void timerEvent(QTimerEvent *e);
93 void leaveEvent(QEvent *e);
94 void resizeEvent(QEvent *e);
95 #endif // Q_WS_MAEMO_5
97 /** Load given part. */
98 void loadContent(int index);
100 /** Get temporary directory for extracting book contents. */
103 /** Go to a given (relative) position in current part. */
104 void goToPosition(qreal position);
106 /** Show reading progress. */
109 int contentIndex; /**< Current part in book. */
110 Book *mBook; /**< Book to show. */
111 bool restorePositionAfterLoad;
112 /**< If true, restore current position after load. */
113 qreal positionAfterLoad;/**< Position to be restored after load. */
114 bool restoreFragmentAfterLoad;
115 /**< If true, restore fragment location after load. */
116 QString fragmentAfterLoad;
117 /**< Fragment location to be restored after load. */
118 QImage bookmarkImage; /**< Bookmark icon pre-loaded. */
119 bool loaded; /**< True, if content has been loaded. */
120 bool mousePressed; /**< Event filter's mouse button state. */
121 bool grabbingVolumeKeys;/**< True, if volume keys should be grabbed. */
123 #if defined(Q_WS_MAEMO_5) || defined(Q_OS_SYMBIAN)
124 int scrollerMonitor; /**< ID of timer monitoring kinetic scroll. */
126 #if defined(Q_WS_MAEMO_5)
127 QAbstractKineticScroller *scroller;
128 #elif defined(Q_OS_SYMBIAN)