2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Kaj Wallin - kaj.wallin@ixonos.com
6 Henri Lampela - henri.lampela@ixonos.com
7 Pekka Nissinen - pekka.nissinen@ixonos.com
8 Jussi Laitinen - jussi.laitinen@ixonos.com
9 Sami Rämö - sami.ramo@ixonos.com
11 Situare is free software; you can redistribute it and/or
12 modify it under the terms of the GNU General Public License
13 version 2 as published by the Free Software Foundation.
15 Situare is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with Situare; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
26 #ifndef FRIENDLISTPANEL_H
27 #define FRIENDLISTPANEL_H
29 #include "panelbase.h"
35 class FriendListItemDelegate;
42 * @brief Class for sliding friends list panel
44 * @author Kaj Wallin - kaj.wallin (at) ixonos.com
45 * @author Henri Lampela - henri.lampela (at) ixonos.com
46 * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
47 * @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
48 * @author Sami Rämö - sami.ramo (at) ixonos.com
50 class FriendListPanel : public PanelBase
56 * @brief Default constructor
60 FriendListPanel(QWidget *parent = 0);
62 /*******************************************************************************
63 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
64 ******************************************************************************/
67 * @brief Re-implemented from QWidget::hideEvent()
69 * Calls updateKeyboardGrabbing() and clearFriendGroupFiltering().
73 void hideEvent(QHideEvent *event);
76 * @brief Re-implemented from QWidget::showEvent()
78 * Calls updateKeyboardGrabbing().
82 void showEvent(QShowEvent *event);
84 /*******************************************************************************
85 * MEMBER FUNCTIONS AND SLOTS
86 ******************************************************************************/
89 * @brief Slot to update friend item's image
93 void friendImageReady(User *user);
96 * @brief Slot to refresh friends list
100 void friendInfoReceived(QList<User *> &friendList);
104 * @brief Set visibility for filtering text field and clearing button
106 * @param visible True if items should be visible, false if not
108 void setFilteringLayoutVisibility(bool visible);
111 * @brief Takes care of grabbing and releasing the keyboard when required
113 * Keyboard is grabbed when MainWindow it the topmost window, panel tab is open and
114 * FriendListPanel is visible. Releasing is done if the MainWindow is not the topmost window
115 * or panel tab is not open or FriendListPanel is invisible.
117 void updateKeyboardGrabbing();
121 * @brief Called when any of the panel tabs is closed
123 * Does call clearFriendGroupFiltering().
125 * Calls updateKeyboardGrabbing() for releasing the grabbing when FriendListPanel is closed, not
126 * changed to other panel. In this case the hideEvent() is not triggered.
128 void anyPanelClosed();
131 * @brief Called when any of the panel tabs is opened
133 * Calls updateKeyboardGrabbing() for grabbing the keyboard when FriendListPanel is closed and
134 * is the last selected tab. In this case the showEvent() is not triggered.
136 void anyPanelOpened();
139 * @brief Slot for clearing the filtering
141 * Clears friend group (or single friend) filtering and calls clearTextFiltering().
143 void clearFiltering();
146 * @brief Slot for clearing the text based filtering.
148 * Does clear only the text based filtering. Friend group based filtering is not affected.
150 void clearTextFiltering();
153 * @brief Updates the filtering when filtering text value is changed
155 * Filtering UI elements are invoked when the text becomes not empty and hidden when text
158 * Sets the new filtering text.
160 * @param text New text value
162 void filterTextChanged(const QString &text);
165 * @brief Routes to selected friend.
167 * Emits routeToFriend if friend is selected from list.
169 void routeToSelectedFriend();
172 * @brief Sets route button disabled.
174 * Disabled if there isn't any list item selected.
176 void setRouteButtonDisabled();
179 * @brief Slot to show friends in list.
181 * Shows only friends that are on userIDs list
182 * @param userIDs list of user ID's
184 void showFriendsInList(const QList<QString> &userIDs);
187 * @brief Called when topmost window is changed
189 * Does set m_mainWindowIsTopmost and calls updateKeyboardGrabbing()
191 * @param mainWindowIsTopmost True if MainWindow is the topmost one
193 void topmostWindowChanged(bool mainWindowIsTopmost);
195 /*******************************************************************************
197 ******************************************************************************/
200 * @brief Signal for friend finding
202 * @param coordinates Target coordinate
204 void findFriend(const GeoCoordinate &coordinates);
207 * @brief Signal for routing to friend.
209 * @param coordinates friend's geo coordinates
211 void routeToFriend(const GeoCoordinate &coordinates);
213 /*******************************************************************************
215 ******************************************************************************/
217 bool m_mainWindowIsTopmost; ///< Is the MainWindow the topmost one
218 bool m_somePanelIsOpen; ///< Is any panel tab open
220 QLabel *m_headerLabel; ///< Show how many friends are selected
222 QLineEdit *m_filterField; ///< Text field for the filter text
224 QPushButton *m_clearTextFilteringButton; ///< Button for clearing the text filtering
226 QWidget *m_headerWidget; ///< Friend list header widget
228 FriendListView *m_friendListView; ///< Friend list view
229 ImageButton *m_clearGroupFilteringButton; ///< Button for clearing friend group filtering
230 ImageButton *m_routeButton; ///< Button for routing to selected friend
233 #endif // FRIENDLISTPANEL_H