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 <QGraphicsView>
25 #include <QGraphicsWidget>
26 #include <QtGui/QVBoxLayout>
27 #include <QGraphicsProxyWidget>
28 #include <QStateMachine>
29 #include "listviewscreen.h"
32 ListViewScreen::ListViewScreen(QWidget *parent)
36 m_arrowbutton = new Pixmap(QPixmap(":/resources/arrow_right.png"));
38 m_personalInfo = new InfoTab;
39 m_personalInfo->setAvatar(QPixmap(":/resources/facebook_user_64.png"));
40 m_personalInfo->setUserName("Fred Facebook");
41 m_personalInfo->setMessageText("Hello Maemo Situare !");
42 m_personalInfo->setTime("1 hour ago");
43 m_personalInfo->setAddress("Kiviharjunlenkki 1E, 91910 Oulu");
45 m_locationDialog = new UpdateLocationDialog(this);
46 m_widgetProxy = new QGraphicsProxyWidget();
47 m_widgetProxy->setWidget(m_personalInfo);
49 QGraphicsScene *scene= new QGraphicsScene(this);
50 scene->setBackgroundBrush(Qt::white);
51 scene->addItem(m_widgetProxy);
52 scene->addItem(m_arrowbutton);
53 qDebug() << "Scene width: " << scene->width();
54 qDebug() << "Scene heigth: " << scene->height();
56 QGraphicsView *view = new QGraphicsView(scene);
57 view->setAlignment(Qt::AlignLeft|Qt::AlignTop);
58 view->setSceneRect(0,0,7000,3000);
59 view->centerOn(QPointF(0,0));
60 view->setFrameStyle(0);
61 view->setAlignment(Qt::AlignLeft | Qt::AlignTop);
62 view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
63 view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
65 QStateMachine *machine = new QStateMachine(this);
66 machine->setGlobalRestorePolicy(QStateMachine::RestoreProperties);
68 QState *state1 = new QState(machine);
69 QState *state2 = new QState(machine);
70 machine->setInitialState(state1);
73 state1->assignProperty(m_widgetProxy,"pos",QPointF(-(m_personalInfo->width()),0));
74 state1->assignProperty(m_arrowbutton,"pos",QPointF(0,(m_personalInfo->height()/4)));
77 state2->assignProperty(m_widgetProxy,"pos",QPointF(0,0));
78 state2->assignProperty(m_arrowbutton,"pos",QPointF((m_personalInfo->width()),(m_personalInfo->height()/4)));
80 m_trans1 = state1->addTransition(m_arrowbutton,SIGNAL(clicked()),state2);
81 m_anim1 = new QPropertyAnimation(m_widgetProxy,"pos");
82 m_anim2 = new QPropertyAnimation(m_arrowbutton,"pos");
83 m_trans1->addAnimation(m_anim1);
84 m_trans1->addAnimation(m_anim2);
86 m_trans2 = state2->addTransition(m_arrowbutton,SIGNAL(clicked()),state1);
87 m_anim3= new QPropertyAnimation(m_widgetProxy,"pos");
88 m_anim4= new QPropertyAnimation(m_arrowbutton,"pos");
89 m_trans2->addAnimation(m_anim3);
90 m_trans2->addAnimation(m_anim4);
94 m_vbox = new QVBoxLayout(this);
95 m_vbox->addWidget(view);
98 connect(m_personalInfo,SIGNAL(launchMessageUpdate()),this,SLOT(updateMessage()));
101 ListViewScreen::~ListViewScreen()
104 delete m_personalInfo;
106 delete m_arrowbutton;
123 void ListViewScreen::updateMessage()
125 qDebug() << __PRETTY_FUNCTION__;
126 m_locationDialog->exec();