Created a sliding user information panel
authorKaj Wallin <kaj.wallin@ixonos.com>
Thu, 6 May 2010 12:42:52 +0000 (15:42 +0300)
committerKaj Wallin <kaj.wallin@ixonos.com>
Thu, 6 May 2010 12:42:52 +0000 (15:42 +0300)
Reviewed by:

src/src.pro
src/ui/friendlistitem.cpp
src/ui/friendlistpanel.cpp
src/ui/friendlistpanel.h
src/ui/mapviewscreen.cpp

index 8c038d1..f08a969 100644 (file)
@@ -37,7 +37,8 @@ SOURCES += main.cpp \
     engine/engine.cpp \
     ui/settingsdialog.cpp \
     map/maptilerequest.cpp \
-    ui/friendlistpanel.cpp
+    ui/friendlistpanel.cpp \
+    ui/userpanel.cpp
 HEADERS += ui/mainwindow.h \
     ui/mapviewscreen.h \
     ui/listviewscreen.h \
@@ -71,10 +72,12 @@ HEADERS += ui/mainwindow.h \
     engine/engine.h \
     ui/settingsdialog.h \
     map/maptilerequest.h \
-    ui/friendlistpanel.h
+    ui/friendlistpanel.h \
+    ui/userpanel.h
 QT += network \
     webkit
-#DEFINES += QT_NO_DEBUG_OUTPUT
+
+# DEFINES += QT_NO_DEBUG_OUTPUT
 !maemo5 { 
     message(QJson built in)
     message(Make sure you have QJson development headers installed)
index af5f7ba..a305b7d 100644 (file)
@@ -135,7 +135,6 @@ FriendListItem::FriendListItem(QWidget *parent)
 
     setMinimumSize(ITEM_MIN_WIDTH, ITEM_MIN_HEIGHT);
     setMaximumSize(ITEM_MIN_WIDTH, ITEM_MAX_HEIGHT);
-    this->setAutoFillBackground(false);
 }
 
 void FriendListItem::setData(User *user)
index a923868..b3b06e9 100644 (file)
 FriendListPanel::FriendListPanel(QWidget *parent)
     : QWidget(parent)
 {
-    qWarning() << __PRETTY_FUNCTION__; 
-    QVBoxLayout *friendsListGrid = new QVBoxLayout(this);
-    this->setLayout(friendsListGrid);
-    QPushButton *friendsDummyBTN = new QPushButton("HOOO", this);
-//    QLabel *friendsDummyLBL = new QLabel("FRIENDS LIST", this);
-    friendsListGrid->addWidget(friendsDummyBTN);
-
+    qDebug() << __PRETTY_FUNCTION__;
+    m_friendsPanelVBox = new QVBoxLayout(this);
+    this->setLayout(m_friendsPanelVBox);
+    m_friendsPanelExpandButton = new QPushButton("Friends", this);
+    m_friendsPanelVBox->addWidget(m_friendsPanelExpandButton);
 
     m_friendListView = new FriendListView(this);
     QScrollArea *friendListScroll = new QScrollArea(this);
     friendListScroll->setWidget(m_friendListView);
     friendListScroll->setWidgetResizable(true);
-//    m_friendListView->setAutoFillBackground(false);
     friendListScroll->viewport()->setAutoFillBackground(false);
 
-    friendsListGrid->addWidget(friendListScroll);
+    m_friendsPanelVBox->addWidget(friendListScroll);
 
-//    friendsListGrid->addWidget(friendsDummyLBL, 2,2,2,3);
     this->resize(420,600);
-//    this->setAutoFillBackground(true);
-    this->move(50,50);
 
-    QStateMachine *friendsListMachine = new QStateMachine(this);
-    QState *friendsListStateClosed = new QState(friendsListMachine);
-    friendsListStateClosed->assignProperty(this, "pos", QPoint(800,0));
-    friendsListMachine->setInitialState(friendsListStateClosed);
+    m_friendsPanelStateMachine = new QStateMachine(this);
+    m_friendsPanelStateClosed = new QState(m_friendsPanelStateMachine);
+    m_friendsPanelStateClosed->assignProperty(this, "pos", QPoint(800,0));
+    m_friendsPanelStateMachine->setInitialState(m_friendsPanelStateClosed);
 
-    QState *friendsListStateOpen = new QState(friendsListMachine);
-    friendsListStateOpen->assignProperty(this, "pos", QPoint(400,0));
+    m_friendsPanelStateOpened = new QState(m_friendsPanelStateMachine);
+    m_friendsPanelStateOpened->assignProperty(this, "pos", QPoint(400,0));
 
-    QSignalTransition *friendsListTransitionOpen = friendsListStateClosed->addTransition(
-            friendsDummyBTN, SIGNAL(clicked()), friendsListStateOpen);
-    friendsListTransitionOpen->addAnimation(new QPropertyAnimation(this, "pos"));
+    m_friendsPanelTransitionOpen = m_friendsPanelStateClosed->addTransition(
+            m_friendsPanelExpandButton, SIGNAL(clicked()), m_friendsPanelStateOpened);
+    m_friendsPanelTransitionOpen->addAnimation(new QPropertyAnimation(this, "pos"));
 
-    QSignalTransition *friendsListTransitionClose = friendsListStateOpen->addTransition(
-            friendsDummyBTN, SIGNAL(clicked()), friendsListStateClosed);
-    friendsListTransitionClose->addAnimation(new QPropertyAnimation(this, "pos"));
+    m_friendsPanelTransitionClose = m_friendsPanelStateOpened->addTransition(
+            m_friendsPanelExpandButton, SIGNAL(clicked()), m_friendsPanelStateClosed);
+    m_friendsPanelTransitionClose->addAnimation(new QPropertyAnimation(this, "pos"));
 
-    friendsListMachine->start();
+    m_friendsPanelStateMachine->start();
 }
 
 void FriendListPanel::friendInfoReceived(QList<User *> &friendList)
