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>
26 #include "friendlocationitem.h"
27 #include "mapcommon.h"
29 FriendLocationItem::FriendLocationItem(const QString &userId,
31 : BaseLocationItem(parent),
34 m_mousePressPosition(QPoint(0, 0)),
37 qDebug() << __PRETTY_FUNCTION__;
39 setPos(UNDEFINED, UNDEFINED);
40 setZValue(FRIEND_LOCATION_ICON_Z_LEVEL);
43 bool FriendLocationItem::isPartOfGroup() const
48 void FriendLocationItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
50 qDebug() << __PRETTY_FUNCTION__;
52 m_mousePressPosition = event->pos();
57 void FriendLocationItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
59 qDebug() << __PRETTY_FUNCTION__;
62 if ((event->pos() - m_mousePressPosition).manhattanLength() > PRESS_MANHATTAN_LENGTH) {
69 void FriendLocationItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
71 qDebug() << __PRETTY_FUNCTION__;
77 QList<QString> userIDs;
78 userIDs.append(m_userId);
80 emit locationItemClicked(userIDs);
86 void FriendLocationItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
89 qDebug() << __PRETTY_FUNCTION__;
93 icon.addPixmap(pixmap());
94 painter->drawPixmap(offset(), icon.pixmap(pixmap().size(), QIcon::Selected,
98 BaseLocationItem::paint(painter, option, widget);
102 void FriendLocationItem::setPartOfGroup(bool value)
104 m_partOfGroup = value;
112 QString FriendLocationItem::userId() const
114 qDebug() << __PRETTY_FUNCTION__;
118 void FriendLocationItem::setProfileImage(const QPixmap image, const QUrl &url)
120 qDebug() << __PRETTY_FUNCTION__;
123 setOffset(-image.width()/2, -image.height()/2);
124 m_profileImageUrl = url;
127 QUrl FriendLocationItem::profileImageUrl() const
129 qDebug() << __PRETTY_FUNCTION__;
130 return m_profileImageUrl;