#include <QScrollArea>
#include <QVBoxLayout>
+#include "imagebutton.h"
#include "panelcommon.h"
#include "userinfo.h"
#include "userinfopanel.h"
UserInfoPanel::UserInfoPanel(QWidget *parent)
- : QWidget(parent)
+ : PanelBase(parent)
{
qDebug() << __PRETTY_FUNCTION__;
QVBoxLayout *userInfoPanelLayout = new QVBoxLayout;
userInfoPanelLayout->setMargin(0);
userInfoPanelLayout->setSpacing(0);
-///< @todo magic
- userInfoPanelLayout->setContentsMargins(PANEL_MARGIN_LEFT, 0, PANEL_MARGIN_RIGHT, 0);
+ userInfoPanelLayout->setContentsMargins(PANEL_MARGIN_LEFT, PANEL_MARGIN_TOP,
+ PANEL_MARGIN_RIGHT, PANEL_MARGIN_BOTTOM);
setLayout(userInfoPanelLayout);
m_userInfo = new UserInfo(this);
connect(m_userInfo,SIGNAL(requestReverseGeo()),
this, SIGNAL(requestReverseGeo()));
+ connect(m_userInfo, SIGNAL(statusUpdate(QString, bool)),
+ this, SIGNAL(statusUpdate(QString, bool)));
+
+ connect(m_userInfo, SIGNAL(notificateUpdateFailing(QString, bool)),
+ this, SIGNAL(notificateUpdateFailing(QString, bool)));
+
connect(this, SIGNAL(reverseGeoReady(QString)),
m_userInfo, SIGNAL(reverseGeoReady(QString)));
- connect(m_userInfo, SIGNAL(statusUpdate(QString,bool)),
- this, SIGNAL(statusUpdate(QString,bool)));
+ connect(this, SIGNAL(clearUpdateLocationDialogData()),
+ m_userInfo, SLOT(clearUpdateLocationDialogData()));
+
+ connect(this, SIGNAL(collapse()),
+ m_userInfo, SLOT(collapse()));
+
+ ImageButton *updateFriendsButton = new ImageButton(":/res/images/refresh.png",
+ ":/res/images/refresh_s.png",
+ "", this);
+ ImageButton *updateStatusMessageButton = new ImageButton(":/res/images/send_position.png",
+ ":/res/images/send_position_s.png",
+ "", this);
- connect(m_userInfo, SIGNAL(refreshUserData()),
+ m_contextButtonLayout->addWidget(updateFriendsButton);
+ m_contextButtonLayout->addWidget(updateStatusMessageButton);
+
+ connect(updateFriendsButton, SIGNAL(clicked()),
this, SIGNAL(refreshUserData()));
- connect(this, SIGNAL(clearUpdateLocationDialogData()),
- m_userInfo, SLOT(clearUpdateLocationDialogData()));
+ connect(updateStatusMessageButton, SIGNAL(clicked()),
+ m_userInfo, SLOT(messageUpdate()));
- connect(m_userInfo, SIGNAL(notificateUpdateFailing(QString, bool)),
- this, SIGNAL(notificateUpdateFailing(QString, bool)));
+}
+
+void UserInfoPanel::showUserInfo(bool logged)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_userInfo->setVisible(logged);
}
void UserInfoPanel::userDataReceived(User *user)
m_userInfo->setAddress(user->address());
m_userInfo->setTime(user->timestamp());
m_userInfo->setCoordinates(user->coordinates());
+
+ m_userInfo->show();
}
}