Documenting, clean-up
[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  * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
58  ******************************************************************************/
59 protected:
60     /**
61     * @brief Used for grabbing the keyboard after the text field is fully initiated.
62     *
63     * @param event
64     */
65     void showEvent(QShowEvent *event);
66
67 /*******************************************************************************
68  * MEMBER FUNCTIONS AND SLOTS
69  ******************************************************************************/
70 public slots:
71     /**
72     * @brief Slot to update friend item's image
73     *
74     * @param user Friend
75     */
76     void friendImageReady(User *user);
77
78     /**
79     * @brief Slot to refresh friends list
80     *
81     * @param friendList
82     */
83     void friendInfoReceived(QList<User *> &friendList);
84
85 private:
86     /**
87     * @brief Set visibility for filtering related UI elements
88     *
89     * @param visible True if items should be visible, false if not
90     */
91     void setFilteringLayoutVisible(bool visible);
92
93 private slots:
94     /**
95     * @brief Slot to clear friend list filter.
96     */
97     void clearFriendListFilter();
98
99     /**
100     * @brief Slot for clearing the friend list filtering.
101     */
102     void clearFiltering();
103
104     /**
105     * @brief Set filtering UI elements visibility based on the filtering text value
106     *
107     * Filtering UI elements are invoked when the text becomes not empty and hidden when text
108     * becomes empty.
109     *
110     * @param text New text value
111     */
112     void filterTextChanged(const QString &text);
113
114     /**
115     * @brief Slot to show friends in list.
116     *
117     * Shows only friends that are on userIDs list.
118     * @param userIDs list of user ID's
119     */
120     void showFriendsInList(const QList<QString> &userIDs);
121
122 /*******************************************************************************
123  * SIGNALS
124  ******************************************************************************/
125 signals:
126     /**
127     * @brief Signal for friend finding.
128     *
129     * @param coordinates Target coordinate
130     */
131     void findFriend(const GeoCoordinate &coordinates);
132
133 /*******************************************************************************
134  * DATA MEMBERS
135  ******************************************************************************/
136 private:
137     QLabel *m_friendListLabel;          ///< Friend list label
138     QLineEdit *m_filterField;           ///< Text field for the filter text
139     QPushButton *m_clearFilterButton;   ///< Button to clear list filtering
140     QPushButton *m_filterClearButton;   ///< Button for clearing the filtering
141     QWidget *m_friendListHeaderWidget;  ///< Friend list header widget
142
143     FriendListItemDelegate *m_friendListItemDelegate;   ///< Friend list item delegate
144     ListView *m_friendListView;         ///< Friend list view
145 };
146
147 #endif // FRIENDLISTPANEL_H