The first "kind of" working version of the new panels
[situare] / src / ui / userinfopanel.cpp
index 7a5bc54..f6cbb24 100644 (file)
  */
 
 #include "userinfopanel.h"
+
 #include "userinfo.h"
+#include "panelcommon.h"
 
 UserInfoPanel::UserInfoPanel(QWidget *parent)
-    : SidePanel(parent)
+    : QWidget(parent)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    setType(SidePanel::UserPanel);
-
     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 *userViewLayout = new QVBoxLayout(userInfoView);
+    userViewLayout->setMargin(0);
+    userViewLayout->setSpacing(0);
+    userViewLayout->setStretch(0, 0);
+    userViewLayout->setSizeConstraint(QLayout::SetFixedSize);
+    userViewLayout->addWidget(m_userInfo);
 
     QScrollArea *userInfoScroll = new QScrollArea(this);
     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);
+
+    connect(m_userInfo, SIGNAL(findUser(GeoCoordinate)),
+            this, SIGNAL(findUser(GeoCoordinate)));
 
     connect(m_userInfo,SIGNAL(requestReverseGeo()),
             this, SIGNAL(requestReverseGeo()));
@@ -58,24 +60,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());
+    }
 }