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 *sendLocationButton = new QToolButton;
16 QToolButton *updateStatusMessageButton = new QToolButton;
18 sendLocationButton->setIcon(QIcon(QPixmap(":/resources/reload_icon.png")));
19 updateStatusMessageButton->setIcon(QIcon(QPixmap(":/resources/sendPosition_icon.png")));
21 m_clockLabel->setPixmap(QPixmap(":/resources/clock_small.png"));
22 m_envelopeLabel->setPixmap(QPixmap(":/resources/list_small.png"));
23 m_compassLabel->setPixmap(QPixmap(":/resources/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(sendLocationButton,0,3,2,1);
33 m_layout->addWidget(updateStatusMessageButton,1,3,2,1);
42 delete m_userNameLabel;
44 delete m_messageLabel;
46 delete m_addressLabel;
59 void InfoTab::paintEvent(QPaintEvent *aPaintEvent)
61 //Look and feel settings
63 QColor myColor(Qt::black);
65 qpalette.setColor(QPalette::Background,myColor);
69 QRect widgetRect = this->rect();
70 QPainter painter(this);
73 painter.setRenderHint(QPainter::Antialiasing);
74 QPainterPath roundedRect;
75 roundedRect.addRoundedRect(1,1,widgetRect.width() - 2, widgetRect.height()-2,roundness,roundness);
77 painter.setClipPath(roundedRect);
78 QRegion maskRegion = painter.clipRegion();
82 painter.fillPath(roundedRect,QBrush(myColor));
86 void InfoTab::setAvatar(const QPixmap &avat)
89 m_userPicture->setPixmap(m_avatar);
92 void InfoTab::setUserName(const QString &usernam)
94 if(m_userName == usernam)
97 m_userNameLabel->setText(m_userName);
100 void InfoTab::setMessageText(const QString &text)
102 if(m_messageText == text)
104 m_messageText = text;
105 m_messageLabel->setText(m_messageText);
108 void InfoTab::setAddress(const QString &addr)
110 if(m_address == addr)
113 m_addressLabel->setText(m_address);
116 void InfoTab::setTime(const QString &tim)
121 m_timeLabel->setText(m_time);