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
35 class FriendListItemDelegate;
41 * @brief Class for sliding friends list panel
43 * @author Kaj Wallin - kaj.wallin (at) ixonos.com
44 * @author Henri Lampela - henri.lampela (at) ixonos.com
45 * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
46 * @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
47 * @author Sami Rämö - sami.ramo (at) ixonos.com
49 class FriendListPanel : public QWidget
55 * @brief Default constructor
59 FriendListPanel(QWidget *parent = 0);
61 /*******************************************************************************
62 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
63 ******************************************************************************/
66 * @brief Re-implemented from QWidget::hideEvent()
68 * Calls updateKeyboardGrabbing() and clearFriendGroupFiltering().
72 void hideEvent(QHideEvent *event);
75 * @brief Re-implemented from QWidget::showEvent()
77 * Calls updateKeyboardGrabbing().
81 void showEvent(QShowEvent *event);
83 /*******************************************************************************
84 * MEMBER FUNCTIONS AND SLOTS
85 ******************************************************************************/
88 * @brief Slot to update friend item's image
92 void friendImageReady(User *user);
95 * @brief Slot to refresh friends list
99 void friendInfoReceived(QList<User *> &friendList);
103 * @brief Set visibility for filtering text field and clearing button
105 * @param visible True if items should be visible, false if not
107 void setFilteringLayoutVisibility(bool visible);
110 * @brief Takes care of grabbing and releasing the keyboard when required
112 * Keyboard is grabbed when MainWindow it the topmost window, panel tab is open and
113 * FriendListPanel is visible. Releasing is done if the MainWindow is not the topmost window
114 * or panel tab is not open or FriendListPanel is invisible.
116 void updateKeyboardGrabbing();
120 * @brief Called when any of the panel tabs is closed
122 * Does call clearFriendGroupFiltering().
124 * Calls updateKeyboardGrabbing() for releasing the grabbing when FriendListPanel is closed, not
125 * changed to other panel. In this case the hideEvent() is not triggered.
127 void anyPanelClosed();
130 * @brief Called when any of the panel tabs is opened
132 * Calls updateKeyboardGrabbing() for grabbing the keyboard when FriendListPanel is closed and
133 * is the last selected tab. In this case the showEvent() is not triggered.
135 void anyPanelOpened();
138 * @brief Slot for clearing the filtering
140 * Clears friend group (or single friend) filtering and calls clearTextFiltering().
142 void clearFiltering();
145 * @brief Slot for clearing the text based filtering.
147 * Does clear only the text based filtering. Friend group based filtering is not affected.
149 void clearTextFiltering();
152 * @brief Updates the filtering when filtering text value is changed
154 * Filtering UI elements are invoked when the text becomes not empty and hidden when text
157 * Sets the new filtering text.
159 * @param text New text value
161 void filterTextChanged(const QString &text);
164 * @brief Routes to selected friend.
166 * Emits routeToFriend if friend is selected from list.
168 void routeToSelectedFriend();
171 * @brief Sets route button disabled.
173 * Disabled if there isn't any list item selected.
175 void setRouteButtonDisabled();
178 * @brief Slot to show friends in list.
180 * Shows only friends that are on userIDs list
181 * @param userIDs list of user ID's
183 void showFriendsInList(const QList<QString> &userIDs);
186 * @brief Called when topmost window is changed
188 * Does set m_mainWindowIsTopmost and calls updateKeyboardGrabbing()
190 * @param mainWindowIsTopmost True if MainWindow is the topmost one
192 void topmostWindowChanged(bool mainWindowIsTopmost);
194 /*******************************************************************************
196 ******************************************************************************/
199 * @brief Signal for friend finding
201 * @param coordinates Target coordinate
203 void findFriend(const GeoCoordinate &coordinates);
206 * @brief Signal for routing to friend.
208 * @param coordinates friend's geo coordinates
210 void routeToFriend(const GeoCoordinate &coordinates);
213 * @brief Signal for requesting a panel to be opened
215 * @param widget Pointer to the widget that emitted the signal
217 void showPanelRequested(QWidget *widget);
219 /*******************************************************************************
221 ******************************************************************************/
223 bool m_mainWindowIsTopmost; ///< Is the MainWindow the topmost one
224 bool m_somePanelIsOpen; ///< Is any panel tab open
226 QLabel *m_friendListLabel; ///< Friend list label
228 QLineEdit *m_filterField; ///< Text field for the filter text
230 QPushButton *m_clearFilterButton; ///< Button to clear list filtering
231 QPushButton *m_filterClearButton; ///< Button for clearing the filtering
232 QPushButton *m_routeButton; ///< Button to route to friend
234 QWidget *m_friendListHeaderWidget; ///< Friend list header widget
236 FriendListView *m_friendListView; ///< Friend list view
239 #endif // FRIENDLISTPANEL_H