Merge branch 'master' into new_panels_with_context_buttons
[situare] / src / ui / mainwindow.cpp
index 500e5b5..576c238 100644 (file)
@@ -4,9 +4,10 @@
 
       Henri Lampela - henri.lampela@ixonos.com
       Kaj Wallin - kaj.wallin@ixonos.com
-      Jussi Laitinen jussi.laitinen@ixonos.com
+      Jussi Laitinen - jussi.laitinen@ixonos.com
       Sami Rämö - sami.ramo@ixonos.com
       Ville Tiensuu - ville.tiensuu@ixonos.com
+      Katri Kaikkonen - katri.kaikkonen@ixonos.com
 
    Situare is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    USA.
 */
 
-#include <QtGui>
-#include <QtWebKit>
+#include <QAction>
+#include <QApplication>
+#include <QMenuBar>
+#include <QMessageBox>
 #include <QtAlgorithms>
+#include <QtWebKit>
 
+///< @todo sort
 #include "facebookservice/facebookauthentication.h"
 #include "map/mapcommon.h"
 #include "map/mapview.h"
 #include "error.h"
 #include "friendlistpanel.h"
 #include "fullscreenbutton.h"
-#include "indicatorbutton.h"
+#include "indicatorbuttonpanel.h"
 #include "logindialog.h"
 #include "mapscale.h"
+#include "panelcommon.h"
+#include "routingpanel.h"
+#include "tabbedpanel.h"
 #include "searchdialog.h"
 #include "settingsdialog.h"
 #include "userinfopanel.h"
 #include "zoombuttonpanel.h"
-#include "indicatorbuttonpanel.h"
 
 #include "mainwindow.h"
 
 
 MainWindow::MainWindow(QWidget *parent)
     : QMainWindow(parent),
-    m_errorShown(false),
-    m_loggedIn(false),
-    m_refresh(false),
-    m_progressIndicatorCount(0),
-    m_ownLocationCrosshair(0),
-    m_email(),
-    m_password(),
-    m_webView(0),
-    m_fullScreenButton(0),
-//    m_indicatorButton(0),
-    m_indicatorButtonPanel(0),
-    m_mapScale(0),
-    m_cookieJar(0)
+      m_errorShown(false),
+      m_loggedIn(false),
+      m_refresh(false),
+      m_mapCenterHorizontalShifting(0),
+      m_progressIndicatorCount(0),
+      m_crosshair(0),
+      m_email(), ///< @todo WTF?!?!?!?
+      m_password(),
+      m_webView(0),
+      m_fullScreenButton(0),
+      m_indicatorButtonPanel(0),
+      m_mapScale(0),
+      m_cookieJar(0)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
     buildMap();
 
-    // build main layout
-    QHBoxLayout *layout = new QHBoxLayout;
-    layout->addWidget(m_mapView);
-    layout->setMargin(0);
-    layout->setSpacing(0);
-
-    setCentralWidget(new QWidget());
-    centralWidget()->setLayout(layout);
+    // map view is the only widget which size & location is handled automatically by the system
+    // default functionality
+    setCentralWidget(m_mapView);
 
-    buildFriendListPanel();
-    buildUserInfoPanel();
+    buildPanels();
 
     createMenus();
     setWindowTitle(tr("Situare"));
 
-    // set stacking order of widgets
-    m_zoomButtonPanel->stackUnder(m_userPanel);
-    if(m_fullScreenButton) {
-        m_fullScreenButton->stackUnder(m_zoomButtonPanel);
-        m_osmLicense->stackUnder(m_fullScreenButton);
+    // set stacking order of widgets (from top to bottom)
+    // m_tabbedPanel is the topmost one
+    if (m_fullScreenButton) {
+        m_fullScreenButton->stackUnder(m_tabbedPanel);
+        m_crosshair->stackUnder(m_fullScreenButton);
     } else {
-        m_osmLicense->stackUnder(m_zoomButtonPanel);
+        m_crosshair->stackUnder(m_tabbedPanel);
     }
-    m_ownLocationCrosshair->stackUnder(m_osmLicense);
-    m_indicatorButtonPanel->stackUnder(m_ownLocationCrosshair);
-    m_mapScale->stackUnder(m_indicatorButtonPanel);
+    m_zoomButtonPanel->stackUnder(m_crosshair);
+    m_indicatorButtonPanel->stackUnder(m_zoomButtonPanel);
+    m_osmLicense->stackUnder(m_indicatorButtonPanel);
+    m_mapScale->stackUnder(m_osmLicense);
     m_mapView->stackUnder(m_mapScale);
 
     grabZoomKeys(true);
@@ -141,14 +143,22 @@ void MainWindow::automaticUpdateDialogFinished(int result)
     m_automaticUpdateLocationDialog->deleteLater();
 }
 
