Personal infotab mods in listviewscreen
authorJukka Saastamoinen <juksa@czc6303cj1.ixonos.local>
Wed, 28 Apr 2010 04:19:44 +0000 (07:19 +0300)
committerJukka Saastamoinen <juksa@czc6303cj1.ixonos.local>
Wed, 28 Apr 2010 04:19:44 +0000 (07:19 +0300)
26 files changed:
src/images.qrc
src/resources/aeroplane_icon.png [deleted file]
src/resources/car_icon.png [deleted file]
src/resources/clock_small.png [deleted file]
src/resources/compas_small.png [deleted file]
src/resources/facebook_user_50.png [deleted file]
src/resources/facebook_user_64.png [deleted file]
src/resources/list_small.png [deleted file]
src/resources/personal_info_bckgrnd.png [new file with mode: 0644]
src/resources/personal_infotab_background.png [deleted file]
src/resources/profile_pic_border.png [new file with mode: 0755]
src/resources/refresh.png [new file with mode: 0755]
src/resources/reload_icon.png [deleted file]
src/resources/sendPosition_icon.png [deleted file]
src/resources/send_position.png [new file with mode: 0755]
src/resources/separe_line.png [deleted file]
src/resources/situare_user.jpg [new file with mode: 0755]
src/resources/top_separtor.png [deleted file]
src/resources/walk_icon.png [deleted file]
src/src.pro
src/ui/infotab.cpp
src/ui/infotab.h
src/ui/listviewscreen.cpp
src/ui/listviewscreen.h
src/ui/situareuser.cpp [new file with mode: 0644]
src/ui/situareuser.h [new file with mode: 0644]

index 5a44cae..1df0f4b 100644 (file)
@@ -1,14 +1,18 @@
 <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>
         <file>resources/zoom_in.png</file>
         <file>resources/zoom_out.png</file>
+        <file>resources/clock.png</file>
+        <file>resources/compass.png</file>
+        <file>resources/envelope.png</file>
+        <file>resources/profile_pic_border.png</file>
+        <file>resources/situare_user.jpg</file>
+        <file>resources/send_position.png</file>
+        <file>resources/side_bar_left.png</file>
+        <file>resources/sliding_bar_left.png</file>
+        <file>resources/personal_info_bckgrnd.png</file>
+        <file>resources/refresh.png</file>
+        <file>resources/arrow_left.png</file>
+        <file>resources/arrow_right.png</file>
     </qresource>
 </RCC>
