Merge branch 'master' of https://vcs.maemo.org/git/situare into list_panel
authorJussi Laitinen <jupe@l3l7588.ixonos.local>
Mon, 10 May 2010 12:08:20 +0000 (15:08 +0300)
committerJussi Laitinen <jupe@l3l7588.ixonos.local>
Mon, 10 May 2010 12:08:20 +0000 (15:08 +0300)
Conflicts:
src/src.pro

1  2 
images.qrc
src/src.pro
src/ui/avatarimage.cpp
src/ui/avatarimage.h
src/ui/friendlistitem.cpp
src/ui/friendlistitem.h
src/ui/friendlistpanel.cpp
src/ui/infotab.cpp
tests/ui/friendlist/testfriendlist.cpp
tests/ui/friendlist/testfriendlist.pro

diff --cc images.qrc
Simple merge
diff --cc src/src.pro
@@@ -32,13 -32,11 +32,13 @@@ SOURCES += main.cpp 
      ui/friendlistview.cpp \
      ui/friendlistitem.cpp \
      user/user.cpp \
-     ui/buttonitem.cpp \
 -    ui/situareuser.cpp \
 +    ui/avatarimage.cpp \
      engine/engine.cpp \
      ui/settingsdialog.cpp \
      map/maptilerequest.cpp \
 +    ui/friendlistpanel.cpp \
-     ui/userpanel.cpp
++    ui/userpanel.cpp \
+     ui/imagebutton.cpp
  HEADERS += ui/mainwindow.h \
      ui/mapviewscreen.h \
      ui/listviewscreen.h \
      ui/friendlistview.h \
      ui/friendlistitem.h \
      user/user.h \
-     ui/buttonitem.h \
 -    ui/situareuser.h \
 +    ui/avatarimage.h \
      engine/engine.h \
      ui/settingsdialog.h \
      map/maptilerequest.h \
 +    ui/friendlistpanel.h \
 +    ui/userpanel.h \
-     ui/panelcommon.h
++    ui/panelcommon.h \
+     ui/imagebutton.h
  QT += network \
      webkit
  #DEFINES += QT_NO_DEBUG_OUTPUT
index 78100bd,0000000..940bb49
mode 100644,000000..100644
--- /dev/null
@@@ -1,60 -1,0 +1,53 @@@
 +/*
 +   Situare - A location system for Facebook
 +   Copyright (C) 2010  Ixonos Plc. Authors:
 +
 +       Jukka Saastamoinen - jukka.saastamoinen@ixonos.com
++       Jussi Laitinen - jussi.laitinen@ixonos.com
 +
 +   Situare is free software; you can redistribute it and/or
 +   modify it under the terms of the GNU General Public License
 +   version 2 as published by the Free Software Foundation.
 +
 +   Situare is distributed in the hope that it will be useful,
 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +   GNU General Public License for more details.
 +
 +   You should have received a copy of the GNU General Public License
 +   along with Situare; if not, write to the Free Software
 +   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
 +   USA.
 +*/
 +
 +#include "avatarimage.h"
 +#include <QPainter>
 +#include <QDebug>
 +
- const int BORDER_X_OFFSET = 7;
- const int BORDER_Y_OFFSET = 7;
- const int RECT_WIDTH_OFFSET = 1;
- const int RECT_HEIGHT_OFFSET = 1;
- const int ROUNDNESS = 9;
- const int IMAGE_SIZE_X = 60;
- const int IMAGE_SIZE_Y = 60;
++const int IMAGE_WIDTH = 60;     ///< Created image width
++const int IMAGE_HEIGHT = 60;    ///< Created image height
++const int ORIGINAL_IMAGE_X = 5; ///< Original image x position
++const int ORIGINAL_IMAGE_Y = 5; ///< Original image y position
++const int ROUNDNESS = 9;        ///< Image roundness
++const int CLIP_X_OFFSET = 1;    ///< Clip
 +
