2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Sami Rämö - sami.ramo@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,
23 #ifndef FRIENDGROUPITEM_H
24 #define FRIENDGROUPITEM_H
28 #include "baselocationitem.h"
30 class FriendLocationItem;
33 * @brief Friend group map item
35 * Contains grouped FriendLocationItem items and draws group image with number of grouped friends
37 * @author Sami Rämö - sami.ramo@ixonos.com
39 class FriendGroupItem : public BaseLocationItem
47 * Create new group, set picture and join first FriendLocationItem to the group.
48 * Group position is set to be exactly same as item given as parameter.
50 * @param item First FriendLocationItem to be joined to new group
52 FriendGroupItem(FriendLocationItem *item);
54 /*******************************************************************************
55 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
56 ******************************************************************************/
60 * Draw amount of joined FriendLocationItem items over the image.
62 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
66 * @brief Mouse move event.
68 * Disables m_clickEvent flag if press and release where not
71 * @param event QGraphicsSceneMouseEvent.
73 void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
76 * @brief Mouse press event.
78 * Sets mouse press position.
80 * @param event QGraphicsSceneMouseEvent.
82 void mousePressEvent(QGraphicsSceneMouseEvent *event);
85 * @brief Mouse release event.
87 * Emits friendGroupItemClicked signal if press and release where
90 * @param event QGraphicsSceneMouseEvent.
92 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
94 /*******************************************************************************
95 * MEMBER FUNCTIONS AND SLOTS
96 ******************************************************************************/
99 * @brief Drop all FriendLocationItem items which bounding rect is not colliding with
102 * Dropped items are set to visible again.
104 bool dropFriends(int zoomLevel);
107 * @brief Drop single FriendLocationItem from this group
109 * @param item FriendLocationItem to be dropped
111 void dropFriend(FriendLocationItem *item);
114 * @brief Join new FriendLocationItem to this group.
116 * Given item is also hidden.
118 * @param item FriendLocationItem to be joined
120 void joinFriend(FriendLocationItem *item);
123 * @brief Merge this group to another FriendGroupItem
125 * Removes all FrienLocationItem items from this group and joins then to given group.
126 * Group item is not deleted, so caller must delete group after merging.
128 * @param group FriendGroupItem which takes all this group FriendLocationItem items
130 void mergeWithGroup(FriendGroupItem *group);
132 /*******************************************************************************
134 ******************************************************************************/
137 * @brief Signal is emitted when l item is clicked.
139 * @param userIDs list of friends user IDs in the group
141 void locationItemClicked(const QList<QString> &userIDs);
143 /*******************************************************************************
145 ******************************************************************************/
147 QList<FriendLocationItem *> m_friends; ///< List of joined FriendLocationItem items
148 QPoint m_mousePressPosition; ///< Mouse press position
149 bool m_clickEvent; ///< Mouse click event flag
150 QPixmap m_image; ///< Normal item image
151 QPixmap m_highlightImage; ///< Highlighted item image
154 #endif // FRIENDGROUPITEM_H