Modified TagsDialog.
[situare] / src / ui / meetpeoplepanel.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
7    Situare is free software; you can redistribute it and/or
8    modify it under the terms of the GNU General Public License
9    version 2 as published by the Free Software Foundation.
10
11    Situare is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with Situare; if not, write to the Free Software
18    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
19    USA.
20 */
21
22 #ifndef MEETPEOPLEPANEL_H
23 #define MEETPEOPLEPANEL_H
24
25 #include <QList>
26
27 #include "panelbase.h"
28
29 class QUrl;
30
31 class ExtendedListItemDelegate;
32 class GeoCoordinate;
33 class HeaderListItemDelegate;
34 class ImageButton;
35 class PersonListView;
36 class User;
37
38 class MeetPeoplePanel : public PanelBase
39 {
40     Q_OBJECT
41
42 public:
43     /**
44     * @brief Unit test class
45     */
46     friend class TestMeetPeoplePanel;
47
48     /**
49      * @brief Default constructor
50      *
51      * @param parent
52      */
53     MeetPeoplePanel(QWidget *parent = 0);
54
55 /*******************************************************************************
56  * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
57  ******************************************************************************/
58 protected:
59     /**
60     * @brief Re-implemented from QWidget::hideEvent()
61     *
62     * Calls clear item selection to list.
63     *
64     * @param event
65     */
66     void hideEvent(QHideEvent *event);
67
68 private slots:
69     /**
70     * @brief Called when any of the panel tabs is closed
71     *
72     * Calls clear item selection to list.
73     */
74     void anyPanelClosed();
75
76     /**
77     * @brief Handles list item selection.
78     *
79     * Sets item releated buttons enabled
80     */
81     void listItemSelectionHandler();
82
83     /**
84     * @brief Called when message button is pressed.
85     *
86     * Calls requestMessageDialog with message receiver's ID and name
87     */
88     void messageButtonPressed();
89
90     /**
91     * @brief Sets person's image.
92     *
93     * @param id image ID
94     * @param image image pixmap
95     */
96     void setImage(const QString &id, const QPixmap &image);
97
98     /**
99     * Shows selected friend in friend list
100     *
101     * Emits requestShowFriend with selected friend from list
102     */
103     void showFriend();
104
105     /**
106     * @brief Populates interesting people list view.
107     *
108     * @param friends list of friends
109     * @param others list of other people
110     */
111     void populateInterestingPeopleListView(QList<User> &friends, QList<User> &others);
112
113 private:
114     /**
115     * @brief Inits item delegates for message list view.
116     */
117     void initItemDelegates();
118
119 signals:
120     /**
121      * @brief Signal for person finding
122      *
123      * @param coordinates Target coordinate
124      */
125     void findPerson(const GeoCoordinate &coordinates);
126
127     /**
128     * @brief Requests interesting people from current map viewport.
129     *
130     * Interesting people is defined by people with same tags as user has.
131     */
132     void requestInterestingPeople();
133
134     /**
135     * @brief Requests interesting people search.
136     */
137     void requestInterestingPeopleSearch();
138
139     /**
140     * @brief Requests message dialog.
141     *
142     * @param receiver receiver facebook ID and name
143     */
144     void requestMessageDialog(const QPair<QString, QString> &receiver);
145
146     /**
147     * @brief Requests to show friend in friend list.
148     *
149     * @param userIDs list of friends' user IDs
150     */
151     void requestShowFriend(const QList<QString> &userIDs);
152
153 private:
154     ExtendedListItemDelegate *m_personListItemDelegate;    ///< Person list item delegate
155     HeaderListItemDelegate *m_headerListItemDelegate;       ///< Header list item delegate
156     ImageButton *m_chatButton;                              ///< Chat button
157     ImageButton *m_friendListButton;                        ///< Friend list button
158     PersonListView *m_personListView;                       ///< Interesting people list view
159 };
160
161 #endif // MEETPEOPLEPANEL_H