00001 /* 00002 Situare - A location system for Facebook 00003 Copyright (C) 2010 Ixonos Plc. Authors: 00004 00005 Sami Rämö - sami.ramo@ixonos.com 00006 00007 Situare is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU General Public License 00009 version 2 as published by the Free Software Foundation. 00010 00011 Situare is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with Situare; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 00019 USA. 00020 */ 00021 00022 00023 #ifndef FRIENDITEMSHANDLER_H 00024 #define FRIENDITEMSHANDLER_H 00025 00026 #include <QLinkedList> 00027 #include <QObject> 00028 00029 #include "user/user.h" 00030 00031 class FriendGroupItem; 00032 class FriendLocationItem; 00033 class MapScene; 00034 00044 class FriendItemsHandler : public QObject 00045 { 00046 Q_OBJECT 00047 00048 public: 00055 FriendItemsHandler(MapScene *mapScene, QObject *parent = 0); 00056 00057 /******************************************************************************* 00058 * MEMBER FUNCTIONS AND SLOTS 00059 ******************************************************************************/ 00060 private: 00069 void addFriendItem(User *friendData); 00070 00076 void checkAllFriendsForCollidingFriends(); 00077 00083 void checkAllGroupsForCollidingFriends(); 00084 00094 void checkFriendForCollidingFriends(FriendLocationItem *item); 00095 00104 void checkGroupForCollidingFriends(FriendGroupItem *group); 00105 00114 void checkGroupForCollidingGroups(FriendGroupItem *group); 00115 00121 void cleanOldFriendData(const QList<User *> &friendsList); 00122 00130 void deleteFriendItem(FriendLocationItem *item); 00131 00137 void dropFriendFromAllGroups(FriendLocationItem *item); 00138 00143 void dropOutOfGroupFriends(); 00144 00150 void mergeCollidingGroups(); 00151 00160 void updateFriendItem(FriendLocationItem *friendItem, User *friendData); 00161 00167 void updateFriendItemList(const QList<User *> &friendsList); 00168 00174 void updateFriendLocationsAndImages(const QList<User *> &friendsList); 00175 00176 private slots: 00185 void friendListUpdated(QList<User *> &friendsList); 00186 00195 void refactorFriendItems(int zoomLevel); 00196 00197 /******************************************************************************* 00198 * SIGNALS 00199 ******************************************************************************/ 00200 signals: 00206 void locationItemClicked(const QList<QString> &userIDs); 00207 00208 /******************************************************************************* 00209 * DATA MEMBERS 00210 ******************************************************************************/ 00211 private: 00212 QLinkedList<FriendGroupItem *> m_friendGroupItems; 00213 QLinkedList<FriendLocationItem *> m_friendItems; 00214 MapScene *m_mapScene; 00215 int m_zoomLevel; 00216 }; 00217 00218 #endif // FRIENDITEMSHANDLER_H