4 #include "headerlistitemdelegate.h"
5 #include "personlistitem.h"
6 #include "extendedlistitemdelegate.h"
7 #include "personlistview.h"
8 #include "imagebutton.h"
9 #include "panelcommon.h"
10 #include "user/user.h"
12 #include "meetpeoplepanel.h"
14 MeetPeoplePanel::MeetPeoplePanel(QWidget *parent)
17 qDebug() << __PRETTY_FUNCTION__;
19 QVBoxLayout *meetPeopleLayout = new QVBoxLayout;
20 meetPeopleLayout->setMargin(0);
21 meetPeopleLayout->setSpacing(0);
22 setLayout(meetPeopleLayout);
24 m_personListView = new PersonListView(this);
25 m_personListView->setItemDelegate(new ExtendedListItemDelegate(this));
26 connect(m_personListView, SIGNAL(listItemSelectionChanged()),
27 this, SLOT(onListItemSelectionChanged()));
28 connect(m_personListView, SIGNAL(personItemClicked(GeoCoordinate)),
29 this, SIGNAL(findPerson(GeoCoordinate)));
31 QVBoxLayout *listViewLayout = new QVBoxLayout;
32 listViewLayout->setContentsMargins(PANEL_MARGIN_LEFT, PANEL_MARGIN_TOP,
33 PANEL_MARGIN_RIGHT, PANEL_MARGIN_BOTTOM);
34 listViewLayout->addWidget(m_personListView);
35 meetPeopleLayout->addLayout(listViewLayout);
37 ImageButton *refreshInterestingPeopleButton = new ImageButton(":/res/images/refresh.png",
38 ":/res/images/refresh_s.png",
40 connect(refreshInterestingPeopleButton, SIGNAL(clicked()),
41 this, SIGNAL(requestInterestingPeople()));
43 ImageButton *searchPeopleButton = new ImageButton(":/res/images/search.png",
44 ":/res/images/search_s.png", "", this);
45 connect(searchPeopleButton, SIGNAL(clicked()),
46 this, SIGNAL(requestInterestingPeopleSearch()));
48 ImageButton *messageButton = new ImageButton(":/res/images/chat_btn.png",
49 ":/res/images/chat_btn_s.png",
50 ":/res/images/chat_btn_d.png", this);
51 connect(messageButton, SIGNAL(clicked()),
52 this, SLOT(openMessageDialog()));
54 m_genericButtonsLayout->addWidget(refreshInterestingPeopleButton);
55 m_genericButtonsLayout->addWidget(searchPeopleButton);
56 m_itemButtonsLayout->addWidget(messageButton);
59 void MeetPeoplePanel::setImage(const QString &id, const QPixmap &image)
61 qDebug() << __PRETTY_FUNCTION__;
63 PersonListItem *personItem = dynamic_cast<PersonListItem*>(m_personListView->listItem(id));
65 personItem->setAvatarImage(image);
68 void MeetPeoplePanel::populateInterestingPeopleListView(QList<User> &interestingPeople)
70 qDebug() << __PRETTY_FUNCTION__ ;
72 m_personListView->clearList();
74 foreach (User interestingPerson, interestingPeople) {
75 PersonListItem *item = new PersonListItem();
76 item->setPersonData(interestingPerson);
77 m_personListView->addListItem(interestingPerson.userId(), item);
80 m_personListView->scrollToTop();