- QPixmap AvatarImage::make(const QPixmap &image)
++QPixmap AvatarImage::create(const QPixmap &image)
 +{
-     QPixmap avatarImage;    // = QPixmap(IMAGE_SIZE_X, IMAGE_SIZE_Y);
++    QPixmap avatarImage = QPixmap(60, 60);
++    avatarImage.fill(Qt::transparent);
 +    QPainter painter(&avatarImage);
- //    QLabel label;
- //    label.setPixmap(image);
 +
-     QRect widgetRect = QRect(0, 0, image.width(), image.height());
++    QRect imageRect = QRect(0, 0, image.width(), image.height());
 +
-     painter.setRenderHint(QPainter::Antialiasing);
 +    QPainterPath roundedRect;
-     roundedRect.addRoundedRect(5, 5, widgetRect.width()+RECT_WIDTH_OFFSET,
-                                widgetRect.height()+RECT_HEIGHT_OFFSET,ROUNDNESS,ROUNDNESS);
++    roundedRect.addRoundedRect(ORIGINAL_IMAGE_X-1, ORIGINAL_IMAGE_Y-1, imageRect.width()+1,
++                               imageRect.height()+1,ROUNDNESS,ROUNDNESS);
++    painter.save();
 +    painter.setClipPath(roundedRect);
-     //QRegion maskRegion = painter.clipRegion();
-     //label.setMask(maskRegion);
-     painter.drawPixmap(QPointF(5, 5), image);
-     //label.clearMask();
-     painter.drawPixmap(QPoint(0, 0), QPixmap(":/res/images/profile_pic_border.png"));
++    painter.drawPixmap(QPointF(ORIGINAL_IMAGE_X, ORIGINAL_IMAGE_Y), image);
++    painter.restore();
++    painter.drawPixmap(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT,
++                       QPixmap(":/res/images/profile_pic_border.png"));
 +
 +    return avatarImage;
 +}
index 23a105d,0000000..44ff0fd
mode 100644,000000..100644
--- /dev/null
@@@ -1,39 -1,0 +1,43 @@@
 +/*
 +   Situare - A location system for Facebook
 +   Copyright (C) 2010  Ixonos Plc. Authors:
 +
 +       Jukka Saastamoinen - jukka.saastamoinen@ixonos.com
++       Jussi Laitinen - jussi.laitinen@ixonos.com
 +
 +   Situare is free software; you can redistribute it and/or
 +   modify it under the terms of the GNU General Public License
 +   version 2 as published by the Free Software Foundation.
 +
 +   Situare is distributed in the hope that it will be useful,
 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +   GNU General Public License for more details.
 +
 +   You should have received a copy of the GNU General Public License
 +   along with Situare; if not, write to the Free Software
 +   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
 +   USA.
 +*/
 +
 +#ifndef SITUAREUSER_H
 +#define SITUAREUSER_H
 +
 +#include <QLabel>
 +#include <QPixmap>
 +
 +/**
- * @brief User class for personal information tab
++* @brief AvatarImage class creates avatar images.
 +*
- * @class SituareUser situareuser.h "ui/situareuser.h"
++* @class AvatarImage avatarimage.h "ui/avatarimage.h"
 +*/
 +class AvatarImage
 +{
++/*******************************************************************************
++* MEMBER FUNCTIONS AND SLOTS
++******************************************************************************/
 +public:
-     static QPixmap make(const QPixmap &image);
++    static QPixmap create(const QPixmap &image);
 +};
 +
