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 <QScrollArea>
25 #include <QVBoxLayout>
27 #include "panelcommon.h"
30 #include "userinfopanel.h"
32 UserInfoPanel::UserInfoPanel(QWidget *parent)
35 qDebug() << __PRETTY_FUNCTION__;
37 QVBoxLayout *userInfoPanelLayout = new QVBoxLayout;
38 userInfoPanelLayout->setMargin(0);
39 userInfoPanelLayout->setSpacing(0);
40 userInfoPanelLayout->setContentsMargins(PANEL_MARGIN_LEFT, PANEL_MARGIN_TOP,
41 PANEL_MARGIN_RIGHT, PANEL_MARGIN_BOTTOM);
42 setLayout(userInfoPanelLayout);
44 m_userInfo = new UserInfo(this);
46 QWidget *userInfoView = new QWidget(this);
47 QVBoxLayout *userInfoViewLayout = new QVBoxLayout(userInfoView);
48 userInfoViewLayout->setMargin(0);
49 userInfoViewLayout->setSpacing(0);
50 userInfoViewLayout->setStretch(0, 0);
51 userInfoViewLayout->setSizeConstraint(QLayout::SetFixedSize);
52 userInfoViewLayout->addWidget(m_userInfo);
54 QScrollArea *userInfoScroll = new QScrollArea();
55 userInfoScroll->setWidgetResizable(true);
56 userInfoScroll->setWidget(userInfoView);
57 userInfoScroll->setAlignment(Qt::AlignVCenter);
58 userInfoScroll->viewport()->setAutoFillBackground(false);
59 userInfoScroll->widget()->setAutoFillBackground(false);
61 userInfoPanelLayout->addWidget(userInfoScroll);
63 connect(m_userInfo, SIGNAL(findUser(GeoCoordinate)),
64 this, SIGNAL(findUser(GeoCoordinate)));
66 connect(m_userInfo,SIGNAL(requestReverseGeo()),
67 this, SIGNAL(requestReverseGeo()));
69 connect(this, SIGNAL(reverseGeoReady(QString)),
70 m_userInfo, SIGNAL(reverseGeoReady(QString)));
72 connect(m_userInfo, SIGNAL(statusUpdate(QString,bool)),
73 this, SIGNAL(statusUpdate(QString,bool)));
75 connect(m_userInfo, SIGNAL(refreshUserData()),
76 this, SIGNAL(refreshUserData()));
78 connect(this, SIGNAL(clearUpdateLocationDialogData()),
79 m_userInfo, SLOT(clearUpdateLocationDialogData()));
81 connect(m_userInfo, SIGNAL(notificateUpdateFailing(QString, bool)),
82 this, SIGNAL(notificateUpdateFailing(QString, bool)));
84 connect(this, SIGNAL(collapse()),
85 m_userInfo, SLOT(collapse()));
88 void UserInfoPanel::userDataReceived(User *user)
90 qDebug() << __PRETTY_FUNCTION__;
93 m_userInfo->setUserName(user->name());
94 m_userInfo->setProfileImage(user->profileImage());
95 m_userInfo->setMessageText(user->note());
96 m_userInfo->setAddress(user->address());
97 m_userInfo->setTime(user->timestamp());
98 m_userInfo->setCoordinates(user->coordinates());