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 Henri Lampela - henri.lampela@ixonos.com 00007 00008 Situare is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU General Public License 00010 version 2 as published by the Free Software Foundation. 00011 00012 Situare is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with Situare; if not, write to the Free Software 00019 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 00020 USA. 00021 */ 00022 00023 00024 #ifndef FRIENDITEMSHANDLER_H 00025 #define FRIENDITEMSHANDLER_H 00026 00027 #include <QLinkedList> 00028 #include <QObject> 00029 00030 class BaseLocationItem; 00031 class FriendGroupItem; 00032 class FriendLocationItem; 00033 class MapScene; 00034 class User; 00035 00045 class FriendItemsHandler : public QObject 00046 { 00047 Q_OBJECT 00048 00049 public: 00056 FriendItemsHandler(MapScene *mapScene, QObject *parent = 0); 00057 00058 /******************************************************************************* 00059 * MEMBER FUNCTIONS AND SLOTS 00060 ******************************************************************************/ 00061 private: 00070 void addFriendItem(User *friendData); 00071 00077 void checkAllFriendsForCollidingFriends(); 00078 00088 void checkFriendForCollidingFriends(FriendLocationItem *item); 00089 00095 void cleanOldFriendData(const QList<User *> &friendsList); 00096 00108 bool collides(BaseLocationItem *item1, BaseLocationItem *item2); 00109 00117 void deleteFriendItem(FriendLocationItem *item); 00118 00122 void destructGroups(); 00123 00132 void updateFriendItem(FriendLocationItem *friendItem, User *friendData); 00133 00139 void updateFriendItemList(const QList<User *> &friendsList); 00140 00146 void updateFriendLocationsAndImages(const QList<User *> &friendsList); 00147 00148 private slots: 00149 00155 void friendImageReady(User *user); 00156 00165 void friendListUpdated(QList<User *> &friendsList); 00166 00174 void refactorFriendItems(int zoomLevel); 00175 00176 /******************************************************************************* 00177 * SIGNALS 00178 ******************************************************************************/ 00179 signals: 00185 void locationItemClicked(const QList<QString> &userIDs); 00186 00187 /******************************************************************************* 00188 * DATA MEMBERS 00189 ******************************************************************************/ 00190 private: 00191 QLinkedList<FriendGroupItem *> m_friendGroupItems; 00192 QLinkedList<FriendLocationItem *> m_friendItems; 00193 MapScene *m_mapScene; 00194 int m_zoomLevel; 00195 }; 00196 00197 #endif // FRIENDITEMSHANDLER_H