-void MainWindow::buildFullScreenButton()
+void MainWindow::buildCrosshair()
 {
     qDebug() << __PRETTY_FUNCTION__;
-#ifdef Q_WS_MAEMO_5
-    m_fullScreenButton = new FullScreenButton(this);
-    connect(m_fullScreenButton, SIGNAL(clicked()),
-            this, SLOT(toggleFullScreen()));
-#endif // Q_WS_MAEMO_5
+
+    m_crosshair = new QLabel(this);
+    QPixmap crosshairImage(":/res/images/sight.png");
+    m_crosshair->setPixmap(crosshairImage);
+    m_crosshair->setFixedSize(crosshairImage.size());
+    m_crosshair->hide();
+    m_crosshair->setAttribute(Qt::WA_TransparentForMouseEvents, true);
+
+    connect(m_mapView, SIGNAL(viewResized(QSize)),
+            this, SLOT(moveCrosshair()));
+
+    connect(m_mapView, SIGNAL(horizontalShiftingChanged(int)),
+            this, SLOT(mapCenterHorizontalShiftingChanged(int)));
 }
 
 void MainWindow::buildFriendListPanel()
@@ -157,27 +167,37 @@ void MainWindow::buildFriendListPanel()
 
     m_friendsListPanel = new FriendListPanel(this);
 
-    m_friendsListPanelSidebar = new PanelSideBar(this, RIGHT);
-
-    m_friendsListPanel->stackUnder(m_friendsListPanelSidebar);
-
     connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
             m_friendsListPanel, SLOT(friendInfoReceived(QList<User*>&)));
 
     connect(this, SIGNAL(locationItemClicked(QList<QString>)),
             m_friendsListPanel, SLOT(showFriendsInList(QList<QString>)));
 
-    connect(m_mapView, SIGNAL(viewResized(QSize)),
-            m_friendsListPanel, SLOT(resizePanel(QSize)));
-
-    connect(m_mapView, SIGNAL(viewResized(QSize)),
-            m_friendsListPanelSidebar, SLOT(resizeSideBar(QSize)));
-
     connect(m_friendsListPanel, SIGNAL(findFriend(GeoCoordinate)),
-            this, SIGNAL(findFriend(GeoCoordinate)));
+            this, SIGNAL(centerToCoordinates(GeoCoordinate)));
 
     connect(this, SIGNAL(friendImageReady(User*)),
             m_friendsListPanel, SLOT(friendImageReady(User*)));
+
+    connect(m_friendsListPanel, SIGNAL(routeToFriend(const GeoCoordinate&)),
+            this, SIGNAL(routeTo(const GeoCoordinate&)));
+}
+
+void MainWindow::buildFullScreenButton()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+#ifdef Q_WS_MAEMO_5
+    m_fullScreenButton = new FullScreenButton(this);
+
+    if (m_fullScreenButton) {
+        connect(m_fullScreenButton, SIGNAL(clicked()),
+                this, SLOT(toggleFullScreen()));
+
+        connect(qApp, SIGNAL(showFullScreenButton()),
+                m_fullScreenButton, SLOT(invoke()));
+    }
+#endif // Q_WS_MAEMO_5
 }
 
 void MainWindow::buildIndicatorButtonPanel()
@@ -231,21 +251,6 @@ void MainWindow::buildInformationBox(const QString &message, bool modal)
     queueDialog(msgBox);
 }
 
-void MainWindow::buildManualLocationCrosshair()
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    m_ownLocationCrosshair = new QLabel(this);
-    QPixmap crosshairImage(":/res/images/sight.png");
-    m_ownLocationCrosshair->setPixmap(crosshairImage);
-    m_ownLocationCrosshair->setFixedSize(crosshairImage.size());
-    m_ownLocationCrosshair->hide();
-    m_ownLocationCrosshair->setAttribute(Qt::WA_TransparentForMouseEvents, true);
-
-    connect(m_mapView, SIGNAL(viewResized(QSize)),
-            this, SLOT(drawOwnLocationCrosshair(QSize)));
-}
-
 void MainWindow::buildMap()
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -254,7 +259,7 @@ void MainWindow::buildMap()
 
     buildZoomButtonPanel();
     buildOsmLicense();