diff --git a/src/resources/aeroplane_icon.png b/src/resources/aeroplane_icon.png
deleted file mode 100644 (file)
index 6deefd6..0000000
Binary files a/src/resources/aeroplane_icon.png and /dev/null differ
diff --git a/src/resources/car_icon.png b/src/resources/car_icon.png
deleted file mode 100644 (file)
index 7165b73..0000000
Binary files a/src/resources/car_icon.png and /dev/null differ
diff --git a/src/resources/clock_small.png b/src/resources/clock_small.png
deleted file mode 100644 (file)
index 50efd6e..0000000
Binary files a/src/resources/clock_small.png and /dev/null differ
diff --git a/src/resources/compas_small.png b/src/resources/compas_small.png
deleted file mode 100644 (file)
index a85e802..0000000
Binary files a/src/resources/compas_small.png and /dev/null differ
diff --git a/src/resources/facebook_user_50.png b/src/resources/facebook_user_50.png
deleted file mode 100644 (file)
index 5a41af8..0000000
Binary files a/src/resources/facebook_user_50.png and /dev/null differ
diff --git a/src/resources/facebook_user_64.png b/src/resources/facebook_user_64.png
deleted file mode 100644 (file)
index b828219..0000000
Binary files a/src/resources/facebook_user_64.png and /dev/null differ
diff --git a/src/resources/list_small.png b/src/resources/list_small.png
deleted file mode 100644 (file)
index d250a1f..0000000
Binary files a/src/resources/list_small.png and /dev/null differ
diff --git a/src/resources/personal_info_bckgrnd.png b/src/resources/personal_info_bckgrnd.png
new file mode 100644 (file)
index 0000000..c479198
Binary files /dev/null and b/src/resources/personal_info_bckgrnd.png differ
diff --git a/src/resources/personal_infotab_background.png b/src/resources/personal_infotab_background.png
deleted file mode 100644 (file)
index a9b30ec..0000000
Binary files a/src/resources/personal_infotab_background.png and /dev/null differ
diff --git a/src/resources/profile_pic_border.png b/src/resources/profile_pic_border.png
new file mode 100755 (executable)
index 0000000..ff257cf
Binary files /dev/null and b/src/resources/profile_pic_border.png differ
diff --git a/src/resources/refresh.png b/src/resources/refresh.png
new file mode 100755 (executable)
index 0000000..f11efba
Binary files /dev/null and b/src/resources/refresh.png differ
diff --git a/src/resources/reload_icon.png b/src/resources/reload_icon.png
deleted file mode 100644 (file)
index 7ffa4ec..0000000
Binary files a/src/resources/reload_icon.png and /dev/null differ
diff --git a/src/resources/sendPosition_icon.png b/src/resources/sendPosition_icon.png
deleted file mode 100644 (file)
index 5c44ea3..0000000
Binary files a/src/resources/sendPosition_icon.png and /dev/null differ
diff --git a/src/resources/send_position.png b/src/resources/send_position.png
new file mode 100755 (executable)
index 0000000..ed185a0
Binary files /dev/null and b/src/resources/send_position.png differ
diff --git a/src/resources/separe_line.png b/src/resources/separe_line.png
deleted file mode 100644 (file)
index 8d9bb0e..0000000
Binary files a/src/resources/separe_line.png and /dev/null differ
diff --git a/src/resources/situare_user.jpg b/src/resources/situare_user.jpg
new file mode 100755 (executable)
index 0000000..7629a66
Binary files /dev/null and b/src/resources/situare_user.jpg differ
diff --git a/src/resources/top_separtor.png b/src/resources/top_separtor.png
deleted file mode 100644 (file)
index d21c24a..0000000
Binary files a/src/resources/top_separtor.png and /dev/null differ
diff --git a/src/resources/walk_icon.png b/src/resources/walk_icon.png
deleted file mode 100644 (file)
index f1fb57c..0000000
Binary files a/src/resources/walk_icon.png and /dev/null differ
index 2d01791..52e73ea 100644 (file)
@@ -23,7 +23,8 @@ SOURCES += main.cpp \
     ui/infotab.cpp \
     ui/updatelocation/updatelocationdialog.cpp \
     ui/updatelocation/texteditautoresizer.cpp \
-    ui/buttonitem.cpp
+    ui/buttonitem.cpp \
+    ui/situareuser.cpp
 HEADERS += ui/mainwindow.h \
     ui/mapviewscreen.h \
     ui/listviewscreen.h \
@@ -45,7 +46,8 @@ HEADERS += ui/mainwindow.h \
     facebookservice/facebookcredentials.h \
     facebookservice/facebookauthentication.h \
     facebookservice/facebookcommon.h \
-    ui/buttonitem.h
+    ui/buttonitem.h \
+    ui/situareuser.h
 QT += network \
     webkit
 
index 0bf5cb0..985ab26 100644 (file)
@@ -30,27 +30,46 @@ InfoTab::InfoTab(QWidget *parent)
     QVBoxLayout *verticalLayout2 = new QVBoxLayout(widget);
     QHBoxLayout *horizontalLayout = new QHBoxLayout(widget);
     QGridLayout *m_layout = new QGridLayout(widget);
-    m_userPicture = new QLabel(widget);
-    m_userPicture->setAlignment(Qt::AlignCenter);
-    m_userPicture->setMargin(2);
+    situUser = new SituareUser(widget);
+    situUser->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
+    situUser->setMargin(1);
+
+    //Tex color settings
+    QPalette textPalette;
+    QColor textColor(152,152,152);
+    textPalette.setColor(QPalette::WindowText,textColor);
     m_userNameLabel = new QLabel(widget);
+    m_userNameLabel->setFont(QFont( "Nokia Sans", 18, QFont::Normal));
+
     m_messageLabel = new QLabel(widget);
