Add chapter navigation. Move some toolbar items to the menu on Maemo.
[dorian] / mainwindow.h
1 #ifndef MAINWINDOW_H
2 #define MAINWINDOW_H
3
4 #include <QtGui>
5
6 class QString;
7 class QModelIndex;
8 class DevTools;
9 class BookView;
10 class Book;
11 class TranslucentButton;
12
13 class MainWindow: public QMainWindow
14 {
15     Q_OBJECT
16
17 public:
18     MainWindow(QWidget *parent = 0);
19     virtual ~MainWindow() {}
20
21 public slots:
22     void showLibrary();
23     void showInfo();
24     void showSettings();
25     void showDevTools();
26     void showBookmarks();
27     void onCurrentBookChanged();
28     void showNormal();
29     void showFullScreen();
30     void onSettingsChanged(const QString &key);
31     void onChapterLoadStart();
32     void onChapterLoadEnd(int index);
33     void onAddBookmark();
34     void onGoToBookmark(int index);
35     void showChapters();
36     void onGoToChapter(int index);
37
38 protected:
39 #ifdef Q_WS_MAEMO5
40 #   define MOUSE_ACTIVATE_EVENT mouseReleaseEvent
41 #else
42 #   define MOUSE_ACTIVATE_EVENT mousePressEvent
43 #endif
44     virtual void MOUSE_ACTIVATE_EVENT(QMouseEvent *event);
45     virtual void resizeEvent(QResizeEvent *event);
46     virtual void closeEvent(QCloseEvent *event);
47
48 private:
49     void setCurrentBook(const QModelIndex &current);
50     QAction *addToolBarAction(const QObject *receiver, const char *member,
51                               const QString &name);
52     QRect fullScreenZone() const;
53     BookView *view;
54     QAction *settingsAction;
55     QAction *libraryAction;
56     QAction *infoAction;
57     QAction *devToolsAction;
58     QAction *bookmarksAction;
59     QAction *fullScreenAction;
60     QAction *forwardAction;
61     QAction *backwardAction;
62     QAction *previousAction;
63     QAction *nextAction;
64     QAction *chaptersAction;
65     QToolBar *toolBar;
66     QDialog *settings;
67     DevTools *devTools;
68     QModelIndex mCurrent;
69     Qt::WindowFlags normalFlags;
70     TranslucentButton *restoreButton;
71     bool isFullscreen;
72     QRect normalGeometry;
73 };
74
75 #endif // MAINWINDOW_H