@@ -79,3 +73,8 @@ void FriendListPanel::friendInfoReceived(QList<User *> &friendList)
         m_friendListView->addWidget(item);
     }
 }
+
+void FriendListPanel::reDrawFriendsPanel(int width, int height)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+}
index 7eb5391..d453d5e 100644 (file)
@@ -40,11 +40,31 @@ class FriendListPanel : public QWidget
 public:
     FriendListPanel(QWidget *parent = 0);
 
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+public slots:
+    void friendInfoReceived(QList<User *> &friendList);
+    void reDrawFriendsPanel(int width, int height);
+/*******************************************************************************
+ * SIGNALS
+ ******************************************************************************/
 
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
+private:
     FriendListView *m_friendListView;   ///< Friend list view
 
-public slots:
-    void friendInfoReceived(QList<User *> &friendList);
+    QVBoxLayout *m_friendsPanelVBox;
+    QPushButton *m_friendsPanelExpandButton;
+    QLabel *m_friendsPanelLabel;
+
+    QStateMachine *m_friendsPanelStateMachine;
+    QState *m_friendsPanelStateClosed;
+    QState *m_friendsPanelStateOpened;
+    QSignalTransition *m_friendsPanelTransitionClose;
+    QSignalTransition *m_friendsPanelTransitionOpen;
 };
 
 #endif // FRIENDLISTPANEL_H
index 6240021..c02615f 100644 (file)
@@ -25,6 +25,7 @@
 #include "../map/mapengine.h"
 #include "infotab.h"
 #include "friendlistpanel.h"
+#include "userpanel.h"
 
 MapViewScreen::MapViewScreen(QWidget *parent)
    : QWidget(parent)
@@ -69,6 +70,7 @@ MapViewScreen::MapViewScreen(QWidget *parent)
     //DEBUG
 
     FriendListPanel *friendsListPanel = new FriendListPanel(this);
+    UserInfoPanel *userPanel = new UserInfoPanel(this);
 
     connect(this, SIGNAL(SIG_friendsLocationsReady(QList<User*>&)),
             friendsListPanel, SLOT(friendInfoReceived(QList<User*>&)));