-    buildManualLocationCrosshair();
+    buildCrosshair();
     buildFullScreenButton();
     buildIndicatorButtonPanel();
     buildMapScale();
@@ -275,7 +280,7 @@ void MainWindow::buildMap()
             this, SLOT(drawMapScale(QSize)));
 
     connect(m_mapView, SIGNAL(viewResized(QSize)),
-             this, SLOT(setViewPortSize(QSize)));
+             this, SLOT(moveCrosshair()));
 
     connect(this, SIGNAL(zoomLevelChanged(int)),
             m_mapView, SLOT(setZoomLevel(int)));
@@ -310,45 +315,106 @@ void MainWindow::buildOsmLicense()
             this, SLOT(drawOsmLicense(QSize)));
 }
 
-void MainWindow::buildUserInfoPanel()
+void MainWindow::buildPanels()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    buildUserInfoPanel();
+    buildFriendListPanel();
+    buildRoutingPanel();
+
+    m_tabbedPanel = new TabbedPanel(this);
+    m_tabbedPanel->addTab(m_userInfoPanel, QIcon(":/res/images/user_info.png"));
+    m_tabbedPanel->addTab(m_friendsListPanel, QIcon(":/res/images/friend_list.png"));
+    m_tabbedPanel->addTab(m_routingPanel, QIcon(":/res/images/routing.png"));
+
+    connect(m_mapView, SIGNAL(viewResized(QSize)),
+            m_tabbedPanel, SLOT(resizePanel(QSize)));
+
+    connect(m_friendsListPanel, SIGNAL(showPanelRequested(QWidget*)),
+            m_tabbedPanel, SLOT(showPanel(QWidget*)));
+
+    connect(m_routingPanel, SIGNAL(showPanelRequested(QWidget*)),
+            m_tabbedPanel, SLOT(showPanel(QWidget*)));
+
+    connect(m_tabbedPanel, SIGNAL(panelClosed()),
+            m_friendsListPanel, SLOT(anyPanelClosed()));
+
+    connect(m_tabbedPanel, SIGNAL(panelOpened()),
+            m_friendsListPanel, SLOT(anyPanelOpened()));
+
+    connect(m_tabbedPanel, SIGNAL(panelClosed()),
+            m_routingPanel, SLOT(clearListsSelections()));
+
+    connect(m_tabbedPanel, SIGNAL(panelClosed()),
+            m_mapView, SLOT(disableCenterShift()));
+
+    connect(m_tabbedPanel, SIGNAL(panelOpened()),
+            m_mapView, SLOT(enableCenterShift()));
+
+    connect(m_tabbedPanel, SIGNAL(panelClosed()),
+            m_userInfoPanel, SIGNAL(collapse()));
+
+    connect(m_tabbedPanel, SIGNAL(currentChanged(int)),
+            m_userInfoPanel, SIGNAL(collapse()));
+}
+
+void MainWindow::buildRoutingPanel()
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    m_userPanel = new UserInfoPanel(this);
+    m_routingPanel = new RoutingPanel(this);
 
-    m_userPanelSidebar = new PanelSideBar(this, LEFT);
+    connect(this, SIGNAL(locationDataParsed(const QList<Location>&)),
+            m_routingPanel, SLOT(populateLocationListView(const QList<Location>&)));
 
