PersonalInfotab as separate QWidget
authorJukka Saastamoinen <juksa@juksa-laptop.(none)>
Wed, 14 Apr 2010 05:04:12 +0000 (08:04 +0300)
committerJukka Saastamoinen <juksa@juksa-laptop.(none)>
Wed, 14 Apr 2010 05:04:12 +0000 (08:04 +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 56c8a7b..3c0562c 100644 (file)
@@ -3,9 +3,7 @@
 # -------------------------------------------------
 TARGET = ../situare
 TEMPLATE = app
-
 RESOURCES += images.qrc
-
 SOURCES += main.cpp \
     ui/mainwindow.cpp \
     ui/mapviewscreen.cpp \
@@ -15,7 +13,8 @@ SOURCES += main.cpp \
     map/mapscene.cpp \
     map/maptile.cpp \
     map/mapfetcher.cpp \
-    ui/pixmap.cpp
+    ui/pixmap.cpp \
+    ui/personalinfotab.cpp
 HEADERS += ui/mainwindow.h \
     ui/mapviewscreen.h \
     ui/listviewscreen.h \
@@ -25,7 +24,8 @@ HEADERS += ui/mainwindow.h \
     map/maptile.h \
     map/mapfetcher.h \
     common.h \
-    ui/pixmap.h
+    ui/pixmap.h \
+    ui/personalinfotab.h
 QT += network \
     webkit
 
index 259228f..9ede436 100644 (file)
 #include <QStateMachine>
 #include "listviewscreen.h"
 #include "pixmap.h"
+#include "ui/personalinfotab.h"
+#include <QGraphicsProxyWidget>
 
 ListViewScreen::ListViewScreen(QWidget *parent)
    : QWidget(parent)
 {
     Pixmap *infoTab = new Pixmap(QPixmap(":/resources/personal_infotab_background.png")); //350x140 pix
-    Pixmap *userPic = new Pixmap(QPixmap(":/resources/facebook_user_64.png")); //64x64 pix
-    Pixmap *envelope = new Pixmap(QPixmap(":/resources/list_small.png"));
-    Pixmap *compass = new Pixmap(QPixmap(":/resources/compas_small.png"));
-    Pixmap *clock = new Pixmap(QPixmap(":/resources/clock_small.png"));
-    Pixmap *reload = new Pixmap(QPixmap(":/resources/reload_icon.png"));
-    Pixmap *reloca = new Pixmap(QPixmap(":/resources/sendPosition_icon.png"));
+    PersonalInfoTab = myTab(this);
+   // Pixmap *userPic = new Pixmap(QPixmap(":/resources/facebook_user_64.png")); //64x64 pix
+   // Pixmap *envelope = new Pixmap(QPixmap(":/resources/list_small.png"));
+   // Pixmap *compass = new Pixmap(QPixmap(":/resources/compas_small.png"));
+   // Pixmap *clock = new Pixmap(QPixmap(":/resources/clock_small.png"));
+   // Pixmap *reload = new Pixmap(QPixmap(":/resources/reload_icon.png"));
+   // Pixmap *reloca = new Pixmap(QPixmap(":/resources/sendPosition_icon.png"));
 
     QGraphicsScene *scene= new QGraphicsScene(0,0,700,360);
     scene->setBackgroundBrush(Qt::white);
     scene->addItem(infoTab);
-    scene->addItem(userPic);
-    scene->addItem(envelope);
-    scene->addItem(compass);
-    scene->addItem(clock);
-    scene->addItem(reload);
-    scene->addItem(reloca);
+   // scene->addItem(userPic);
+   // scene->addItem(envelope);
+   // scene->addItem(compass);
+   // scene->addItem(clock);
+   // scene->addItem(reload);
+   // scene->addItem(reloca);
+    QGraphicsProxyWidget *widgetProxy = new QGraphicsProxyWidget();
+    widgetProxy->setWidget(myTab);
 
     QGraphicsView *view = new QGraphicsView(scene);
     view->setFrameStyle(0);
@@ -64,39 +69,39 @@ ListViewScreen::ListViewScreen(QWidget *parent)
 
     // State 1
     state1->assignProperty(infoTab,"pos",QPointF(-330,110));
-    state1->assignProperty(userPic,"pos",QPointF(-320,120));
-    state1->assignProperty(envelope,"pos",QPointF(-246,165));
-    state1->assignProperty(compass,"pos",QPointF(-246,190));
-    state1->assignProperty(clock,"pos",QPointF(-246,220));
-    state1->assignProperty(reload,"pos",QPointF(-60,120));
-    state1->assignProperty(reloca,"pos",QPointF(-60,180));
+    //state1->assignProperty(userPic,"pos",QPointF(-320,120));
+    //state1->assignProperty(envelope,"pos",QPointF(-246,165));
+    //state1->assignProperty(compass,"pos",QPointF(-246,190));
+    //state1->assignProperty(clock,"pos",QPointF(-246,220));
+    //state1->assignProperty(reload,"pos",QPointF(-60,120));
+    //state1->assignProperty(reloca,"pos",QPointF(-60,180));
 
     // State 2
     state2->assignProperty(infoTab,"pos",QPointF(0,110));
-    state2->assignProperty(userPic,"pos",QPointF(10,120));
-    state2->assignProperty(envelope,"pos",QPointF(84,165));
-    state2->assignProperty(compass,"pos",QPointF(84,190));
-    state2->assignProperty(clock,"pos",QPointF(84,220));
-    state2->assignProperty(reload,"pos",QPointF(290,120));
-    state2->assignProperty(reloca,"pos",QPointF(290,180));
+    //state2->assignProperty(userPic,"pos",QPointF(10,120));
+    //state2->assignProperty(envelope,"pos",QPointF(84,165));
+    //state2->assignProperty(compass,"pos",QPointF(84,190));
+    //state2->assignProperty(clock,"pos",QPointF(84,220));
+    //state2->assignProperty(reload,"pos",QPointF(290,120));
+    //state2->assignProperty(reloca,"pos",QPointF(290,180));
 
     QAbstractTransition *trans1 = state1->addTransition(infoTab,SIGNAL(clicked()),state2);
     trans1->addAnimation(new QPropertyAnimation(infoTab,"pos"));
-    trans1->addAnimation(new QPropertyAnimation(userPic,"pos"));
+    /*trans1->addAnimation(new QPropertyAnimation(userPic,"pos"));
     trans1->addAnimation(new QPropertyAnimation(envelope,"pos"));
     trans1->addAnimation(new QPropertyAnimation(compass,"pos"));
     trans1->addAnimation(new QPropertyAnimation(clock,"pos"));
     trans1->addAnimation(new QPropertyAnimation(reload,"pos"));
-    trans1->addAnimation(new QPropertyAnimation(reloca,"pos"));
+    trans1->addAnimation(new QPropertyAnimation(reloca,"pos"));*/
 
     QAbstractTransition *trans2 = state2->addTransition(infoTab,SIGNAL(clicked()),state1);
     trans2->addAnimation(new QPropertyAnimation(infoTab,"pos"));
-    trans2->addAnimation(new QPropertyAnimation(userPic,"pos"));
+   /* trans2->addAnimation(new QPropertyAnimation(userPic,"pos"));
     trans2->addAnimation(new QPropertyAnimation(envelope,"pos"));
     trans2->addAnimation(new QPropertyAnimation(compass,"pos"));
     trans2->addAnimation(new QPropertyAnimation(clock,"pos"));
     trans2->addAnimation(new QPropertyAnimation(reload,"pos"));
-    trans2->addAnimation(new QPropertyAnimation(reloca,"pos"));
+    trans2->addAnimation(new QPropertyAnimation(reloca,"pos"));*/
 
     machine->start();
 
diff --git a/src/ui/personalinfotab.cpp b/src/ui/personalinfotab.cpp
new file mode 100644 (file)
index 0000000..ebccb91
--- /dev/null
@@ -0,0 +1,55 @@
+#include "personalinfotab.h"
+
+PersonalInfoTab::PersonalInfoTab(QWidget *parent)
+        : QWidget(parent)
+{
+    QGridLayout *layout = new QGridLayout(this);
+    QLabel *userPicture = new QLabel;
+    QLabel *userNameLabel = new QLabel;
+    QLabel *messageLabel = new QLabel;
+    QLabel *addressLabel = new QLabel;
+    QLabel *timeLabel = new QLabel;
+    QLabel *clockLabel = new QLabel;
+    QLabel *envelopeLabel = new QLabel;
+    QLabel *compassLabel = new QLabel;
+
+    //QPixmap pixmap(350,140);
+    //pixmap.fill(Qt::gray);
+    //QPainter painter(&pixmap);
+    //painter.setPen(Qt::black);
+
+
+    userPicture->setPixmap(QPixmap(":/resources/facebook_user_64.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,1,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);
+
+}
+
+void PersonalInfoTab::setUserName(const QString &username)
+{
+    userName = username;
+}
+
+void PersonalInfoTab::setMessageText(const QString &text)
+{
+    message = text;
+}
+
+void PersonalInfoTab::setAddress(const QString &address)
+{
+    this->address = address;
+}
+
+void PersonalInfoTab::setTime(const QString &time)
+{
+    this->time = time;
+}
diff --git a/src/ui/personalinfotab.h b/src/ui/personalinfotab.h
new file mode 100644 (file)
index 0000000..cac919e
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef PERSONALINFOTAB_H
+#define PERSONALINFOTAB_H
+
+#include <QtGui>
+
+class PersonalInfoTab : public QWidget
+{
+    Q_OBJECT
+public:
+    PersonalInfoTab(QWidget *parent=0);
+public slots:
+    void setUserName(const QString &);
+    void setMessageText(const QString &);
+    void setAddress(const QString &);
+    void setTime(const QString &);
+private:
+    QString message;
+    QString userName;
+    QString address;
+    QString time;
+};
+
+#endif // PERSONALINFOTAB_H