Some minor cosmetic changes
[situare] / src / ui / userinfopanel.cpp
index 7a5bc54..ae2d6db 100644 (file)
@@ -1,8 +1,10 @@
- /*
+/*
     Situare - A location system for Facebook
     Copyright (C) 2010  Ixonos Plc. Authors:
 
         Kaj Wallin - kaj.wallin@ixonos.com
+        Katri Kaikkonen - katri.kaikkonen@ixonos.com
+        Pekka Nissinen - pekka.nissinen@ixonos.com
 
     Situare is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
     along with Situare; if not, write to the Free Software
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
     USA.
- */
+*/
 
-#include "userinfopanel.h"
+#include <QScrollArea>
+#include <QVBoxLayout>
+
+#include "panelcommon.h"
 #include "userinfo.h"
 
+#include "userinfopanel.h"
+
 UserInfoPanel::UserInfoPanel(QWidget *parent)
-    : SidePanel(parent)
+    : QWidget(parent)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    setType(SidePanel::UserPanel);
+    QVBoxLayout *userInfoPanelLayout = new QVBoxLayout;
+    userInfoPanelLayout->setMargin(0);
+    userInfoPanelLayout->setSpacing(0);
+    userInfoPanelLayout->setContentsMargins(PANEL_MARGIN_LEFT, 0, PANEL_MARGIN_RIGHT, 0);
+    setLayout(userInfoPanelLayout);
 
     m_userInfo = new UserInfo(this);
 
-    m_userInfoView = new QWidget(this);
-    m_userViewLayout = new QVBoxLayout(m_userInfoView);
-    m_userViewLayout->setMargin(0);
-    m_userViewLayout->setSpacing(0);
-    m_userViewLayout->setStretch(0, 0);
-    m_userViewLayout->setSizeConstraint(QLayout::SetFixedSize);
-    m_userViewLayout->addWidget(m_userInfo);
+    QWidget *userInfoView = new QWidget(this);
+    QVBoxLayout *userInfoViewLayout = new QVBoxLayout(userInfoView);
+    userInfoViewLayout->setMargin(0);
+    userInfoViewLayout->setSpacing(0);
+    userInfoViewLayout->setStretch(0, 0);
+    userInfoViewLayout->setSizeConstraint(QLayout::SetFixedSize);
+    userInfoViewLayout->addWidget(m_userInfo);
 
-    QScrollArea *userInfoScroll = new QScrollArea(this);
+    QScrollArea *userInfoScroll = new QScrollArea();
     userInfoScroll->setWidgetResizable(true);
-    userInfoScroll->setWidget(m_userInfoView);
+    userInfoScroll->setWidget(userInfoView);
     userInfoScroll->setAlignment(Qt::AlignVCenter);
     userInfoScroll->viewport()->setAutoFillBackground(false);
     userInfoScroll->widget()->setAutoFillBackground(false);
-    m_panelVBox->addWidget(userInfoScroll);
+
+    userInfoPanelLayout->addWidget(userInfoScroll);
+
+    connect(m_userInfo, SIGNAL(findUser(GeoCoordinate)),
+            this, SIGNAL(findUser(GeoCoordinate)));
 
     connect(m_userInfo,SIGNAL(requestReverseGeo()),
             this, SIGNAL(requestReverseGeo()));
@@ -58,24 +73,24 @@ UserInfoPanel::UserInfoPanel(QWidget *parent)
 
     connect(m_userInfo, SIGNAL(refreshUserData()),
             this, SIGNAL(refreshUserData()));
+
+    connect(this, SIGNAL(clearUpdateLocationDialogData()),
+            m_userInfo, SLOT(clearUpdateLocationDialogData()));
+
+    connect(m_userInfo, SIGNAL(notificateUpdateFailing(QString, bool)),
+             this, SIGNAL(notificateUpdateFailing(QString, bool)));
 }
 
 void UserInfoPanel::userDataReceived(User *user)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-//    m_userInfo->setUserName(user->name());
-    m_userInfo->setUserName("pirkko-liisapaula Marjamaa-Pulkkinen");
-    m_userInfo->setProfileImage(user->profileImage());
-    m_userInfo->setMessageText(user->note());
-    m_userInfo->setAddress(user->address());
-    m_userInfo->setTime(user->timestamp());
-
-    //if(user) {
-    //    m_userInfo->setUserName(user->name());
-    //    m_userInfo->setAvatar(user->profileImage());
-    //    m_userInfo->setMessageText(user->note());
-    //    m_userInfo->setAddress(user->address());
-    //    m_userInfo->setTime(user->timestamp());
-    //}
+    if(user) {
+        m_userInfo->setUserName(user->name());
+        m_userInfo->setProfileImage(user->profileImage());
+        m_userInfo->setMessageText(user->note());
+        m_userInfo->setAddress(user->address());
+        m_userInfo->setTime(user->timestamp());
+        m_userInfo->setCoordinates(user->coordinates());
+    }
 }