-    m_userPanelSidebar->stackUnder(m_friendsListPanel);
-    m_userPanel->stackUnder(m_userPanelSidebar);
+    connect(m_routingPanel, SIGNAL(locationItemClicked(const GeoCoordinate&, const GeoCoordinate&)),
+            this, SIGNAL(locationItemClicked(const GeoCoordinate&, const GeoCoordinate&)));
+
+    connect(m_routingPanel, SIGNAL(routeToLocation(const GeoCoordinate&)),
+            this, SIGNAL(routeTo(const GeoCoordinate&)));
+
+    connect(this, SIGNAL(routeParsed(Route&)),
+            m_routingPanel, SLOT(setRoute(Route&)));
+
+    connect(m_routingPanel, SIGNAL(routeWaypointItemClicked(GeoCoordinate)),
+            this, SIGNAL(centerToCoordinates(GeoCoordinate)));
+
+    connect(m_routingPanel, SIGNAL(requestSearchLocation()),
+            this, SLOT(startLocationSearch()));
+
+    connect(m_routingPanel, SIGNAL(clearRoute()),
+            this, SIGNAL(clearRoute()));
+}
+
+void MainWindow::buildUserInfoPanel()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    m_userInfoPanel = new UserInfoPanel(this);
 
     connect(this, SIGNAL(userLocationReady(User*)),
-            m_userPanel, SLOT(userDataReceived(User*)));
+            m_userInfoPanel, SLOT(userDataReceived(User*)));
 
     connect(this, SIGNAL(reverseGeoReady(QString)),
-            m_userPanel, SIGNAL(reverseGeoReady(QString)));
+            m_userInfoPanel, SIGNAL(reverseGeoReady(QString)));
 
     connect(this, SIGNAL(clearUpdateLocationDialogData()),
-            m_userPanel, SIGNAL(clearUpdateLocationDialogData()));
-
-    connect(m_mapView, SIGNAL(viewResized(QSize)),
-            m_userPanel, SLOT(resizePanel(QSize)));
-
-    connect(m_mapView, SIGNAL(viewResized(QSize)),
-            m_userPanelSidebar, SLOT(resizeSideBar(QSize)));
+            m_userInfoPanel, SIGNAL(clearUpdateLocationDialogData()));
 
-    connect(m_userPanel, SIGNAL(findUser(GeoCoordinate)),
-            this, SIGNAL(findUser(GeoCoordinate)));
+    connect(m_userInfoPanel, SIGNAL(findUser(GeoCoordinate)),
+            this, SIGNAL(centerToCoordinates(GeoCoordinate)));
 
-    connect(m_userPanel, SIGNAL(requestReverseGeo()),
+    connect(m_userInfoPanel, SIGNAL(requestReverseGeo()),
             this, SIGNAL(requestReverseGeo()));
 
-    connect(m_userPanel, SIGNAL(statusUpdate(QString,bool)),
+    connect(m_userInfoPanel, SIGNAL(statusUpdate(QString,bool)),
             this, SIGNAL(statusUpdate(QString,bool)));
 
-    connect(m_userPanel, SIGNAL(refreshUserData()),
+    connect(m_userInfoPanel, SIGNAL(refreshUserData()),
             this, SIGNAL(refreshUserData()));
 
-    connect(m_userPanel, SIGNAL(notificateUpdateFailing(QString, bool)),
+    connect(m_userInfoPanel, SIGNAL(notificateUpdateFailing(QString, bool)),
             this, SLOT(buildInformationBox(QString, bool)));
 }
 
@@ -442,17 +508,11 @@ void MainWindow::createMenus()
     connect(m_gpsToggleAct, SIGNAL(triggered(bool)),
             this, SIGNAL(gpsTriggered(bool)));
 
-    /// @todo remove when not needed!
-    m_searchLocationAct = new QAction(tr("Location search"), this);
-    connect(m_searchLocationAct, SIGNAL(triggered()),
-            this, SLOT(startLocationSearch()));
-
     // build the actual menu
     m_viewMenu = menuBar()->addMenu(tr("Main"));
     m_viewMenu->addAction(m_loginAct);
     m_viewMenu->addAction(m_toSettingsAct);
     m_viewMenu->addAction(m_gpsToggleAct);
-    m_viewMenu->addAction(m_searchLocationAct); /// @todo remove when not needed!
     m_viewMenu->setObjectName(tr("Menu"));
 }
 
@@ -505,15 +565,9 @@ void MainWindow::drawFullScreenButton(const QSize &size)
 {
     qDebug() << __PRETTY_FUNCTION__ << size.width() << "x" << size.height();
 
-    if(m_fullScreenButton) {
-        if(m_loggedIn) {
-            m_fullScreenButton->move(size.width() - m_fullScreenButton->size().width()
-                                     - PANEL_PEEK_AMOUNT,
-                                     size.height() - m_fullScreenButton->size().height());
-        } else {
-            m_fullScreenButton->move(size.width() - m_fullScreenButton->size().width(),
-                                     size.height() - m_fullScreenButton->size().height());
-        }
+    if (m_fullScreenButton) {
+        m_fullScreenButton->move(size.width() - m_fullScreenButton->size().width(),
+                                 size.height() - m_fullScreenButton->size().height());
     }
 }
 
@@ -523,9 +577,8 @@ void MainWindow::drawMapScale(const QSize &size)
 
     const int LEFT_SCALE_MARGIN = 10;
     const int BOTTOM_SCALE_MARGIN = 2;
-    qDebug() << __PRETTY_FUNCTION__ << size.width() << "x" << size.height();
 
-    m_mapScale->move(PANEL_PEEK_AMOUNT + LEFT_SCALE_MARGIN,
+    m_mapScale->move(LEFT_SCALE_MARGIN,
                      size.height() - m_mapScale->size().height() - BOTTOM_SCALE_MARGIN);
 }
 
@@ -534,20 +587,10 @@ void MainWindow::drawOsmLicense(const QSize &size)
     qDebug() << __PRETTY_FUNCTION__ << size.width() << "x" << size.height();
 
     m_osmLicense->move(size.width() - m_osmLicense->fontMetrics().width(OSM_LICENSE)
-                       - PANEL_PEEK_AMOUNT,
+                       - PANEL_BAR_WIDTH,
                        size.height() - m_osmLicense->fontMetrics().height());
 }
 
-void MainWindow::drawOwnLocationCrosshair(const QSize &size)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    if (m_ownLocationCrosshair != 0) {
-        m_ownLocationCrosshair->move(size.width()/2 - m_ownLocationCrosshair->pixmap()->width()/2,
-                            size.height()/2 - m_ownLocationCrosshair->pixmap()->height()/2);
-    }
-}
-
 void MainWindow::errorDialogFinished(int status)
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -737,32 +780,34 @@ void MainWindow::loginUsingCookies()
 
 }
 
