--- /dev/null
+<RCC>
+ <qresource prefix="/">
+ <file>resources/facebook_user_64.png</file>
+ <file>resources/compas_small.png</file>
+ <file>resources/reload_icon.png</file>
+ <file>resources/sendPosition_icon.png</file>
+ <file>resources/list_small.png</file>
+ <file>resources/clock_small.png</file>
+ <file>resources/arrow_left.png</file>
+ <file>resources/arrow_right.png</file>
+ </qresource>
+</RCC>
-#-------------------------------------------------
-#
+# -------------------------------------------------
# Project created by QtCreator 2010-03-26T07:57:35
-#
-#-------------------------------------------------
-
+# -------------------------------------------------
TARGET = ../situare
TEMPLATE = app
-
-
+RESOURCES += images.qrc
SOURCES += main.cpp \
ui/mainwindow.cpp \
ui/mapviewscreen.cpp \
map/mapview.cpp \
map/mapscene.cpp \
map/maptile.cpp \
- map/mapfetcher.cpp
-
+ map/mapfetcher.cpp \
+ ui/pixmap.cpp \
+ ui/infotab.cpp
HEADERS += ui/mainwindow.h \
ui/mapviewscreen.h \
ui/listviewscreen.h \
map/mapscene.h \
map/maptile.h \
map/mapfetcher.h \
- common.h
-
+ common.h \
+ ui/pixmap.h \
+ ui/infotab.h
QT += network \
- webkit
+ webkit
# -----------------------------------------------------------------
-# Debian packetizing additions
+# Debian packetizing additions
# -----------------------------------------------------------------
-unix {
-#VARIABLES
- isEmpty(PREFIX) {
- PREFIX = /usr
- }
-BINDIR = $$PREFIX/bin
-DATADIR =$$PREFIX/share
-
-DEFINES += DATADIR=\\\"$$DATADIR\\\" PKGDATADIR=\\\"$$PKGDATADIR\\\"
-
-#MAKE INSTALL
-
-desktop.path = $$DATADIR/applications/hildon
-desktop.files += situare.desktop
-INSTALLS += desktop
-
-icon26.path = $$DATADIR/icons/hicolor/26x26/apps
-icon26.files += situare.png
-INSTALLS += icon26
-
-target.path = $$BINDIR
-INSTALLS += target
+unix {
+ # VARIABLES
+ isEmpty(PREFIX):PREFIX = /usr
+ BINDIR = $$PREFIX/bin
+ DATADIR = $$PREFIX/share
+ DEFINES += DATADIR=\\\"$$DATADIR\\\" \
+ PKGDATADIR=\\\"$$PKGDATADIR\\\"
+
+ # MAKE INSTALL
+ desktop.path = $$DATADIR/applications/hildon
+ desktop.files += situare.desktop
+ INSTALLS += desktop
+ icon26.path = $$DATADIR/icons/hicolor/26x26/apps
+ icon26.files += situare.png
+ INSTALLS += icon26
+ target.path = $$BINDIR
+ INSTALLS += target
}
--- /dev/null
+#include "infotab.h"
+
+InfoTab::InfoTab(QWidget *parent)
+ : QWidget(parent, Qt::FramelessWindowHint)
+{
+ layout = new QGridLayout(this);
+ userPicture = new QLabel;
+ userNameLabel = new QLabel;
+ messageLabel = new QLabel;
+ addressLabel = new QLabel;
+ timeLabel = new QLabel;
+ QLabel *clockLabel = new QLabel;
+ QLabel *envelopeLabel = new QLabel;
+ QLabel *compassLabel = new QLabel;
+ QToolButton *sendLocationButton = new QToolButton;
+ QToolButton *updateStatusMessageButton = new QToolButton;
+
+ sendLocationButton->setIcon(QIcon(QPixmap(":/resources/reload_icon.png")));
+ updateStatusMessageButton->setIcon(QIcon(QPixmap(":/resources/sendPosition_icon.png")));
+
+ clockLabel->setPixmap(QPixmap(":/resources/clock_small.png"));
+ envelopeLabel->setPixmap(QPixmap(":/resources/list_small.png"));
+ compassLabel->setPixmap(QPixmap(":/resources/compas_small.png"));
+ layout->addWidget(userPicture,0,0,4,1);
+ layout->addWidget(userNameLabel,0,2,1,2);
+ layout->addWidget(clockLabel,1,1,1,1);
+ layout->addWidget(envelopeLabel,2,1,1,1);
+ layout->addWidget(compassLabel,3,1,1,1);
+ layout->addWidget(timeLabel,1,2,1,1);
+ layout->addWidget(messageLabel,2,2,1,1);
+ layout->addWidget(addressLabel,3,2,1,1);
+ layout->addWidget(sendLocationButton,0,3,2,1);
+ layout->addWidget(updateStatusMessageButton,1,3,2,1);
+
+}
+
+InfoTab::~InfoTab()
+{
+ if (userPicture)
+ delete userPicture;
+ if (userNameLabel)
+ delete userNameLabel;
+ if (messageLabel)
+ delete messageLabel;
+ if (addressLabel)
+ delete addressLabel;
+ if (timeLabel)
+ delete timeLabel;
+ if (layout)
+ delete layout;
+ userPicture=NULL;
+ userNameLabel=NULL;
+ messageLabel=NULL;
+ addressLabel=NULL;
+ timeLabel=NULL;
+ layout=NULL;
+}
+
+void InfoTab::paintEvent(QPaintEvent *aPaintEvent)
+{
+ //Look and feel settings
+ QPalette qpalette;
+ QColor myColor(Qt::black);
+ myColor.setAlpha(50);
+ qpalette.setColor(QPalette::Background,myColor);
+ setPalette(qpalette);
+ int roundness(6);
+
+ QRect widgetRect = this->rect();
+ QPainter painter(this);
+ painter.save();
+
+ painter.setRenderHint(QPainter::Antialiasing);
+ QPainterPath roundedRect;
+ roundedRect.addRoundedRect(1,1,widgetRect.width() - 2, widgetRect.height()-2,roundness,roundness);
+
+ painter.setClipPath(roundedRect);
+ QRegion maskRegion = painter.clipRegion();
+
+ setMask(maskRegion);
+
+ painter.fillPath(roundedRect,QBrush(myColor));
+ painter.restore();
+}
+
+void InfoTab::setAvatar(const QPixmap &avat)
+{
+ avatar = avat;
+ userPicture->setPixmap(avat);
+}
+
+void InfoTab::setUserName(const QString &usernam)
+{
+ if(userName == usernam)
+ return;
+ userName = usernam;
+ userNameLabel->setText(userName);
+}
+
+void InfoTab::setMessageText(const QString &text)
+{
+ if(messageText == text)
+ return;
+ messageText = text;
+ messageLabel->setText(messageText);
+}
+
+void InfoTab::setAddress(const QString &addr)
+{
+ if(address == addr)
+ return;
+ address = addr;
+ addressLabel->setText(address);
+}
+
+void InfoTab::setTime(const QString &tim)
+{
+ if(time == tim)
+ return;
+ time = tim;
+ timeLabel->setText(time);
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jukka Saastamoinen - jukka.saastamoinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#ifndef INFOTAB_H
+#define INFOTAB_H
+
+#include <QtGui>
+#include <QWidget>
+
+/**
+* @brief Pixmap class.
+* Composite custom widget class used to show user information
+* @author Jukka Saastamoinen
+*/
+
+class InfoTab : public QWidget
+{
+ Q_OBJECT
+public:
+ /**
+ * @brief Constructor
+ *
+ * @param parent Parent
+ */
+ InfoTab(QWidget *parent=0);
+ /**
+ *
+ * @brief Destructor
+ */
+ ~InfoTab();
+public slots:
+ /**
+ * @brief Sets the user picture
+ *
+ * @param avat Reference to user picture
+ */
+ void setAvatar(const QPixmap & avat);
+ /**
+ * @brief Sets the user name
+ *
+ * @param usernam Reference to user name
+ */
+ void setUserName(const QString &usernam);
+ /**
+ * @brief Sets the message text
+ *
+ * @param text Reference to user message
+ */
+ void setMessageText(const QString &text);
+ /**
+ * @brief Sets the users current address
+ *
+ * @param addr Reference to users current address
+ */
+ void setAddress(const QString &addr);
+ /**
+ * @brief Sets the time of updated message
+ *
+ * @param tim Reference to time when message was sent.
+ */
+ void setTime(const QString &tim);
+protected:
+ /**
+ * @brief This function is called when the widget is drawn
+ *
+ * @param aPaintEvent Pointer to paint event
+ */
+ void paintEvent(QPaintEvent *aPaintEvent);
+private:
+ QLabel *userPicture;
+ QLabel *userNameLabel;
+ QLabel *messageLabel;
+ QLabel *addressLabel;
+ QLabel *timeLabel;
+ QGridLayout *layout;
+ QString messageText;
+ QString userName;
+ QString address;
+ QString time;
+ QPixmap avatar;
+};
+
+#endif // INFOTAB_H
Copyright (C) 2010 Ixonos Plc. Authors:
Kaj Wallin - kaj.wallin@ixonos.com
+ Jukka Saastamoinen jukka.saastamoinen@ixonos.com
Situare is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
USA.
*/
+#include <QGraphicsScene>
+#include <QGraphicsView>
+#include <QGraphicsWidget>
+#include <QtGui/QVBoxLayout>
+#include <QGraphicsProxyWidget>
+#include <QStateMachine>
#include "listviewscreen.h"
+#include "pixmap.h"
+#include "infotab.h"
+#include <QDebug>
ListViewScreen::ListViewScreen(QWidget *parent)
: QWidget(parent)
{
- QPushButton *listViewButton = new QPushButton(tr("This is listview"));
- QHBoxLayout *listViewLayout = new QHBoxLayout;
- listViewLayout->addWidget(listViewButton);
- setLayout(listViewLayout);
+ Pixmap *arrowbutton = new Pixmap(QPixmap(":/resources/arrow_right.png"));
+
+ InfoTab *personalInfo = new InfoTab;
+ personalInfo->setAvatar(QPixmap(":/resources/facebook_user_64.png"));
+ personalInfo->setUserName("Fred Facebook");
+ personalInfo->setMessageText("Hello Maemo Situare !");
+ personalInfo->setTime("1 hour ago");
+ personalInfo->setAddress("Kiviharjunlenkki 1E, 91910 Oulu");
+
+ QGraphicsProxyWidget *widgetProxy = new QGraphicsProxyWidget();
+ widgetProxy->setWidget(personalInfo);
+
+ QGraphicsScene *scene= new QGraphicsScene();
+ QGraphicsWidget *graphWidget = new QGraphicsWidget();
+ graphLayout = new QGraphicsLinearLayout(graphWidget);
+ graphLayout->setOrientation(Qt::Horizontal);
+ graphLayout->addItem(widgetProxy);
+ scene->setBackgroundBrush(Qt::white);
+ scene->addItem(graphWidget);
+ scene->addItem(arrowbutton);
+ qDebug() << "Scene width: " << scene->width();
+ qDebug() << "Scene heigth: " << scene->height();
+
+ QGraphicsView *view = new QGraphicsView(scene);
+ view->setAlignment(Qt::AlignLeft|Qt::AlignTop);
+ view->setSceneRect(0,0,7000,3000);
+ view->centerOn(QPointF(0,0));
+ view->setFrameStyle(0);
+ view->setAlignment(Qt::AlignLeft | Qt::AlignTop);
+ view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+
+ QStateMachine *machine = new QStateMachine;
+ machine->setGlobalRestorePolicy(QStateMachine::RestoreProperties);
+
+ QState *state1 = new QState(machine);
+ QState *state2 = new QState(machine);
+ machine->setInitialState(state1);
+
+ // State 1
+ state1->assignProperty(graphWidget,"pos",QPointF(-(personalInfo->width()+20),0));
+ state1->assignProperty(arrowbutton,"pos",QPointF(0,(arrowbutton->boundingRect().height()/2)+10));
+
+ // State 2
+ state2->assignProperty(graphWidget,"pos",QPointF(-20,0));
+ state2->assignProperty(arrowbutton,"pos",QPointF((personalInfo->width()-5),(arrowbutton->boundingRect().height()/2)+10));
+
+ QAbstractTransition *trans1 = state1->addTransition(arrowbutton,SIGNAL(clicked()),state2);
+ trans1->addAnimation(new QPropertyAnimation(graphWidget,"pos"));
+ trans1->addAnimation(new QPropertyAnimation(arrowbutton,"pos"));
+
+ QAbstractTransition *trans2 = state2->addTransition(arrowbutton,SIGNAL(clicked()),state1);
+ trans2->addAnimation(new QPropertyAnimation(graphWidget,"pos"));
+ trans2->addAnimation(new QPropertyAnimation(arrowbutton,"pos"));
+
+ machine->start();
+
+ vbox = new QVBoxLayout(this);
+ vbox->addWidget(view);
+}
+
+ListViewScreen::~ListViewScreen()
+{
+ if (vbox)
+ delete vbox;
+ if (graphLayout)
+ delete graphLayout;
+ vbox=NULL;
+ graphLayout=NULL;
}
{
public:
ListViewScreen(QWidget *parent = 0);
+ ~ListViewScreen();
+private:
+ QVBoxLayout *vbox;
+ QGraphicsLinearLayout *graphLayout;
};
#endif // LISTVIEWTAB_H
*/
#include "mapviewscreen.h"
+#include "infotab.h"
#include "../map/mapview.h"
#include "../map/mapengine.h"
+#include "infotab.h"
MapViewScreen::MapViewScreen(QWidget *parent)
: QWidget(parent)
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jukka Saastamoinen - jukka.saastamoinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#include "pixmap.h"
+#include <QDebug>
+
+Pixmap::Pixmap(const QPixmap &picture, QGraphicsObject *parent)
+ : QGraphicsObject(parent), p(picture)
+{
+}
+
+void Pixmap::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ emit clicked();
+ qDebug() << __PRETTY_FUNCTION__;
+}
+
+void Pixmap::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+{
+ painter->drawPixmap(QPointF(), p);
+}
+
+QRectF Pixmap::boundingRect() const
+{
+ return QRectF( QPointF(0, 0), p.size());
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jukka Saastamoinen - jukka.saastamoinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#ifndef PIXMAP_H
+#define PIXMAP_H
+
+#include <QtCore>
+#include <QtGui>
+
+/**
+* @brief Pixmap class.
+*
+* General purpose class used to display graphical objects
+* that can be animated.
+* @author Jukka Saastamoinen
+*/
+
+class Pixmap : public QGraphicsObject
+{
+ Q_OBJECT
+public:
+ /**
+ * @brief Constructor
+ *
+ * @param Reference to the picture displayed
+ * @param parent Parent
+ */
+ Pixmap(const QPixmap &, QGraphicsObject *parent = 0);
+ /**
+ * @brief Mouse press event
+ *
+ * @param event Mouse event
+ */
+ void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ /**
+ * @brief Bounding box of the drawed pixmap
+ *
+ * @return Rectangle shaped bounding box of the pixmap
+ */
+ QRectF boundingRect() const;
+protected:
+ /**
+ * @brief Drawer of the given picture
+ *
+ * @param painter Pointer to painting class
+ * @param Pointer to class describing parameters needed to draw the item
+ * @param Pointer to the widget
+ */
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *);
+signals:
+ /**
+ * @brief Signal which is emitted when the pixmap
+ * bounding box area is clicked.
+ */
+ void clicked();
+private:
+ QPixmap p;
+};
+
+#endif // PIXMAP_H
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jukka Saastamoinen - jukka.saastamoinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#include <QtTest>
+#include <QtGui>
+#include "ui/pixmap.h"
+
+
+class TestPixmap: public QObject
+{
+ Q_OBJECT
+private slots:
+ void constructorTest();
+ void boundingRegionTest();
+};
+
+/**
+* @brief Tests that the class accepts the png file used to draw the image
+*/
+void TestPixmap::constructorTest()
+{
+ Pixmap *infoTab = new Pixmap(QPixmap("dummy_personal_infotab_background.png"));
+ delete infoTab;
+ infoTab=NULL;
+ QVERIFY(!infoTab);
+}
+
+/**
+* @brief Tests that the bounding area reserved for the picture is the same as
+* the picture size.
+*/
+
+void TestPixmap::boundingRegionTest()
+{
+ Pixmap testPic(QPixmap("dummy_personal_infotab_background.png")); //350x300 pix
+ QPixmap refPic("dummy_personal_infotab_background.png");
+ QRectF boundArea = testPic.boundingRect();
+ QRectF refArea;
+ refArea.setSize(refPic.size());
+ QVERIFY(boundArea.size()==refArea.size());
+}
+
+
+QTEST_MAIN(TestPixmap)
+#include "testpixmap.moc"
+
+
--- /dev/null
+CONFIG += qtestlib
+TEMPLATE = app
+TARGET = pixmap
+DEPENDPATH += .
+INCLUDEPATH += . \
+ ../../../src/
+
+SOURCES += testpixmap.cpp \
+ ../../../src/ui/pixmap.cpp
+HEADERS += ../../../src/ui/pixmap.h