2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Kaj Wallin - kaj.wallin@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,
22 #include "userpanel.h"
23 #include "panelcommon.h"
25 UserInfoPanel::UserInfoPanel(QWidget *parent)
28 qDebug() << __PRETTY_FUNCTION__;
29 m_userPanelVBox = new QVBoxLayout(this);
30 this->setLayout(m_userPanelVBox);
31 m_userPanelExpandButton = new QPushButton("Personal", this);
32 m_userPanelLabel = new QLabel("User information here",this);
33 m_userPanelVBox->addWidget(m_userPanelExpandButton);
34 m_userPanelVBox->addWidget(m_userPanelLabel);
36 this->setAutoFillBackground(true);
37 QPalette pal = palette();
38 pal.setColor(QPalette::Background, QColor(0, 0, 0, 128));
41 m_userPanelStateMachine = new QStateMachine(this);
42 m_userPanelStateClosed = new QState(m_userPanelStateMachine);
43 m_userPanelStateClosed->assignProperty(this, "pos", QPoint(
44 USERPANEL_CLOSED_X, PANEL_TOP_Y));
45 m_userPanelStateMachine->setInitialState(m_userPanelStateClosed);
47 m_userPanelStateOpened = new QState(m_userPanelStateMachine);
48 m_userPanelStateOpened->assignProperty(this, "pos", QPoint(
49 USERPANEL_OPENED_X, PANEL_TOP_Y));
51 m_userPanelTransitionOpen = m_userPanelStateClosed->addTransition(
52 this, SIGNAL(clicked()), m_userPanelStateOpened);
53 m_userPanelTransitionOpen->addAnimation(new QPropertyAnimation(this, "pos", this));
55 m_userPanelTransitionClose = m_userPanelStateOpened->addTransition(
56 this, SIGNAL(clicked()), m_userPanelStateClosed);
57 m_userPanelTransitionClose->addAnimation(new QPropertyAnimation(this, "pos", this));
59 m_userPanelStateMachine->start();
60 this->setObjectName("UserPanel");
62 m_userPanelSlidingBar = new QWidget(this);
63 m_userPanelSlidingBar->setObjectName("UserPanelSlidingBar");
64 m_userPanelSlidingBar->setStyleSheet(QString(
65 "#UserPanelSlidingBar{background-image: url(:/res/images/sliding_bar_left.png)}"));
66 m_userPanelSlidingBar->resize(SIDEBAR_WIDTH + 1, SIDEBAR_HEIGHT);
67 m_userPanelSlidingBar->move(USERPANEL_WIDTH - SIDEBAR_WIDTH + 1, PANEL_TOP_Y);
70 void UserInfoPanel::reDrawUserPanel(int width, int height)
72 qDebug() << __PRETTY_FUNCTION__;
74 this->resize(USERPANEL_WIDTH,height + MARGIN_CORRECTION);
77 void UserInfoPanel::mouseReleaseEvent(QMouseEvent *)
79 qDebug() << __PRETTY_FUNCTION__;
83 void UserInfoPanel::paintEvent(QPaintEvent *)
85 qDebug() << __PRETTY_FUNCTION__;
90 QStylePainter painter(this);
91 style()->drawPrimitive(QStyle::PE_Widget, &option, &painter, this);