- #endif // SITUAREUSER_H
++#endif // AVATARIMAGE_H
  
  #include "friendlistitem.h"
  #include "../user/user.h"
 -
 -const QString BACKGROUND_PATH = ":/res/images/list_item.png";   ///< Background image path
 -const QString BACKGROUND_TOP_PATH = ":/res/images/list_item_top.png";   ///< Background image path
 -const QString BACKGROUND_MIDDLE_PATH = ":/res/images/list_item_middle.png";   ///< Background image path
 -const QString BACKGROUND_BOTTOM_PATH = ":/res/images/list_item_bottom.png";   ///< Background image path
 -const QString CLOCK_PATH = ":/res/images/clock.png";        ///< Clock image path
 -const QString COMPASS_PATH = ":/res/images/compass.png";    ///< Compass image path
 -const QString ENVELOPE_PATH = ":/res/images/envelope.png";  ///< Envelope image path
 -
 -const int ICON_MARGIN = 5;   ///< Icon margin
 -const int IMAGE_HEIGHT = 60; ///< Friend image height
 -const int IMAGE_WIDTH = 60;  ///< Friend image width
 -
 -const int ITEM_MAX_HEIGHT = 240; ///< Maximum height for item
 -const int ITEM_MAX_WIDTH = 368;  ///< Maximum width for item
 -const int ITEM_MIN_HEIGHT = 141; ///< Minimum height for item
 -const int ITEM_MIN_WIDTH = 368;  ///< Minimum width for item
 -const int LABEL_MAX_WIDTH = 247;   ///< Label maximum width
 -
 -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
 -
 -const QFont NOKIA_FONT_NORMAL = QFont( "Nokia Sans", 18, QFont::Normal);    ///< Normal font
 -const QFont NOKIA_FONT_SMALL = QFont( "Nokia Sans", 13, QFont::Normal);     ///< Small font
 -
 -/**
 -* @var STYLESHEET
 -* @brief Stylesheet for FriendListItem
 -*/
 -const QString STYLESHEET = "QWidget#listItem { border-image: url(:/res/images/list_item.png) 20%; " \
 -                           "border-width: 20px 14px 16px 14px; } " \
 -                           "QLabel { color: #989898; }" \
 -                           "#nameLabel { color: #ffffff }";
 +#include "avatarimage.h"
  
- const QString BACKGROUND_PATH = ":/res/images/list_item.png";   ///< Background image path
- const QString CLOCK_PATH = ":/res/images/clock.png";        ///< Clock image path
- const QString COMPASS_PATH = ":/res/images/compass.png";    ///< Compass image path
- const QString ENVELOPE_PATH = ":/res/images/envelope.png";  ///< Envelope image path
- const int MARGIN = 5;   ///< Icon margin
- const int IMAGE_HEIGHT = 60; ///< Friend image height
- const int IMAGE_WIDTH = 60;  ///< Friend image width
- const int ITEM_MAX_HEIGHT = 240; ///< Maximum height for item
- const int ITEM_MAX_WIDTH = 368;  ///< Maximum width for item
- const int ITEM_MIN_HEIGHT = 141; ///< Minimum height for item
- const int ITEM_MIN_WIDTH = 368;  ///< Minimum width for item
- const int LABEL_MAX_WIDTH = 247;   ///< Label maximum width
- 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
- const QFont NOKIA_FONT_NORMAL = QFont("Nokia Sans", 18, QFont::Normal);    ///< Normal font
- const QFont NOKIA_FONT_SMALL = QFont("Nokia Sans", 13, QFont::Normal);     ///< Small font
- const QColor COLOR_GRAY = QColor(152, 152, 152);
  FriendListItem::FriendListItem(QWidget *parent)
      : QWidget(parent)
      , m_expanded(false)
@@@ -66,9 -75,7 +43,9 @@@
      qDebug() << __PRETTY_FUNCTION__;
  
      QVBoxLayout *layout = new QVBoxLayout(this);
 -    this->setLayout(layout);
 +    layout->setContentsMargins(MARGIN, 0, MARGIN*2, MARGIN*2);
 +    layout->setSpacing(0);
-     this->setLayout(layout);
++    setLayout(layout);
  
      QHBoxLayout *topLayout = new QHBoxLayout();
      topLayout->setMargin(0);
      QFormLayout *infoLayout = new QFormLayout();
      infoLayout->setMargin(0);
      infoLayout->setSpacing(0);
++    infoLayout->setLabelAlignment(Qt::AlignTop);
  
      QLabel *clockLabel = new QLabel();
