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();
93 /** Adjust web view position after orientation change. */
94 void adjustPosition(const QSize &size, const QSize &oldSize);
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. */
122 int contentIndex; /**< Current part in book. */
123 Book *mBook; /**< Book to show. */
124 bool restorePositionAfterLoad;
125 /**< If true, restore current position after load. */
126 qreal positionAfterLoad;/**< Position to be restored after load. */
127 bool restoreFragmentAfterLoad;
128 /**< If true, restore fragment location after load. */
129 QString fragmentAfterLoad;
130 /**< Fragment location to be restored after load. */
131 QImage bookmarkImage; /**< Bookmark icon pre-loaded. */
132 bool loaded; /**< True, if content has been loaded. */
133 bool mousePressed; /**< Event filter's mouse button state. */
134 bool grabbingVolumeKeys;/**< True, if volume keys should be grabbed. */
136 #if defined(Q_WS_MAEMO_5) || defined(Q_OS_SYMBIAN)
137 int scrollerMonitor; /**< ID of timer monitoring kinetic scroll. */
140 #if defined(Q_WS_MAEMO_5)
141 QAbstractKineticScroller *scroller;
144 #if defined(Q_OS_SYMBIAN)
145 FlickCharm *charm; /**< Kinetic scroller. */