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)),
36 qDebug() << __PRETTY_FUNCTION__;
38 setPos(UNDEFINED, UNDEFINED);
39 setZValue(FRIEND_LOCATION_ICON_Z_LEVEL);
42 bool FriendLocationItem::isPartOfGroup() const
47 void FriendLocationItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
49 qDebug() << __PRETTY_FUNCTION__;
51 m_mousePressPosition = event->pos().toPoint();
55 void FriendLocationItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
57 qDebug() << __PRETTY_FUNCTION__;
59 if ((abs(m_mousePressPosition.y() - event->pos().toPoint().y()) > FRIEND_ITEM_PRESS_HEIGHT) ||
60 (abs(m_mousePressPosition.x() - event->pos().toPoint().x()) > FRIEND_ITEM_PRESS_WIDTH)) {
66 void FriendLocationItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
68 qDebug() << __PRETTY_FUNCTION__;
73 QList<QString> userIDs;
74 userIDs.append(m_userId);
76 emit locationItemClicked(userIDs);
80 void FriendLocationItem::setPartOfGroup(bool value)
82 m_partOfGroup = value;
90 QString FriendLocationItem::userId() const
92 qDebug() << __PRETTY_FUNCTION__;
96 void FriendLocationItem::setProfileImage(const QPixmap image, const QUrl &url)
98 qDebug() << __PRETTY_FUNCTION__;
100 setOffset(-image.width()/2, -image.height()/2);
101 m_profileImageUrl = url;
104 QUrl FriendLocationItem::profileImageUrl() const
106 qDebug() << __PRETTY_FUNCTION__;
107 return m_profileImageUrl;