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

src/ui/mainwindow.cpp
src/ui/updatelocation/updatelocationdialog.cpp
src/ui/userinfo.cpp
src/ui/userinfo.h
src/ui/userinfopanel.cpp
src/ui/userinfopanel.h

index b8b5093..b59bd2c 100644 (file)
@@ -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()));
+
+    connect(m_tabbedPanel, SIGNAL(currentChanged(int)),
+            m_userInfoPanel, SIGNAL(collapse()));
 }
 
 void MainWindow::buildRoutingPanel()
index 4761dab..20e78ad 100644 (file)
@@ -20,8 +20,7 @@
    USA.\r
 */\r
 \r
-#include <Qt/qapplication.h>\r
-\r
+#include <QApplication>\r
 #include <QCheckBox>\r
 #include <QDebug>\r
 #include <QDialogButtonBox>\r
@@ -162,8 +161,7 @@ void UpdateLocationDialog::textChanged()
 \r
     QString msgText = m_textEdit->toPlainText().toUtf8();\r
 \r
-    if (msgText.length() > MESSAGE_MAX_LENGTH)\r
-    {\r
+    if (msgText.length() > MESSAGE_MAX_LENGTH) {\r
         QKeyEvent event = QKeyEvent(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier);\r
         QApplication::sendEvent(m_textEdit, &event);\r
     }\r
index 0465bf7..244041e 100644 (file)
 
 #include "userinfo.h"
 
-const int BACKGROUND_WIDTH = 368;
-const int BACKGROUND_TOP_HEIGHT = 20;
 const int BACKGROUND_BOTTOM_HEIGHT = 15;
+const int BACKGROUND_TOP_HEIGHT = 20;
+const int BACKGROUND_WIDTH = 368;
 const int ICON_HEIGHT = 24;
 const int ICON_WIDTH = 24;
-const int MARGIN = 5;
 const int LABEL_MAX_WIDTH = 300;
+const int MARGIN = 5;
 
 UserInfo::UserInfo(QWidget *parent)
     : QWidget(parent),
@@ -166,6 +166,13 @@ void UserInfo::clearUpdateLocationDialogData()
     m_backupFacebookPublishPolicity = false;
 }
 
+void UserInfo::collapse()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    setExpanded(false);
+}
+
 void UserInfo::findButtonClicked()
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -215,11 +222,11 @@ void UserInfo::mouseReleaseEvent(QMouseEvent *event)
     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 {
-            setText(true);
+            setExpanded(true);
             m_expanded = true;
         }
     }
@@ -280,7 +287,8 @@ void UserInfo::setMessageText(const QString &text)
     }
 
     m_messageText = list.join(" ");
-    setText(false);
+
+    setExpanded(false);
 }
 
 void UserInfo::setProfileImage(const QPixmap &image)
@@ -291,7 +299,7 @@ void UserInfo::setProfileImage(const QPixmap &image)
         m_findButton->setButtonIcon(image);
 }
 
-void UserInfo::setText(bool expanded)
+void UserInfo::setExpanded(bool expanded)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
@@ -313,6 +321,7 @@ void UserInfo::setUserName(const QString &name)
     qDebug() << __PRETTY_FUNCTION__;
 
     m_userName = name;
+
     m_nameLabel->setText(shortenText(m_nameLabel, m_userName, LABEL_MAX_WIDTH));
 }
 
index 9e582aa..ac51ac9 100644 (file)
@@ -153,7 +153,7 @@ private:
      *
      * @param expanded true if full-length text is set, false otherwise
      */
-    void setText(bool expanded);
+    void setExpanded(bool expanded);
 
     /**
      * @brief Elides long text
@@ -177,6 +177,11 @@ private:
 
 private slots:
     /**
+     * @brief Slot for collapse user info
+     */
+    void collapse();
+
+    /**
      * @brief Slot for find button click
      */
     void findButtonClicked();
index e68f390..e4e022c 100644 (file)
@@ -79,7 +79,10 @@ UserInfoPanel::UserInfoPanel(QWidget *parent)
             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()));
 }
 
 void UserInfoPanel::userDataReceived(User *user)
index df38811..c575dc1 100644 (file)
@@ -72,6 +72,11 @@ signals:
     void findUser(const GeoCoordinate &coordinates);
 
     /**
+     * @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