{
qDebug() << __PRETTY_FUNCTION__;
m_friendsPanelVBox = new QVBoxLayout(this);
+ m_friendsPanelVBox->setMargin(0);
++ m_friendsPanelVBox->setContentsMargins(SLIDINGBAR_WIDTH, 0, SIDEBAR_WIDTH, 0);
+ m_friendsPanelVBox->setSpacing(0);
- this->setLayout(m_friendsPanelVBox);
- m_friendsPanelExpandButton = new QPushButton("Friends", this);
- m_friendsPanelVBox->addWidget(m_friendsPanelExpandButton);
+ setLayout(m_friendsPanelVBox);
-// m_friendListView = new FriendListView(this);
-// QScrollArea *friendListScroll = new QScrollArea(this);
-// friendListScroll->setWidget(m_friendListView);
-// friendListScroll->setWidgetResizable(true);
-// friendListScroll->viewport()->setAutoFillBackground(false);
-// m_friendsPanelVBox->addWidget(friendListScroll);
+ m_friendListView = new FriendListView(this);
+ QScrollArea *friendListScroll = new QScrollArea(this);
++ friendListScroll->setWidgetResizable(false);
+ friendListScroll->setWidget(m_friendListView);
+ friendListScroll->viewport()->setAutoFillBackground(false);
+ friendListScroll->widget()->setAutoFillBackground(false);
+
+ m_friendsPanelVBox->addWidget(friendListScroll);
+ setAutoFillBackground(true);
+ QPalette pal = palette();
+ pal.setColor(QPalette::Background, QColor(0, 0, 0, 128));
+ setPalette(pal);
+
+ m_friendsPanelSlidingBar = new PanelSliderBar(this, RIGHT);
+ m_friendsPanelSlidingBar->move(TOP_CORNER_X, PANEL_TOP_Y);
+
m_friendsPanelStateMachine = new QStateMachine(this);
m_friendsPanelStateClosed = new QState(m_friendsPanelStateMachine);
m_friendsPanelStateClosed->assignProperty(this, "pos", QPoint(
FRIENDPANEL_OPENED_X, PANEL_TOP_Y));
m_friendsPanelTransitionOpen = m_friendsPanelStateClosed->addTransition(
- m_friendsPanelExpandButton, SIGNAL(clicked()), m_friendsPanelStateOpened);
- m_friendsPanelTransitionOpen->addAnimation(new QPropertyAnimation(this, "pos"));
+ m_friendsPanelSlidingBar, SIGNAL(clicked()), m_friendsPanelStateOpened);
+ m_friendsPanelTransitionOpen->addAnimation(new QPropertyAnimation(this, "pos", this));
m_friendsPanelTransitionClose = m_friendsPanelStateOpened->addTransition(
- m_friendsPanelExpandButton, SIGNAL(clicked()), m_friendsPanelStateClosed);
- m_friendsPanelTransitionClose->addAnimation(new QPropertyAnimation(this, "pos"));
+ m_friendsPanelSlidingBar, SIGNAL(clicked()), m_friendsPanelStateClosed);
+ m_friendsPanelTransitionClose->addAnimation(new QPropertyAnimation(this, "pos", this));
m_friendsPanelStateMachine->start();
-
- //Debug
- QList<User *> friendList;
- for (int i = 0; i < 10; ++i) {
- User *user = new User(QString("Address"), QPointF(12.22, 23.33), QString("Name Name Name Naem"),
- QString("Hello world! Hello world! Hello world! Hello world! "),
- QUrl(), QString("2 days ago"), false, QString("id"), QString("km"),
- 600);
- user->setProfileImage(QPixmap(":/res/images/face.gif"));
- friendList.append(user);
- }
- friendInfoReceived(friendList);
-
- this->setObjectName("UserPanel");
- //this->setStyleSheet(QString("#UserPanel{background-image: url(:/res/images/personal_info_bckgrnd.png)}"));
-
- this->setAutoFillBackground(true);
- QPalette pal = palette();
- pal.setColor(QPalette::Background, QColor(0, 0, 0, 128));
- setPalette(pal);
+ setObjectName("FriendsPanel");
}
-//void FriendListPanel::friendInfoReceived(QList<User *> &friendList)
-//{
-// qDebug() << __PRETTY_FUNCTION__;
+void FriendListPanel::friendInfoReceived(QList<User *> &friendList)
+{
+ qDebug() << __PRETTY_FUNCTION__;
- //m_friendListView->clear();
-// m_friendListView->clear();
++ m_friendListView->clear();
-// foreach (User *user, friendList) {
-// FriendListItem *item = new FriendListItem(m_friendListView);
-// item->setData(user);
-// m_friendListView->addWidget(item);
-// }
-//}
+ foreach (User *user, friendList) {
+ FriendListItem *item = new FriendListItem(m_friendListView);
+ item->setData(user);
+ m_friendListView->addWidget(item);
- FriendListItem *item2 = new FriendListItem(m_friendListView);
- item2->setData(user);
- m_friendListView->addWidget(item2);
- FriendListItem *item3 = new FriendListItem(m_friendListView);
- item3->setData(user);
- m_friendListView->addWidget(item3);
- FriendListItem *item4 = new FriendListItem(m_friendListView);
- item4->setData(user);
- m_friendListView->addWidget(item4);
+ }
+}
void FriendListPanel::reDrawFriendsPanel(int width, int height)
{
#include <QtCore>
#include "map/mapcommon.h"
- const int PANEL_PEEK_AMOUNT = 60; ///< Amount of pixels shown when panel is closed
- const int FRIENDPANEL_WIDTH = 400; ///< Width of the friends list panel
+ enum Side{LEFT, RIGHT}; ///< Enumerator for panel sideness
+
+ const int PANEL_PEEK_AMOUNT = 25; ///< Amount of pixels shown when panel is closed
+
-const int FRIENDPANEL_WIDTH = 420; ///< Width of the friends list panel
++const int FRIENDPANEL_WIDTH = 430; ///< Width of the friends list panel
const int FRIENDPANEL_HEIGHT = DEFAULT_SCREEN_HEIGHT; ///< Height of the friends list panel
- const int USERPANEL_WIDTH = 400; ///< Width of the user panel
+ const int USERPANEL_WIDTH = 300; ///< Width of the user panel
const int USERPANEL_HEIGHT = DEFAULT_SCREEN_HEIGHT; ///< Height of the user panetl
- const int MARGIN_CORRECTION = 1; ///< Amount of correction to make panels touch the widnow borders
+ const int MARGIN_CORRECTION = 1; ///< Amount of correction to make panels touch the window borders
+ const int MARGIN_CORRECTION2 = 2; ///< Amount of correction to make panels touch the window borders
const int PANEL_TOP_Y = 0; ///< Y coordinate for top of both panels
+ const int TOP_CORNER_X = 0; ///< X coordinate for top left corner
const int FRIENDPANEL_CLOSED_X =
DEFAULT_SCREEN_WIDTH-PANEL_PEEK_AMOUNT; ///< X location of the friend list panel when closed