fd87bf2192ccf3b9dc09ad0c8518d36f8a9b8e27
[situare] / src / ui / locationsearchpanel.h
1 /*
2     Situare - A location system for Facebook
3     Copyright (C) 2010  Ixonos Plc. Authors:
4
5         Jussi Laitinen - jussi.laitinen@ixonos.com
6         Sami Rämö - sami.ramo@ixonos.com
7
8     Situare is free software; you can redistribute it and/or
9     modify it under the terms of the GNU General Public License
10     version 2 as published by the Free Software Foundation.
11
12     Situare is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.
16
17     You should have received a copy of the GNU General Public License
18     along with Situare; if not, write to the Free Software
19     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
20     USA.
21 */
22
23 #ifndef LOCATIONSEARCHPANEL_H
24 #define LOCATIONSEARCHPANEL_H
25
26 #include <QtGui>
27
28 #include "panelbase.h"
29
30 class ExtendedListItemDelegate;
31 class GeoCoordinate;
32 class ImageButton;
33 class Location;
34 class LocationListView;
35
36 /**
37  * @brief Location search panel
38  *
39  * @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
40  * @author Sami Rämö - sami.ramo (at) ixonos.com
41  */
42 class LocationSearchPanel : public PanelBase
43 {
44     Q_OBJECT
45
46 public:
47     /**
48      * @brief Default constructor
49      *
50      * @param parent
51      */
52     LocationSearchPanel(QWidget *parent = 0);
53
54 /*******************************************************************************
55  * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
56  ******************************************************************************/
57 protected:
58     /**
59     * @brief Re-implemented from QWidget::hideEvent()
60     *
61     * Calls clearListsSelections()
62     *
63     * @param event
64     */
65     void hideEvent(QHideEvent *event);
66
67 /*******************************************************************************
68  * MEMBER FUNCTIONS AND SLOTS
69  ******************************************************************************/
70 private:
71     /**
72     * @brief Set text for header
73     *
74     * @param count Search result count
75     */
76     void setHeaderText(int count);
77
78 private slots:
79     /**
80     * @brief Clears lists' selections.
81     *
82     * Does call setRouteButtonDisabled().
83     */
84     void clearListsSelections();
85
86     /**
87     * @brief Populates location list view.
88     *
89     * @param locations list of Location objects
90     */
91     void populateLocationListView(const QList<Location> &locations);
92
93     /**
94     * @brief Routes to selected location.
95     *
96     * Emits routeToLocation if location is selected from list.
97     */
98     void routeToSelectedLocation();
99
100     /**
101     * @brief Sets route button disabled.
102     *
103     * Disabled if there isn't any list item selected.
104     */
105     void setRouteButtonDisabled();
106
107 /*******************************************************************************
108  * SIGNALS
109  ******************************************************************************/
110 signals:
111     /**
112     * @brief Signal for location item clicked.
113     *
114     * @param swBound south-west bound GeoCoordinate
115     * @param neBound north-east bound GeoCoordinate
116     */
117     void locationItemClicked(const GeoCoordinate &swBound, const GeoCoordinate &neBound);
118
119     /**
120     * @brief Signal for requesting searching location.
121     */
122     void requestSearchLocation();
123
124     /**
125     * @brief Signal for routing to location.
126     *
127     * @param coordinates location's geo coordinates
128     */
129     void routeToLocation(const GeoCoordinate &coordinates);
130
131     /**
132     * @brief Signal for route waypoint item clicked.
133     *
134     * @param coordinate waypoint item's coordinate
135     */
136     void routeWaypointItemClicked(const GeoCoordinate &coordinate);
137
138 /*******************************************************************************
139  * DATA MEMBERS
140  ******************************************************************************/
141 private:
142     QLabel *m_resultsLabel;                 ///< Location list label
143
144     ImageButton *m_routeButton;             ///< Route to location button
145     LocationListView *m_locationListView;   ///< Search results list view
146 };
147
148 #endif // LOCATIONSEARCHPANEL_H