Results after hard coding day...
authorJukka Saastamoinen <juksa@czc6303cj1.ixonos.local>
Wed, 14 Apr 2010 12:10:30 +0000 (15:10 +0300)
committerJukka Saastamoinen <juksa@czc6303cj1.ixonos.local>
Wed, 14 Apr 2010 12:10:30 +0000 (15:10 +0300)
13 files changed:
src/images.qrc
src/resources/arrow_button.png [new file with mode: 0644]
src/resources/arrow_left.png [new file with mode: 0755]
src/resources/arrow_right.png [new file with mode: 0755]
src/src.pro
src/ui/infotab.cpp [new file with mode: 0644]
src/ui/infotab.h [new file with mode: 0644]
src/ui/listviewscreen.cpp
src/ui/listviewscreen.h
src/ui/mapviewscreen.cpp
src/ui/personalinfotab.cpp [deleted file]
src/ui/personalinfotab.h [deleted file]
src/ui/pixmap.h

index 073d2ae..7095d4f 100644 (file)
@@ -2,10 +2,11 @@
     <qresource prefix="/">
         <file>resources/facebook_user_64.png</file>
         <file>resources/compas_small.png</file>
-        <file>resources/personal_infotab_background.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>
diff --git a/src/resources/arrow_button.png b/src/resources/arrow_button.png
new file mode 100644 (file)
index 0000000..0de60a2
Binary files /dev/null and b/src/resources/arrow_button.png differ
diff --git a/src/resources/arrow_left.png b/src/resources/arrow_left.png
new file mode 100755 (executable)
index 0000000..454fbdb
Binary files /dev/null and b/src/resources/arrow_left.png differ
diff --git a/src/resources/arrow_right.png b/src/resources/arrow_right.png
new file mode 100755 (executable)
index 0000000..4a43016
Binary files /dev/null and b/src/resources/arrow_right.png differ
index 3c0562c..4f084e6 100644 (file)
@@ -14,7 +14,7 @@ SOURCES += main.cpp \
     map/maptile.cpp \
     map/mapfetcher.cpp \
     ui/pixmap.cpp \
-    ui/personalinfotab.cpp
+    ui/infotab.cpp
 HEADERS += ui/mainwindow.h \
     ui/mapviewscreen.h \
     ui/listviewscreen.h \
@@ -25,7 +25,7 @@ HEADERS += ui/mainwindow.h \
     map/mapfetcher.h \
     common.h \
     ui/pixmap.h \
-    ui/personalinfotab.h
+    ui/infotab.h
 QT += network \
     webkit
 
