Personal info tab creation and integration to UI started
authorJukka Saastamoinen <juksa@czc6303cj1.ixonos.local>
Fri, 9 Apr 2010 08:22:13 +0000 (11:22 +0300)
committerJukka Saastamoinen <juksa@czc6303cj1.ixonos.local>
Fri, 9 Apr 2010 08:22:13 +0000 (11:22 +0300)
src/src.pro
src/ui/listviewscreen.cpp
src/ui/personalinfotab.cpp [new file with mode: 0644]
src/ui/personalinfotab.h [new file with mode: 0644]

index cb15dd3..8fd52e0 100644 (file)
@@ -1,13 +1,8 @@
-#-------------------------------------------------
-#
+# -------------------------------------------------
 # Project created by QtCreator 2010-03-26T07:57:35
-#
-#-------------------------------------------------
-
+# -------------------------------------------------
 TARGET = ../situare
 TEMPLATE = app
-
-
 SOURCES += main.cpp \
     ui/mainwindow.cpp \
     ui/mapviewscreen.cpp \
@@ -16,8 +11,8 @@ SOURCES += main.cpp \
     map/mapview.cpp \
     map/mapscene.cpp \
     map/maptile.cpp \
-    map/mapfetcher.cpp
-    
+    map/mapfetcher.cpp \
+    ui/personalinfotab.cpp
 HEADERS += ui/mainwindow.h \
     ui/mapviewscreen.h \
     ui/listviewscreen.h \
@@ -26,34 +21,29 @@ HEADERS += ui/mainwindow.h \
     map/mapscene.h \
     map/maptile.h \
     map/mapfetcher.h \
-    common.h
-
+    common.h \
+    ui/personalinfotab.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
 }
index c1084d2..5915840 100644 (file)
@@ -3,6 +3,7 @@
    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 <QGraphicsWidget>
+#include <QGraphicsLinearLayout>
+#include <QGraphicsView>
+#include <QGraphicsProxyWidget>
+#include <QtGui/QVBoxLayout>
+#include <QStateMachine>
 #include "listviewscreen.h"
+#include "personalinfotab.h"
 
 ListViewScreen::ListViewScreen(QWidget *parent)
    : QWidget(parent)
 {
-   QPushButton *listViewButton = new QPushButton(tr("This is listview"));
-   QHBoxLayout *listViewLayout = new QHBoxLayout;
-   listViewLayout->addWidget(listViewButton);
-   setLayout(listViewLayout);
+
+    PersonalInfoTab *myTab = new PersonalInfoTab();
+    QGraphicsScene *scene= new QGraphicsScene();
+    QGraphicsWidget *widget = new QGraphicsWidget();
+    QGraphicsLinearLayout *linearLayout = new QGraphicsLinearLayout(widget);
+    linearLayout->setOrientation(Qt::Vertical);
+    linearLayout->addItem(myTab);
+    widget->setLayout(linearLayout);
+    scene->addItem(widget);
+
+    //States and animations
+
+    QStateMachine machine;
+    QState *state1 = new QState(&machine);
+    QState *state2 = new QState(&machine);
+    machine.setInitialState(state1);
+
+    state1->assignProperty(widget, "pos", QPointF(-140, 0));
+    state2->assignProperty(widget, "pos", QPointF(0, 0));
+
+    QAbstractTransition *t1 = state1->addTransition(myTab, SIGNAL(clicked()), state2);
+    t1->addAnimation(new QPropertyAnimation(widget, "pos"));
+
+    QAbstractTransition *t2 = state2->addTransition(myTab, SIGNAL(clicked()), state1);
+    t2->addAnimation(new QPropertyAnimation(widget, "pos"));
+
+    machine.start();
+
+
+    QGraphicsView *view = new QGraphicsView(scene);
+    QVBoxLayout *vbox = new QVBoxLayout(this);
+    vbox->addWidget(view);
+
 }
diff --git a/src/ui/personalinfotab.cpp b/src/ui/personalinfotab.cpp
new file mode 100644 (file)
index 0000000..4cc2b05
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+   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 "personalinfotab.h"
+#include <QtGui/QPushButton>
+#include <QtGui/QVBoxLayout>
+#include <QGraphicsProxyWidget>
+#include <QGraphicsLinearLayout>
+
+
+PersonalInfoTab::PersonalInfoTab(QGraphicsItem *parent)
+    : QGraphicsWidget(parent)
+{
+    QWidget *infoTab = new QWidget();
+    QPushButton *reloadButton = new QPushButton("Testing");
+    QVBoxLayout *vbox = new QVBoxLayout(infoTab);
+    vbox->addWidget(reloadButton);
+
+    // Need to use QGraphicsProxyWidget to enable embedding QWidgets like QPushButton etc.
+    QGraphicsProxyWidget *infoTabProxy = new QGraphicsProxyWidget();
+    infoTabProxy->setWidget(infoTab);
+    QGraphicsLinearLayout *linearVbox = new QGraphicsLinearLayout(this);
+    linearVbox->addItem(infoTabProxy);
+
+}
+
+void PersonalInfoTab::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+    emit clicked();
+}
diff --git a/src/ui/personalinfotab.h b/src/ui/personalinfotab.h
new file mode 100644 (file)
index 0000000..412716b
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+   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 PERSONALINFOTAB_H
+#define PERSONALINFOTAB_H
+
+#include <QGraphicsWidget>
+
+
+class PersonalInfoTab : public QGraphicsWidget
+{
+    Q_OBJECT
+public:
+    /**
+    * @brief Constructor
+    *
+    * @param parent Parent
+    */
+    PersonalInfoTab(QGraphicsItem *parent = 0);
+    void mousePressEvent(QGraphicsSceneMouseEvent *event);
+
+Q_SIGNALS:
+    void clicked();
+};
+
+#endif // PERSONALINFOTAB_H