Merge branch 'master' of https://vcs.maemo.org/git/situare into list_panel
authorJussi Laitinen <jupe@l3l7588.ixonos.local>
Mon, 10 May 2010 12:45:27 +0000 (15:45 +0300)
committerJussi Laitinen <jupe@l3l7588.ixonos.local>
Mon, 10 May 2010 12:45:27 +0000 (15:45 +0300)
Conflicts:
src/situareservice/situareservice.cpp
src/src.pro
src/ui/friendlistpanel.cpp
src/ui/panelcommon.h

1  2 
src/situareservice/situareservice.cpp
src/src.pro
src/ui/friendlistpanel.cpp
src/ui/friendlistpanel.h
src/ui/mapviewscreen.cpp
src/ui/panelcommon.h

@@@ -220,9 -220,12 +220,12 @@@ void SituareService::requestFinished(QN
              parseUserData(replyArray);
          }
          else if(replyArray == "") {
-             qDebug() << "No error, update was successful";
-             if (url.toString().contains(UPDATE_LOCATION.toAscii()))
 -            if(url.toString().contains(UPDATE_LOCATION.toAscii())) {
++                      if(url.toString().contains(UPDATE_LOCATION.toAscii())) {
                  emit updateWasSuccessful();
+             }
+             else {
+                 // server error!
+             }
          }
          else {
              // Street address ready
diff --cc src/src.pro
@@@ -32,13 -32,16 +32,16 @@@ SOURCES += main.cpp 
      ui/friendlistview.cpp \
      ui/friendlistitem.cpp \
      user/user.cpp \
 -    ui/situareuser.cpp \
 +    ui/avatarimage.cpp \
      engine/engine.cpp \
      ui/settingsdialog.cpp \
+     ui/logindialog.cpp \
      map/maptilerequest.cpp \
+     ui/imagebutton.cpp \
      ui/friendlistpanel.cpp \
      ui/userpanel.cpp \
-     ui/imagebutton.cpp
+     ui/panelsidebar.cpp \
+     ui/panelsliderbar.cpp
  HEADERS += ui/mainwindow.h \
      ui/mapviewscreen.h \
      ui/listviewscreen.h \
      ui/friendlistview.h \
      ui/friendlistitem.h \
      user/user.h \
 -    ui/situareuser.h \
 +    ui/avatarimage.h \
      engine/engine.h \
      ui/settingsdialog.h \
+     ui/logindialog.h \
      map/maptilerequest.h \
+     ui/imagebutton.h \
      ui/friendlistpanel.h \
      ui/userpanel.h \
      ui/panelcommon.h \
-     ui/imagebutton.h
+     ui/panelsidebar.h \
+     ui/panelsliderbar.h
  QT += network \
      webkit
 -DEFINES += QT_NO_DEBUG_OUTPUT
 +#DEFINES += QT_NO_DEBUG_OUTPUT
 +
- !maemo5 { 
+ !maemo5 {
      message(QJson built in)
      message(Make sure you have QJson development headers installed)
      message(install headers with: sudo apt-get install libqjson-dev)
@@@ -29,20 -30,23 +30,28 @@@ FriendListPanel::FriendListPanel(QWidge
  {
      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)
  {
@@@ -24,8 -24,9 +24,9 @@@
  
  #include <QtGui>
  
 -//class FriendListView;
 -//class User;
 +class FriendListView;
 +class User;
+ class PanelSliderBar;
  
  /**
  * @brief Class for sliding friends list panel
@@@ -71,10 -69,9 +69,9 @@@ public slots
   * DATA MEMBERS
   ******************************************************************************/
  private:
 -//    FriendListView *m_friendListView; ///< Friend list view
 +    FriendListView *m_friendListView; ///< Friend list view
      QVBoxLayout *m_friendsPanelVBox; ///< Vertical layout inside the panel
-     QPushButton *m_friendsPanelExpandButton; ///< PushButton used to expand the panel
+     PanelSliderBar *m_friendsPanelSlidingBar; ///< Widget for sidebar tab item
  
      QStateMachine *m_friendsPanelStateMachine; ///< State machine for sliding the panel
      QState *m_friendsPanelStateClosed; ///< State of the closed panel
@@@ -57,9 -62,11 +62,11 @@@ MapViewScreen::MapViewScreen(QWidget *p
              friendsListPanel, SLOT(reDrawFriendsPanel(int,int)));
      connect(mapView, SIGNAL(viewResizedNewSize(int,int)),
              userPanel, SLOT(reDrawUserPanel(int,int)));
+     connect(mapView, SIGNAL(viewResizedNewSize(int,int)),
+             friendsListPanelSidebar, SLOT(reDrawSidebar(int,int)));
  
 -//    connect(this, SIGNAL(SIG_friendsLocationsReady(QList<User*>&)),
 -//            friendsListPanel, SLOT(friendInfoReceived(QList<User*>&)));
 +    connect(this, SIGNAL(SIG_friendsLocationsReady(QList<User*>&)),
 +            friendsListPanel, SLOT(friendInfoReceived(QList<User*>&)));
  
  
      QHBoxLayout *mapViewLayout = new QHBoxLayout;
  #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