3 InfoTab::InfoTab(QWidget *parent)
4 : QWidget(parent, Qt::FramelessWindowHint)
6 m_layout = new QGridLayout(this);
7 m_userPicture = new QLabel;
8 m_userNameLabel = new QLabel;
9 m_messageLabel = new QLabel;
10 m_addressLabel = new QLabel;
11 m_timeLabel = new QLabel;
12 QLabel *m_clockLabel = new QLabel;
13 QLabel *m_envelopeLabel = new QLabel;
14 QLabel *m_compassLabel = new QLabel;
15 QToolButton *updateFriendsButton = new QToolButton;
16 QToolButton *updateStatusMessageButton = new QToolButton;
18 updateFriendsButton->setIcon(QIcon(QPixmap(":/res/images/reload_icon.png")));
19 updateStatusMessageButton->setIcon(QIcon(QPixmap(":/res/images/sendPosition_icon.png")));
21 m_clockLabel->setPixmap(QPixmap(":/res/images/clock_small.png"));
22 m_envelopeLabel->setPixmap(QPixmap(":/res/images/list_small.png"));
23 m_compassLabel->setPixmap(QPixmap(":/res/images/compas_small.png"));
24 m_layout->addWidget(m_userPicture,0,0,4,1);
25 m_layout->addWidget(m_userNameLabel,0,2,1,2);
26 m_layout->addWidget(m_clockLabel,1,1,1,1);
27 m_layout->addWidget(m_envelopeLabel,2,1,1,1);
28 m_layout->addWidget(m_compassLabel,3,1,1,1);
29 m_layout->addWidget(m_timeLabel,1,2,1,1);
30 m_layout->addWidget(m_messageLabel,2,2,1,1);
31 m_layout->addWidget(m_addressLabel,3,2,1,1);
32 m_layout->addWidget(updateFriendsButton,0,3,2,1);
33 m_layout->addWidget(updateStatusMessageButton,1,3,2,1);
35 connect(updateStatusMessageButton,SIGNAL(clicked()),this,SLOT(messageUpdate()));
36 connect(updateFriendsButton,SIGNAL(clicked()),this,SLOT(updateFriendsStatus()));
44 delete m_userNameLabel;
46 delete m_messageLabel;
48 delete m_addressLabel;
61 void InfoTab::paintEvent(QPaintEvent *aPaintEvent)
63 //Look and feel settings
65 QColor myColor(Qt::black);
67 qpalette.setColor(QPalette::Background,myColor);
71 QRect widgetRect = this->rect();
72 QPainter painter(this);
75 painter.setRenderHint(QPainter::Antialiasing);
76 QPainterPath roundedRect;
77 roundedRect.addRoundedRect(1,1,widgetRect.width() - 2, widgetRect.height()-2,roundness,roundness);
79 painter.setClipPath(roundedRect);
80 QRegion maskRegion = painter.clipRegion();
84 painter.fillPath(roundedRect,QBrush(myColor));
88 void InfoTab::setAvatar(const QPixmap &avat)
91 m_userPicture->setPixmap(m_avatar);
94 void InfoTab::setUserName(const QString &usernam)
96 if(m_userName == usernam)
99 m_userNameLabel->setText(m_userName);
102 void InfoTab::setMessageText(const QString &text)
104 if(m_messageText == text)
106 m_messageText = text;
107 m_messageLabel->setText(m_messageText);
110 void InfoTab::setAddress(const QString &addr)
112 if(m_address == addr)
115 m_addressLabel->setText(m_address);
118 void InfoTab::setTime(const QString &tim)
123 m_timeLabel->setText(m_time);
126 void InfoTab::messageUpdate()
128 emit launchMessageUpdate();
129 qDebug() << __PRETTY_FUNCTION__;
132 void InfoTab::updateFriendsStatus()
134 emit launchUpdateFriendsStatus();
135 qDebug() << __PRETTY_FUNCTION__;