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();
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 button press, when the real event has been suppressed. */
63 void suppressedMouseButtonPress();
65 /** Signal progress in reading the book. */
66 void progress(qreal p);
69 /** Go to next part. */
72 /** Go to previous part. */
75 /** Actions to perform after URL loading finished. */
76 void onLoadFinished(bool ok);
78 /** Handle settings changes. */
79 void onSettingsChanged(const QString &key);
81 /** Add QObjects to the main frame. */
82 void addJavaScriptObjects();
84 /** Go to previous page. */
85 void goPreviousPage();
87 /** Go to next page. */
90 /** Restore saved position after URL loading finished. */
91 void restoreAfterLoad();
93 /** Restore book's last reading position. */
94 void restoreLastBookmark();
98 /** Observe media keys. */
99 void onMediaKeysPressed(MediaKeysObserver::MediaKeys key);
103 void paintEvent(QPaintEvent *e);
104 void mousePressEvent(QMouseEvent *e);
105 void wheelEvent(QWheelEvent *);
106 bool eventFilter(QObject *o, QEvent *e);
107 void timerEvent(QTimerEvent *e);
109 /** Load given part. */
110 void loadContent(int index);
112 /** Get temporary directory for extracting book contents. */
115 /** Go to a given (relative) position in current part. */
116 void goToPosition(qreal position);
118 /** Show reading progress. */
121 int contentIndex; /**< Current part in book. */
122 Book *mBook; /**< Book to show. */
123 bool restorePositionAfterLoad;
124 /**< If true, restore current position after load. */
125 qreal positionAfterLoad;/**< Position to be restored after load. */
126 bool restoreFragmentAfterLoad;
127 /**< If true, restore fragment location after load. */
128 QString fragmentAfterLoad;
129 /**< Fragment location to be restored after load. */
130 QImage bookmarkImage; /**< Bookmark icon pre-loaded. */
131 bool loaded; /**< True, if content has been loaded. */
132 bool mousePressed; /**< Event filter's mouse button state. */
133 bool grabbingVolumeKeys;/**< True, if volume keys should be grabbed. */
135 #if defined(Q_WS_MAEMO_5) || defined(Q_OS_SYMBIAN)
136 int scrollerMonitor; /**< ID of timer monitoring kinetic scroll. */
138 #if defined(Q_WS_MAEMO_5)
139 QAbstractKineticScroller *scroller;
140 #elif defined(Q_OS_SYMBIAN)