+    m_messageLabel->setFont(QFont( "Nokia Sans", 13, QFont::Normal));
+    m_messageLabel->setPalette(textPalette);
+
     m_addressLabel = new QLabel(widget);
+    m_addressLabel->setFont(QFont( "Nokia Sans", 13, QFont::Normal));
+    m_addressLabel->setPalette(textPalette);
+
     m_timeLabel = new QLabel(widget);
+    m_timeLabel->setFont(QFont( "Nokia Sans", 13, QFont::Normal));
+    m_timeLabel->setPalette(textPalette);
+
     QLabel *m_clockLabel = new QLabel(widget);
+    m_clockLabel->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);
     QLabel *m_envelopeLabel = new QLabel(widget);
+    m_envelopeLabel->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);
     QLabel *m_compassLabel = new QLabel(widget);
+    m_compassLabel->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);
     ButtonItem *updateFriendsButton = new ButtonItem(widget);
     ButtonItem *updateStatusMessageButton = new ButtonItem(widget);
 
-    updateFriendsButton->setIcon(QIcon(QPixmap(":/resources/reload_icon.png")));
-    updateStatusMessageButton->setIcon(QIcon(QPixmap(":/resources/sendPosition_icon.png")));
+    updateFriendsButton->setIcon(QIcon(QPixmap(":/resources/refresh.png")));
+    updateStatusMessageButton->setIcon(QIcon(QPixmap(":/resources/send_position.png")));
 
     m_clockLabel->setPixmap(QPixmap(":/resources/clock.png"));
     m_envelopeLabel->setPixmap(QPixmap(":/resources/envelope.png"));
     m_compassLabel->setPixmap(QPixmap(":/resources/compass.png"));
-    m_layout->addWidget(m_userPicture,0,0,1,2);
-    m_layout->addWidget(m_userNameLabel,1,0,1,2);
+    m_layout->addWidget(situUser,0,0,1,2,Qt::AlignHCenter);
+    m_layout->addWidget(m_userNameLabel,1,1,1,2);
     m_layout->addWidget(m_clockLabel,3,0,1,1);
     m_layout->addWidget(m_envelopeLabel,2,0,1,1);
     m_layout->addWidget(m_compassLabel,4,0,1,1);
@@ -59,8 +78,7 @@ InfoTab::InfoTab(QWidget *parent)
     m_layout->addWidget(m_addressLabel,4,1,1,1);
 
     verticalLayout->addLayout(m_layout);
-
-    horizontalLayout->setContentsMargins(-1,0,-1,-1);
+    horizontalLayout->setSpacing(0);
     horizontalLayout->addWidget(updateFriendsButton);
     horizontalLayout->addWidget(updateStatusMessageButton);
 
@@ -73,22 +91,24 @@ InfoTab::InfoTab(QWidget *parent)
 
 void InfoTab::paintEvent(QPaintEvent *aPaintEvent)
 {
+
+    QRect widgetRect = this->rect();
+
+    //Gradient
+    QLinearGradient linearGrad(QPointF(widgetRect.height(), widgetRect.width()/2),
+                               QPointF(widgetRect.width()/2,0));
+    linearGrad.setColorAt(0, QColor::fromRgb(49,52,57));
+    linearGrad.setColorAt(1, QColor::fromRgb(82,73,74));
+
     //Look and feel settings
     QPalette qpalette;
-    QColor myColor(Qt::black);
-    myColor.setAlpha(50);
-    qpalette.setColor(QPalette::Background,myColor);
-    //QBrush brush;
-    //brush.setTexture(QPixmap(":/resources/bkg_grid.png"));
-    //brush.setStyle(Qt::TexturePattern);
-    //brush.setColor(myColor);
-    qpalette.setBrush(QPalette::Window,myColor);
-    //qpalette.setBrush(QPalette::Window,brush);
+    QBrush brush(linearGrad);
+    qpalette.setBrush(QPalette::Window,brush);
     setPalette(qpalette);
-    int roundness(6);
+    int roundness(9);
 
-    QRect widgetRect = this->rect();
     QPainter painter(this);
+
     painter.save();
 
     painter.setRenderHint(QPainter::Antialiasing);
@@ -100,14 +120,20 @@ void InfoTab::paintEvent(QPaintEvent *aPaintEvent)
 
     setMask(maskRegion);
 
-    painter.fillPath(roundedRect,QBrush(myColor));
+    painter.fillPath(roundedRect,QBrush(brush));
     painter.restore();
 }
 
