Merge branch 'master' into new_zoom_buttons_panel
authorPekka Nissinen <pekka.nissinen@ixonos.com>
Fri, 14 May 2010 09:53:18 +0000 (12:53 +0300)
committerPekka Nissinen <pekka.nissinen@ixonos.com>
Fri, 14 May 2010 09:53:18 +0000 (12:53 +0300)
Conflicts:
src/src.pro
src/ui/mainwindow.cpp
src/ui/mapviewscreen.cpp

1  2 
src/map/mapcommon.h
src/map/mapengine.cpp
src/map/mapengine.h
src/src.pro
src/ui/mainwindow.cpp
src/ui/mapviewscreen.cpp
src/ui/mapviewscreen.h

Simple merge
Simple merge
@@@ -266,10 -293,13 +293,12 @@@ signals
   * DATA MEMBERS
   ******************************************************************************/
  private:
+     bool m_autoCenteringEnabled;    ///< Auto centering enabled
      QPoint m_centerTile; ///< Current center tile
      FriendItemsHandler *m_friendItemsHandler; ///< Handler for friend and group items
+     QPoint m_lastManualPosition;  ///< Last manually set position in scene coordinate
      MapFetcher *m_mapFetcher; ///< Fetcher for map tiles
      MapScene *m_mapScene; ///< Scene for map tiles
 -    MapZoomPanel *m_mapZoomPanel; ///< Toolbar for zoom buttons
      OwnLocationItem *m_ownLocation; ///< Item to show own location
      QPoint m_sceneCoordinate; ///< Current center coordinate
      QRect m_viewTilesGrid; ///< Current grid of tiles in view (includes margin)
diff --cc src/src.pro
@@@ -76,7 -79,7 +76,8 @@@ HEADERS += ui/mainwindow.h 
      map/friendgroupitem.h \
      map/frienditemshandler.h \
      gps/gpspositioninterface.h \
 +    ui/zoombuttonpanel.h
+     situarecommon.h
  QT += network \
      webkit
  DEFINES += QT_NO_DEBUG_OUTPUT
Simple merge
@@@ -38,60 -41,61 +38,70 @@@ MapViewScreen::MapViewScreen(QWidget *p
      PanelSideBar *userPanelSidebar = new PanelSideBar(this, LEFT);
      PanelSideBar *friendsListPanelSidebar = new PanelSideBar(this, RIGHT);
  
 +    m_zoomButtonPanel = new ZoomButtonPanel(this, ZOOM_BUTTON_PANEL_POSITION_X,
 +                                            ZOOM_BUTTON_PANEL_POSITION_Y);
 +
      connect(mapView, SIGNAL(viewScrolled(QPoint)),
 -            mapEngine, SLOT(setLocation(QPoint)));
 -    connect(mapEngine, SIGNAL(locationChanged(QPoint)),
 +            m_mapEngine, SLOT(setLocation(QPoint)));
 +    connect(m_mapEngine, SIGNAL(locationChanged(QPoint)),
              mapView, SLOT(centerToSceneCoordinates(QPoint)));
 -    connect(mapEngine, SIGNAL(zoomLevelChanged(int)),
 +    connect(m_mapEngine, SIGNAL(zoomLevelChanged(int)),
              mapView, SLOT(setZoomLevel(int)));
      connect(mapView, SIGNAL(viewResized(QSize)),
 -            mapEngine, SLOT(viewResized(QSize)));
 +            m_mapEngine, SLOT(viewResized(QSize)));
      connect(mapView, SIGNAL(viewContentChanged(QPoint)),
 -            mapEngine, SLOT(alignImmovableItems(QPoint)));
 +            m_mapEngine, SLOT(alignImmovableItems(QPoint)));
      connect(mapView, SIGNAL(viewZoomFinished()),
 -            mapEngine, SLOT(viewZoomFinished()));
 +            m_mapEngine, SLOT(viewZoomFinished()));
  