--    clockLabel->setPixmap(QPixmap(CLOCK_PATH));
 -    clockLabel->setContentsMargins(0, 0, ICON_MARGIN, 0);
++    clockLabel->setPixmap(QPixmap(":/res/images/clock.png"));
 +    clockLabel->setContentsMargins(0, 0, MARGIN, 0);
++    clockLabel->setFixedSize(ICON_WIDTH + MARGIN, ICON_HEIGHT);
      QLabel *envelopeLabel = new QLabel();
--    envelopeLabel->setPixmap(QPixmap(ENVELOPE_PATH));
 -    envelopeLabel->setContentsMargins(0, 0, ICON_MARGIN, 0);
++    envelopeLabel->setPixmap(QPixmap(":/res/images/envelope.png"));
 +    envelopeLabel->setContentsMargins(0, 0, MARGIN, 0);
++    envelopeLabel->setFixedSize(ICON_WIDTH + MARGIN, ICON_HEIGHT);
      QLabel *compassLabel = new QLabel();
--    compassLabel->setPixmap(QPixmap(COMPASS_PATH));
 -    compassLabel->setContentsMargins(0, 0, ICON_MARGIN, 0);
++    compassLabel->setPixmap(QPixmap(":/res/images/compass.png"));
 +    compassLabel->setContentsMargins(0, 0, MARGIN, 0);
++    compassLabel->setFixedSize(ICON_WIDTH + MARGIN, ICON_HEIGHT);
  
      m_imageLabel = new QLabel();
      m_imageLabel->setFixedSize(IMAGE_WIDTH, IMAGE_HEIGHT);
  
      m_nameLabel = new QLabel();
      m_nameLabel->setFixedHeight(IMAGE_HEIGHT);
 -    m_nameLabel->setFont(NOKIA_FONT_NORMAL);
 +
 +    m_distanceLabel = new QLabel();
 +    m_distanceLabel->setFixedHeight(IMAGE_HEIGHT);
-     //m_distanceLabel->setAlignment(Qt::AlignHCenter | Qt::AlignRight);
- //    m_distanceLabel->setMinimumWidth(IMAGE_WIDTH + 15);
- //    m_distanceLabel->setMaximumWidth(IMAGE_WIDTH + 15);
 +
 +    QLabel *button = new QLabel();
-     button->setPixmap(QPixmap("res/images/show_position.png"));
++    button->setPixmap(QPixmap(":/res/images/show_position.png"));
 +    button->setFixedSize(IMAGE_WIDTH, IMAGE_HEIGHT);
  
      m_updatedLabel = new QLabel();
      m_updatedLabel->setWordWrap(true);
@@@ -152,12 -143,9 +130,15 @@@ void FriendListItem::setData(User *user
  
      if (user) {
          m_user = user;
--        shortenTexts();
-         m_imageLabel->setPixmap(AvatarImage::make(m_user->profileImage()));
 -        m_imageLabel->setPixmap(m_user->profileImage());
++        m_imageLabel->setPixmap(AvatarImage::create(m_user->profileImage()));
++
 +        QString unit;
 +        double value;
 +        user->distance(value, unit);
 +        m_distanceLabel->setText(QString::number(value) + " " + unit);
++
++        shortenTexts();
          setText(false);
      }
  }
@@@ -196,8 -184,8 +177,9 @@@ void FriendListItem::shortenTexts(
          location.append("...");
      }
  
--
--    m_shortenedName = nameLabelMetrics.elidedText(name, Qt::ElideRight, LABEL_MAX_WIDTH + 30);
++    int distanceLabelWidth = otherLabelsMetrics.width(m_distanceLabel->text());
++    m_shortenedName = nameLabelMetrics.elidedText(name, Qt::ElideRight, NAME_LABEL_MAX_WIDTH
++                                                  - distanceLabelWidth);
      m_shortenedUpdated = otherLabelsMetrics.elidedText(updated, Qt::ElideRight, LABEL_MAX_WIDTH);
      m_shortenedStatusText = otherLabelsMetrics.elidedText(statusText, Qt::ElideRight,
                                                            LABEL_MAX_WIDTH);