+QSize InfoTab::sizeHint() const
+{
+   QSize size(280,280);
+   return size;
+}
+
 void InfoTab::setAvatar(const QPixmap &avat)
 {
     m_avatar = avat;
-    m_userPicture->setPixmap(m_avatar);
+    situUser->setPixmap(m_avatar);
 }
 
 void InfoTab::setUserName(const QString &usernam)
index 350fb7a..788707f 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <QtGui>
 #include <QWidget>
-
+#include "situareuser.h"
 /**
 * @brief InfoTab class.
 * Composite custom widget class used to show user information
@@ -41,6 +41,7 @@ protected:
     * @param aPaintEvent Pointer to paint event
     */
     void paintEvent(QPaintEvent *aPaintEvent);
+    QSize sizeHint() const;
 public:
     /**
     * @brief Constructor
@@ -48,7 +49,6 @@ public:
     * @param parent Parent
     */
     InfoTab(QWidget *parent=0);
-
 public slots:
     /**
     * @brief Sets the users current address
@@ -113,7 +113,8 @@ private:
     QString m_address;        ///< Address from where the new message was sent.
     QString m_time;           ///< Time when the new message was sent
     QPixmap m_avatar;         ///< User's avatar
-    QWidget *widget;
+    QWidget *widget;          ///< Parent of all widgets.
+    SituareUser *situUser;
 };
 
 #endif // INFOTAB_H
index 450d3db..3da21bf 100644 (file)
 #include <QGraphicsProxyWidget>
 #include <QStateMachine>
 #include "listviewscreen.h"
+#include "situareuser.h"
 #include <QDebug>
 
 ListViewScreen::ListViewScreen(QWidget *parent)
     : QWidget(parent)
 {
-
-    m_arrowbutton = new Pixmap(QPixmap(":/resources/arrow_right.png"));
-
+    m_leftSideBar = new Pixmap(QPixmap(":/resources/side_bar_left.png"));
+    m_slidingLeftSideBar = new Pixmap(QPixmap(":/resources/sliding_bar_left.png"));
+    m_personalInfoBackGround = new Pixmap(QPixmap(":/resources/personal_info_bckgrnd.png"));
+    m_arrowLeft = new Pixmap(QPixmap(":/resources/arrow_left.png"));
+    m_arrowRight = new Pixmap(QPixmap(":/resources/arrow_right.png"));
     m_personalInfo = new InfoTab;
-    m_personalInfo->setAvatar(QPixmap(":/resources/facebook_user_64.png"));
+    m_personalInfo->setAvatar(QPixmap(":/resources/situare_user.jpg"));
     m_personalInfo->setUserName("Fred Facebook");
     m_personalInfo->setMessageText("Hello Maemo Situare !");
     m_personalInfo->setTime("1 hour ago");
     m_personalInfo->setAddress("Kiviharjunlenkki 1E, 91910 Oulu");
 
+    qDebug() << "InfoTab width: " << m_personalInfo->width();
+    qDebug() << "InfoTab heigth: " << m_personalInfo->height();
+
     m_locationDialog = new UpdateLocationDialog(this);
     m_widgetProxy = new QGraphicsProxyWidget();
     m_widgetProxy->setWidget(m_personalInfo);
 
     QGraphicsScene *scene= new QGraphicsScene(this);
     scene->setBackgroundBrush(Qt::white);    
+    scene->addItem(m_personalInfoBackGround);
     scene->addItem(m_widgetProxy);
-    scene->addItem(m_arrowbutton);
-    qDebug() << "Infotab heigth: " << m_personalInfo->height();
-    qDebug() << "Scene heigth: " << scene->height();
+    scene->addItem(m_leftSideBar);
+    scene->addItem(m_slidingLeftSideBar);
+    scene->addItem(m_arrowRight);
+    m_leftSideBar->setPos(0,0);
 
     QGraphicsView *view = new QGraphicsView(scene);
     view->setAlignment(Qt::AlignLeft|Qt::AlignTop);
@@ -70,24 +78,36 @@ ListViewScreen::ListViewScreen(QWidget *parent)
     machine->setInitialState(state1);
 
     // State 1
-    state1->assignProperty(m_widgetProxy,"pos",QPointF(-(m_personalInfo->width()),0));
-    state1->assignProperty(m_arrowbutton,"pos",QPointF(0,(m_personalInfo->height()/4)+8));
+    state1->assignProperty(m_widgetProxy,"pos",QPointF(-m_personalInfo->width(),71));
+    state1->assignProperty(m_slidingLeftSideBar,"pos",QPointF(0,0));
+    state1->assignProperty(m_personalInfoBackGround,"pos",QPointF(-400,0));
+    state1->assignProperty(m_arrowRight,"pos", QPointF(9,205));
 
     // State 2
-    state2->assignProperty(m_widgetProxy,"pos",QPointF(0,0));
-    state2->assignProperty(m_arrowbutton,"pos",QPointF((m_personalInfo->width()-2),(m_personalInfo->height()/4)+8));
+    state2->assignProperty(m_widgetProxy,"pos",QPointF(59,71));
+    state2->assignProperty(m_slidingLeftSideBar,"pos",QPointF(376,0));
+    state2->assignProperty(m_personalInfoBackGround,"pos",QPointF(0,0));
+    state2->assignProperty(m_arrowRight,"pos", QPointF(385,205));
 
-    m_trans1 = state1->addTransition(m_arrowbutton,SIGNAL(clicked()),state2);
+    m_trans1 = state1->addTransition(m_slidingLeftSideBar,SIGNAL(clicked()),state2);
     m_anim1 = new QPropertyAnimation(m_widgetProxy,"pos");
-    m_anim2 = new QPropertyAnimation(m_arrowbutton,"pos");
+    m_anim2 = new QPropertyAnimation(m_slidingLeftSideBar,"pos");
+    m_anim5 = new QPropertyAnimation(m_personalInfoBackGround,"pos");
+    m_anim7 = new QPropertyAnimation(m_arrowRight,"pos");
     m_trans1->addAnimation(m_anim1);
     m_trans1->addAnimation(m_anim2);
-
-    m_trans2 = state2->addTransition(m_arrowbutton,SIGNAL(clicked()),state1);
-    m_anim3= new QPropertyAnimation(m_widgetProxy,"pos");
-    m_anim4= new QPropertyAnimation(m_arrowbutton,"pos");
+    m_trans1->addAnimation(m_anim5);
+    m_trans1->addAnimation(m_anim7);
+
+    m_trans2 = state2->addTransition(m_slidingLeftSideBar,SIGNAL(clicked()),state1);
+    m_anim3 = new QPropertyAnimation(m_widgetProxy,"pos");
+    m_anim4 = new QPropertyAnimation(m_slidingLeftSideBar,"pos");
+    m_anim6 = new QPropertyAnimation(m_personalInfoBackGround,"pos");
+    m_anim8 = new QPropertyAnimation(m_arrowRight,"pos");
     m_trans2->addAnimation(m_anim3);
     m_trans2->addAnimation(m_anim4);
+    m_trans2->addAnimation(m_anim6);
+    m_trans2->addAnimation(m_anim8);
 
     machine->start();
 
@@ -102,8 +122,10 @@ ListViewScreen::~ListViewScreen()
 {
     if (m_personalInfo)
         delete m_personalInfo;
-    if (m_arrowbutton)
-        delete m_arrowbutton;
+    if (m_leftSideBar)
+        delete m_leftSideBar;
+    if (m_slidingLeftSideBar)
+        delete m_slidingLeftSideBar;
     if (m_trans1)
         delete m_trans1;
     if (m_trans2)
@@ -116,6 +138,10 @@ ListViewScreen::~ListViewScreen()
         delete m_anim3;
     if (m_anim4)
         delete m_anim4;
+    if (m_anim5)
+        delete m_anim5;
+    if (m_anim6)
+        delete m_anim6;
     if (m_vbox)
         delete m_vbox;
 }
index 2d746ab..f672ba1 100644 (file)
@@ -65,7 +65,11 @@ public slots:
 private:
     QVBoxLayout *m_vbox;    ///< Holds the graphics view
     InfoTab *m_personalInfo;    ///< Personal info tab
-    Pixmap *m_arrowbutton;    ///< Button which reveals/hides the info tab when pressed
+    Pixmap *m_leftSideBar;
+    Pixmap *m_slidingLeftSideBar;
+    Pixmap *m_personalInfoBackGround;
+    Pixmap *m_arrowLeft;
+    Pixmap *m_arrowRight;
     QGraphicsProxyWidget *m_widgetProxy; ///< Embeds InfoTab to graphics view
     QAbstractTransition *m_trans1;    ///< Animation transition from hidden state to visible
     QAbstractTransition *m_trans2;    ///< Animation transition from visible to hidden
@@ -73,7 +77,14 @@ private:
     QPropertyAnimation *m_anim2;    ///< Animation for arrowbutton from hidden to visible
     QPropertyAnimation *m_anim3;    ///< Animation for infotab from visible to hidden
     QPropertyAnimation *m_anim4;    ///< Animation for arrowbutton from visible to hidden
+    QPropertyAnimation *m_anim5;    ///< Animation
+    QPropertyAnimation *m_anim6;    ///< Animation for arrowbutton from visible to hidden
+    QPropertyAnimation *m_anim7;
+    QPropertyAnimation *m_anim8;
     UpdateLocationDialog *m_locationDialog; ///< Message dialog
 };
 
 #endif // LISTVIEWTAB_H
+
+
+#endif // LISTVIEWTAB_H
\ No newline at end of file
diff --git a/src/ui/situareuser.cpp b/src/ui/situareuser.cpp
new file mode 100644 (file)
index 0000000..0f23fa6
--- /dev/null
@@ -0,0 +1,38 @@
+#include "situareuser.h"
+#include <QPainter>
+#include <QDebug>
+
+SituareUser::SituareUser(QWidget *parent)
+    : QLabel(parent)
+{
+}
+
+
+void SituareUser::paintEvent(QPaintEvent *aPaintEvent)
+{
+
+    int roundness(9);
+
+    QRect widgetRect = QRect(0,0,this->pixmap()->width(),this->pixmap()->height());
+
+    QPainter painter(this);
+    painter.save();
+
+    painter.setRenderHint(QPainter::Antialiasing);
+    QPainterPath roundedRect;
+    roundedRect.addRoundedRect(0,0,widgetRect.width()+2, widgetRect.height()+2,roundness,roundness);
+    painter.setClipPath(roundedRect);
+    QRegion maskRegion = painter.clipRegion();
+
+    setMask(maskRegion);
+    //qDebug() << "Current clip region: " << painter.clipRegion();
+    qDebug() << "Current mask region: " << maskRegion.boundingRect();
+    painter.drawPixmap(QPointF(0,0),(*(this->pixmap())));
+    painter.drawPixmap(QPointF(-6,-6),(QPixmap(":/resources/profile_pic_border.png")));
+    painter.restore();
+}
+
+QSize SituareUser::sizeHint() const
+{
+    return QSize(50,50);
+}
diff --git a/src/ui/situareuser.h b/src/ui/situareuser.h
new file mode 100644 (file)
index 0000000..43f0f85
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef SITUAREUSER_H
+#define SITUAREUSER_H
+
+#include <QLabel>
+#include <QPixmap>
+
+class SituareUser : public QLabel
+{
+    Q_OBJECT
+protected:
+    /**
+    * @brief This function is called when the widget is drawn
+    *
+    * @param aPaintEvent Pointer to paint event
+    */
+    void paintEvent(QPaintEvent *aPaintEvent);
+public:
+    SituareUser(QWidget *parent=0);
+    QSize sizeHint() const;
+private:
+    QPixmap m_p;
+};
+
+#endif // SITUAREUSER_H