Moved "route to" button in routing panel to context button area
[situare] / src / ui / routingpanel.h
index 66bbcfa..bb433f5 100644 (file)
 
 #include <QtGui>
 
+#include "panelbase.h"
+
 class ExtendedListItemDelegate;
 class GeoCoordinate;
-class LocationListView;
+class ImageButton;
 class Location;
+class LocationListView;
+class Route;
+class RouteWaypointListView;
 
 /**
  * @brief Class for sliding routing panel
  *
  * @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
  */
-class RoutingPanel : public QWidget
+class RoutingPanel : public PanelBase
 {
     Q_OBJECT
 
@@ -47,15 +52,57 @@ public:
     RoutingPanel(QWidget *parent = 0);
 
 /*******************************************************************************
+ * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
+ ******************************************************************************/
+protected:
+    /**
+    * @brief Re-implemented from QWidget::hideEvent()
+    *
+    * Calls clearListsSelections()
+    *
+    * @param event
+    */
+    void hideEvent(QHideEvent *event);
+
+/*******************************************************************************
  * MEMBER FUNCTIONS AND SLOTS
  ******************************************************************************/
 private slots:
     /**
+    * @brief Clears lists' selections.
+    *
+    * Does call setRouteButtonDisabled().
+    */
+    void clearListsSelections();
+
+    /**
     * @brief Populates location list view.
     *
-    * @param result list of Location objects
+    * @param locations list of Location objects
+    */
+    void populateLocationListView(const QList<Location> &locations);
+
+    /**
+    * @brief Routes to selected location.
+    *
+    * Emits routeToLocation if location is selected from list.
+    */
+    void routeToSelectedLocation();
+
+    /**
+    * @brief Sets route to the panel.
+    *
+    * Appends route waypoint list with route segments.
+    * @param route Route item containing parsed route details
     */
-    void populateLocationListView(QList<Location> &locations);
+    void setRoute(Route &route);
+
+    /**
+    * @brief Sets route button disabled.
+    *
+    * Disabled if there isn't any list item selected.
+    */
+    void setRouteButtonDisabled();
 
 /*******************************************************************************
  * SIGNALS
@@ -67,16 +114,47 @@ signals:
     * @param swBound south-west bound GeoCoordinate
     * @param neBound north-east bound GeoCoordinate
     */
-    void locationItemClicked(GeoCoordinate &swBound, GeoCoordinate &neBound);
+    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);
+
+    /**
+     * @brief Signal for requesting a panel to be opened
+     *
+     * @param widget Pointer to the widget that emitted the signal
+     */
+    void showPanelRequested(QWidget *widget);
 
 /*******************************************************************************
  * DATA MEMBERS
  ******************************************************************************/
 private:
-    QLabel *m_locationListLabel;          ///< Location list label
-    QWidget *m_locationListHeaderWidget;  ///< Location list header widget
+    QLabel *m_locationListLabel;            ///< Location list label
+
+    QPushButton *m_searchLocationButton;    ///< Search location button
+
+    QWidget *m_locationListHeaderWidget;    ///< Location list header widget
 
+    ImageButton *m_routeButton;             ///< Route to location button
     LocationListView *m_locationListView;   ///< Location list view
+    RouteWaypointListView *m_routeWaypointListView; ///< Route waypoint list view
 };
 
 #endif // ROUTINGPANEL_H