Modified FriendListView::clear method.
authorJussi Laitinen <jupe@l3l7588.ixonos.local>
Thu, 29 Apr 2010 11:48:50 +0000 (14:48 +0300)
committerJussi Laitinen <jupe@l3l7588.ixonos.local>
Thu, 29 Apr 2010 11:48:50 +0000 (14:48 +0300)
res/images/personal_info_bckgrnd.png [changed mode: 0644->0755]
src/situareservice/situareservice.cpp
src/ui/friendlistview.cpp
src/ui/listviewscreen.cpp

old mode 100644 (file)
new mode 100755 (executable)
index c479198..2bdfb0c
Binary files a/res/images/personal_info_bckgrnd.png and b/res/images/personal_info_bckgrnd.png differ
index 7397908..234698b 100644 (file)
@@ -268,6 +268,9 @@ void SituareService::parseUserData(const QByteArray &jsonReply)
 
     QUrl imageUrl = userMap["profile_pic"].toUrl();
 
+//    if (imageUrl.isEmpty())
+//        imageUrl = QUrl("http://static.ak.fbcdn.net/pics/q_silhouette.gif");
+
     m_user = new User(userMap["address"].toString(), coordinates, userMap["name"].toString(),
                   userMap["note"].toString(), imageUrl, userMap["timestamp"].toString(),
                   true, userMap["uid"].toString());
@@ -319,14 +322,14 @@ void SituareService::imageReceived(const QUrl &url, const QPixmap &image)
 
 void SituareService::addProfileImages()
 {
-    qDebug() << __PRETTY_FUNCTION__;
+    qDebug() << __PRETTY_FUNCTION__ << m_user->profileImageUrl();
 
-    if(!m_user->profileImageUrl().isEmpty() && m_user->profileImageUrl().isValid()) {
+    if(!m_user->profileImageUrl().isEmpty()) {
         emit fetchImage(m_user->profileImageUrl());
     }
 
     for(int i=0;i<m_friendsList.count();i++) {
-        if(!m_friendsList.at(i)->profileImageUrl().isEmpty() && m_user->profileImageUrl().isValid()) {
+        if(!m_friendsList.at(i)->profileImageUrl().isEmpty()) {
             m_visited++; // indicates how many friends that have profile image
             emit fetchImage(m_friendsList.at(i)->profileImageUrl());
         }
index 1c3e4d6..008a0aa 100644 (file)
@@ -20,6 +20,7 @@
 */
 
 #include <QVBoxLayout>
+#include <QDebug>
 
 #include "friendlistview.h"
 
@@ -45,8 +46,15 @@ void FriendListView::addWidget(QWidget *widget)
 
 void FriendListView::clear()
 {
+    qDebug() << __PRETTY_FUNCTION__;
+
+    qDebug() << __PRETTY_FUNCTION__ << " Count: " << m_friendListLayout->count();
+
     foreach (QWidget *widget, widgets) {
         m_friendListLayout->removeWidget(widget);
         widgets.removeOne(widget);
+        delete widget;
     }
+
+    qDebug() << __PRETTY_FUNCTION__ << " Count: " << m_friendListLayout->count();
 }
index d1005c8..0ae12fb 100644 (file)
@@ -131,7 +131,7 @@ ListViewScreen::ListViewScreen(QWidget *parent)
     m_widgetProxy->setWidget(m_personalInfo);
 
     QGraphicsScene *scene= new QGraphicsScene(this);
-//    scene->setBackgroundBrush(Qt::white);
+    scene->setBackgroundBrush(Qt::black);
     scene->addItem(m_personalInfoBackGround);
     scene->addItem(m_widgetProxy);
     scene->addItem(m_leftSideBar);
@@ -142,9 +142,9 @@ ListViewScreen::ListViewScreen(QWidget *parent)
     QGraphicsProxyWidget *scrollProxy = new QGraphicsProxyWidget();
     scrollProxy->setWidget(friendListScroll);
     scrollProxy->setZValue(m_personalInfoBackGround->zValue() - 3);
-    scrollProxy->setMinimumSize(790 - 300, 480);
+    scrollProxy->setMinimumSize(790 - 400, 480 - 56);
     scene->addItem(scrollProxy);
-    scrollProxy->setPos(300, 0);
+    scrollProxy->setPos(410, 0);
     //DEBUG
     m_leftSideBar->setPos(0,0);
 
@@ -156,7 +156,7 @@ ListViewScreen::ListViewScreen(QWidget *parent)
     view->setAlignment(Qt::AlignLeft | Qt::AlignTop);
     view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-//    view->setBackgroundBrush(Qt::white);
+    view->setBackgroundBrush(Qt::black);
 
 
     QStateMachine *machine = new QStateMachine(this);
@@ -231,7 +231,7 @@ ListViewScreen::ListViewScreen(QWidget *parent)
     //m_vbox->addWidget(friendListScroll);
     m_vbox->setMargin(0);
 
-    connect(m_personalInfo,SIGNAL(launchMessageUpdate()),this,SLOT(updateMessage()));
+//    connect(m_personalInfo,SIGNAL(launchMessageUpdate()),this,SLOT(updateMessage()));
     setObjectName("List view");
 }
 
@@ -265,16 +265,24 @@ ListViewScreen::~ListViewScreen()
 void ListViewScreen::updateMessage()
 {
    qDebug() << __PRETTY_FUNCTION__;
+
    m_locationDialog->exec();
 }
 
 void ListViewScreen::userDataChanged(User *user, QList<User *> &friends)
 {
+    qDebug() << __PRETTY_FUNCTION__;
+
     m_friendListView->clear();
 
+
     foreach (User *user, friends) {
         FriendListItem *item = new FriendListItem(m_friendListView);
         item->setData(*user);
         m_friendListView->addWidget(item);
     }
+    
+    FriendListItem *item = new FriendListItem(m_friendListView);
+    item->setData(*user);
+    m_friendListView->addWidget(item);
 }