Speed up paging through the book. Clean up code for saving/restoring
[dorian] / fullscreenwindow.cpp
index ca8baba..c63f003 100644 (file)
@@ -9,8 +9,7 @@
 
 static const int MARGIN = 9;
 
-FullScreenWindow::FullScreenWindow(QWidget *parent):
-        AdopterWindow(parent), progress(0), previousButton(0), nextButton(0)
+FullScreenWindow::FullScreenWindow(QWidget *parent): AdopterWindow(parent)
 {
     TRACE;
     Q_ASSERT(parent);
@@ -18,9 +17,7 @@ FullScreenWindow::FullScreenWindow(QWidget *parent):
     setAttribute(Qt::WA_Maemo5StackedWindow, true);
     setAttribute(Qt::WA_Maemo5NonComposited, true);
 #endif // Q_WS_MAEMO_5
-#ifndef Q_OS_SYMBIAN
-    toolBar->hide();
-#endif
+    hideToolBar();
     QFrame *frame = new QFrame(this);
     QVBoxLayout *layout = new QVBoxLayout(frame);
     layout->setMargin(0);
@@ -36,16 +33,23 @@ FullScreenWindow::FullScreenWindow(QWidget *parent):
     connect(restoreButton, SIGNAL(triggered()), this, SIGNAL(restore()));
 }
 
-void FullScreenWindow::showFullScreen()
+void FullScreenWindow::showEvent(QShowEvent *e)
 {
-    TRACE;
-    AdopterWindow::showFullScreen();
-    restoreButton->flash(3000);
+    Trace t("FullScreenWindow::showEvent");
+    AdopterWindow::showEvent(e);
+    placeChildren();
 }
 
 void FullScreenWindow::resizeEvent(QResizeEvent *e)
 {
-    TRACE;
+    Trace t("FullScreenWindow::resizeEvent");
+    AdopterWindow::resizeEvent(e);
+    placeChildren();
+}
+
+void FullScreenWindow::placeChildren()
+{
+    Trace t("FullScreenWindow::placeChildren");
 
     QRect screen = QApplication::desktop()->screenGeometry();
     int w = screen.width();
@@ -68,40 +72,5 @@ void FullScreenWindow::resizeEvent(QResizeEvent *e)
         h - TranslucentButton::pixels - MARGIN,
         TranslucentButton::pixels,
         TranslucentButton::pixels);
-
-    if (hasChild(progress)) {
-        progress->setGeometry(0, h - progress->thickness(),
-                              w, progress->thickness());
-    }
-    if (hasChild(previousButton)) {
-        previousButton->setGeometry(
-                MARGIN,
-                h - TranslucentButton::pixels - MARGIN,
-                TranslucentButton::pixels,
-                TranslucentButton::pixels);
-    }
-    if (hasChild(nextButton)) {
-        nextButton->setGeometry(
-        w - TranslucentButton::pixels - MARGIN,
-        MARGIN,
-        TranslucentButton::pixels,
-        TranslucentButton::pixels);
-    }
-
     restoreButton->flash(3000);
-    AdopterWindow::resizeEvent(e);
-}
-
-void FullScreenWindow::takeChildren(BookView *view,
-                                    Progress *prog,
-                                    TranslucentButton *previous,
-                                    TranslucentButton *next)
-{
-    TRACE;
-    progress = prog;
-    previousButton = previous;
-    nextButton = next;
-    QList<QWidget *> otherChildren;
-    otherChildren << progress << previousButton << nextButton;
-    AdopterWindow::takeChildren(view, otherChildren);
 }