Show Qt header and runtime versions. Clean temporary files when
[dorian] / adopterwindow.h
1 #ifndef ADOPTERWINDOW_H
2 #define ADOPTERWINDOW_H
3
4 #include <QMainWindow>
5 #include <QList>
6
7 class QWidget;
8 class QToolBar;
9 class QAction;
10 class BookView;
11
12 /**
13  * A toplevel window that can adopt a BookView and other children.
14  * On Maemo, it can also grab the volume keys.
15  */
16 class AdopterWindow: public QMainWindow
17 {
18     Q_OBJECT
19
20 public:
21     explicit AdopterWindow(QWidget *parent = 0);
22
23     /** Adopt children "bookView" and "others". */
24     void takeChildren(BookView *bookView, const QList<QWidget *> &others);
25
26     /** Release current children (adopted in @see takeChildren). */
27     void leaveChildren();
28
29     /**
30      * Add action that is visible on the tool bar (except on Symbian, where
31      * it is visible on the Options menu).
32      */
33     QAction *addToolBarAction(QObject *receiver, const char *slot,
34                               const QString &iconName, const QString &text);
35
36     /** Add spacing to tool bar. */
37     void addToolBarSpace();
38
39     /** Show window. */
40     void show();
41
42     /** If grab is true, volume keys will generate pageUp/Down keys. */
43     void grabVolumeKeys(bool grab);
44
45 public slots:
46     /** Handle settings changes. */
47     void onSettingsChanged(const QString &key);
48
49 protected:
50     void keyPressEvent(QKeyEvent *event);
51 #ifdef Q_WS_MAEMO_5
52     void showEvent(QShowEvent *event);
53     void doGrabVolumeKeys(bool grab);
54 #endif
55     BookView *bookView;
56     bool grabbingVolumeKeys;/**< True, if volume keys should be grabbed. */
57 #ifndef Q_OS_SYMBIAN
58     QToolBar *toolBar;
59 #endif
60 };
61
62 #endif // ADOPTERWINDOW_H