Merge branch 'master' into disable_panels
[situare] / src / ui / mainwindow.cpp
index 3766c2c..d5aadae 100644 (file)
@@ -40,6 +40,7 @@
 #include "friendlistpanel.h"
 #include "fullscreenbutton.h"
 #include "indicatorbuttonpanel.h"
+#include "locationsearchpanel.h"
 #include "logindialog.h"
 #include "mapscale.h"
 #include "panelcommon.h"
@@ -251,6 +252,25 @@ void MainWindow::buildInformationBox(const QString &message, bool modal)
     queueDialog(msgBox);
 }
 
+void MainWindow::buildLocationSearchPanel()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    m_locationSearchPanel = new LocationSearchPanel(this);
+
+    connect(this, SIGNAL(locationDataParsed(const QList<Location>&)),
+            m_locationSearchPanel, SLOT(populateLocationListView(const QList<Location>&)));
+
+    connect(m_locationSearchPanel, SIGNAL(locationItemClicked(const GeoCoordinate&, const GeoCoordinate&)),
+            this, SIGNAL(locationItemClicked(const GeoCoordinate&, const GeoCoordinate&)));
+
+    connect(m_locationSearchPanel, SIGNAL(routeToLocation(const GeoCoordinate&)),
+            this, SIGNAL(routeTo(const GeoCoordinate&)));
+
+    connect(m_locationSearchPanel, SIGNAL(requestSearchLocation()),
+            this, SLOT(startLocationSearch()));
+}
+
 void MainWindow::buildMap()
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -321,13 +341,17 @@ void MainWindow::buildPanels()
 
     buildUserInfoPanel();
     buildFriendListPanel();
+    buildLocationSearchPanel();
     buildRoutingPanel();
 
     m_tabbedPanel = new TabbedPanel(this);
+    
     m_situareTabsIndexes.append(
             m_tabbedPanel->addTab(m_userInfoPanel, QIcon(":/res/images/user_info.png")));
     m_situareTabsIndexes.append(
             m_tabbedPanel->addTab(m_friendsListPanel, QIcon(":/res/images/friend_list.png")));
+
+    m_tabbedPanel->addTab(m_locationSearchPanel, QIcon(":/res/images/compass.png"));
     m_tabbedPanel->addTab(m_routingPanel, QIcon(":/res/images/routing.png"));
 
     connect(m_mapView, SIGNAL(viewResized(QSize)),
@@ -367,14 +391,8 @@ void MainWindow::buildRoutingPanel()
 
     m_routingPanel = new RoutingPanel(this);
 
-    connect(this, SIGNAL(locationDataParsed(const QList<Location>&)),
-            m_routingPanel, SLOT(populateLocationListView(const QList<Location>&)));
-
-    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(m_routingPanel, SIGNAL(routeToCursor()),
+            this, SIGNAL(routeToCursor()));
 
     connect(this, SIGNAL(routeParsed(Route&)),
             m_routingPanel, SLOT(setRoute(Route&)));
@@ -382,9 +400,6 @@ void MainWindow::buildRoutingPanel()
     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()));
 }