No progress at all.
authorAkos Polster <akos@pipacs.com>
Tue, 11 Jan 2011 23:55:23 +0000 (00:55 +0100)
committerAkos Polster <akos@pipacs.com>
Tue, 11 Jan 2011 23:55:23 +0000 (00:55 +0100)
mainwindow.cpp
platform.cpp
platform.h
widgets/mainbase.cpp
widgets/mainbase.h

index 583928e..c8f5dfe 100755 (executable)
@@ -185,8 +185,12 @@ void MainWindow::showRegular()
     // Re-parent children
     fullScreenWindow->leaveBookView();
     takeBookView(view, prog, prev, next);
-
     fullScreenWindow->hide();
+
+#ifdef Q_OS_SYMBIAN
+    view->setFixedSize(Platform::availableSize().width(),
+        Platform::availableSize().height() - Platform::softKeyHeight());
+#endif
     show();
 }
 
@@ -197,8 +201,11 @@ void MainWindow::showBig()
     // Re-parent children
     leaveBookView();
     fullScreenWindow->takeBookView(view, prog, prev, next);
-
     hide();
+
+#ifdef Q_OS_SYMBIAN
+    view->setFixedSize(Platform::size());
+#endif
     fullScreenWindow->showFullScreen();
 }
 
index ac25039..873d4fb 100644 (file)
@@ -187,3 +187,41 @@ void Platform::setOrientation(QWidget *widget, const QString &orientation)
 #endif
     }
 }
+
+int Platform::softKeyHeight()
+{
+#if defined(Q_OS_SYMBIAN)
+    return 62;
+#else
+    return 0;
+#endif
+}
+
+int Platform::toolBarIconHeight()
+{
+#if defined(Q_OS_SYMBIAN)
+    return 60;
+#elif defined(Q_WS_X11)  && !defined(Q_WS_MAEMO_5)
+    return 40;
+#else
+    return 0;
+#endif
+}
+
+QSize Platform::size()
+{
+    return QApplication::desktop()->geometry().size();
+}
+
+QSize Platform::availableSize()
+{
+    QSize s = QApplication::desktop()->availableGeometry().size();
+#if defined(Q_OS_SYMBIAN)
+    // Work around a Qt bug on Symbian which sometimes forgets to reduce the
+    // available height by the soft key area height
+    if (s.height() == 548) {
+        s.setHeight(s.height() - softKeyHeight());
+    }
+#endif
+    return s;
+}
index f920f80..30628dd 100644 (file)
@@ -2,6 +2,7 @@
 #define PLATFORM_H
 
 #include <QString>
+#include <QSize>
 
 class QWidget;
 
@@ -18,12 +19,16 @@ public:
     QString version();
     QString downloadDir();
     QString defaultFont();
-    int defaultZoom();
+    static int defaultZoom();
     QString defaultOrientation();
     void setOrientation(QWidget *widget, const QString &orientation);
     void information(const QString &label, QWidget *parent = 0);
     void showBusy(QWidget *w, bool isBusy);
     QString traceFileName();
+    static int softKeyHeight();
+    static int toolBarIconHeight();
+    static QSize size();
+    static QSize availableSize();
 };
 
 #endif // PLATFORM_H
index f2707c8..e560b5d 100755 (executable)
@@ -36,7 +36,8 @@ void MainBase::addToolBar()
 \r
 #if defined(Q_OS_SYMBIAN)\r
     toolBar = new QToolBar("", this);\r
-    QMainWindow::addToolBar(Qt::BottomToolBarArea, toolBar);\r
+    toolBar->setFixedHeight(Platform::softKeyHeight());\r
+    QMainWindow::addToolBar(Qt::NoToolBarArea, toolBar);\r
 #else\r
     toolBar = QMainWindow::addToolBar("");\r
 #endif\r
@@ -47,7 +48,8 @@ void MainBase::addToolBar()
     toolBar->toggleViewAction()->setVisible(false);\r
 \r
 #if defined(Q_WS_X11) && !defined(Q_WS_MAEMO_5)\r
-    toolBar->setIconSize(QSize(42, 42));\r
+    toolBar->setIconSize(QSize(Platform::toolBarIconHeight(),\r
+                               Platform::toolBarIconHeight()));\r
 #endif\r
 }\r
 \r
@@ -112,3 +114,20 @@ void MainBase::show()
     QMainWindow::show();\r
 #endif\r
 }\r
+\r
+#ifdef Q_OS_SYMBIAN\r
+\r
+void MainBase::resizeEvent(QResizeEvent *e)\r
+{\r
+    Trace t("MainBase::resizeEvent");\r
+\r
+    QMainWindow::resizeEvent(e);\r
+    if (!toolBar) {\r
+        return;\r
+    }\r
+    QSize available = Platform::availableSize();\r
+    toolBar->setGeometry(0, available.height() - Platform::softKeyHeight(),\r
+                         available.width(), Platform::softKeyHeight());\r
+}\r
+\r
+#endif // Q_OS_SYMBIAN\r
index bf2e83b..c1103a4 100755 (executable)
@@ -42,6 +42,11 @@ protected:
     /** Return the height of the tool bar (or 0 if there is no tool bar). */\r
     int toolBarHeight();\r
 \r
+#ifdef Q_OS_SYMBIAN\r
+    /** Handle resize. */\r
+    void resizeEvent(QResizeEvent *e);\r
+#endif\r
+\r
 private:\r
     QToolBar *toolBar;      /**< Tool bar. */\r
 };\r