@@@ -252,17 -236,12 +234,17 @@@ void FriendListItem::mouseReleaseEvent(
  
  void FriendListItem::paintEvent(QPaintEvent *event)
  {
 -//    qDebug() << __PRETTY_FUNCTION__ << " " << event->rect();
 -    Q_UNUSED(event);
 +    qDebug() << __PRETTY_FUNCTION__ << " " << event->rect();
 +
 +    QPainter painter(this);
  
-     QRect topRect = QRect(0, 0, event->rect().width(), 20);
 -    QStyleOption option;
 -    option.init(this);
++    QRect topRect = QRect(0, 0, event->rect().width(), BACKGROUND_TOP_HEIGHT);
 +    QRect middleRect = QRect(0, topRect.bottom(), event->rect().width(),
-                              height() - 20 - 15);
++                             height() - BACKGROUND_TOP_HEIGHT - BACKGROUND_BOTTOM_HEIGHT);
 +    QRect bottomRect = QRect(topRect.left(), middleRect.bottom(), event->rect().width(),
-                              15);
++                             BACKGROUND_BOTTOM_HEIGHT);
  
 -    QStylePainter painter(this);
 -    style()->drawPrimitive(QStyle::PE_Widget, &option, &painter, this);
 +    painter.drawPixmap(topRect, m_backgroundTopImage);
 +    painter.drawPixmap(middleRect, m_backgroundMiddleImage);
 +    painter.drawPixmap(bottomRect, m_backgroundBottomImage);
  }
@@@ -102,17 -103,10 +102,20 @@@ private
      void setText(bool expanded);
  
  /******************************************************************************
 +* SIGNALS
 +******************************************************************************/
 +signals:
-     void findButtonClicked(const QPointF &coordinates);
++    void locationButtonClicked(const QPointF &coordinates);
 +
 +/******************************************************************************
  * DATA MEMBERS
  ******************************************************************************/
  private:
++    QPixmap m_backgroundTopImage;   ///< Top background image
++    QPixmap m_backgroundMiddleImage;   ///< Middle background image
++    QPixmap m_backgroundBottomImage;   ///< Bottom background image
      bool m_expanded;                ///< Item expanded state
 +    QLabel *m_distanceLabel;        ///< Distance to friend label
      QLabel *m_imageLabel;           ///< Image label
      QLabel *m_locationLabel;        ///< Location label
      QPoint m_mousePosition;         ///< Current mouse press position
      QString m_shortenedUpdated;     ///< Shortened updated text
      QLabel *m_statusTextLabel;      ///< Status text label
      QLabel *m_updatedLabel;         ///< Updated label
--
      User *m_user;                    ///< User data
-     QPixmap m_backgroundTopImage;   ///< Top background image
-     QPixmap m_backgroundMiddleImage;   ///< Middle background image
-     QPixmap m_backgroundBottomImage;   ///< Bottom background image
  };
  
++const int BACKGROUND_TOP_HEIGHT = 20;
++const int BACKGROUND_BOTTOM_HEIGHT = 15;
++const QColor COLOR_GRAY = QColor(152, 152, 152);    ///< Gray color
++const QFont NOKIA_FONT_NORMAL = QFont("Nokia Sans", 18, QFont::Normal);    ///< Normal font
++const QFont NOKIA_FONT_SMALL = QFont("Nokia Sans", 13, QFont::Normal);     ///< Small font
++const int ICON_HEIGHT = 24;     ///< Icon height
++const int ICON_WIDTH = 24;       ///< Icon width
++const int IMAGE_HEIGHT = 60; ///< Friend image height
++const int IMAGE_WIDTH = 60;  ///< Friend image width
++const int ITEM_MAX_HEIGHT = 240; ///< Maximum height for item
++const int ITEM_MAX_WIDTH = 368;  ///< Maximum width for item
++const int ITEM_MIN_HEIGHT = 141; ///< Minimum height for item
++const int ITEM_MIN_WIDTH = 368;  ///< Minimum width for item
++const int MARGIN = 5;   ///< Icon margin
++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
++/**
++* @var NAME_LABEL_MAX_WIDTH
++*
++* @brief Name label's maximum width
++*/
++const int NAME_LABEL_MAX_WIDTH = ITEM_MIN_WIDTH - 3*MARGIN - IMAGE_WIDTH;
++/**
++* @var LABEL_MAX_WIDTH
++*
++* @brief All label's maximum width
++*/
++const int LABEL_MAX_WIDTH = ITEM_MIN_WIDTH - 3*MARGIN - IMAGE_WIDTH - MARGIN - ICON_WIDTH;
++
  #endif // FRIENDLISTITEM_H
