3 #include "fullscreenwindow.h"
4 #include "translucentbutton.h"
10 static const int MARGIN = 9;
12 FullScreenWindow::FullScreenWindow(QWidget *parent): AdopterWindow(parent)
16 #if defined(Q_WS_MAEMO_5)
17 setAttribute(Qt::WA_Maemo5StackedWindow, true);
18 setAttribute(Qt::WA_Maemo5NonComposited, true);
20 QFrame *frame = new QFrame(this);
21 QVBoxLayout *layout = new QVBoxLayout(frame);
23 frame->setLayout(layout);
24 setCentralWidget(frame);
25 restoreButton = new TranslucentButton("view-normal", this);
26 QRect screen = QApplication::desktop()->screenGeometry();
27 restoreButton->setGeometry(
28 screen.width() - TranslucentButton::pixels - MARGIN,
29 screen.height() - TranslucentButton::pixels - MARGIN,
30 TranslucentButton::pixels,
31 TranslucentButton::pixels);
32 connect(restoreButton, SIGNAL(triggered()), this, SIGNAL(restore()));
35 void FullScreenWindow::showEvent(QShowEvent *e)
37 Trace t("FullScreenWindow::showEvent");
38 qDebug() << "Softkeys visible?"
39 << (windowFlags() & Qt::WindowSoftkeysVisibleHint);
41 AdopterWindow::showEvent(e);
44 void FullScreenWindow::resizeEvent(QResizeEvent *e)
46 Trace t("FullScreenWindow::resizeEvent");
48 AdopterWindow::resizeEvent(e);
51 void FullScreenWindow::closeEvent(QCloseEvent *e)
53 Trace t("FullscreenWindow::closeEvent");
54 AdopterWindow::closeEvent(e);
57 void FullScreenWindow::placeChildren()
59 Trace t("FullScreenWindow::placeChildren");
61 QRect screen = QApplication::desktop()->screenGeometry();
62 int w = screen.width();
63 int h = screen.height();
66 // Hack: FullScreenWindow can lose orientation on Maemo...
67 QString orientation = Settings::instance()->value("orientation",
68 Platform::instance()->defaultOrientation()).toString();
69 if (((orientation == "portrait") && (w > h)) ||
70 ((orientation == "landscape") && (w < h))) {
75 #endif // Q_WS_MAEMO_5
77 restoreButton->setGeometry(
78 w - TranslucentButton::pixels - MARGIN,
79 h - TranslucentButton::pixels - MARGIN,
80 TranslucentButton::pixels,
81 TranslucentButton::pixels);
82 restoreButton->flash(3000);