2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Ville Tiensuu - ville.tiensuu@ixonos.com
6 Sami Rämö - sami.ramo@ixonos.com
8 Situare is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 version 2 as published by the Free Software Foundation.
12 Situare is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Situare; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
23 #ifndef FRIENDLOCATIONITEM_H
24 #define FRIENDLOCATIONITEM_H
32 #include "baselocationitem.h"
35 * @brief Class that shows friends location icons on the map
37 * @class FriendLocationItem friendlocationitem.h "map/friendlocationitem.h"
38 * @author Ville Tiensuu.
39 * @author Sami Rämö - sami.ramo@ixonos.com
41 class FriendLocationItem : public BaseLocationItem
47 * @brief Constructor of FriendLocationItem
50 * Sets position to UNDEFINED.
51 * Sets default Z-value.
52 * Sets item to ignore transformations. this feature is needed to make icon on the map
55 * @param userId Used ID of the friend
56 * @param parent Parent
58 FriendLocationItem(const QString &userId, QObject *parent = 0);
60 /*******************************************************************************
61 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
62 ******************************************************************************/
65 * @brief Paints item pixmap.
67 * Paints normal or highlighted pixmap image.
69 * @param painter QPainter
70 * @param option QStyleOptionGraphicsItem
71 * @param widget QWidget
73 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
75 /*******************************************************************************
76 * MEMBER FUNCTIONS AND SLOTS
77 ******************************************************************************/
80 * @brief Is item part of any group
82 * @return True if item is part of group, otherwise false.
84 bool isPartOfGroup() const;
87 * @brief getter for friends profile image URL
89 * @return QUrl friends profile images URL
91 QUrl profileImageUrl() const;
94 * @brief Set profile image and it's URL for friend
96 * Also offset is set matching new image dimensions.
98 * @param image New profile image
99 * @param url URL of the new profile image
101 void setProfileImage(const QPixmap image, const QUrl &url);
104 * @brief Set value for m_partOfGroup flag
106 * @param value New value
108 void setPartOfGroup(bool value);
111 * @brief getter for m_userId
113 * @return QString friends user identity
115 QString userId() const;
119 * @brief method that detects when friend icon is moved
121 * Disables m_clickEvent flag if press and release where not
124 * @param event detects the mouse move (or touch in Maemo)
126 void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
129 * @brief method that detects when friend icon is clicked
131 * @param event detects the mouse click (or touch in Maemo)
133 void mousePressEvent(QGraphicsSceneMouseEvent *event);
136 * @brief method that detects when friend icon press is released
138 * @param event detects the mouse release event (or touch in Maemo)
140 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
142 /*******************************************************************************
144 ******************************************************************************/
147 * @brief Signal is emitted when l item is clicked.
149 * @param userIDs list of friends user IDs in the group
151 void locationItemClicked(const QList<QString> &userIDs);
153 /*******************************************************************************
155 ******************************************************************************/
157 bool m_partOfGroup; ///< Flag to mark if item is part of any group
158 const QString m_userId; ///< Friends user ID. Can't be changed afterwards
159 QUrl m_profileImageUrl; ///< Friends Facebook profile image URL
160 QPointF m_mousePressPosition; ///< Mouse press position
161 bool m_clickEvent; ///< Flag to mark click event
164 #endif // FRIENDLOCATIONITEM_H