FriendItemsHandler Class Reference

Handler for friend and friend group items. More...

#include <frienditemshandler.h>

Collaboration diagram for FriendItemsHandler:
Collaboration graph
[legend]

List of all members.

Signals

void locationItemClicked (const QList< QString > &userIDs)
 Signal is emitted when location item is clicked.

Public Member Functions

 FriendItemsHandler (MapScene *mapScene, QObject *parent=0)
 Constructor.

Private Slots

void friendListUpdated (QList< User * > &friendsList)
 Slot for upgrading friend items and groups.
void refactorFriendItems (int zoomLevel)
 Re-factors all FriendLocationItem and FriendGroupItem items.

Private Member Functions

void addFriendItem (User *friendData)
 Add new FriendLocationItem.
void checkAllFriendsForCollidingFriends ()
 Group colliding friends.
void checkAllGroupsForCollidingFriends ()
 Join friends to colliding group.
void checkFriendForCollidingFriends (FriendLocationItem *item)
 Check single FriendLocationItem for colliding FriendLocationItem items.
void checkGroupForCollidingFriends (FriendGroupItem *group)
 Check single FriendGroupItem for colliding FriendLocationItem.
void checkGroupForCollidingGroups (FriendGroupItem *group)
 Check single FriendGroupItem for colliding FriendGroupItem items.
void cleanOldFriendData (const QList< User * > &friendsList)
 clean old friend data from m_mapScene and m_friendItems
void deleteFriendItem (FriendLocationItem *item)
 Delete FriendLocationItem.
void dropFriendFromAllGroups (FriendLocationItem *item)
 Drop FriendLocationItem from all FriendGroupItem groups.
void dropOutOfGroupFriends ()
 Drop all FriendLocationItem items, which are out of FriendGroupItem boundaries, from all FriendGroupItem items.
void mergeCollidingGroups ()
 Merge all colliding groups.
void updateFriendItem (FriendLocationItem *friendItem, User *friendData)
 Update FriendLocationItem data.
void updateFriendItemList (const QList< User * > &friendsList)
 updates data member m_friendItems from given parameter
void updateFriendLocationsAndImages (const QList< User * > &friendsList)
 updates data member m_friendItems values that differs from given parameter

Private Attributes

QLinkedList< FriendGroupItem * > m_friendGroupItems
 All FriendGroupItem items.
QLinkedList< FriendLocationItem * > m_friendItems
 List of friendLocationItems.
MapScenem_mapScene
 Pointer to MapScene.
int m_zoomLevel
 Current view zoom level used for calculation of items bounding rect.

Detailed Description

Handler for friend and friend group items.

Handles all friend map items. Colliding items and groups are grouped. All items are owned by MapScene.

Author:
Sami Rämö - sami.ramo@ixonos.com
Ville Tiensuu - ville.tiensuu@ixonos.com

Constructor & Destructor Documentation

FriendItemsHandler::FriendItemsHandler ( MapScene mapScene,
QObject *  parent = 0 
)

Constructor.

Parameters:
mapScene MapScene object
parent Parent QObject

Member Function Documentation

void FriendItemsHandler::addFriendItem ( User friendData  )  [private]

Add new FriendLocationItem.

New FriendLocationItem is created, values are set and item is added to map. Item is also added to m_friendItems list.

Parameters:
friendData Data for new friend
void FriendItemsHandler::checkAllFriendsForCollidingFriends (  )  [private]

Group colliding friends.

Call checkFriendForCollidingFriends() for all visible FriendLocationItem items.

void FriendItemsHandler::checkAllGroupsForCollidingFriends (  )  [private]

Join friends to colliding group.

Call checkGroupForCollidingFriends() for all FriendGroupItem items.

void FriendItemsHandler::checkFriendForCollidingFriends ( FriendLocationItem item  )  [private]

Check single FriendLocationItem for colliding FriendLocationItem items.

Check FriendLocationItem against another visible FriendLocationItem items. If collision is found, then new FriendGroupItem is made and colliding FriendLocationItem items are joined to this new FriendGroupItem.

Parameters:
item FriendLocationItem to be checked
void FriendItemsHandler::checkGroupForCollidingFriends ( FriendGroupItem group  )  [private]

Check single FriendGroupItem for colliding FriendLocationItem.

Check FriendGroupItem against all visible FriendLocationItem items. Colliding FriendLocationItem items are joiden to given FriendGroupItem.

Parameters:
group FriendGroupItem to be checked
void FriendItemsHandler::checkGroupForCollidingGroups ( FriendGroupItem group  )  [private]

Check single FriendGroupItem for colliding FriendGroupItem items.

Colliding FriendGroupItem items are merged. Item given as parameter remains and colliding items are deleted after their friend items are merged to remaining group.

Parameters:
group FriendGroupItem to be checked
void FriendItemsHandler::cleanOldFriendData ( const QList< User * > &  friendsList  )  [private]

clean old friend data from m_mapScene and m_friendItems

Parameters:
friendsList QList item of friend information
void FriendItemsHandler::deleteFriendItem ( FriendLocationItem item  )  [private]

Delete FriendLocationItem.

Drops item from all groups, removes it from scene and deletes the item.

Parameters:
item Item to be deleted
void FriendItemsHandler::dropFriendFromAllGroups ( FriendLocationItem item  )  [private]

Drop FriendLocationItem from all FriendGroupItem groups.

Parameters:
item Item to be dropped.
void FriendItemsHandler::friendListUpdated ( QList< User * > &  friendsList  )  [private, slot]

Slot for upgrading friend items and groups.

Does add and/or remove FriendLocationItem items if there are new friends or old ones deleted in the given list. Remaining FriensLocationItems are updated.

Parameters:
friendsList QList item of friend information
void FriendItemsHandler::locationItemClicked ( const QList< QString > &  userIDs  )  [signal]

Signal is emitted when location item is clicked.

Parameters:
userIDs list of friends user IDs in the group
void FriendItemsHandler::mergeCollidingGroups (  )  [private]

Merge all colliding groups.

Calls checkGroupForCollidingGroups() for all FriendGroupItem items.

void FriendItemsHandler::refactorFriendItems ( int  zoomLevel  )  [private, slot]
void FriendItemsHandler::updateFriendItem ( FriendLocationItem friendItem,
User friendData 
) [private]

Update FriendLocationItem data.

Position and image are updated.

Parameters:
friendItem Item to be updated
friendData New data for the item
void FriendItemsHandler::updateFriendItemList ( const QList< User * > &  friendsList  )  [private]

updates data member m_friendItems from given parameter

Parameters:
friendsList QList item of friend information
void FriendItemsHandler::updateFriendLocationsAndImages ( const QList< User * > &  friendsList  )  [private]

updates data member m_friendItems values that differs from given parameter

Parameters:
friendsList QList item of friend information

The documentation for this class was generated from the following files:

Generated on Thu Jun 10 09:44:02 2010 for Situare client for Maemo by  doxygen 1.6.1