1 #ifndef ADOPTERWINDOW_H
2 #define ADOPTERWINDOW_H
13 class TranslucentButton;
16 * A toplevel window that can adopt a BookView and other children.
17 * On Maemo, it can also grab the volume keys.
19 class AdopterWindow: public QMainWindow
24 explicit AdopterWindow(QWidget *parent = 0);
26 /** Adopt book view and decorations. */
27 void takeBookView(BookView *bookView, Progress *prog,
28 TranslucentButton *prev, TranslucentButton *next);
30 /** Release book view and decorations. */
33 /** Return true if the book view is currently adopted. */
37 * Add action that is visible on the tool bar.
38 * @param receiver Object receiving "activated" signal.
39 * @param slot Slot receiving "activated" signal.
40 * @param iconName Base name of tool bar icon in resource file.
41 * @param text Tool bar item text.
42 * @param important On Symbian, only "important" actions are added to
43 * the tool bar. All actions are added to the Options
46 QAction *addToolBarAction(QObject *receiver, const char *slot,
47 const QString &iconName, const QString &text,
48 bool important = false);
50 /** Add spacing to tool bar. */
51 void addToolBarSpace();
56 /** If grab is true, volume keys will navigate the book view. */
57 void grabVolumeKeys(bool grab);
60 /** Handle settings changes. */
61 void onSettingsChanged(const QString &key);
64 /** Emitted when Page Up or Volume Up pressed. */
67 /** Emitted when Page Down or Volume Down pressed. */
71 /** Handle key press events. */
72 void keyPressEvent(QKeyEvent *event);
76 * On Symbian, volume keys can only be grabbed, if the window is shown.
78 void showEvent(QShowEvent *event);
80 /** Handle resize event: Restore reading position. */
81 void resizeEvent(QResizeEvent *event);
83 /** Handle close event. */
84 void closeEvent(QCloseEvent *event);
86 /** Handle leave event: Save reading position. */
87 void leaveEvent(QEvent *event);
90 /** Update toolbar visibility. */
93 /** Return true in portrait mode. */
95 #endif // Q_OS_SYMBIAN
98 /** Actually grab the volume keys. */
99 void doGrabVolumeKeys(bool grab);
100 #endif // Q_WS_MAEMO_5
102 /** Hide tool bar if visible. */
106 void placeDecorations();
111 BookView *bookView; /**< Book view widget. */
112 bool grabbingVolumeKeys;/**< True, if volume keys should be grabbed. */
113 QToolBar *toolBar; /**< Tool bar. */
114 Progress *progress; /**< Reading progress indicator. */
115 TranslucentButton *previousButton; /**< Previous page indicator. */
116 TranslucentButton *nextButton; /**< Next page indicator. */
119 #endif // ADOPTERWINDOW_H