-void MainWindow::openSettingsDialog()
+void MainWindow::mapCenterHorizontalShiftingChanged(int shifting)
 {
-    qDebug() << __PRETTY_FUNCTION__;
+    m_mapCenterHorizontalShifting = shifting;
+    moveCrosshair();
+}
 
-    SettingsDialog *settingsDialog = new SettingsDialog(this);
-    settingsDialog->enableSituareSettings((m_loggedIn && m_gpsToggleAct->isChecked()));
-    connect(settingsDialog, SIGNAL(accepted()), this, SLOT(settingsDialogAccepted()));
+void MainWindow::moveCrosshair()
+{
+    qDebug() << __PRETTY_FUNCTION__;
 
-    settingsDialog->show();
+    if (m_crosshair) {
+        int mapHeight = m_mapView->size().height();
+        int mapWidth = m_mapView->size().width();
+        m_crosshair->move(mapWidth / 2 - m_crosshair->pixmap()->width() / 2
+                          - m_mapCenterHorizontalShifting,
+                          mapHeight / 2 - m_crosshair->pixmap()->height() / 2);
+    }
 }
 
-void MainWindow::readAutomaticLocationUpdateSettings()
+void MainWindow::openSettingsDialog()
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    QSettings settings(DIRECTORY_NAME, FILE_NAME);
-    bool automaticUpdateEnabled = settings.value(SETTINGS_AUTOMATIC_UPDATE_ENABLED, false).toBool();
-    QTime automaticUpdateInterval = settings.value(SETTINGS_AUTOMATIC_UPDATE_INTERVAL, QTime())
-                                      .toTime();
+    SettingsDialog *settingsDialog = new SettingsDialog(this);
+    settingsDialog->enableSituareSettings((m_loggedIn && m_gpsToggleAct->isChecked()));
+    connect(settingsDialog, SIGNAL(accepted()), this, SLOT(settingsDialogAccepted()));
 
-    if (automaticUpdateEnabled && automaticUpdateInterval.isValid()) {
-        QTime time;
-        emit enableAutomaticLocationUpdate(true, time.msecsTo(automaticUpdateInterval));
-    } else {
-        emit enableAutomaticLocationUpdate(false);
-    }
+    settingsDialog->show();
 }
 
 void MainWindow::queueDialog(QDialog *dialog)
@@ -783,6 +828,23 @@ void MainWindow::queueDialog(QDialog *dialog)
         showInformationBox();
 }
 
