connect(m_ui, SIGNAL(refreshUserData()),
this, SLOT(refreshUserData()));
+ connect(m_ui, SIGNAL(findUser(QPointF)),
+ m_mapEngine, SLOT(setViewLocation(QPointF)));
+
// signals from friend list tab
connect(m_ui, SIGNAL(findFriend(QPointF)),
m_mapEngine, SLOT(setViewLocation(QPointF)));
m_userPanelSidebar->stackUnder(m_friendsListPanel);
m_userPanel->stackUnder(m_userPanelSidebar);
+ connect(m_userPanel, SIGNAL(findUser(QPointF)),
+ this, SIGNAL(findUser(QPointF)));
+
connect(this, SIGNAL(userLocationReady(User*)),
m_userPanel, SLOT(userDataReceived(User*)));
void fetchUsernameFromSettings();
/**
+ * @brief Signal for finding user.
+ *
+ * @param coordinates user geo coordinates
+ */
+ void findUser(const QPointF &coordinates);
+
+ /**
* @brief GPS setting changed
*
* @param enabled True if GPS is enabled, otherwise false
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
verticalLayout->setContentsMargins(MARGIN * 2, 0, MARGIN * 2, MARGIN * 2);
verticalLayout->setSpacing(0);
- this->setLayout(verticalLayout);
+ setLayout(verticalLayout);
QFormLayout *infoLayout = new QFormLayout();
infoLayout->setMargin(0);
buttonLayout->setMargin(0);
buttonLayout->setSpacing(0);
- QLabel *envelopeLabel = new QLabel(this);
+ QLabel *envelopeLabel = new QLabel();
envelopeLabel->setPixmap(QPixmap(":/res/images/envelope.png"));
envelopeLabel->setContentsMargins(0, 0, MARGIN, 0);
envelopeLabel->setFixedSize(ICON_WIDTH + MARGIN, ICON_HEIGHT);
- QLabel *compassLabel = new QLabel(this);
+ QLabel *compassLabel = new QLabel();
compassLabel->setPixmap(QPixmap(":/res/images/compass.png"));
compassLabel->setContentsMargins(0, 0, MARGIN, 0);
compassLabel->setFixedSize(ICON_WIDTH + MARGIN, ICON_HEIGHT);
- QLabel *clockLabel = new QLabel(this);
+ QLabel *clockLabel = new QLabel();
clockLabel->setPixmap(QPixmap(":/res/images/clock.png"));
clockLabel->setContentsMargins(0, 0, MARGIN, 0);
clockLabel->setFixedSize(ICON_WIDTH + MARGIN, ICON_HEIGHT);
- m_imageLabel = new QLabel(this);
- m_imageLabel->setFixedSize(IMAGE_WIDTH, IMAGE_HEIGHT);
+ m_findButton = new ImageButton();
- m_nameLabel = new QLabel(this);
+ m_nameLabel = new QLabel();
m_nameLabel->setWordWrap(true);
- m_statusTextLabel = new QLabel(this);
+ m_statusTextLabel = new QLabel();
m_statusTextLabel->setWordWrap(true);
- m_locationLabel = new QLabel(this);
+ m_locationLabel = new QLabel();
m_locationLabel->setWordWrap(true);
- m_updatedLabel = new QLabel(this);
+ m_updatedLabel = new QLabel();
m_updatedLabel->setWordWrap(true);
ImageButton *updateFriendsButton = new ImageButton(this, ":/res/images/refresh.png",
infoLayout->addRow(compassLabel, m_locationLabel);
infoLayout->addRow(clockLabel, m_updatedLabel);
- verticalLayout->addWidget(m_imageLabel, 0, Qt::AlignHCenter);
+ verticalLayout->addWidget(m_findButton, 0, Qt::AlignHCenter);
verticalLayout->addWidget(m_nameLabel, 0, Qt::AlignHCenter);
verticalLayout->addLayout(infoLayout);
verticalLayout->addLayout(buttonLayout);
this,SLOT(messageUpdate()));
connect(updateFriendsButton,SIGNAL(clicked()),
this, SIGNAL(refreshUserData()));
+ connect(m_findButton, SIGNAL(clicked()),
+ this, SLOT(findButtonClicked()));
- this->setFixedWidth(BACKGROUND_WIDTH);
+ setFixedWidth(BACKGROUND_WIDTH);
this->setFont(NOKIA_FONT_SMALL);
m_nameLabel->setFont(NOKIA_FONT_NORMAL);
namePalette.setColor(QPalette::Foreground, Qt::white);
m_nameLabel->setPalette(namePalette);
- this->m_backgroundTopImage.load(":/res/images/user_info_item_top.png");
- this->m_backgroundMiddleImage.load(":/res/images/user_info_item_middle.png");
- this->m_backgroundBottomImage.load(":/res/images/user_info_item_bottom.png");
+ m_backgroundTopImage.load(":/res/images/user_info_item_top.png");
+ m_backgroundMiddleImage.load(":/res/images/user_info_item_middle.png");
+ m_backgroundBottomImage.load(":/res/images/user_info_item_bottom.png");
}
-void UserInfo::setUserName(const QString &name)
+void UserInfo::setAddress(const QString &address)
{
qDebug() << __PRETTY_FUNCTION__;
- m_userName = name;
- setText(false);
+ m_locationLabel->setText(address);
}
-void UserInfo::setProfileImage(const QPixmap &image)
+void UserInfo::setCoordinates(const QPointF &coordinates)
{
qDebug() << __PRETTY_FUNCTION__;
- m_imageLabel->setPixmap(image);
+ m_coordinates = coordinates;
}
void UserInfo::setMessageText(const QString &text)
setText(false);
}
-void UserInfo::setAddress(const QString &address)
+void UserInfo::setProfileImage(const QPixmap &image)
{
qDebug() << __PRETTY_FUNCTION__;
- m_locationLabel->setText(address);
+ m_findButton->setIcon(image);
}
void UserInfo::setTime(const QString &time)
m_updatedLabel->setText(time);
}
+void UserInfo::setUserName(const QString &name)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_userName = name;
+ setText(false);
+}
+
QString UserInfo::shortenText(const QLabel *label, const QString &text, int textMaxWidth)
{
qDebug() << __PRETTY_FUNCTION__;
m_mousePosition = event->pos();
}
+void UserInfo::findButtonClicked()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ emit findUser(m_coordinates);
+}
+
void UserInfo::messageUpdate()
{
qDebug() << __PRETTY_FUNCTION__;
#include <QWidget>
#include "updatelocation/updatelocationdialog.h"
+class ImageButton;
+
/**
* @brief UserInfo shows user's data in expandable item.
*
void setAddress(const QString &address);
/**
- * @brief Sets the user picture
+ * @brief Sets the users current coordinates
*
- * @param image Reference to user picture
+ * @param coordinates Reference to users current coordinates
*/
- void setProfileImage(const QPixmap &image);
+ void setCoordinates(const QPointF &coordinates);
/**
* @brief Sets the message text
void setMessageText(const QString &text);
/**
+ * @brief Sets the user picture
+ *
+ * @param image Reference to user picture
+ */
+ void setProfileImage(const QPixmap &image);
+
+ /**
* @brief Sets the time of updated message
*
* @param time Reference to time when message was sent.
private slots:
/**
+ * @brief Slot for find button click
+ */
+ void findButtonClicked();
+
+ /**
* @brief Slot function to forward messageUpdate launch signal
*
*/
******************************************************************************/
signals:
/**
+ * @brief Signal for finding user.
+ *
+ * @param coordinates user geo coordinates
+ */
+ void findUser(const QPointF &coordinates);
+
+ /**
* @brief Signal for refreshing user data.
*
*/
******************************************************************************/
private:
bool m_expanded; ///< Item expanded state
- QLabel *m_imageLabel; ///< Image label
QLabel *m_locationLabel; ///< Location label
QLabel *m_nameLabel; ///< Name label
QLabel *m_statusTextLabel; ///< Status text label
QPixmap m_backgroundMiddleImage; ///< Middle background image
QPixmap m_backgroundTopImage; ///< Top background image
QPoint m_mousePosition; ///< Current mouse press position
+ QPointF m_coordinates; ///< User current coordinates
QString m_address; ///< Address from where the new message was sent.
QString m_messageText; ///< User's message
QString m_time; ///< Time when the new message was sent
QString m_userName; ///< User's name
+ ImageButton *m_findButton; ///< User find button
};
#endif // USERINFO_H
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(QPointF)),
+ this, SIGNAL(findUser(QPointF)));
+
connect(m_userInfo,SIGNAL(requestReverseGeo()),
this, SIGNAL(requestReverseGeo()));
void UserInfoPanel::userDataReceived(User *user)
{
+ qDebug() << __PRETTY_FUNCTION__;
+
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());
}
}
*/
void userDataReceived(User *user);
+/*******************************************************************************
+ * SIGNALS
+ ******************************************************************************/
signals:
/**
+ * @brief Signal for finding user.
+ *
+ * @param coordinates user geo coordinates
+ */
+ void findUser(const QPointF &coordinates);
+
+ /**
* @brief Signal for refreshing user data.
*
*/
* DATA MEMBERS
******************************************************************************/
private:
- QVBoxLayout *m_userViewLayout; ///< Layout for userInfo
- QWidget *m_userInfoView; ///< Widget for userInfoLayout
UserInfo *m_userInfo; ///< Instance of the user info view
};