Merge branch 'fix_userinfo' into userinfo_collapse, review and fixes
[situare] / src / ui / userinfo.cpp
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));
 }