Add minimal documentation.
[dorian] / widgets / fullscreenwindow.cpp
1 #include <QtGui>
2
3 #include "fullscreenwindow.h"
4 #include "translucentbutton.h"
5 #include "trace.h"
6
7 FullScreenWindow::FullScreenWindow(QWidget *parent): AdopterWindow(parent)
8 {
9     Q_ASSERT(parent);
10 #ifdef Q_WS_MAEMO_5
11     setAttribute(Qt::WA_Maemo5StackedWindow, true);
12     setAttribute(Qt::WA_Maemo5NonComposited, true);
13 #endif // Q_WS_MAEMO_5
14     toolBar->hide();
15     QFrame *frame = new QFrame(this);
16     QVBoxLayout *layout = new QVBoxLayout(frame);
17     layout->setMargin(0);
18     frame->setLayout(layout);
19     setCentralWidget(frame);
20     restoreButton = new TranslucentButton("view-normal", this);
21     QRect screen = QApplication::desktop()->screenGeometry();
22     restoreButton->setGeometry((screen.width() - TranslucentButton::pixels) / 2,
23         screen.height() - TranslucentButton::pixels - 9,
24         TranslucentButton::pixels, TranslucentButton::pixels);
25     connect(restoreButton, SIGNAL(triggered()), this, SIGNAL(restore()));
26 }
27
28 void FullScreenWindow::showFullScreen()
29 {
30 #ifdef Q_WS_MAEMO_5
31     setAttribute(Qt::WA_Maemo5PortraitOrientation, parentWidget()->
32                  testAttribute(Qt::WA_Maemo5PortraitOrientation));
33     setAttribute(Qt::WA_Maemo5LandscapeOrientation, parentWidget()->
34                  testAttribute(Qt::WA_Maemo5LandscapeOrientation));
35 #endif // Q_WS_MAEMO_5
36     QWidget::showFullScreen();
37     restoreButton->flash();
38 }
39
40 void FullScreenWindow::resizeEvent(QResizeEvent *e)
41 {
42     Q_UNUSED(e);
43     QRect screen = QApplication::desktop()->screenGeometry();
44     restoreButton->setGeometry(screen.width() - TranslucentButton::pixels - 9,
45         screen.height() - TranslucentButton::pixels - 9,
46         TranslucentButton::pixels, TranslucentButton::pixels);
47 }