#include "infotab.h"
#include "buttonitem.h"
+#include "mainwindow.h"
+#include <QDebug>
+
+const int RGB_R = 152;
+const int RGB_G = 152;
+const int RGB_B = 152;
+const int SIZE_X = 320;
+const int SIZE_Y = 280;
+const int BIG_FONT = 18;
+const int SMALL_FONT = 13;
InfoTab::InfoTab(QWidget *parent)
: QWidget(parent, Qt::FramelessWindowHint)
{
widget = new QWidget(this);
- QVBoxLayout *verticalLayout = new QVBoxLayout(widget);
- 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);
+ verticalLayout = new QVBoxLayout(widget);
+ horizontalLayout = new QHBoxLayout(widget);
+ m_layout = new QGridLayout(widget);
+ situUser = new SituareUser(widget);
+
+ //Tex color settings
+ QPalette textPalette;
+ QColor textColor(RGB_R,RGB_G,RGB_B);
+ textPalette.setColor(QPalette::WindowText,textColor);
m_userNameLabel = new QLabel(widget);
+ m_userNameLabel->setFont(QFont( "Nokia Sans", BIG_FONT, QFont::Normal));
+
m_messageLabel = new QLabel(widget);
+ m_messageLabel->setFont(QFont( "Nokia Sans", SMALL_FONT, QFont::Normal));
+ m_messageLabel->setPalette(textPalette);
+
m_addressLabel = new QLabel(widget);
+ m_addressLabel->setFont(QFont( "Nokia Sans", SMALL_FONT, QFont::Normal));
+ m_addressLabel->setPalette(textPalette);
+
m_timeLabel = new QLabel(widget);
- QLabel *m_clockLabel = new QLabel(widget);
- QLabel *m_envelopeLabel = new QLabel(widget);
- QLabel *m_compassLabel = new QLabel(widget);
+ m_timeLabel->setFont(QFont( "Nokia Sans", 13, QFont::Normal));
+ m_timeLabel->setPalette(textPalette);
+
+ m_clockLabel = new QLabel(widget);
+ m_clockLabel->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);
+ m_envelopeLabel = new QLabel(widget);
+ m_envelopeLabel->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);
+ 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(":/res/images/refresh.png")));
+ updateStatusMessageButton->setIcon(QIcon(QPixmap(":/res/images/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_clockLabel->setPixmap(QPixmap(":/res/images/clock.png"));
+ m_envelopeLabel->setPixmap(QPixmap(":/res/images/envelope.png"));
+ m_compassLabel->setPixmap(QPixmap(":/res/images/compass.png"));
+ 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);
verticalLayout->addLayout(horizontalLayout);
- verticalLayout2->addLayout(verticalLayout);
connect(updateStatusMessageButton,SIGNAL(clicked()),this,SLOT(messageUpdate()));
connect(updateFriendsButton,SIGNAL(clicked()),this,SLOT(updateFriendsStatus()));
+
+ widget->setObjectName("infoTab");
+ widget->setStyleSheet(QString("#infoTab { border-image: url(:/res/images/list_item.png) 20%; " \
+ "border-width: 20px 14px 16px 14px; }"));
}
void InfoTab::paintEvent(QPaintEvent *aPaintEvent)
{
- //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);
- 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);
+ Q_UNUSED(aPaintEvent);
- painter.setClipPath(roundedRect);
- QRegion maskRegion = painter.clipRegion();
+ QStyleOption option;
+ option.init(this);
- setMask(maskRegion);
+ QPainter painter(this);
+ style()->drawPrimitive(QStyle::PE_Widget, &option, &painter, this);
+}
- painter.fillPath(roundedRect,QBrush(myColor));
- painter.restore();
+QSize InfoTab::sizeHint() const
+{
+ QSize size(SIZE_X,SIZE_Y);
+ 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)