The first "kind of" working version of the new panels
[situare] / src / ui / userinfo.cpp
index c6f11ae..7ee573f 100644 (file)
    USA.
 */
 
+#include "userinfo.h"
+
+#include "../user/user.h"
 #include "common.h"
 #include "imagebutton.h"
-#include "../user/user.h"
-#include "userinfo.h"
 
-const int BACKGROUND_WIDTH = 240;           ///< Width for item
-const int BACKGROUND_TOP_HEIGHT = 16;       ///< Height for item top
+const int BACKGROUND_WIDTH = 368;           ///< Width for item
+const int BACKGROUND_TOP_HEIGHT = 20;       ///< Height for item top
 const int BACKGROUND_BOTTOM_HEIGHT = 15;    ///< Height for item bottom
 const int ICON_HEIGHT = 24;                 ///< Icon height
 const int ICON_WIDTH = 24;                  ///< Icon width
 const int MARGIN = 5;                       ///< Icon margin
-const int LINE_LENGTH = 17;                 ///< Line length
+const int LINE_LENGTH = 27;                 ///< Line length
 const int MOUSE_PRESS_AREA_WIDTH = 20;      ///< Area width for item height toggling
 const int MOUSE_PRESS_AREA_HEIGHT = 20;     ///< Area height for item height toggling
 
@@ -127,9 +128,9 @@ UserInfo::UserInfo(QWidget *parent)
     namePalette.setColor(QPalette::Foreground, Qt::white);
     m_nameLabel->setPalette(namePalette);
 
-    m_backgroundTopImage.load(":/res/images/user_info_item_top.png");
-    m_backgroundMiddleImage.load(":/res/images/user_info_item_middle.png");
-    m_backgroundBottomImage.load(":/res/images/user_info_item_bottom.png");
+    m_backgroundTopImage.load(":/res/images/list_item_top.png");
+    m_backgroundMiddleImage.load(":/res/images/list_item_middle.png");
+    m_backgroundBottomImage.load(":/res/images/list_item_bottom.png");
 
     restoreUnsendMessage();
 }
@@ -301,7 +302,7 @@ void UserInfo::paintEvent(QPaintEvent *aPaintEvent)
 
     QRect topRect = QRect(0, MARGIN, BACKGROUND_WIDTH, BACKGROUND_TOP_HEIGHT);
     QRect middleRect = QRect(0, topRect.bottom(), BACKGROUND_WIDTH,
-                             height() - BACKGROUND_TOP_HEIGHT - BACKGROUND_BOTTOM_HEIGHT);
+                             this->height() - BACKGROUND_TOP_HEIGHT - BACKGROUND_BOTTOM_HEIGHT);
     QRect bottomRect = QRect(topRect.left(), middleRect.bottom(), BACKGROUND_WIDTH,
                              BACKGROUND_BOTTOM_HEIGHT);
 
@@ -333,7 +334,7 @@ QString UserInfo::shortenText(const QLabel *label, const QString &text, int text
             textParam.truncate(index);
             textParam.append("...");
         }
-            if (textWidth > 150)
+            if (textWidth > 250)
                 textParam.insert(LINE_LENGTH, QString("\n"));
 
    return labelMetrics.elidedText(textParam, Qt::ElideRight, textMaxWidth);
@@ -361,5 +362,4 @@ void UserInfo::updateLocationDialogFinished(int reason)
         m_updateLocation->deleteLater();
         m_updateLocation = 0;
     }
-
 }