<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>
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 \
facebookservice/facebookcredentials.h \
facebookservice/facebookauthentication.h \
facebookservice/facebookcommon.h \
- ui/buttonitem.h
+ ui/buttonitem.h \
+ ui/situareuser.h
QT += network \
webkit
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);
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);
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);
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)
#include <QtGui>
#include <QWidget>
-
+#include "situareuser.h"
/**
* @brief InfoTab class.
* Composite custom widget class used to show user information
* @param aPaintEvent Pointer to paint event
*/
void paintEvent(QPaintEvent *aPaintEvent);
+ QSize sizeHint() const;
public:
/**
* @brief Constructor
* @param parent Parent
*/
InfoTab(QWidget *parent=0);
-
public slots:
/**
* @brief Sets the users current address
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
#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);
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();
{
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)
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;
}
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
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
--- /dev/null
+#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);
+}
--- /dev/null
+#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