2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Kaj Wallin - kaj.wallin@ixonos.com
6 Jukka Saastamoinen jukka.saastamoinen@ixonos.com
8 Situare is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 version 2 as published by the Free Software Foundation.
12 Situare is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Situare; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
23 #include <QGraphicsScene>
24 #include <QGraphicsWidget>
25 #include <QGraphicsView>
26 #include <QtGui/QVBoxLayout>
27 #include <QStateMachine>
28 #include "listviewscreen.h"
31 ListViewScreen::ListViewScreen(QWidget *parent)
34 Pixmap *infoTab = new Pixmap(QPixmap(":/resources/dummy_personal_infotab_background.png")); //350x300 pix
35 Pixmap *userPic = new Pixmap(QPixmap(":/resources/facebook_user_64.png")); //64x64 pix
36 QGraphicsScene *scene= new QGraphicsScene(0,0,700,360);
37 scene->setBackgroundBrush(Qt::white);
38 scene->addItem(infoTab);
39 scene->addItem(userPic);
41 QGraphicsView *view = new QGraphicsView(scene);
42 view->setFrameStyle(0);
43 view->setAlignment(Qt::AlignLeft | Qt::AlignTop);
44 view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
45 view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
48 QStateMachine *machine = new QStateMachine;
49 machine->setGlobalRestorePolicy(QStateMachine::RestoreProperties);
51 QState *state1 = new QState(machine);
52 QState *state2 = new QState(machine);
53 machine->setInitialState(state1);
56 state1->assignProperty(infoTab,"pos",QPointF(-330,30));
57 state1->assignProperty(userPic,"pos",QPointF(-310,50));
59 state2->assignProperty(infoTab,"pos",QPointF(0,30));
60 state2->assignProperty(userPic,"pos",QPointF(20,50));
63 QAbstractTransition *trans1 = state1->addTransition(infoTab,SIGNAL(clicked()),state2);
64 trans1->addAnimation(new QPropertyAnimation(infoTab,"pos"));
65 trans1->addAnimation(new QPropertyAnimation(userPic,"pos"));
67 QAbstractTransition *trans2 = state2->addTransition(infoTab,SIGNAL(clicked()),state1);
68 trans2->addAnimation(new QPropertyAnimation(infoTab,"pos"));
69 trans2->addAnimation(new QPropertyAnimation(userPic,"pos"));
73 vbox = new QVBoxLayout(this);
74 vbox->addWidget(view);
77 ListViewScreen::~ListViewScreen()