3 #include "fullscreenwindow.h"
4 #include "translucentbutton.h"
10 static const int MARGIN = 9;
12 FullScreenWindow::FullScreenWindow(QWidget *parent):
13 AdopterWindow(parent), progress(0), previousButton(0), nextButton(0)
18 setAttribute(Qt::WA_Maemo5StackedWindow, true);
19 setAttribute(Qt::WA_Maemo5NonComposited, true);
20 #endif // Q_WS_MAEMO_5
24 QFrame *frame = new QFrame(this);
25 QVBoxLayout *layout = new QVBoxLayout(frame);
27 frame->setLayout(layout);
28 setCentralWidget(frame);
29 restoreButton = new TranslucentButton("view-normal", this);
30 QRect screen = QApplication::desktop()->screenGeometry();
31 restoreButton->setGeometry(
32 screen.width() - TranslucentButton::pixels - MARGIN,
33 screen.height() - TranslucentButton::pixels - MARGIN,
34 TranslucentButton::pixels,
35 TranslucentButton::pixels);
36 connect(restoreButton, SIGNAL(triggered()), this, SIGNAL(restore()));
39 void FullScreenWindow::showFullScreen()
42 AdopterWindow::showFullScreen();
43 restoreButton->flash(3000);
46 void FullScreenWindow::resizeEvent(QResizeEvent *e)
50 QRect screen = QApplication::desktop()->screenGeometry();
51 int w = screen.width();
52 int h = screen.height();
55 // Hack: FullScreenWindow can lose orientation on Maemo...
56 QString orientation = Settings::instance()->value("orientation",
57 Platform::instance()->defaultOrientation()).toString();
58 if (((orientation == "portrait") && (w > h)) ||
59 ((orientation == "landscape") && (w < h))) {
64 #endif // Q_WS_MAEMO_5
66 restoreButton->setGeometry(
67 w - TranslucentButton::pixels - MARGIN,
68 h - TranslucentButton::pixels - MARGIN,
69 TranslucentButton::pixels,
70 TranslucentButton::pixels);
72 if (hasChild(progress)) {
73 progress->setGeometry(0, h - progress->thickness(),
74 w, progress->thickness());
76 if (hasChild(previousButton)) {
77 previousButton->setGeometry(
79 h - TranslucentButton::pixels - MARGIN,
80 TranslucentButton::pixels,
81 TranslucentButton::pixels);
83 if (hasChild(nextButton)) {
84 nextButton->setGeometry(
85 w - TranslucentButton::pixels - MARGIN,
87 TranslucentButton::pixels,
88 TranslucentButton::pixels);
91 restoreButton->flash(3000);
92 AdopterWindow::resizeEvent(e);
95 void FullScreenWindow::takeChildren(BookView *view,
97 TranslucentButton *previous,
98 TranslucentButton *next)
102 previousButton = previous;
104 QList<QWidget *> otherChildren;
105 otherChildren << progress << previousButton << nextButton;
106 AdopterWindow::takeChildren(view, otherChildren);