Minor changes to userinfo. Remove word wrap from name label and rename button
[situare] / src / ui / userinfo.h
index f3514c8..14be1cf 100644 (file)
@@ -35,8 +35,6 @@ class ImageButton;
 
 /**
  * @brief UserInfo shows user's data in expandable item.
- *
- * @class UserInfo userinfo.h "ui/userinfo.h"
  */
 class UserInfo : public QWidget
 {
@@ -48,7 +46,7 @@ public:
      *
      * @param parent Parent
      */
-    UserInfo(QWidget *parent=0);
+    UserInfo(QWidget *parent = 0);
 
     /**
      * @brief Desctructor
@@ -79,9 +77,9 @@ protected:
     /**
      * @brief This function is called when the widget is drawn
      *
-     * @param aPaintEvent Pointer to paint event
+     * @param event Pointer to paint event
      */
-    void paintEvent(QPaintEvent *aPaintEvent);
+    void paintEvent(QPaintEvent *event);
 
 /******************************************************************************
 * MEMBER FUNCTIONS AND SLOTS
@@ -123,12 +121,6 @@ public:
     void setUserName(const QString &name);
 
 public slots:
-
-    /**
-     * @brief Clears backups of message and publish on Facebook setting
-     */
-    void clearUpdateLocationDialogData();
-
     /**
      * @brief Saves status message and Facebook publish setting
      *
@@ -139,6 +131,11 @@ public slots:
     void backupUpdateLocationDialogData(const QString &status, bool publish);
 
     /**
+     * @brief Clears backups of message and publish on Facebook setting
+     */
+    void clearUpdateLocationDialogData();
+
+    /**
      * @brief Sets the message text
      *
      * @param text Reference to user message
@@ -146,7 +143,6 @@ public slots:
     void setMessageText(const QString &text);
 
 private:
-
     /**
      * @brief reads Unsend message from settings at startup
      */
@@ -157,17 +153,35 @@ 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);
 
+    /**
+     * @brief Split too long words.
+     *
+     * Splits long word to several by adding extra spaces
+     *
+     * @param word long word to be splitted
+     * @returns splitted word
+     */
+    QString splitWord(const QString &word) const;
+
 private slots:
     /**
+     * @brief Slot for collapse user info
+     */
+    void collapse();
+
+    /**
      * @brief Slot for find button click
      */
     void findButtonClicked();
@@ -247,13 +261,12 @@ private:
 
     QString m_address;                      ///< Address from where the new message was sent
     QString m_backupMessage;                ///< Backup of users message
-    QString m_expandedMessageText;          ///< Expanded message text
     QString m_messageText;                  ///< User's message
     QString m_time;                         ///< Time when the new message was sent
     QString m_userName;                     ///< User's name
 
     GeoCoordinate m_coordinates;            ///< User current coordinates
-    ImageButton *m_findButton;              ///< User find button
+    ImageButton *m_avatar;                  ///< User find button
     UpdateLocationDialog *m_updateLocation; ///< Update location dialog
 };