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
30 #include "baselocationitem.h"
33 * @brief Class that shows friends location icons on the map
35 * @class FriendLocationItem friendlocationitem.h "map/friendlocationitem.h"
36 * @author Ville Tiensuu.
37 * @author Sami Rämö - sami.ramo@ixonos.com
39 class FriendLocationItem : public BaseLocationItem
45 * @brief Constructor of FriendLocationItem
48 * Sets position to UNDEFINED.
49 * Sets default Z-value.
50 * Sets item to ignore transformations. this feature is needed to make icon on the map
53 * @param userId Used ID of the friend
54 * @param parent Parent
56 FriendLocationItem(const QString &userId, QObject *parent = 0);
58 /*******************************************************************************
59 * MEMBER FUNCTIONS AND SLOTS
60 ******************************************************************************/
63 * @brief Is item part of any group
65 * @return True if item is part of group, otherwise false.
67 bool isPartOfGroup() const;
70 * @brief getter for friends profile image URL
72 * @return QUrl friends profile images URL
74 QUrl profileImageUrl() const;
77 * @brief Set profile image and it's URL for friend
79 * Also offset is set matching new image dimensions.
81 * @param image New profile image
82 * @param url URL of the new profile image
84 void setProfileImage(const QPixmap image, const QUrl &url);
87 * @brief Set value for m_partOfGroup flag
89 * @param value New value
91 void setPartOfGroup(bool value);
94 * @brief getter for m_userId
96 * @return QString friends user identity
98 QString userId() const;
102 * @brief method that detects when friend icon is moved
104 * Disables m_clickEvent flag if press and release where not
107 * @param event detects the mouse move (or touch in Maemo)
109 void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
112 * @brief method that detects when friend icon is clicked
114 * @param event detects the mouse click (or touch in Maemo)
116 void mousePressEvent(QGraphicsSceneMouseEvent *event);
119 * @brief method that detects when friend icon press is released
121 * @param event detects the mouse release event (or touch in Maemo)
123 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
125 /*******************************************************************************
127 ******************************************************************************/
130 * @brief Signal is emitted when l item is clicked.
132 * @param userIDs list of friends user IDs in the group
134 void locationItemClicked(const QList<QString> &userIDs);
136 /*******************************************************************************
138 ******************************************************************************/
140 bool m_partOfGroup; ///< Flag to mark if item is part of any group
141 const QString m_userId; ///< Friends user ID. Can't be changed afterwards
142 QUrl m_profileImageUrl; ///< Friends Facebook profile image URL
143 QPoint m_mousePressPosition; ///< Mouse press position
144 bool m_clickEvent; ///< Flag to mark click event
147 #endif // FRIENDLOCATIONITEM_H