- /*
+/*
Situare - A location system for Facebook
Copyright (C) 2010 Ixonos Plc. Authors:
Kaj Wallin - kaj.wallin@ixonos.com
Henri Lampela - henri.lampela@ixonos.com
+ Pekka Nissinen - pekka.nissinen@ixonos.com
+ Jussi Laitinen - jussi.laitinen@ixonos.com
+ Sami Rämö - sami.ramo@ixonos.com
Situare is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
along with Situare; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
- */
+*/
#ifndef FRIENDLISTPANEL_H
#define FRIENDLISTPANEL_H
-#include <QtGui>
-
-#include "sidepanel.h"
+#include "panelbase.h"
class QLabel;
-class QWidget;
+class QLineEdit;
+class QPushButton;
class FriendListItemDelegate;
+class FriendListView;
class GeoCoordinate;
-class ListView;
+class ImageButton;
class User;
-class Location;
-class LocationListView;
/**
-* @brief Class for sliding friends list panel
-*
-* @author Kaj Wallin - kaj.wallin (at) ixonos.com
-* @class FriendListPanel friendlistpanel.h "ui/friendlistpanel.h"
-*/
-class FriendListPanel : public SidePanel
+ * @brief Class for sliding friends list panel
+ *
+ * @author Kaj Wallin - kaj.wallin (at) ixonos.com
+ * @author Henri Lampela - henri.lampela (at) ixonos.com
+ * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
+ * @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
+ * @author Sami Rämö - sami.ramo (at) ixonos.com
+ */
+class FriendListPanel : public PanelBase
{
Q_OBJECT
public:
/**
- * @brief Default constructor
+ * @brief Default constructor
+ *
+ * @param parent
+ */
+ FriendListPanel(QWidget *parent = 0);
+
+/*******************************************************************************
+ * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
+ ******************************************************************************/
+protected:
+ /**
+ * @brief Re-implemented from QWidget::hideEvent()
*
- * @param parent
+ * Calls updateKeyboardGrabbing() and clearFriendGroupFiltering().
+ *
+ * @param event
*/
- FriendListPanel(QWidget *parent = 0);
+ void hideEvent(QHideEvent *event);
+
+ /**
+ * @brief Re-implemented from QWidget::showEvent()
+ *
+ * Calls updateKeyboardGrabbing().
+ *
+ * @param event
+ */
+ void showEvent(QShowEvent *event);
/*******************************************************************************
* MEMBER FUNCTIONS AND SLOTS
******************************************************************************/
public slots:
/**
- * @brief Slot to update friend item's image
+ * @brief Slot to update friend item's image
+ *
+ * @param user Friend
+ */
+ void friendImageReady(User *user);
+
+ /**
+ * @brief Slot to refresh friends list
+ *
+ * @param friendList
+ */
+ void friendInfoReceived(QList<User *> &friendList);
+
+private:
+ /**
+ * @brief Set visibility for filtering text field and clearing button
*
- * @param user Friend
+ * @param visible True if items should be visible, false if not
*/
- void friendImageReady(User *user);
+ void setFilteringLayoutVisibility(bool visible);
/**
- * @brief Slot to refresh friends list
+ * @brief Takes care of grabbing and releasing the keyboard when required
*
- * @param friendList
+ * Keyboard is grabbed when MainWindow it the topmost window, panel tab is open and
+ * FriendListPanel is visible. Releasing is done if the MainWindow is not the topmost window
+ * or panel tab is not open or FriendListPanel is invisible.
*/
- void friendInfoReceived(QList<User *> &friendList);
+ void updateKeyboardGrabbing();
private slots:
/**
- * @brief Slot to clear friend list filter.
+ * @brief Called when any of the panel tabs is closed
+ *
+ * Does call clearFriendGroupFiltering().
+ *
+ * Calls updateKeyboardGrabbing() for releasing the grabbing when FriendListPanel is closed, not
+ * changed to other panel. In this case the hideEvent() is not triggered.
*/
- void clearFriendListFilter();
+ void anyPanelClosed();
/**
- * @brief Slot to intercept signal when location search results are ready
+ * @brief Called when any of the panel tabs is opened
*
- * @param result list if location search results
+ * Calls updateKeyboardGrabbing() for grabbing the keyboard when FriendListPanel is closed and
+ * is the last selected tab. In this case the showEvent() is not triggered.
*/
- void locationDataReady(QList<Location> &result);
+ void anyPanelOpened();
/**
- * @brief Slot to show friends in list.
+ * @brief Slot for clearing the filtering
*
- * Shows only friends that are on userIDs list.
- * @param userIDs list of user ID's
+ * Clears friend group (or single friend) filtering and calls clearTextFiltering().
*/
+ void clearFiltering();
+
+ /**
+ * @brief Slot for clearing the text based filtering.
+ *
+ * Does clear only the text based filtering. Friend group based filtering is not affected.
+ */
+ void clearTextFiltering();
+
+ /**
+ * @brief Updates the filtering when filtering text value is changed
+ *
+ * Filtering UI elements are invoked when the text becomes not empty and hidden when text
+ * becomes empty.
+ *
+ * Sets the new filtering text.
+ *
+ * @param text New text value
+ */
+ void filterTextChanged(const QString &text);
+
+ /**
+ * @brief Routes to selected friend.
+ *
+ * Emits routeToFriend if friend is selected from list.
+ */
+ void routeToSelectedFriend();
+
+ /**
+ * @brief Slot to show friends in list.
+ *
+ * Shows only friends that are on userIDs list
+ * @param userIDs list of user ID's
+ */
void showFriendsInList(const QList<QString> &userIDs);
+ /**
+ * @brief Called when topmost window is changed
+ *
+ * Does set m_mainWindowIsTopmost and calls updateKeyboardGrabbing()
+ *
+ * @param mainWindowIsTopmost True if MainWindow is the topmost one
+ */
+ void topmostWindowChanged(bool mainWindowIsTopmost);
+
/*******************************************************************************
* SIGNALS
******************************************************************************/
signals:
/**
- * @brief Signal for friend finding.
- *
- * @param coordinates Target coordinate
- */
+ * @brief Signal for friend finding
+ *
+ * @param coordinates Target coordinate
+ */
void findFriend(const GeoCoordinate &coordinates);
- void locationItemClicked(GeoCoordinate &swBound, GeoCoordinate &neBound);
+ /**
+ * @brief Signal for routing to friend.
+ *
+ * @param coordinates friend's geo coordinates
+ */
+ void routeToFriend(const GeoCoordinate &coordinates);
/*******************************************************************************
* DATA MEMBERS
******************************************************************************/
private:
- QWidget *m_friendListHeaderWidget; ///< Friend list header widget
- QLabel *m_friendListLabel; ///< Friend list label
- QPushButton *m_clearFilterButton; ///< Button to clear list filtering
- ListView *m_friendListView; ///< Friend list view
- LocationListView *m_locationListView;
- FriendListItemDelegate *m_friendListItemDelegate; ///< Friend list item delegate
+ bool m_mainWindowIsTopmost; ///< Is the MainWindow the topmost one
+ bool m_somePanelIsOpen; ///< Is any panel tab open
+
+ QLabel *m_headerLabel; ///< Show how many friends are selected
+
+ QLineEdit *m_filterField; ///< Text field for the filter text
+
+ QPushButton *m_clearTextFilteringButton; ///< Button for clearing the text filtering
+
+ QWidget *m_headerWidget; ///< Friend list header widget
+
+ FriendListView *m_friendListView; ///< Friend list view
+ ImageButton *m_clearGroupFilteringButton; ///< Button for clearing friend group filtering
+ ImageButton *m_routeButton; ///< Button for routing to selected friend
};
#endif // FRIENDLISTPANEL_H