Even more Symbian improvements. Work around softkey visibility bug.
authorAkos Polster <akos@pipacs.com>
Mon, 13 Jun 2011 13:56:18 +0000 (15:56 +0200)
committerAkos Polster <akos@pipacs.com>
Mon, 13 Jun 2011 13:56:18 +0000 (15:56 +0200)
adopterwindow.cpp
adopterwindow.h
fullscreenwindow.cpp
fullscreenwindow.h
mainwindow.cpp
mainwindow.h
model/book.cpp

index a1f369b..7ec642d 100644 (file)
@@ -172,7 +172,8 @@ void AdopterWindow::leaveEvent(QEvent *event)
 
 void AdopterWindow::keyPressEvent(QKeyEvent *event)
 {
-    TRACE;
+    Trace t("AdopterWindow::keyPressEvent");
+
     switch (event->key()) {
     case Qt::Key_PageDown:
 #ifdef Q_WS_MAEMO_5
index 7420d2c..26c08cb 100644 (file)
@@ -12,7 +12,7 @@ class TranslucentButton;
 
 /**
  * A toplevel window that can adopt a BookView and other children.
- * On Maemo, it can also grab the volume keys.
+ * On some platforms, it can also grab the volume keys.
  */
 class AdopterWindow: public MainBase
 {
@@ -51,14 +51,15 @@ protected:
 
     /**
      * Handle show events.
-     * On Symbian, volume keys can only be grabbed, if the window is shown.
+     * On Symbian, volume keys can only be grabbed, when the window is shown.
+     * So we do it from here.
      */
     void showEvent(QShowEvent *event);
 
     /** Handle resize event: Restore reading position. */
     void resizeEvent(QResizeEvent *event);
 
-    /** Handle close event. */
+    /** Handle close event: Save reading position. */
     void closeEvent(QCloseEvent *event);
 
     /** Handle leave event: Save reading position. */
index 1ffbd7b..27ac731 100644 (file)
@@ -35,15 +35,23 @@ FullScreenWindow::FullScreenWindow(QWidget *parent): AdopterWindow(parent)
 void FullScreenWindow::showEvent(QShowEvent *e)
 {
     Trace t("FullScreenWindow::showEvent");
-    AdopterWindow::showEvent(e);
+    qDebug() << "Softkeys visible?"
+             << (windowFlags() & Qt::WindowSoftkeysVisibleHint);
     placeChildren();
+    AdopterWindow::showEvent(e);
 }
 
 void FullScreenWindow::resizeEvent(QResizeEvent *e)
 {
     Trace t("FullScreenWindow::resizeEvent");
-    AdopterWindow::resizeEvent(e);
     placeChildren();
+    AdopterWindow::resizeEvent(e);
+}
+
+void FullScreenWindow::closeEvent(QCloseEvent *e)
+{
+    Trace t("FullscreenWindow::closeEvent");
+    AdopterWindow::closeEvent(e);
 }
 
 void FullScreenWindow::placeChildren()
index d91408c..0a84e54 100644 (file)
@@ -18,7 +18,7 @@ class FullScreenWindow: public AdopterWindow
     Q_OBJECT
 
 public:
-    explicit FullScreenWindow(QWidget *parent);
+    explicit FullScreenWindow(QWidget *parent = 0);
 
     /**
      * Adopt children.
@@ -39,6 +39,9 @@ protected:
     /** Handle show event. */
     void showEvent(QShowEvent *e);
 
+    /** Handle close event. */
+    void closeEvent(QCloseEvent *e);
+
 protected slots:
     /** Re-align adopted child windows. */
     void placeChildren();
index 82fde67..8694cd2 100755 (executable)
@@ -43,10 +43,6 @@ MainWindow::MainWindow(QWidget *parent):
     setAttribute(Qt::WA_Maemo5StackedWindow, true);
 #endif
 
-#ifndef Q_OS_SYMBIAN
-    setWindowTitle("Dorian");
-#endif
-
     // Central widget. Must be an intermediate, because the book view widget
     // might be re-parented later
     QFrame *central = new QFrame(this);
@@ -122,7 +118,7 @@ MainWindow::MainWindow(QWidget *parent):
     connect(view, SIGNAL(progress(qreal)), prog, SLOT(setProgress(qreal)));
 
     // Shadow window for full screen reading
-    fullScreenWindow = new FullScreenWindow(this);
+    fullScreenWindow = new FullScreenWindow();
     connect(fullScreenWindow, SIGNAL(restore()), this, SLOT(showRegular()));
 
     // Handle settings changes
@@ -138,6 +134,11 @@ MainWindow::MainWindow(QWidget *parent):
 #endif
 }
 
+MainWindow::~MainWindow()
+{
+    delete fullScreenWindow;
+}
+
 void MainWindow::initialize()
 {
     TRACE;
@@ -199,7 +200,7 @@ void MainWindow::showBig()
     leaveBookView();
     fullScreenWindow->takeBookView(view, prog, prev, next);
 
-#ifdef Q_WS_MAEMO_5
+#if defined(Q_WS_MAEMO_5)
     fullScreenWindow->raise();
 #else
     hide();
index 1f50c41..c33f33b 100755 (executable)
@@ -22,6 +22,7 @@ class MainWindow: public AdopterWindow
 
 public:
     MainWindow(QWidget *parent = 0);
+    ~MainWindow();
     void initialize();
 
 public slots:
index 7516665..ca6f912 100644 (file)
@@ -82,7 +82,7 @@ void Book::peek()
 
 void Book::close()
 {
-    TRACE;
+    Trace t("Book::close");
     content.clear();
     parts.clear();
     QDir::setCurrent(QDir::rootPath());