2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Kaj Wallin - kaj.wallin@ixonos.com
7 Situare is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 version 2 as published by the Free Software Foundation.
11 Situare is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Situare; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 #include "friendlistpanel.h"
23 #include "friendlistview.h"
24 #include "friendlistitem.h"
26 FriendListPanel::FriendListPanel(QWidget *parent)
29 qDebug() << __PRETTY_FUNCTION__;
30 m_friendsPanelVBox = new QVBoxLayout(this);
31 this->setLayout(m_friendsPanelVBox);
32 m_friendsPanelExpandButton = new QPushButton("Friends", this);
33 m_friendsPanelVBox->addWidget(m_friendsPanelExpandButton);
35 m_friendListView = new FriendListView(this);
36 QScrollArea *friendListScroll = new QScrollArea(this);
37 friendListScroll->setWidget(m_friendListView);
38 friendListScroll->setWidgetResizable(true);
39 friendListScroll->viewport()->setAutoFillBackground(false);
41 m_friendsPanelVBox->addWidget(friendListScroll);
43 this->resize(420,600);
45 m_friendsPanelStateMachine = new QStateMachine(this);
46 m_friendsPanelStateClosed = new QState(m_friendsPanelStateMachine);
47 m_friendsPanelStateClosed->assignProperty(this, "pos", QPoint(800,0));
48 m_friendsPanelStateMachine->setInitialState(m_friendsPanelStateClosed);
50 m_friendsPanelStateOpened = new QState(m_friendsPanelStateMachine);
51 m_friendsPanelStateOpened->assignProperty(this, "pos", QPoint(400,0));
53 m_friendsPanelTransitionOpen = m_friendsPanelStateClosed->addTransition(
54 m_friendsPanelExpandButton, SIGNAL(clicked()), m_friendsPanelStateOpened);
55 m_friendsPanelTransitionOpen->addAnimation(new QPropertyAnimation(this, "pos"));
57 m_friendsPanelTransitionClose = m_friendsPanelStateOpened->addTransition(
58 m_friendsPanelExpandButton, SIGNAL(clicked()), m_friendsPanelStateClosed);
59 m_friendsPanelTransitionClose->addAnimation(new QPropertyAnimation(this, "pos"));
61 m_friendsPanelStateMachine->start();
64 void FriendListPanel::friendInfoReceived(QList<User *> &friendList)
66 qDebug() << __PRETTY_FUNCTION__;
68 m_friendListView->clear();
70 foreach (User *user, friendList) {
71 FriendListItem *item = new FriendListItem(m_friendListView);
73 m_friendListView->addWidget(item);
77 void FriendListPanel::reDrawFriendsPanel(int width, int height)
79 qDebug() << __PRETTY_FUNCTION__;