From: Katri Kaikkonen Date: Fri, 27 Aug 2010 12:37:21 +0000 (+0300) Subject: Merge branch 'fix_userinfo' into userinfo_collapse, review and fixes X-Git-Tag: v2.0b-1~36^2^2~2 X-Git-Url: https://vcs.maemo.org/git/?p=situare;a=commitdiff_plain;h=f4d35a5ccb86127d44aa73d44349773b0d4f3ed1 Merge branch 'fix_userinfo' into userinfo_collapse, review and fixes Reviewed by Sami Rämö Conflicts: src/ui/userinfo.cpp --- f4d35a5ccb86127d44aa73d44349773b0d4f3ed1 diff --cc src/ui/mainwindow.cpp index 970e369,b8b5093..b59bd2c --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@@ -349,12 -349,6 +349,12 @@@ void MainWindow::buildPanels( connect(m_tabbedPanel, SIGNAL(panelOpened()), m_mapView, SLOT(enableCenterShift())); + + connect(m_tabbedPanel, SIGNAL(panelClosed()), - m_userInfoPanel, SIGNAL(collapse())); ++ m_userInfoPanel, SIGNAL(collapse())); + + connect(m_tabbedPanel, SIGNAL(currentChanged(int)), - m_userInfoPanel, SIGNAL(collapse())); ++ m_userInfoPanel, SIGNAL(collapse())); } void MainWindow::buildRoutingPanel() diff --cc src/ui/userinfo.cpp index adb89ee,0465bf7..244041e --- a/src/ui/userinfo.cpp +++ b/src/ui/userinfo.cpp @@@ -216,14 -209,13 +216,13 @@@ void UserInfo::mouseReleaseEvent(QMouse { qDebug() << __PRETTY_FUNCTION__ << " " << event->pos(); - - const int MOUSE_PRESS_AREA_WIDTH = 20; const int MOUSE_PRESS_AREA_HEIGHT = 20; + const int MOUSE_PRESS_AREA_WIDTH = 20; - if ((abs(m_mousePosition.y() - event->pos().y()) <= MOUSE_PRESS_AREA_WIDTH) && - (abs(m_mousePosition.x() - event->pos().x()) <= MOUSE_PRESS_AREA_HEIGHT)) { + if ((abs(m_mousePosition.y() - event->pos().y()) <= MOUSE_PRESS_AREA_WIDTH) + && (abs(m_mousePosition.x() - event->pos().x()) <= MOUSE_PRESS_AREA_HEIGHT)) { if (m_expanded) { - setText(false); + setExpanded(false); m_expanded = false; } else { @@@ -288,8 -280,7 +287,8 @@@ void UserInfo::setMessageText(const QSt } m_messageText = list.join(" "); - m_statusTextLabel->setText(m_messageText); - setText(false); ++ + setExpanded(false); } void UserInfo::setProfileImage(const QPixmap &image) @@@ -326,7 -313,7 +321,8 @@@ void UserInfo::setUserName(const QStrin qDebug() << __PRETTY_FUNCTION__; m_userName = name; - setExpanded(false); ++ + m_nameLabel->setText(shortenText(m_nameLabel, m_userName, LABEL_MAX_WIDTH)); } QString UserInfo::shortenText(const QLabel *label, const QString &text, int textMaxWidth) diff --cc src/ui/userinfo.h index bc23f2e,9e582aa..ac51ac9 --- a/src/ui/userinfo.h +++ b/src/ui/userinfo.h @@@ -154,12 -153,15 +153,15 @@@ private * * @param expanded true if full-length text is set, false otherwise */ - void setText(bool expanded); + void setExpanded(bool expanded); /** - * @brief Set shortened texts from User data. + * @brief Elides long text * - * Text length is defined by MAXIMUM_CHARS. + * @param label get the fontmetrics from the label + * @param text long text to be shortened + * @param textMaxWidth label width + * @returns shortened text */ QString shortenText(const QLabel *label, const QString &text, int textMaxWidth); diff --cc src/ui/userinfopanel.cpp index 6f8582f,e68f390..e4e022c --- a/src/ui/userinfopanel.cpp +++ b/src/ui/userinfopanel.cpp @@@ -79,10 -79,7 +79,10 @@@ UserInfoPanel::UserInfoPanel(QWidget *p m_userInfo, SLOT(clearUpdateLocationDialogData())); connect(m_userInfo, SIGNAL(notificateUpdateFailing(QString, bool)), -- this, SIGNAL(notificateUpdateFailing(QString, bool))); ++ this, SIGNAL(notificateUpdateFailing(QString, bool))); + + connect(this, SIGNAL(collapse()), - m_userInfo, SLOT(collapse())); ++ m_userInfo, SLOT(collapse())); } void UserInfoPanel::userDataReceived(User *user) diff --cc src/ui/userinfopanel.h index ace37d4,df38811..c575dc1 --- a/src/ui/userinfopanel.h +++ b/src/ui/userinfopanel.h @@@ -72,11 -72,6 +72,11 @@@ signals void findUser(const GeoCoordinate &coordinates); /** - * @brief Slot for collapse user info ++ * @brief Signal for collapse user info + */ + void collapse(); + + /** * @brief Signal that used to inform user that his message/location update tp Situare server * was failed. * This signal is originally sended from UserInfo