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)
35 m_arrowbutton = new Pixmap(QPixmap(":/resources/arrow_right.png"));
37 m_personalInfo = new InfoTab;
38 m_personalInfo->setAvatar(QPixmap(":/resources/facebook_user_64.png"));
39 m_personalInfo->setUserName("Fred Facebook");
40 m_personalInfo->setMessageText("Hello Maemo Situare !");
41 m_personalInfo->setTime("1 hour ago");
42 m_personalInfo->setAddress("Kiviharjunlenkki 1E, 91910 Oulu");
44 m_locationDialog = new updatelocationdialog(this);
45 m_widgetProxy = new QGraphicsProxyWidget();
46 m_widgetProxy->setWidget(m_personalInfo);
48 QGraphicsScene *scene= new QGraphicsScene(this);
49 scene->setBackgroundBrush(Qt::white);
50 scene->addItem(m_widgetProxy);
51 scene->addItem(m_arrowbutton);
52 qDebug() << "Scene width: " << scene->width();
53 qDebug() << "Scene heigth: " << scene->height();
55 QGraphicsView *view = new QGraphicsView(scene);
56 view->setAlignment(Qt::AlignLeft|Qt::AlignTop);
57 view->setSceneRect(0,0,7000,3000);
58 view->centerOn(QPointF(0,0));
59 view->setFrameStyle(0);
60 view->setAlignment(Qt::AlignLeft | Qt::AlignTop);
61 view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
62 view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
64 QStateMachine *machine = new QStateMachine(this);
65 machine->setGlobalRestorePolicy(QStateMachine::RestoreProperties);
67 QState *state1 = new QState(machine);
68 QState *state2 = new QState(machine);
69 machine->setInitialState(state1);
72 state1->assignProperty(m_widgetProxy,"pos",QPointF(-(m_personalInfo->width()),0));
73 state1->assignProperty(m_arrowbutton,"pos",QPointF(0,(m_personalInfo->height()/4)));
76 state2->assignProperty(m_widgetProxy,"pos",QPointF(0,0));
77 state2->assignProperty(m_arrowbutton,"pos",QPointF((m_personalInfo->width()),(m_personalInfo->height()/4)));
79 m_trans1 = state1->addTransition(m_arrowbutton,SIGNAL(clicked()),state2);
80 m_anim1 = new QPropertyAnimation(m_widgetProxy,"pos");
81 m_anim2 = new QPropertyAnimation(m_arrowbutton,"pos");
82 m_trans1->addAnimation(m_anim1);
83 m_trans1->addAnimation(m_anim2);
85 m_trans2 = state2->addTransition(m_arrowbutton,SIGNAL(clicked()),state1);
86 m_anim3= new QPropertyAnimation(m_widgetProxy,"pos");
87 m_anim4= new QPropertyAnimation(m_arrowbutton,"pos");
88 m_trans2->addAnimation(m_anim3);
89 m_trans2->addAnimation(m_anim4);
93 m_vbox = new QVBoxLayout(this);
94 m_vbox->addWidget(view);
97 connect(m_personalInfo,SIGNAL(launchMessageUpdate()),this,SLOT(updateMessage()));
100 ListViewScreen::~ListViewScreen()
103 delete m_personalInfo;
105 delete m_arrowbutton;
122 void ListViewScreen::updateMessage()
124 qDebug() << __PRETTY_FUNCTION__;
125 m_locationDialog->exec();