bb08f114d97bca36a20720094026058a303a7744
[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     void setHeaderText(int count);
72
73 private slots:
74     /**
75     * @brief Clears lists' selections.
76     *
77     * Does call setRouteButtonDisabled().
78     */
79     void clearListsSelections();
80
81     /**
82     * @brief Populates location list view.
83     *
84     * @param locations list of Location objects
85     */
86     void populateLocationListView(const QList<Location> &locations);
87
88     /**
89     * @brief Routes to selected location.
90     *
91     * Emits routeToLocation if location is selected from list.
92     */
93     void routeToSelectedLocation();
94
95     /**
96     * @brief Sets route button disabled.
97     *
98     * Disabled if there isn't any list item selected.
99     */
100     void setRouteButtonDisabled();
101
102 /*******************************************************************************
103  * SIGNALS
104  ******************************************************************************/
105 signals:
106     /**
107     * @brief Signal for location item clicked.
108     *
109     * @param swBound south-west bound GeoCoordinate
110     * @param neBound north-east bound GeoCoordinate
111     */
112     void locationItemClicked(const GeoCoordinate &swBound, const GeoCoordinate &neBound);
113
114     /**
115     * @brief Signal for requesting searching location.
116     */
117     void requestSearchLocation();
118
119     /**
120     * @brief Signal for routing to location.
121     *
122     * @param coordinates location's geo coordinates
123     */
124     void routeToLocation(const GeoCoordinate &coordinates);
125
126     /**
127     * @brief Signal for route waypoint item clicked.
128     *
129     * @param coordinate waypoint item's coordinate
130     */
131     void routeWaypointItemClicked(const GeoCoordinate &coordinate);
132
133 /*******************************************************************************
134  * DATA MEMBERS
135  ******************************************************************************/
136 private:
137     QLabel *m_resultsLabel;                 ///< Location list label
138
139     ImageButton *m_routeButton;             ///< Route to location button
140     LocationListView *m_locationListView;   ///< Search results list view
141 };
142
143 #endif // LOCATIONSEARCHPANEL_H