Added userinfo collapse functionality
authorKatri Kaikkonen <katri.kaikkonen@ixonos.com>
Fri, 27 Aug 2010 10:59:55 +0000 (13:59 +0300)
committerKatri Kaikkonen <katri.kaikkonen@ixonos.com>
Fri, 27 Aug 2010 10:59:55 +0000 (13:59 +0300)
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..970e369 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 d5e59af..adb89ee 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__;
@@ -216,11 +223,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;
         }
     }
@@ -282,7 +289,7 @@ void UserInfo::setMessageText(const QString &text)
 
     m_messageText = list.join(" ");
     m_statusTextLabel->setText(m_messageText);
-    setText(false);
+    setExpanded(false);
 }
 
 void UserInfo::setProfileImage(const QPixmap &image)
@@ -293,7 +300,7 @@ void UserInfo::setProfileImage(const QPixmap &image)
         m_findButton->setButtonIcon(image);
 }
 
-void UserInfo::setText(bool expanded)
+void UserInfo::setExpanded(bool expanded)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
@@ -319,7 +326,7 @@ void UserInfo::setUserName(const QString &name)
     qDebug() << __PRETTY_FUNCTION__;
 
     m_userName = name;
-    setText(false);
+    setExpanded(false);
 }
 
 QString UserInfo::shortenText(const QLabel *label, const QString &text, int textMaxWidth)
index 0e51cd7..bc23f2e 100644 (file)
@@ -154,7 +154,7 @@ 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.
@@ -172,6 +172,11 @@ private:
 
 private slots:
     /**
+     * @brief Slot for collapse user info
+     */
+    void collapse();
+
+    /**
      * @brief Slot for find button click
      */
     void findButtonClicked();
index e68f390..6f8582f 100644 (file)
@@ -80,6 +80,9 @@ UserInfoPanel::UserInfoPanel(QWidget *parent)
 
     connect(m_userInfo, SIGNAL(notificateUpdateFailing(QString, bool)),
              this, SIGNAL(notificateUpdateFailing(QString, bool)));
+
+    connect(this, SIGNAL(collapse()),
+               m_userInfo, SLOT(collapse()));
 }
 
 void UserInfoPanel::userDataReceived(User *user)
index df38811..ace37d4 100644 (file)
@@ -72,6 +72,11 @@ signals:
     void findUser(const GeoCoordinate &coordinates);
 
     /**
+     * @brief Slot 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