Merge branch 'fix_userinfo' into userinfo_collapse, review and fixes
authorKatri Kaikkonen <katri.kaikkonen@ixonos.com>
Fri, 27 Aug 2010 12:37:21 +0000 (15:37 +0300)
committerKatri Kaikkonen <katri.kaikkonen@ixonos.com>
Fri, 27 Aug 2010 12:37:21 +0000 (15:37 +0300)
Reviewed by Sami Rämö

Conflicts:
src/ui/userinfo.cpp

1  2 
src/ui/mainwindow.cpp
src/ui/userinfo.cpp
src/ui/userinfo.h
src/ui/userinfopanel.cpp
src/ui/userinfopanel.h

@@@ -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()
@@@ -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)
@@@ -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);
  
@@@ -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)
@@@ -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