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 friendImageReady (User *user)
 Slot updating friend item's profile image.
void friendListUpdated (QList< User * > &friendsList)
 Slot for upgrading friend items and groups.
void refactorFriendItems (int zoomLevel)
 Destroys all current groups and runs grouping again.

Private Member Functions

void addFriendItem (User *friendData)
 Add new FriendLocationItem.
void checkAllFriendsForCollidingFriends ()
 Group colliding friends.
void checkFriendForCollidingFriends (FriendLocationItem *item)
 Check single FriendLocationItem for colliding FriendLocationItem items.
void cleanOldFriendData (const QList< User * > &friendsList)
 clean old friend data from m_mapScene and m_friendItems
bool collides (BaseLocationItem *item1, BaseLocationItem *item2)
 Check if items collide.
void deleteFriendItem (FriendLocationItem *item)
 Delete FriendLocationItem.
void destructGroups ()
 Destructs all current group items.
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::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::cleanOldFriendData ( const QList< User * > &  friendsList  )  [private]

clean old friend data from m_mapScene and m_friendItems

Parameters:
friendsList QList item of friend information
bool FriendItemsHandler::collides ( BaseLocationItem item1,
BaseLocationItem item2 
) [private]

Check if items collide.

Does check if items sceneTransformedBoundingRect() does intersect. If item1's rect is max half of the rect width from the vertical limits of the map (from inside), then rect is translated to opposite side of the map and intersections are tested there too.

Parameters:
item1 First item
item2 Secont item
Returns:
True if collision was found, otherwise false
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::friendImageReady ( User user  )  [private, slot]

Slot updating friend item's profile image.

Parameters:
user Friend
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::refactorFriendItems ( int  zoomLevel  )  [private, slot]

Destroys all current groups and runs grouping again.

Calls destructGroups() and checkAllFriendsForCollidingFriends().

Parameters:
zoomLevel Current view zoom level, used for friend item rect scaling
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 Fri Sep 3 12:05:41 2010 for Situare client for Maemo by  doxygen 1.6.1