Merge branch 'master' into new_panels
[situare] / src / ui / mainwindow.cpp
index a32659e..446e952 100644 (file)
@@ -7,6 +7,7 @@
       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
@@ -34,7 +35,6 @@
 #include "error.h"
 #include "friendlistpanel.h"
 #include "fullscreenbutton.h"
-#include "indicatorbutton.h"
 #include "logindialog.h"
 #include "mapscale.h"
 #include "panelcommon.h"
@@ -43,6 +43,7 @@
 #include "settingsdialog.h"
 #include "userinfopanel.h"
 #include "zoombuttonpanel.h"
+#include "indicatorbuttonpanel.h"
 
 #include "mainwindow.h"
 
@@ -96,8 +97,8 @@ MainWindow::MainWindow(QWidget *parent)
         m_osmLicense->stackUnder(m_zoomButtonPanel);
     }
     m_ownLocationCrosshair->stackUnder(m_osmLicense);
-    m_indicatorButton->stackUnder(m_ownLocationCrosshair);
-    m_mapScale->stackUnder(m_indicatorButton);
+    m_indicatorButtonPanel->stackUnder(m_ownLocationCrosshair);
+    m_mapScale->stackUnder(m_indicatorButtonPanel);
     m_mapView->stackUnder(m_mapScale);
 
     grabZoomKeys(true);
@@ -169,19 +170,22 @@ void MainWindow::buildFriendListPanel()
             m_friendsListPanel, SLOT(friendImageReady(User*)));
 }
 
-void MainWindow::buildIndicatorButton()
+void MainWindow::buildIndicatorButtonPanel()
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    m_indicatorButton = new IndicatorButton(this);
+    m_indicatorButtonPanel = new IndicatorButtonPanel(this);
 
-    connect(m_indicatorButton, SIGNAL(autoCenteringTriggered(bool)),
+    connect(m_indicatorButtonPanel, SIGNAL(autoCenteringTriggered(bool)),
         this, SIGNAL(autoCenteringTriggered(bool)));
 
     connect(m_mapView, SIGNAL(viewResized(QSize)),
-            m_indicatorButton, SLOT(screenResized(QSize)));
+            m_indicatorButtonPanel, SLOT(screenResized(QSize)));
 
-    connect(m_indicatorButton, SIGNAL(draggingModeTriggered()),
+    connect(this, SIGNAL(directionIndicatorValuesUpdate(qreal, qreal, bool)),
+            m_indicatorButtonPanel, SIGNAL(directionIndicatorValuesUpdate(qreal, qreal, bool)));
+
+    connect(m_indicatorButtonPanel, SIGNAL(draggingModeTriggered()),
             this, SIGNAL(draggingModeTriggered()));
 }
 
@@ -242,7 +246,7 @@ void MainWindow::buildMap()
     buildOsmLicense();
     buildManualLocationCrosshair();
     buildFullScreenButton();
-    buildIndicatorButton();
+    buildIndicatorButtonPanel();
     buildMapScale();
 
     connect(m_mapView, SIGNAL(viewScrolled(SceneCoordinate)),
@@ -801,8 +805,7 @@ void MainWindow::setIndicatorButtonEnabled(bool enabled)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    m_indicatorButton->setChecked(enabled);
-
+    m_indicatorButtonPanel->setIndicatorButtonEnabled(enabled);
 }
 
 void MainWindow::setMapViewScene(QGraphicsScene *scene)