index 33edabe,0000000..8719b2e
mode 100644,000000..100644
--- /dev/null
@@@ -1,128 -1,0 +1,127 @@@
 + /*
 +    Situare - A location system for Facebook
 +    Copyright (C) 2010  Ixonos Plc. Authors:
 +
 +        Kaj Wallin - kaj.wallin@ixonos.com
 +
 +    Situare is free software; you can redistribute it and/or
 +    modify it under the terms of the GNU General Public License
 +    version 2 as published by the Free Software Foundation.
 +
 +    Situare is distributed in the hope that it will be useful,
 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +    GNU General Public License for more details.
 +
 +    You should have received a copy of the GNU General Public License
 +    along with Situare; if not, write to the Free Software
 +    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
 +    USA.
 + */
 +
 +#include "friendlistpanel.h"
 +#include "friendlistview.h"
 +#include "friendlistitem.h"
 +#include "panelcommon.h"
 +
 +FriendListPanel::FriendListPanel(QWidget *parent)
 +    : QWidget(parent)
 +{
 +    qDebug() << __PRETTY_FUNCTION__;
 +    m_friendsPanelVBox = new QVBoxLayout(this);
 +    m_friendsPanelVBox->setMargin(0);
 +    m_friendsPanelVBox->setSpacing(0);
 +    this->setLayout(m_friendsPanelVBox);
 +    m_friendsPanelExpandButton = new QPushButton("Friends", this);
 +    m_friendsPanelVBox->addWidget(m_friendsPanelExpandButton);
 +
 +    m_friendListView = new FriendListView(this);
 +    QScrollArea *friendListScroll = new QScrollArea(this);
 +    friendListScroll->setWidget(m_friendListView);
-     friendListScroll->setWidgetResizable(true);
 +    friendListScroll->viewport()->setAutoFillBackground(false);
 +    friendListScroll->widget()->setAutoFillBackground(false);
 +
 +    m_friendsPanelVBox->addWidget(friendListScroll);
 +
 +    m_friendsPanelStateMachine = new QStateMachine(this);
 +    m_friendsPanelStateClosed = new QState(m_friendsPanelStateMachine);
 +    m_friendsPanelStateClosed->assignProperty(this, "pos", QPoint(
 +            FRIENDPANEL_CLOSED_X, PANEL_TOP_Y));
 +    m_friendsPanelStateMachine->setInitialState(m_friendsPanelStateClosed);
 +
 +    m_friendsPanelStateOpened = new QState(m_friendsPanelStateMachine);
 +    m_friendsPanelStateOpened->assignProperty(this, "pos", QPoint(
 +            FRIENDPANEL_OPENED_X, PANEL_TOP_Y));
 +
 +    m_friendsPanelTransitionOpen = m_friendsPanelStateClosed->addTransition(
 +            m_friendsPanelExpandButton, SIGNAL(clicked()), m_friendsPanelStateOpened);
 +    m_friendsPanelTransitionOpen->addAnimation(new QPropertyAnimation(this, "pos"));
 +
 +    m_friendsPanelTransitionClose = m_friendsPanelStateOpened->addTransition(
 +            m_friendsPanelExpandButton, SIGNAL(clicked()), m_friendsPanelStateClosed);
 +    m_friendsPanelTransitionClose->addAnimation(new QPropertyAnimation(this, "pos"));
 +
 +    m_friendsPanelStateMachine->start();
 +
 +    //Debug
 +    QList<User *> friendList;
 +    for (int i = 0; i < 10; ++i) {
 +        User *user = new User(QString("Address"), QPointF(12.22, 23.33), QString("Name Name Name Naem"),
 +                              QString("Hello world! Hello world! Hello world! Hello world! "),
 +                              QUrl(), QString("2 days ago"), false, QString("id"), QString("km"),
-                               10000);
-         user->setProfileImage(QPixmap("res/images/face.gif"));
++                              600);
++        user->setProfileImage(QPixmap(":/res/images/face.gif"));
 +        friendList.append(user);
 +    }
 +    friendInfoReceived(friendList);
 +
 +    this->setObjectName("UserPanel");
 +    //this->setStyleSheet(QString("#UserPanel{background-image: url(:/res/images/personal_info_bckgrnd.png)}"));
 +
 +    this->setAutoFillBackground(true);
 +    QPalette pal = palette();
 +    pal.setColor(QPalette::Background, QColor(0, 0, 0, 128));
 +    setPalette(pal);
 +}
 +
 +void FriendListPanel::friendInfoReceived(QList<User *> &friendList)
 +{
 +    qDebug() << __PRETTY_FUNCTION__;
 +
-     m_friendListView->clear();
++    //m_friendListView->clear();
 +
 +    foreach (User *user, friendList) {
 +        FriendListItem *item = new FriendListItem(m_friendListView);
 +        item->setData(user);
 +        m_friendListView->addWidget(item);
 +        FriendListItem *item2 = new FriendListItem(m_friendListView);
 +        item2->setData(user);
 +        m_friendListView->addWidget(item2);
 +        FriendListItem *item3 = new FriendListItem(m_friendListView);
 +        item3->setData(user);
 +        m_friendListView->addWidget(item3);
 +        FriendListItem *item4 = new FriendListItem(m_friendListView);
 +        item4->setData(user);
 +        m_friendListView->addWidget(item4);
 +    }
 +}
 +
 +void FriendListPanel::reDrawFriendsPanel(int width, int height)
 +{
 +    qDebug() << __PRETTY_FUNCTION__;
 +    this->resize(FRIENDPANEL_WIDTH,height + MARGIN_CORRECTION);
 +    m_friendsPanelStateClosed->assignProperty(this, "pos", QPoint(
 +            width-PANEL_PEEK_AMOUNT, PANEL_TOP_Y));
 +    m_friendsPanelStateOpened->assignProperty(this, "pos", QPoint(
 +            width - FRIENDPANEL_WIDTH + MARGIN_CORRECTION, PANEL_TOP_Y));
 +    this->move(width-PANEL_PEEK_AMOUNT, PANEL_TOP_Y);
 +}
 +
 +void FriendListPanel::paintEvent(QPaintEvent *)
 +{
 +    QStyleOption option;
 +    option.init(this);
 +
 +    QStylePainter painter(this);
 +    style()->drawPrimitive(QStyle::PE_Widget, &option, &painter, this);
 +}
Simple merge
@@@ -25,6 -25,6 +25,7 @@@
  #include "../../../src/ui/friendlistitem.h"
  #include "../../../src/ui/friendlistview.h"
  #include "../../../src/user/user.h"
++#include "../../../src/ui/avatarimage.h"
  
  
  class TestFriendList: public QObject
@@@ -1,8 -1,8 +1,10 @@@
  CONFIG += qtestlib
  HEADERS += ../../../src/ui/friendlistview.h \
      ../../../src/ui/friendlistitem.h \
--    ../../../src/user/user.h
++    ../../../src/user/user.h \
++    ../../../src/ui/avatarimage.h
  SOURCES += ../../../src/ui/friendlistview.cpp \
      ../../../src/ui/friendlistitem.cpp \
      ../../../src/user/user.cpp \
++    ../../../src/ui/avatarimage.cpp \
      testfriendlist.cpp