Implemented text field for filtering the friend list
[situare] / src / ui / friendlistpanel.h
1  /*
2     Situare - A location system for Facebook
3     Copyright (C) 2010  Ixonos Plc. Authors:
4
5         Kaj Wallin - kaj.wallin@ixonos.com
6         Henri Lampela - henri.lampela@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 FRIENDLISTPANEL_H
24 #define FRIENDLISTPANEL_H
25
26 #include <QtGui>
27
28 #include "sidepanel.h"
29
30 class QLabel;
31 class QWidget;
32
33 class FriendListItemDelegate;
34 class GeoCoordinate;
35 class ListView;
36 class User;
37
38 /**
39 * @brief Class for sliding friends list panel
40 *
41 * @author Kaj Wallin - kaj.wallin (at) ixonos.com
42 * @class FriendListPanel friendlistpanel.h "ui/friendlistpanel.h"
43 */
44 class FriendListPanel : public SidePanel
45 {
46     Q_OBJECT
47
48 public:
49     /**
50     * @brief Default constructor
51     *
52     * @param parent
53     */
54     FriendListPanel(QWidget *parent = 0);
55
56 /*******************************************************************************
57  * MEMBER FUNCTIONS AND SLOTS
58  ******************************************************************************/
59 public slots:
60     /**
61     * @brief Slot to update friend item's image
62     *
63     * @param user Friend
64     */
65     void friendImageReady(User *user);
66
67     /**
68     * @brief Slot to refresh friends list
69     *
70     * @param friendList
71     */
72     void friendInfoReceived(QList<User *> &friendList);
73
74 private slots:
75     /**
76     * @brief Slot to clear friend list filter.
77     */
78     void clearFriendListFilter();
79
80     void filterReturnPressed();
81
82     void filterTextChanged(const QString &text);
83
84     /**
85     * @brief Slot to show friends in list.
86     *
87     * Shows only friends that are on userIDs list.
88     * @param userIDs list of user ID's
89     */
90     void showFriendsInList(const QList<QString> &userIDs);
91
92 /*******************************************************************************
93  * SIGNALS
94  ******************************************************************************/
95 signals:
96     /**
97     * @brief Signal for friend finding.
98     *
99     * @param coordinates Target coordinate
100     */
101     void findFriend(const GeoCoordinate &coordinates);
102
103 /*******************************************************************************
104  * DATA MEMBERS
105  ******************************************************************************/
106 private:
107     QWidget *m_friendListHeaderWidget;  ///< Friend list header widget
108     QLabel *m_friendListLabel;          ///< Friend list label
109     QPushButton *m_clearFilterButton;   ///< Button to clear list filtering
110     ListView *m_friendListView;         ///< Friend list view
111     FriendListItemDelegate *m_friendListItemDelegate;   ///< Friend list item delegate
112
113     QLineEdit *m_filterField;
114 };
115
116 #endif // FRIENDLISTPANEL_H