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,
24 #include <QGraphicsSceneMouseEvent>
25 #include "friendlocationitem.h"
26 #include "mapcommon.h"
28 FriendLocationItem::FriendLocationItem(const QString &userId,
30 : BaseLocationItem(parent),
33 m_mousePressPosition(QPoint(0, 0))
35 qDebug() << __PRETTY_FUNCTION__;
37 setPos(UNDEFINED, UNDEFINED);
38 setZValue(FRIEND_LOCATION_ICON_Z_LEVEL);
41 bool FriendLocationItem::isPartOfGroup() const
46 void FriendLocationItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
48 qDebug() << __PRETTY_FUNCTION__;
50 m_mousePressPosition = event->screenPos();
53 void FriendLocationItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
55 qDebug() << __PRETTY_FUNCTION__;
57 if ((abs(m_mousePressPosition.y() - event->screenPos().y()) <= FRIEND_ITEM_PRESS_HEIGHT) &&
58 (abs(m_mousePressPosition.x() - event->screenPos().x()) <= FRIEND_ITEM_PRESS_WIDTH)) {
59 QList<QString> userIDs;
60 userIDs.append(m_userId);
62 emit locationItemClicked(userIDs);
66 void FriendLocationItem::setPartOfGroup(bool value)
68 m_partOfGroup = value;
76 QString FriendLocationItem::userId() const
78 qDebug() << __PRETTY_FUNCTION__;
82 void FriendLocationItem::setProfileImage(const QPixmap image, const QUrl &url)
84 qDebug() << __PRETTY_FUNCTION__;
86 setOffset(-image.width()/2, -image.height()/2);
87 m_profileImageUrl = url;
90 QUrl FriendLocationItem::profileImageUrl() const
92 qDebug() << __PRETTY_FUNCTION__;
93 return m_profileImageUrl;