2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Jussi Laitinen - jussi.laitinen@ixonos.com
7 Situare is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 version 2 as published by the Free Software Foundation.
11 Situare is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Situare; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
25 #include <QListWidget>
31 * @brief View for ListItems.
33 * ListView is used to show ListItems in list view. Items can be added, removed or
36 class ListView : public QListWidget
41 ListView(QWidget *parent = 0);
43 /******************************************************************************
44 * MEMBER FUNCTIONS AND SLOTS
45 ******************************************************************************/
48 * @brief Add item to view and item list.
51 * @param item item to add to view and list
53 void addListItem(const QString &key, ListItem *item);
56 * @brief Adds item to view.
58 * @param item FriendListItem
60 void addListItemToView(ListItem *item);
63 * @brief Clear unused items from view.
65 * Clears items which are not in user ID's list from the view and items list.
67 * @param userIDs list of new user ID's.
69 void clearUnused(const QStringList &userIDs);
72 * @brief Clears filtering from list.
81 * Items are removed from view and item list.
86 * @brief Checks if view contains item with userID.
88 * @param userID user's ID
89 * @return true if view contains item, false otherwise
91 bool contains(const QString &userID);
94 * @brief Sets filter to list.
96 * Hide all items that are not in the userIDs list.
98 * @param userIDs user ID's to items that are shown
100 void filter(const QList<QString> &userIDs);
103 * @brief Takes item from view.
105 * Item is not deleted.
107 * @param userID user's ID
110 ListItem *takeListItemFromView(const QString &userID);
113 * @brief Returns ListItem with userID.
115 * @param userID user's ID
118 ListItem *listItem(const QString &userID);
122 * @brief Slot for list item clicked.
124 * Toggles items selection state and emits listItemClicked signal.
126 void listItemClicked(QListWidgetItem *item);
128 /******************************************************************************
130 ******************************************************************************/
133 * @brief Signal is emitted when list item is clicked.
135 * @param coordinates item's coordinates
137 void listItemClicked(const GeoCoordinate &coordinates);
139 /*******************************************************************************
141 ******************************************************************************/
143 ListItem *m_previousItem; ///< Previously selected item
144 QHash<QString, ListItem *> m_listItems; ///< List of items in this view. Key = user ID