Added actual friends list inside the panel
authorKaj Wallin <kaj.wallin@ixonos.com>
Thu, 6 May 2010 10:58:39 +0000 (13:58 +0300)
committerKaj Wallin <kaj.wallin@ixonos.com>
Thu, 6 May 2010 10:58:39 +0000 (13:58 +0300)
Reviewed by:

images.qrc
src/ui/friendlistitem.cpp
src/ui/friendlistpanel.cpp
src/ui/friendlistpanel.h
src/ui/mainwindow.cpp
src/ui/mapviewscreen.cpp
src/ui/mapviewscreen.h

index 141b8bc..e38df87 100644 (file)
@@ -22,6 +22,5 @@
         <file>res/images/list_item_bottom.png</file>
         <file>res/images/list_item_middle.png</file>
         <file>res/images/list_item_top.png</file>
-        <file>res/images/list_item2.png</file>
     </qresource>
 </RCC>
index a305b7d..af5f7ba 100644 (file)
@@ -135,6 +135,7 @@ FriendListItem::FriendListItem(QWidget *parent)
 
     setMinimumSize(ITEM_MIN_WIDTH, ITEM_MIN_HEIGHT);
     setMaximumSize(ITEM_MIN_WIDTH, ITEM_MAX_HEIGHT);
+    this->setAutoFillBackground(false);
 }
 
 void FriendListItem::setData(User *user)
index 2255f26..a923868 100644 (file)
  */
 
 #include "friendlistpanel.h"
+#include "friendlistview.h"
+#include "friendlistitem.h"
 
 FriendListPanel::FriendListPanel(QWidget *parent)
     : QWidget(parent)
 {
     qWarning() << __PRETTY_FUNCTION__; 
-    QGridLayout *friendsListGrid = new QGridLayout(this);
+    QVBoxLayout *friendsListGrid = new QVBoxLayout(this);
     this->setLayout(friendsListGrid);
     QPushButton *friendsDummyBTN = new QPushButton("HOOO", this);
-    QLabel *friendsDummyLBL = new QLabel("FRIENDS LIST", this);
-    friendsListGrid->addWidget(friendsDummyBTN,1,1,3,1);
-    friendsListGrid->addWidget(friendsDummyLBL, 2,2,2,3);
-    this->resize(300,600);
-    this->setAutoFillBackground(true);
+//    QLabel *friendsDummyLBL = new QLabel("FRIENDS LIST", this);
+    friendsListGrid->addWidget(friendsDummyBTN);
+
+
+    m_friendListView = new FriendListView(this);
+    QScrollArea *friendListScroll = new QScrollArea(this);
+    friendListScroll->setWidget(m_friendListView);
+    friendListScroll->setWidgetResizable(true);
+//    m_friendListView->setAutoFillBackground(false);
+    friendListScroll->viewport()->setAutoFillBackground(false);
+
+    friendsListGrid->addWidget(friendListScroll);
+
+//    friendsListGrid->addWidget(friendsDummyLBL, 2,2,2,3);
+    this->resize(420,600);
+//    this->setAutoFillBackground(true);
     this->move(50,50);
 
     QStateMachine *friendsListMachine = new QStateMachine(this);
@@ -53,3 +66,16 @@ FriendListPanel::FriendListPanel(QWidget *parent)
 
     friendsListMachine->start();
 }
+
+void FriendListPanel::friendInfoReceived(QList<User *> &friendList)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    m_friendListView->clear();
+
+    foreach (User *user, friendList) {
+        FriendListItem *item = new FriendListItem(m_friendListView);
+        item->setData(user);
+        m_friendListView->addWidget(item);
+    }
+}
index eccb482..7eb5391 100644 (file)
@@ -24,6 +24,9 @@
 
 #include <QtGui>
 
+class FriendListView;
+class User;
+
 /**
 * @brief Class for sliding friends list panel
 *
@@ -36,7 +39,12 @@ class FriendListPanel : public QWidget
 
 public:
     FriendListPanel(QWidget *parent = 0);
-    void startti();
+
+
+    FriendListView *m_friendListView;   ///< Friend list view
+
+public slots:
+    void friendInfoReceived(QList<User *> &friendList);
 };
 
 #endif // FRIENDLISTPANEL_H
index a2e2aac..5456037 100644 (file)
@@ -44,7 +44,8 @@ MainWindow::MainWindow(QWidget *parent)
     connect(m_listViewScreen,SIGNAL(launchUpdateDialog()),
             this,SLOT(openLocationUpdateDialog()));
 
-    connect(this, SIGNAL(reverseGeoReady(QString)), m_locationDialog, SLOT(setAddress(QString)));
+    connect(this, SIGNAL(reverseGeoReady(QString)),
+            m_locationDialog, SLOT(setAddress(QString)));
     connect(m_locationDialog, SIGNAL(statusUpdate(QString,bool)), this,
             SIGNAL(statusUpdate(QString,bool)));
 
@@ -53,13 +54,16 @@ MainWindow::MainWindow(QWidget *parent)
     connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
             m_mapViewScreen, SLOT(friendsLocationsReady(QList<User*>&)));
 
-    connect(this, SIGNAL(userLocationReady(User*)), m_listViewScreen,
-            SLOT(userDataReceived(User*)));
-    connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)), m_listViewScreen,
-            SLOT(friendInfoReceived(QList<User*>&)));
+    connect(this, SIGNAL(userLocationReady(User*)),
+            m_listViewScreen, SLOT(userDataReceived(User*)));
+    connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
+            m_listViewScreen, SLOT(friendInfoReceived(QList<User*>&)));
     connect(m_listViewScreen, SIGNAL(updateFriendsData()),
             this, SIGNAL(refreshUserData()));
 
+    connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
+            m_mapViewScreen, SIGNAL(SIG_friendsLocationsReady(QList<User*>&)));
+
     this->toggleProgressIndicator(true);
 }
 
index a0be51c..6240021 100644 (file)
@@ -70,6 +70,9 @@ MapViewScreen::MapViewScreen(QWidget *parent)
 
     FriendListPanel *friendsListPanel = new FriendListPanel(this);
 
+    connect(this, SIGNAL(SIG_friendsLocationsReady(QList<User*>&)),
+            friendsListPanel, SLOT(friendInfoReceived(QList<User*>&)));
+
     osmLicense = new QLabel(this);
     osmLicense->setAttribute(Qt::WA_TranslucentBackground, true);
     osmLicense->setAttribute(Qt::WA_TransparentForMouseEvents, true);
index c52b04e..ee5d91a 100644 (file)
@@ -26,6 +26,7 @@
 #include <QtGui>
 
 #include "map/mapengine.h"
+#include "friendlistpanel.h"
 
 /**
 * @brief Map View class. Used to display Map
@@ -78,6 +79,12 @@ private slots:
 /*******************************************************************************
  * DATA MEMBERS
  ******************************************************************************/
+signals:
+    void SIG_friendsLocationsReady(QList<User *> &friendsList);
+
+public:
+    FriendListPanel *friendsListPanel;
+
 private:
     MapEngine *mapEngine; ///< MapEngine
     //DEBUG