Merge branch 'new_info_panels'
authorKaj Wallin <kaj.wallin@ixonos.com>
Tue, 18 May 2010 06:11:13 +0000 (09:11 +0300)
committerKaj Wallin <kaj.wallin@ixonos.com>
Tue, 18 May 2010 06:11:13 +0000 (09:11 +0300)
Conflicts:
src/ui/userpanel.cpp
src/ui/userpanel.h

1  2 
images.qrc
src/ui/mapviewscreen.cpp
src/ui/userpanel.cpp
src/ui/userpanel.h

diff --cc images.qrc
Simple merge
@@@ -141,12 -105,12 +141,18 @@@ MapViewScreen::MapViewScreen(QWidget *p
      m_osmLicense->resize(m_osmLicense->fontMetrics().width(OSM_LICENSE),
                           m_osmLicense->fontMetrics().height());
  
++    m_ownLocationCrosshair = new QLabel(this);
++    QPixmap crosshairImage(":/res/images/sight.png");
++    m_ownLocationCrosshair->setPixmap(crosshairImage);
++    m_ownLocationCrosshair->setFixedSize(crosshairImage.size());
++
      m_friendsListPanel->stackUnder(friendsListPanelSidebar);
      userPanelSidebar->stackUnder(m_friendsListPanel);
      m_userPanel->stackUnder(userPanelSidebar);
      m_zoomButtonPanel->stackUnder(m_userPanel);
      m_osmLicense->stackUnder(m_zoomButtonPanel);
--    mapView->stackUnder(m_osmLicense);
++    m_ownLocationCrosshair->stackUnder(m_osmLicense);
++    mapView->stackUnder(m_ownLocationCrosshair);
  
      mapViewLayout->addWidget(mapView);
      setLayout(mapViewLayout);
@@@ -165,41 -129,3 +171,38 @@@ void MapViewScreen::drawOsmLicense(int 
                          height - m_osmLicense->fontMetrics().height());
  }
  
 +
 +void MapViewScreen::drawOwnLocationCrosshair(int width, int height)
 +{
 +    qDebug() << __PRETTY_FUNCTION__;
 +
 +    if (m_drawOwnLocationCrosshair) {
 +        m_ownLocationCrosshair->move(width/2 - m_ownLocationCrosshair->pixmap()->width()/2,
 +                            height/2 - m_ownLocationCrosshair->pixmap()->height()/2);
 +    }
 +}
 +
 +void MapViewScreen::setOwnLocationCrosshairVisibility(bool visibility)
 +{   
 +    if (visibility == false) {
 +
 +        if (m_ownLocationCrosshair == 0) {
-             m_ownLocationCrosshair = new QLabel(this);
-             QPixmap crosshairImage(":/res/images/sight.png");
-             m_ownLocationCrosshair->setPixmap(crosshairImage);
-             m_ownLocationCrosshair->setFixedSize(crosshairImage.size());
++
 +        }
 +
 +        m_ownLocationCrosshair->show();
 +        m_drawOwnLocationCrosshair = true;
 +        drawOwnLocationCrosshair(m_viewPortWidth, m_viewPortHeight);
 +    }
 +
 +    else {
 +        m_ownLocationCrosshair->hide();
 +        m_drawOwnLocationCrosshair = false;
 +    }
 +}
 +
 +void MapViewScreen::setViewPortSize(int width, int height)
 +{
 +    m_viewPortWidth = width;
 +    m_viewPortHeight = height;
 +}
@@@ -28,19 -27,17 +28,24 @@@ UserInfoPanel::UserInfoPanel(QWidget *p
      : QWidget(parent)
  {
      qDebug() << __PRETTY_FUNCTION__;
      m_userPanelVBox = new QVBoxLayout(this);
 +    m_userPanelVBox->setMargin(0);
 +    m_userPanelVBox->setContentsMargins(SLIDINGBAR_WIDTH+1, 0, SIDEBAR_WIDTH, 0);
 +    m_userPanelVBox->setSpacing(0);
-     setLayout(m_userPanelVBox);
 +
 +    m_userInfo = new UserInfo(this);
 +    m_userPanelVBox->addWidget(m_userInfo, 0, Qt::AlignCenter);
 +
-     setAutoFillBackground(true);
+     m_panelBase = new QWidget(this);
+     m_panelBase->setLayout(m_userPanelVBox);
+     m_panelBase->move(TOP_CORNER_X,PANEL_TOP_Y);
+     m_panelBase->resize(USERPANEL_WIDTH, USERPANEL_HEIGHT);
      QPalette pal = palette();
      pal.setColor(QPalette::Background, QColor(0, 0, 0, 128));
-     setPalette(pal);
+     m_panelBase->setPalette(pal);
+     m_panelBase->setAutoFillBackground(true);
  
      PanelSliderBar *m_userPanelSlidingBar = new PanelSliderBar(this, LEFT);
      m_userPanelSlidingBar->move(USERPANEL_WIDTH - SLIDINGBAR_WIDTH, PANEL_TOP_Y);
@@@ -94,5 -71,5 +102,6 @@@ void UserInfoPanel::reDrawUserPanel(in
  {
      qDebug() << __PRETTY_FUNCTION__;
      Q_UNUSED(width);
-     resize(USERPANEL_WIDTH,height + MARGIN_CORRECTION);
++    m_panelBase->resize(USERPANEL_WIDTH, height + MARGIN_CORRECTION);
+     resize(USERPANEL_WIDTH + SLIDINGBAR_WIDTH,height + MARGIN_CORRECTION);
  }
@@@ -108,6 -68,6 +107,7 @@@ private
      QState *m_userPanelStateOpened; ///< State of the opened panel
      QSignalTransition *m_userPanelTransitionClose; ///< Transition signal for closing the panel
      QSignalTransition *m_userPanelTransitionOpen; ///< Transition signal for opening the panel
 +    UserInfo *m_userInfo;
+     QVBoxLayout *m_userPanelVBox; ///< Vertical layout inside the panel
  };
  #endif // USERPANEL_H