diff --git a/src/ui/infotab.cpp b/src/ui/infotab.cpp
new file mode 100644 (file)
index 0000000..e0ec8a7
--- /dev/null
@@ -0,0 +1,125 @@
+#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
+    //setAutoFillBackground(true);
+    QPalette qpalette;
+    QColor myColor(Qt::lightGray);
+    myColor.setAlpha(100);
+    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);
+}
diff --git a/src/ui/infotab.h b/src/ui/infotab.h
new file mode 100644 (file)
index 0000000..4723412
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef INFOTAB_H
+#define INFOTAB_H
+
+#include <QtGui>
+#include <QWidget>
+
+class InfoTab : public QWidget
+{
+    Q_OBJECT
+public:
+    InfoTab(QWidget *parent=0);
+    ~InfoTab();
+public slots:
+    void setAvatar(const QPixmap &);
+    void setUserName(const QString &);
+    void setMessageText(const QString &);
+    void setAddress(const QString &);
+    void setTime(const QString &);
+protected:
+    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
index 9ede436..d479378 100644 (file)
 */
 
 #include <QGraphicsScene>
-#include <QGraphicsWidget>
 #include <QGraphicsView>
+#include <QGraphicsWidget>
 #include <QtGui/QVBoxLayout>
+#include <QGraphicsProxyWidget>
 #include <QStateMachine>
 #include "listviewscreen.h"
 #include "pixmap.h"
-#include "ui/personalinfotab.h"
-#include <QGraphicsProxyWidget>
+#include "infotab.h"
+
 
 ListViewScreen::ListViewScreen(QWidget *parent)
    : QWidget(parent)
 {
-    Pixmap *infoTab = new Pixmap(QPixmap(":/resources/personal_infotab_background.png")); //350x140 pix
-    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"));
+    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");
 
-    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);
     QGraphicsProxyWidget *widgetProxy = new QGraphicsProxyWidget();
-    widgetProxy->setWidget(myTab);
+    widgetProxy->setWidget(personalInfo);
+
+    QGraphicsScene *scene= new QGraphicsScene(0,0,700,360);
+    QGraphicsWidget *graphWidget = new QGraphicsWidget();
+    graphLayout = new QGraphicsLinearLayout(graphWidget);
+    graphLayout->setOrientation(Qt::Horizontal);
+    graphLayout->addItem(widgetProxy);
+    scene->setBackgroundBrush(Qt::white);    
+    //scene->addItem(widgetProxy);
+    scene->addItem(graphWidget);
+    scene->addItem(arrowbutton);
 
     QGraphicsView *view = new QGraphicsView(scene);
     view->setFrameStyle(0);
@@ -68,40 +70,22 @@ ListViewScreen::ListViewScreen(QWidget *parent)
     machine->setInitialState(state1);
 
     // 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(graphWidget,"pos",QPointF(-(personalInfo->width()),(scene->height()/4)));
+    //state1->assignProperty(arrowbutton,"pos",QPointF(0,135));
+    state1->assignProperty(arrowbutton,"pos",QPointF(0,(scene->height()/2 - (arrowbutton->boundingRect().height()/2))));
 
     // 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));
-
-    QAbstractTransition *trans1 = state1->addTransition(infoTab,SIGNAL(clicked()),state2);
-    trans1->addAnimation(new QPropertyAnimation(infoTab,"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"));*/
-
-    QAbstractTransition *trans2 = state2->addTransition(infoTab,SIGNAL(clicked()),state1);
-    trans2->addAnimation(new QPropertyAnimation(infoTab,"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"));*/
+    state2->assignProperty(graphWidget,"pos",QPointF(0,(scene->height()/4)));
+    //state2->assignProperty(arrowbutton,"pos",QPointF(0,135));
+    state2->assignProperty(arrowbutton,"pos",QPointF(0,(scene->height()/2 - (arrowbutton->boundingRect().height()/2))));
+
+    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();
 
@@ -113,4 +97,8 @@ ListViewScreen::~ListViewScreen()
 {
     if (vbox)
         delete vbox;
+    if (graphLayout)
+        delete graphLayout;
+    vbox=NULL;
+    graphLayout=NULL;
 }
index d1f3c30..67f4e20 100644 (file)
@@ -37,6 +37,7 @@ public:
     ~ListViewScreen();
 private:
     QVBoxLayout *vbox;
+    QGraphicsLinearLayout *graphLayout;
 };
 
 #endif // LISTVIEWTAB_H
index 82b89dc..1bd35eb 100644 (file)
 */
 
 #include "mapviewscreen.h"
+#include "infotab.h"
 #include "../map/mapview.h"
 #include "../map/mapengine.h"
+#include "infotab.h"
 
 MapViewScreen::MapViewScreen(QWidget *parent)
    : QWidget(parent)
diff --git a/src/ui/personalinfotab.cpp b/src/ui/personalinfotab.cpp
deleted file mode 100644 (file)
index ebccb91..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#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
deleted file mode 100644 (file)
index cac919e..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#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
index 075022f..9a6b47e 100644 (file)
@@ -19,8 +19,8 @@
    USA.
 */
 
-#ifndef PERSONALINFOTAB_H
-#define PERSONALINFOTAB_H
+#ifndef PIXMAP_H
+#define PIXMAP_H
 
 #include <QtCore>
 #include <QtGui>
@@ -74,4 +74,4 @@ private:
     QPixmap p;
 };
 
-#endif // PERSONALINFOTAB_H
+#endif // PIXMAP_H