Moved location search button from menu to routing panel.
authorJussi Laitinen <jupe@l3l7588.ixonos.local>
Mon, 16 Aug 2010 08:54:56 +0000 (11:54 +0300)
committerJussi Laitinen <jupe@l3l7588.ixonos.local>
Mon, 16 Aug 2010 08:54:56 +0000 (11:54 +0300)
src/ui/mainwindow.cpp
src/ui/mainwindow.h
src/ui/routewaypointlistitem.cpp
src/ui/routewaypointlistitem.h
src/ui/routingpanel.cpp
src/ui/routingpanel.h

index abdd148..c011f6f 100644 (file)
@@ -357,6 +357,9 @@ void MainWindow::buildRoutingPanel()
 
     connect(m_routingPanel, SIGNAL(routeWaypointItemClicked(GeoCoordinate)),
             this, SIGNAL(centerToCoordinates(GeoCoordinate)));
+
+    connect(m_routingPanel, SIGNAL(requestSearchLocation()),
+            this, SLOT(startLocationSearch()));
 }
 
 void MainWindow::buildUserInfoPanel()
@@ -480,17 +483,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"));
 }
 
index 0c8d034..39d7cce 100644 (file)
@@ -667,7 +667,6 @@ private:
     QAction *m_gpsToggleAct;                ///< Action to trigger gps toggle
     QAction *m_loginAct;                    ///< Action to Login/Logout
     QAction *m_toSettingsAct;               ///< Action to trigger switch to settings dialog
-    QAction *m_searchLocationAct;           /// @todo this is temporary, remove when not needed!
 
     QLabel *m_osmLicense;                   ///< Label for Open Street Map license
     QLabel *m_ownLocationCrosshair;         ///< Label that show ownLocationCrosshair
index 80608f4..10ca7c4 100644 (file)
@@ -69,7 +69,7 @@ void RouteWaypointListItem::setTurnTypeImage(const QString &turnType)
     } else if (turnType == "TU") {
         setImage(AvatarImage::create(QPixmap(":/res/images/arrow_turn_u_turn.png"),
                                      AvatarImage::Small));
-    } else if (turnType == "EXIT") {
+    } else if (turnType.startsWith("EXIT")) {
         setImage(AvatarImage::create(QPixmap(":/res/images/arrow_turn_roundabout.png"),
                                      AvatarImage::Small));
     } else
index 6c5fb72..ebb7611 100644 (file)
@@ -61,12 +61,17 @@ public:
     * @brief Set route waypoint data for this item.
     *
     * @param routeSegment RouteSegment data
-    * @param coordinates GeoCoordinate
+    * @param coordinate GeoCoordinate
     */
     void setRouteWaypointData(const RouteSegment &routeSegment,
                               const GeoCoordinate &coordinate);
 
 private:
+    /**
+    * @brief Sets item's turn type image.
+    *
+    * @param turnType turn type defined in RouteSegment class.
+    */
     void setTurnTypeImage(const QString &turnType);
 
 /******************************************************************************
index 29257b3..4369909 100644 (file)
@@ -27,7 +27,10 @@ RoutingPanel::RoutingPanel(QWidget *parent)
     QVBoxLayout *listViewLayout = new QVBoxLayout;
     listViewLayout->setContentsMargins(PANEL_MARGIN_LEFT, 0, PANEL_MARGIN_RIGHT, 0);
 
+    m_searchLocationButton = new QPushButton("Search location");
+
     m_routeButton = new QPushButton("Route to location");
+    m_routeButton->hide();
 
     m_locationListHeaderWidget = new QWidget();
     m_locationListHeaderWidget->setLayout(headerLayout);
@@ -52,6 +55,7 @@ RoutingPanel::RoutingPanel(QWidget *parent)
     listViewLayout->addWidget(m_locationListView);
     listViewLayout->addWidget(m_routeWaypointListView);
 
+    routingLayout->addWidget(m_searchLocationButton);
     routingLayout->addWidget(m_routeButton);
     routingLayout->addWidget(m_locationListHeaderWidget);
     routingLayout->addLayout(listViewLayout);
@@ -66,12 +70,17 @@ RoutingPanel::RoutingPanel(QWidget *parent)
 
     connect(m_routeWaypointListView, SIGNAL(routeWaypointItemClicked(GeoCoordinate)),
             this, SIGNAL(routeWaypointItemClicked(GeoCoordinate)));
+
+    connect(m_searchLocationButton, SIGNAL(clicked()),
+            this, SIGNAL(requestSearchLocation()));
 }
 
 void RoutingPanel::populateLocationListView(const QList<Location> &locations)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
+    m_routeButton->show();
+
     m_locationListHeaderWidget->show();
     m_locationListLabel->setText(tr("Search results: %1").arg(locations.count()));
 
index eb42ab8..7ea34ed 100644 (file)
@@ -87,12 +87,22 @@ signals:
     void locationItemClicked(const GeoCoordinate &swBound, const GeoCoordinate &neBound);
 
     /**
+    * @brief Signal for requesting searching location.
+    */
+    void requestSearchLocation();
+
+    /**
     * @brief Signal for routing to location.
     *
     * @param coordinates location's geo coordinates
     */
     void routeToLocation(const GeoCoordinate &coordinates);
 
+    /**
+    * @brief Signal for route waypoint item clicked.
+    *
+    * @param coordinate waypoint item's coordinate
+    */
     void routeWaypointItemClicked(const GeoCoordinate &coordinate);
 
 /*******************************************************************************
@@ -102,6 +112,7 @@ private:
     QLabel *m_locationListLabel;            ///< Location list label
 
     QPushButton *m_routeButton;             ///< Route to location button
+    QPushButton *m_searchLocationButton;    ///< Search location button
 
     QWidget *m_locationListHeaderWidget;    ///< Location list header widget