+void MainWindow::readAutomaticLocationUpdateSettings()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    QSettings settings(DIRECTORY_NAME, FILE_NAME);
+    bool automaticUpdateEnabled = settings.value(SETTINGS_AUTOMATIC_UPDATE_ENABLED, false).toBool();
+    QTime automaticUpdateInterval = settings.value(SETTINGS_AUTOMATIC_UPDATE_INTERVAL, QTime())
+                                      .toTime();
+
+    if (automaticUpdateEnabled && automaticUpdateInterval.isValid()) {
+        QTime time;
+        emit enableAutomaticLocationUpdate(true, time.msecsTo(automaticUpdateInterval));
+    } else {
+        emit enableAutomaticLocationUpdate(false);
+    }
+}
+
 void MainWindow::saveCookies()
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -804,6 +866,18 @@ void MainWindow::saveCookies()
     settings.setValue(COOKIES, list);
 }
 
+void MainWindow::setCrosshairVisibility(bool visibility)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    if (visibility) {
+        m_crosshair->show();
+        moveCrosshair();
+    } else {
+        m_crosshair->hide();
+    }
+}
+
 void MainWindow::setGPSButtonEnabled(bool enabled)
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -825,18 +899,6 @@ void MainWindow::setMapViewScene(QGraphicsScene *scene)
     m_mapView->setScene(scene);
 }
 
-void MainWindow::setOwnLocationCrosshairVisibility(bool visibility)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    if (visibility) {
-        m_ownLocationCrosshair->show();
-        drawOwnLocationCrosshair(m_viewPortSize);
-    } else {
-        m_ownLocationCrosshair->hide();
-    }
-}
-
 void MainWindow::settingsDialogAccepted()
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -851,13 +913,6 @@ void MainWindow::setUsername(const QString &username)
     m_email = username;
 }
 
-void MainWindow::setViewPortSize(const QSize &size)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    m_viewPortSize = size;
-}
-
 void MainWindow::showEnableAutomaticUpdateLocationDialog(const QString &text)
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -872,16 +927,6 @@ void MainWindow::showEnableAutomaticUpdateLocationDialog(const QString &text)
     m_automaticUpdateLocationDialog->show();
 }
 
-void MainWindow::toggleFullScreen()
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    if(windowState() == Qt::WindowNoState)
-        showFullScreen();
-    else
-        showNormal();
-}
-
 void MainWindow::showErrorInformationBox()
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -911,19 +956,19 @@ void MainWindow::showPanels()
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    drawFullScreenButton(m_viewPortSize);
+///< @todo check how this is called and can this method be removed
 
-    if(m_loggedIn) {
-        if(!m_friendsListPanel->isVisible()) {
-            m_friendsListPanel->show();
-            m_friendsListPanelSidebar->show();
-        }
+//    if(m_loggedIn) {
+//        if(!m_friendsListPanel->isVisible()) {
+//            m_friendsListPanel->show();
+//            m_friendsListPanelSidebar->show();
+//        }
 
-        if(!m_userPanel->isVisible()) {
-            m_userPanel->show();
-            m_userPanelSidebar->show();
-        }
-    }
+//        if(!m_userPanel->isVisible()) {
+//            m_userPanel->show();
+//            m_userPanelSidebar->show();
+//        }
+//    }
 }
 
 void MainWindow::startLocationSearch()
@@ -950,6 +995,16 @@ void MainWindow::startLoginProcess()
     queueDialog(loginDialog);
 }
 
+void MainWindow::toggleFullScreen()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    if(windowState() == Qt::WindowNoState)
+        showFullScreen();
+    else
+        showNormal();
+}
+
 void MainWindow::toggleProgressIndicator(bool value)
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -974,14 +1029,17 @@ void MainWindow::updateItemVisibility()
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    if(!m_loggedIn) {
-        m_friendsListPanel->closePanel();
-        m_friendsListPanel->hide();
-        m_friendsListPanelSidebar->hide();
-        m_userPanel->closePanel();
-        m_userPanel->hide();
-        m_userPanelSidebar->hide();
-    }
+///< @todo can this be removed?
+
+//    if(!m_loggedIn) {
+//        m_friendsListPanel->closePanel();
+//        m_friendsListPanel->hide();
+//        m_friendsListPanelSidebar->hide();
+
+//        m_userPanel->closePanel();
+//        m_userPanel->hide();
+//        m_userPanelSidebar->hide();
+//    }
 }
 
 const QString MainWindow::username()