2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Kaj Wallin - kaj.wallin@ixonos.com
6 Katri Kaikkonen - katri.kaikkonen@ixonos.com
7 Pekka Nissinen - pekka.nissinen@ixonos.com
9 Situare is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 version 2 as published by the Free Software Foundation.
13 Situare is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with Situare; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
24 #include "userinfopanel.h"
27 #include "panelcommon.h"
29 UserInfoPanel::UserInfoPanel(QWidget *parent)
32 qDebug() << __PRETTY_FUNCTION__;
34 QVBoxLayout *userInfoPanelLayout = new QVBoxLayout;
35 userInfoPanelLayout->setMargin(0);
36 userInfoPanelLayout->setSpacing(0);
37 userInfoPanelLayout->setContentsMargins(USERPANEL_MARGIN_LEFT, 0, USERPANEL_MARGIN_RIGHT, 0);
38 setLayout(userInfoPanelLayout);
40 m_userInfo = new UserInfo(this);
42 QWidget *userInfoView = new QWidget(this);
43 QVBoxLayout *userInfoViewLayout = new QVBoxLayout(userInfoView);
44 userInfoViewLayout->setMargin(0);
45 userInfoViewLayout->setSpacing(0);
46 userInfoViewLayout->setStretch(0, 0);
47 userInfoViewLayout->setSizeConstraint(QLayout::SetFixedSize);
48 userInfoViewLayout->addWidget(m_userInfo);
50 QScrollArea *userInfoScroll = new QScrollArea();
51 userInfoScroll->setWidgetResizable(true);
52 userInfoScroll->setWidget(userInfoView);
53 userInfoScroll->setAlignment(Qt::AlignVCenter);
54 userInfoScroll->viewport()->setAutoFillBackground(false);
55 userInfoScroll->widget()->setAutoFillBackground(false);
57 userInfoPanelLayout->addWidget(userInfoScroll);
59 connect(m_userInfo, SIGNAL(findUser(GeoCoordinate)),
60 this, SIGNAL(findUser(GeoCoordinate)));
62 connect(m_userInfo,SIGNAL(requestReverseGeo()),
63 this, SIGNAL(requestReverseGeo()));
65 connect(this, SIGNAL(reverseGeoReady(QString)),
66 m_userInfo, SIGNAL(reverseGeoReady(QString)));
68 connect(m_userInfo, SIGNAL(statusUpdate(QString,bool)),
69 this, SIGNAL(statusUpdate(QString,bool)));
71 connect(m_userInfo, SIGNAL(refreshUserData()),
72 this, SIGNAL(refreshUserData()));
74 connect(this, SIGNAL(clearUpdateLocationDialogData()),
75 m_userInfo, SLOT(clearUpdateLocationDialogData()));
77 connect(m_userInfo, SIGNAL(notificateUpdateFailing(QString, bool)),
78 this, SIGNAL(notificateUpdateFailing(QString, bool)));
81 void UserInfoPanel::userDataReceived(User *user)
83 qDebug() << __PRETTY_FUNCTION__;
86 m_userInfo->setUserName(user->name());
87 m_userInfo->setProfileImage(user->profileImage());
88 m_userInfo->setMessageText(user->note());
89 m_userInfo->setAddress(user->address());
90 m_userInfo->setTime(user->timestamp());
91 m_userInfo->setCoordinates(user->coordinates());