2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Jukka Saastamoinen - jukka.saastamoinen@ixonos.com
7 Situare is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 version 2 as published by the Free Software Foundation.
11 Situare is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Situare; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
24 InfoTab::InfoTab(QWidget *parent)
25 : QWidget(parent, Qt::FramelessWindowHint)
27 m_layout = new QGridLayout(this);
28 m_userPicture = new QLabel;
29 m_userNameLabel = new QLabel;
30 m_messageLabel = new QLabel;
31 m_addressLabel = new QLabel;
32 m_timeLabel = new QLabel;
33 QLabel *m_clockLabel = new QLabel;
34 QLabel *m_envelopeLabel = new QLabel;
35 QLabel *m_compassLabel = new QLabel;
36 QToolButton *updateFriendsButton = new QToolButton;
37 QToolButton *updateStatusMessageButton = new QToolButton;
39 updateFriendsButton->setIcon(QIcon(QPixmap(":/res/images/reload_icon.png")));
40 updateStatusMessageButton->setIcon(QIcon(QPixmap(":/res/images/sendPosition_icon.png")));
42 m_clockLabel->setPixmap(QPixmap(":/res/images/clock_small.png"));
43 m_envelopeLabel->setPixmap(QPixmap(":/res/images/list_small.png"));
44 m_compassLabel->setPixmap(QPixmap(":/res/images/compas_small.png"));
45 m_layout->addWidget(m_userPicture,0,0,4,1);
46 m_layout->addWidget(m_userNameLabel,0,2,1,2);
47 m_layout->addWidget(m_clockLabel,1,1,1,1);
48 m_layout->addWidget(m_envelopeLabel,2,1,1,1);
49 m_layout->addWidget(m_compassLabel,3,1,1,1);
50 m_layout->addWidget(m_timeLabel,1,2,1,1);
51 m_layout->addWidget(m_messageLabel,2,2,1,1);
52 m_layout->addWidget(m_addressLabel,3,2,1,1);
53 m_layout->addWidget(updateFriendsButton,0,3,2,1);
54 m_layout->addWidget(updateStatusMessageButton,1,3,2,1);
56 connect(updateStatusMessageButton,SIGNAL(clicked()),this,SLOT(messageUpdate()));
57 connect(updateFriendsButton,SIGNAL(clicked()),this,SLOT(updateFriendsStatus()));
65 delete m_userNameLabel;
67 delete m_messageLabel;
69 delete m_addressLabel;
82 void InfoTab::paintEvent(QPaintEvent *aPaintEvent)
84 //Look and feel settings
86 QColor myColor(Qt::black);
88 qpalette.setColor(QPalette::Background,myColor);
92 QRect widgetRect = this->rect();
93 QPainter painter(this);
96 painter.setRenderHint(QPainter::Antialiasing);
97 QPainterPath roundedRect;
98 roundedRect.addRoundedRect(1,1,widgetRect.width() - 2, widgetRect.height()-2,roundness,roundness);
100 painter.setClipPath(roundedRect);
101 QRegion maskRegion = painter.clipRegion();
105 painter.fillPath(roundedRect,QBrush(myColor));
109 void InfoTab::setAvatar(const QPixmap &avat)
112 m_userPicture->setPixmap(m_avatar);
115 void InfoTab::setUserName(const QString &usernam)
117 if(m_userName == usernam)
119 m_userName = usernam;
120 m_userNameLabel->setText(m_userName);
123 void InfoTab::setMessageText(const QString &text)
125 if(m_messageText == text)
127 m_messageText = text;
128 m_messageLabel->setText(m_messageText);
131 void InfoTab::setAddress(const QString &addr)
133 if(m_address == addr)
136 m_addressLabel->setText(m_address);
139 void InfoTab::setTime(const QString &tim)
144 m_timeLabel->setText(m_time);
147 void InfoTab::messageUpdate()
149 emit launchMessageUpdate();
150 qDebug() << __PRETTY_FUNCTION__;
153 void InfoTab::updateFriendsStatus()
155 emit launchUpdateFriendsStatus();
156 qDebug() << __PRETTY_FUNCTION__;