From 86319ed216fd2acbbb0c87e31c75489974300cf2 Mon Sep 17 00:00:00 2001 From: Kaj Wallin Date: Thu, 6 May 2010 13:58:39 +0300 Subject: [PATCH] Added actual friends list inside the panel Reviewed by: --- images.qrc | 1 - src/ui/friendlistitem.cpp | 1 + src/ui/friendlistpanel.cpp | 38 ++++++++++++++++++++++++++++++++------ src/ui/friendlistpanel.h | 10 +++++++++- src/ui/mainwindow.cpp | 14 +++++++++----- src/ui/mapviewscreen.cpp | 3 +++ src/ui/mapviewscreen.h | 7 +++++++ 7 files changed, 61 insertions(+), 13 deletions(-) diff --git a/images.qrc b/images.qrc index 141b8bc..e38df87 100644 --- a/images.qrc +++ b/images.qrc @@ -22,6 +22,5 @@ res/images/list_item_bottom.png res/images/list_item_middle.png res/images/list_item_top.png - res/images/list_item2.png diff --git a/src/ui/friendlistitem.cpp b/src/ui/friendlistitem.cpp index a305b7d..af5f7ba 100644 --- a/src/ui/friendlistitem.cpp +++ b/src/ui/friendlistitem.cpp @@ -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) diff --git a/src/ui/friendlistpanel.cpp b/src/ui/friendlistpanel.cpp index 2255f26..a923868 100644 --- a/src/ui/friendlistpanel.cpp +++ b/src/ui/friendlistpanel.cpp @@ -20,19 +20,32 @@ */ #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 &friendList) +{ + qDebug() << __PRETTY_FUNCTION__; + + m_friendListView->clear(); + + foreach (User *user, friendList) { + FriendListItem *item = new FriendListItem(m_friendListView); + item->setData(user); + m_friendListView->addWidget(item); + } +} diff --git a/src/ui/friendlistpanel.h b/src/ui/friendlistpanel.h index eccb482..7eb5391 100644 --- a/src/ui/friendlistpanel.h +++ b/src/ui/friendlistpanel.h @@ -24,6 +24,9 @@ #include +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 &friendList); }; #endif // FRIENDLISTPANEL_H diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index a2e2aac..5456037 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -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&)), m_mapViewScreen, SLOT(friendsLocationsReady(QList&))); - connect(this, SIGNAL(userLocationReady(User*)), m_listViewScreen, - SLOT(userDataReceived(User*))); - connect(this, SIGNAL(friendsLocationsReady(QList&)), m_listViewScreen, - SLOT(friendInfoReceived(QList&))); + connect(this, SIGNAL(userLocationReady(User*)), + m_listViewScreen, SLOT(userDataReceived(User*))); + connect(this, SIGNAL(friendsLocationsReady(QList&)), + m_listViewScreen, SLOT(friendInfoReceived(QList&))); connect(m_listViewScreen, SIGNAL(updateFriendsData()), this, SIGNAL(refreshUserData())); + connect(this, SIGNAL(friendsLocationsReady(QList&)), + m_mapViewScreen, SIGNAL(SIG_friendsLocationsReady(QList&))); + this->toggleProgressIndicator(true); } diff --git a/src/ui/mapviewscreen.cpp b/src/ui/mapviewscreen.cpp index a0be51c..6240021 100644 --- a/src/ui/mapviewscreen.cpp +++ b/src/ui/mapviewscreen.cpp @@ -70,6 +70,9 @@ MapViewScreen::MapViewScreen(QWidget *parent) FriendListPanel *friendsListPanel = new FriendListPanel(this); + connect(this, SIGNAL(SIG_friendsLocationsReady(QList&)), + friendsListPanel, SLOT(friendInfoReceived(QList&))); + osmLicense = new QLabel(this); osmLicense->setAttribute(Qt::WA_TranslucentBackground, true); osmLicense->setAttribute(Qt::WA_TransparentForMouseEvents, true); diff --git a/src/ui/mapviewscreen.h b/src/ui/mapviewscreen.h index c52b04e..ee5d91a 100644 --- a/src/ui/mapviewscreen.h +++ b/src/ui/mapviewscreen.h @@ -26,6 +26,7 @@ #include #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 &friendsList); + +public: + FriendListPanel *friendsListPanel; + private: MapEngine *mapEngine; ///< MapEngine //DEBUG -- 1.7.9.5