+     connect(this, SIGNAL(zoomInKeyPressed()),
+             mapEngine, SLOT(zoomIn()));
+     connect(this, SIGNAL(zoomOutKeyPressed()),
+             mapEngine, SLOT(zoomOut()));
      connect(mapView, SIGNAL(viewResizedNewSize(int,int)),
              this, SLOT(drawOsmLicense(int, int)));
 -
      connect(mapView, SIGNAL(viewResizedNewSize(int,int)),
 -            friendsListPanel, SLOT(reDrawFriendsPanel(int,int)));
 +            m_friendsListPanel, SLOT(reDrawFriendsPanel(int,int)));
      connect(mapView, SIGNAL(viewResizedNewSize(int,int)),
 -            userPanel, SLOT(reDrawUserPanel(int,int)));
 +            m_userPanel, SLOT(reDrawUserPanel(int,int)));
      connect(mapView, SIGNAL(viewResizedNewSize(int,int)),
              friendsListPanelSidebar, SLOT(reDrawSidebar(int,int)));
  
 +    connect(m_zoomButtonPanel->m_zoomInBtn, SIGNAL(clicked()),
 +            m_mapEngine, SLOT(zoomIn()));
 +    connect(m_zoomButtonPanel->m_zoomOutBtn, SIGNAL(clicked()),
 +            m_mapEngine, SLOT(zoomOut()));
 +
      connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
 -            friendsListPanel, SLOT(friendInfoReceived(QList<User*>&)));
 -    connect(friendsListPanel, SIGNAL(findFriend(QPointF)),
 -            mapEngine, SLOT(setViewLocation(QPointF)));
 +            m_friendsListPanel, SLOT(friendInfoReceived(QList<User*>&)));
++    connect(m_friendsListPanel, SIGNAL(findFriend(QPointF)),
++            m_mapEngine, SLOT(setViewLocation(QPointF)));
  
      connect(this, SIGNAL(userLocationReady(User*)),
 -            mapEngine, SLOT(receiveOwnLocation(User*)));
 +            m_mapEngine, SLOT(receiveOwnLocation(User*)));
      connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
 -            mapEngine, SIGNAL(friendsLocationsReady(QList<User*>&)));
 +            m_mapEngine, SIGNAL(friendsLocationsReady(QList<User*>&)));
  
 -    connect(mapEngine, SIGNAL(mapScrolled()), this, SLOT(locationChanged()));
++    connect(m_mapEngine, SIGNAL(mapScrolled()),
++            this, SLOT(locationChanged()));
      QHBoxLayout *mapViewLayout = new QHBoxLayout;
  
 -    osmLicense = new QLabel(this);
 -    osmLicense->setAttribute(Qt::WA_TranslucentBackground, true);
 -    osmLicense->setAttribute(Qt::WA_TransparentForMouseEvents, true);
 -    osmLicense->setText("<font color='black'>"+OSM_LICENSE+"</font>");
 -    osmLicense->setFont(QFont("Nokia Sans", 9));
 -    osmLicense->resize(osmLicense->fontMetrics().width(OSM_LICENSE),
 -                       osmLicense->fontMetrics().height());
 -
 -    friendsListPanel->stackUnder(friendsListPanelSidebar);
 -    userPanelSidebar->stackUnder(friendsListPanel);
 -    userPanel->stackUnder(userPanelSidebar);
 -    osmLicense->stackUnder(userPanel);
 -    mapView->stackUnder(osmLicense);
 +    m_osmLicense = new QLabel(this);
 +    m_osmLicense->setAttribute(Qt::WA_TranslucentBackground, true);
 +    m_osmLicense->setAttribute(Qt::WA_TransparentForMouseEvents, true);
 +    m_osmLicense->setText("<font color='black'>"+OSM_LICENSE+"</font>");
 +    m_osmLicense->setFont(QFont("Nokia Sans", 9));
 +    m_osmLicense->resize(m_osmLicense->fontMetrics().width(OSM_LICENSE),
-                             m_osmLicense->fontMetrics().height());
++                         m_osmLicense->fontMetrics().height());
 +
 +    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);
  
      mapViewLayout->addWidget(mapView);
      setLayout(mapViewLayout);
  void MapViewScreen::drawOsmLicense(int width, int height)
  {
      qDebug() << __PRETTY_FUNCTION__ << width << "x" << height;
 -    osmLicense->move(width - osmLicense->fontMetrics().width(OSM_LICENSE) - PANEL_PEEK_AMOUNT,
 -                     height - osmLicense->fontMetrics().height());
 +    m_osmLicense->move(width - m_osmLicense->fontMetrics().width(OSM_LICENSE) - PANEL_PEEK_AMOUNT,
 +                        height - m_osmLicense->fontMetrics().height());
  }
  
- void MapViewScreen::positionReceived(QPointF position)
+ void MapViewScreen::locationChanged()
+ {
+     qDebug() << __PRETTY_FUNCTION__;
+     if (m_autoCenteringEnabled)
+         emit mapLocationChanged();
+ }
+ void MapViewScreen::positionReceived(QPointF position, qreal accuracy)
  {
      qDebug() << __PRETTY_FUNCTION__;
  
@@@ -123,4 -135,5 +141,5 @@@ void MapViewScreen::enableAutoCentering
      qDebug() << __PRETTY_FUNCTION__;
  
      m_autoCenteringEnabled = enabled;
 -    mapEngine->setAutoCentering(enabled);
++    m_mapEngine->setAutoCentering(enabled);
  }
Simple merge