Added feature for full screen toggling
authorKaj Wallin <kaj.wallin@ixonos.com>
Thu, 3 Jun 2010 09:53:01 +0000 (12:53 +0300)
committerKaj Wallin <kaj.wallin@ixonos.com>
Thu, 3 Jun 2010 09:53:01 +0000 (12:53 +0300)
Reviewed by: Marko Niemelä

debian/changelog
src/ui/mainwindow.cpp
src/ui/mainwindow.h

index 2ddfc75..f2d5ba5 100644 (file)
@@ -1,3 +1,8 @@
+situare (0.6-0) unstable; urgency=low
+  * Mid-sprint test build
+
+ -- Kaj Wallin <kaj.wallin@ixonos.com>  Wed, 3 Jun 2010 10:43:00 +0300
+
 situare (0.5-1) unstable; urgency=low
   * Alpha release
 
index c412071..a0d13bd 100644 (file)
@@ -54,8 +54,10 @@ MainWindow::MainWindow(QWidget *parent)
     m_drawOwnLocationCrosshair(false),
     m_loggedIn(false),
     m_refresh(false),
+    m_ownLocationCrosshair(0),
     m_email(),    
     m_password(),
+    m_fullScreenButton(0),
     m_webView(0),
     m_cookieJar(0)
 {
@@ -83,7 +85,11 @@ MainWindow::MainWindow(QWidget *parent)
 
     // set stacking order of widgets
     m_zoomButtonPanel->stackUnder(m_userPanel);
-    m_osmLicense->stackUnder(m_zoomButtonPanel);
+    if(m_fullScreenButton) {
+        m_fullScreenButton->stackUnder(m_zoomButtonPanel);
+        m_osmLicense->stackUnder(m_fullScreenButton);
+    } else
+        m_osmLicense->stackUnder(m_zoomButtonPanel);
     m_ownLocationCrosshair->stackUnder(m_osmLicense);
     m_mapView->stackUnder(m_ownLocationCrosshair);
 
@@ -105,6 +111,19 @@ MainWindow::~MainWindow()
         delete m_webView;
 }
 
+void MainWindow::buildFullScreenButton()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+#ifdef Q_WS_MAEMO_5
+    m_fullScreenButton = new QToolButton(this);
+    m_fullScreenButton->setIcon(QIcon::fromTheme(QLatin1String("general_fullsize")));
+    m_fullScreenButton->setFixedSize(m_fullScreenButton->sizeHint());
+    connect(m_fullScreenButton, SIGNAL(clicked()),
+            this, SLOT(toggleFullScreen()));
+#endif // Q_WS_MAEMO_5
+
+}
+
 void MainWindow::buildFriendListPanel()
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -152,10 +171,9 @@ void MainWindow::buildMap()
     m_mapView = new MapView(this);
 
     buildZoomButtonPanel();
-
-    m_ownLocationCrosshair = 0;
     buildOsmLicense();
     buildManualLocationCrosshair();
+    buildFullScreenButton();
 
     connect(m_mapView, SIGNAL(viewScrolled(QPoint)),
             this, SIGNAL(mapViewScrolled(QPoint)));
@@ -166,6 +184,9 @@ void MainWindow::buildMap()
     connect(m_mapView, SIGNAL(viewResized(QSize)),
             this, SIGNAL(mapViewResized(QSize)));
 
+    connect(m_mapView, SIGNAL(viewResized(QSize)),
+            this, SLOT(drawFullScreenButton(QSize)));
+
     connect(m_mapView, SIGNAL(viewResizedNewSize(int, int)),
              this, SLOT(setViewPortSize(int, int)));
 
@@ -317,6 +338,17 @@ void MainWindow::createMenus()
     m_viewMenu->setObjectName(tr("Menu"));
 }
 
+void MainWindow::drawFullScreenButton(const QSize &size)
+{
+    qDebug() << __PRETTY_FUNCTION__ << size.width() << "x" << size.height();
+
+    if(m_fullScreenButton) {
+        m_fullScreenButton->move(size.width() - m_fullScreenButton->size().width()
+                                 - PANEL_PEEK_AMOUNT,
+                                 size.height() - m_fullScreenButton->size().height());
+    }
+}
+
 void MainWindow::drawOsmLicense(const QSize &size)
 {
     qDebug() << __PRETTY_FUNCTION__ << size.width() << "x" << size.height();
@@ -324,7 +356,6 @@ void MainWindow::drawOsmLicense(const QSize &size)
     m_osmLicense->move(size.width() - m_osmLicense->fontMetrics().width(OSM_LICENSE)
                        - PANEL_PEEK_AMOUNT,
                        size.height() - m_osmLicense->fontMetrics().height());
-
 }
 
 void MainWindow::drawOwnLocationCrosshair(int width, int height)
@@ -626,6 +657,16 @@ void MainWindow::showMaemoInformationBox(const QString &message, bool modal)
 #endif
 }
 
+void MainWindow::toggleFullScreen()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    if(windowState() == Qt::WindowNoState)
+        showFullScreen();
+    else
+        showNormal();
+}
+
 void MainWindow::startLoginProcess(const QUrl &url)
 {
     qDebug() << __PRETTY_FUNCTION__;
index 55df773..44ac036 100644 (file)
@@ -43,6 +43,7 @@ class User;
 class UserInfoPanel;
 class ZoomButtonPanel;
 class SettingsDialog;
+class QToolButton;
 
 /**
 * @brief Main Window Class
@@ -178,6 +179,11 @@ public slots:
 
 private:
     /**
+      * @brief Build fullscreen toggle button and connect slots
+      */
+    void buildFullScreenButton();
+
+    /**
       * @brief Build friend list panel and connect slots
       */
     void buildFriendListPanel();
@@ -234,6 +240,13 @@ private:
 
 private slots:
     /**
+    * @brief Slot for drawing the fullscreen toggle button
+    *
+    * @param size Size of the screen
+    */
+    void drawFullScreenButton(const QSize &size);
+
+    /**
     * @brief Slot for drawing the Open Street Map license text
     *
     * @param size Size of the screen
@@ -289,6 +302,11 @@ private slots:
     */
     void setViewPortSize(const int width, const int height);
 
+    /**
+    * @brief Toggle between fullscreen and normal window mode
+    */
+    void toggleFullScreen();
+
 /*******************************************************************************
  * SIGNALS
  ******************************************************************************/
@@ -484,6 +502,8 @@ private:
     QString m_email;                        ///< Placeholder for email
     QString m_password;                     ///< Placeholder for password
 
+    QToolButton *m_fullScreenButton;        ///< Instance of the fullscreen toggle button
+
     QWebView *m_webView;                    ///< Shows facebook login page
 
     FriendListPanel *m_friendsListPanel;    ///< Instance of friends list panel