X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=adopterwindow.h;h=c6c99cd4adc3ea104f86f90d2a4f957497142137;hb=e3bd4bc7d42d381abe498a83545923fdd1b5ad6c;hp=d2e3fe9a71779a85c3952b482fff419be683a3bd;hpb=986c5df2ad57bad44e8dd02286a2326406ace831;p=dorian diff --git a/adopterwindow.h b/adopterwindow.h index d2e3fe9..c6c99cd 100644 --- a/adopterwindow.h +++ b/adopterwindow.h @@ -8,6 +8,9 @@ class QWidget; class QToolBar; class QAction; class BookView; +class QVBoxLayout; +class Progress; +class TranslucentButton; /** * A toplevel window that can adopt a BookView and other children. @@ -20,18 +23,29 @@ class AdopterWindow: public QMainWindow public: explicit AdopterWindow(QWidget *parent = 0); - /** Adopt children "bookView" and "others". */ - void takeChildren(BookView *bookView, const QList &others); + /** Adopt book view and decorations. */ + void takeBookView(BookView *bookView, Progress *prog, + TranslucentButton *prev, TranslucentButton *next); - /** Release current children (adopted in @see takeChildren). */ - void leaveChildren(); + /** Release book view and decorations. */ + void leaveBookView(); + + /** Return true if the book view is currently adopted. */ + bool hasBookView(); /** - * Add action that is visible on the tool bar (except on Symbian, where - * it is visible on the Options menu). + * Add action that is visible on the tool bar. + * @param receiver Object receiving "activated" signal. + * @param slot Slot receiving "activated" signal. + * @param iconName Base name of tool bar icon in resource file. + * @param text Tool bar item text. + * @param important On Symbian, only "important" actions are added to + * the tool bar. All actions are added to the Options + * menu though. */ QAction *addToolBarAction(QObject *receiver, const char *slot, - const QString &iconName, const QString &text); + const QString &iconName, const QString &text, + bool important = false); /** Add spacing to tool bar. */ void addToolBarSpace(); @@ -39,24 +53,67 @@ public: /** Show window. */ void show(); - /** If grab is true, volume keys will generate pageUp/Down keys. */ + /** If grab is true, volume keys will navigate the book view. */ void grabVolumeKeys(bool grab); public slots: /** Handle settings changes. */ void onSettingsChanged(const QString &key); +signals: + /** Emitted when Page Up or Volume Up pressed. */ + void pageUp(); + + /** Emitted when Page Down or Volume Down pressed. */ + void pageDown(); + protected: + /** Handle key press events. */ void keyPressEvent(QKeyEvent *event); -#ifdef Q_WS_MAEMO_5 + + /** + * Handle show events. + * On Symbian, volume keys can only be grabbed, if the window is shown. + */ void showEvent(QShowEvent *event); + + /** Handle resize event: Restore reading position. */ + void resizeEvent(QResizeEvent *event); + + /** Handle close event. */ + void closeEvent(QCloseEvent *event); + + /** Handle leave event: Save reading position. */ + void leaveEvent(QEvent *event); + +#ifdef Q_OS_SYMBIAN + /** Update toolbar visibility. */ + void updateToolBar(); + + /** Return true in portrait mode. */ + bool portrait(); +#endif // Q_OS_SYMBIAN + +#ifdef Q_WS_MAEMO_5 + /** Actually grab the volume keys. */ void doGrabVolumeKeys(bool grab); -#endif - BookView *bookView; +#endif // Q_WS_MAEMO_5 + + /** Hide tool bar if visible. */ + void hideToolBar(); + +protected slots: + void placeDecorations(); + void onPageDown(); + void onPageUp(); + +private: + BookView *bookView; /**< Book view widget. */ bool grabbingVolumeKeys;/**< True, if volume keys should be grabbed. */ -#ifndef Q_OS_SYMBIAN - QToolBar *toolBar; -#endif + QToolBar *toolBar; /**< Tool bar. */ + Progress *progress; /**< Reading progress indicator. */ + TranslucentButton *previousButton; /**< Previous page indicator. */ + TranslucentButton *nextButton; /**< Next page indicator. */ }; #endif // ADOPTERWINDOW_H