Merge branch 'master' into current_position_marker current_position_marker
authorSami Rämö <sami.ramo@ixonos.com>
Mon, 17 May 2010 11:50:11 +0000 (14:50 +0300)
committerSami Rämö <sami.ramo@ixonos.com>
Mon, 17 May 2010 12:30:57 +0000 (15:30 +0300)
 - Reviewed by Jussi

Conflicts:
images.qrc
src/gps/gpsposition.h
src/map/mapengine.cpp
src/src.pro
src/ui/mainwindow.cpp
src/ui/mapviewscreen.cpp
src/ui/mapviewscreen.h

12 files changed:
1  2 
images.qrc
src/engine/engine.h
src/gps/gpsposition.cpp
src/gps/gpsposition.h
src/map/mapengine.cpp
src/map/mapengine.h
src/map/mapview.cpp
src/map/mapview.h
src/src.pro
src/ui/mainwindow.cpp
src/ui/mapviewscreen.cpp
src/ui/mapviewscreen.h

diff --cc images.qrc
@@@ -26,7 -25,6 +25,8 @@@
          <file>res/images/list_item_bottom.png</file>
          <file>res/images/list_item_middle.png</file>
          <file>res/images/list_item_top.png</file>
 +        <file>res/images/gps_pos_accurate.png</file>
 +        <file>res/images/gps_pos_coarse.png</file>
+         <file>res/images/friend_group.png</file>
      </qresource>
  </RCC>
Simple merge
@@@ -121,12 -126,15 +127,12 @@@ void GPSPosition::requestLastPosition(
  
  void GPSPosition::positionUpdated(QGeoPositionInfo positionInfo)
  {
-     qDebug() << __PRETTY_FUNCTION__;
+     qDebug() << __PRETTY_FUNCTION__ << positionInfo;
  
 -    if (positionInfo.coordinate().isValid()) {
 -
 -        qreal accuracy = biggerAccuracy(positionInfo);
 -
 +    if (positionInfo.coordinate().isValid())
          emit position(QPointF(positionInfo.coordinate().longitude(),
 -                          positionInfo.coordinate().latitude()), accuracy);
 -    }
 +                              positionInfo.coordinate().latitude()),
 +                      accuracy(positionInfo));
  }
  
  void GPSPosition::updateTimeout()
Simple merge
@@@ -32,7 -32,7 +32,8 @@@
  #include <QRect>
  
  #include "frienditemshandler.h"
 +#include "gpslocationitem.h"
+ #include "mapcommon.h"
  #include "mapengine.h"
  #include "maptile.h"
  
@@@ -141,13 -132,11 +137,6 @@@ QRect MapEngine::calculateTileGrid(QPoi
      return QRect(topLeftX, topLeftY, gridWidth, gridHeight);
  }
  
--void MapEngine::alignImmovableItems(QPoint viewTopLeft)
--{
--    qDebug() << __PRETTY_FUNCTION__ << "viewTopLeft:" << viewTopLeft;
-     m_mapZoomPanel->setPos(viewTopLeft);
--}
--
  void MapEngine::setLocation(QPoint sceneCoordinate)
  {
      qDebug() << __PRETTY_FUNCTION__;
@@@ -118,13 -123,13 +117,6 @@@ public
  
  public slots:
      /**
--    * @brief Slot for immovable scene items position correction
--    *
--    * @param viewTopLeft Scene coordinate of the viewport top left corner
--    */
--    void alignImmovableItems(QPoint viewTopLeft);
--
--    /**
      * @brief Slot for setting current view location
      *
      * Emits locationChanged signal.
@@@ -67,7 -68,7 +68,6 @@@ void MapView::setViewScale(qreal viewSc
      QTransform transform;
      transform.scale(viewScale, viewScale);
      setTransform(transform);
--    emit viewContentChanged(mapToScene(viewport()->x(), viewport()->y()).toPoint());
  }
  
  void MapView::mouseMoveEvent(QMouseEvent *event)
@@@ -79,7 -80,7 +79,6 @@@
      emit viewScrolled(m_scenePosition);
  
      m_mousePosition = mapToScene(event->pos()).toPoint();
--    emit viewContentChanged(mapToScene(viewport()->x(), viewport()->y()).toPoint());
  }
  
  void MapView::mousePressEvent(QMouseEvent *event)
@@@ -105,13 -106,13 +104,4 @@@ void MapView::resizeEvent(QResizeEvent 
  
      emit viewResized(event->size());
      emit viewResizedNewSize(viewport()->width(), viewport()->height());
--    emit viewContentChanged(mapToScene(viewport()->x(), viewport()->y()).toPoint());
--}
--
--void MapView::showEvent(QShowEvent *event)
--{
--    qDebug() << __PRETTY_FUNCTION__;
--
--    QGraphicsView::showEvent(event);
--    emit viewContentChanged(mapToScene(viewport()->x(), viewport()->y()).toPoint());
  }
@@@ -60,13 -62,13 +62,6 @@@ protected
      */
      void resizeEvent(QResizeEvent *event);
  
--    /**
--    * @brief Called when view is displayed.
--    *
--    * @param event show event
--    */
--    void showEvent(QShowEvent *event);
--
  private:
      /**
      * @brief Event handler for mouse move events
@@@ -146,14 -148,14 +141,6 @@@ signals
      void viewZoomFinished();
  
      /**
--    * @brief Signal for updating view content
--    *
--    * Signal is emitted when view content needs an update.
--    * @param viewTopLeft Scene coordinate of the viewport top left corner
--    */
--    void viewContentChanged(QPoint viewTopLeft);
--
--    /**
      * @brief Signal for drawing OSM license
      *
      * Signal is emitted when view is resized.
diff --cc src/src.pro
@@@ -41,7 -39,7 +39,8 @@@ SOURCES += main.cpp 
      map/friendgroupitem.cpp \
      map/frienditemshandler.cpp \
      gps/gpspositioninterface.cpp \
-     map/gpslocationitem.cpp
++    map/gpslocationitem.cpp \
+     ui/zoombuttonpanel.cpp
  HEADERS += ui/mainwindow.h \
      ui/mapviewscreen.h \
      map/mapengine.h \
      map/friendgroupitem.h \
      map/frienditemshandler.h \
      gps/gpspositioninterface.h \
 +    map/gpslocationitem.h \
-     situarecommon.h \
-     gps/gpscommon.h
++    gps/gpscommon.h \
+     ui/zoombuttonpanel.h \
+     common.h
  QT += network \
      webkit
  DEFINES += QT_NO_DEBUG_OUTPUT
@@@ -66,10 -66,11 +66,11 @@@ MainWindow::MainWindow(QWidget *parent
              m_mapViewScreen, SIGNAL(friendsLocationsReady(QList<User*>&)));
  
        connect(this, SIGNAL(autoCentering(bool)),
 -            m_mapViewScreen, SLOT(enableAutoCentering(bool)));
 +            m_mapViewScreen, SIGNAL(enableAutoCentering(bool)));
      connect(this, SIGNAL(positionReceived(QPointF, qreal)),
 -            m_mapViewScreen, SLOT(positionReceived(QPointF, qreal)));
 +            m_mapViewScreen, SIGNAL(positionReceived(QPointF, qreal)));
-     connect(m_mapViewScreen, SIGNAL(mapLocationChanged()), this, SLOT(mapLocationChanged()));
+     connect(m_mapViewScreen, SIGNAL(mapLocationChanged()),
+             this, SLOT(mapLocationChanged()));
  
      connect(this, SIGNAL(zoomInKeyPressed()),
              m_mapViewScreen, SIGNAL(zoomInKeyPressed()));
@@@ -115,11 -118,10 +118,12 @@@ void MainWindow::createMenus(
      m_autoCenteringAct = new QAction(tr("Auto centering"), this);
      m_autoCenteringAct->setCheckable(true);
      m_autoCenteringAct->setChecked(true);
-     connect(m_autoCenteringAct, SIGNAL(toggled(bool)), this, SLOT(autoCenteringToggled(bool)));    
+     connect(m_autoCenteringAct, SIGNAL(toggled(bool)),
 -        this, SLOT(autoCenteringToggled(bool)));    
 -      
 -      m_viewMenu = menuBar()->addMenu(tr("Main"));
++        this, SLOT(autoCenteringToggled(bool))); 
 +    connect(this, SIGNAL(enableGPS(bool)),
 +            m_mapViewScreen, SIGNAL(gpsEnabled(bool)));
 +
 +    m_viewMenu = menuBar()->addMenu(tr("Main"));
  
      m_viewMenu->addAction(m_toSettingsAct);
        m_viewMenu->addAction(m_gpsToggleAct);
  #include "panelsidebar.h"
  
  MapViewScreen::MapViewScreen(QWidget *parent)
 -   : QWidget(parent),
 -     m_autoCenteringEnabled(false)
 +   : QWidget(parent)
  {
      MapView *mapView = new MapView(this);
-     mapEngine = new MapEngine(this);
-     mapView->setScene(mapEngine->scene());
+     m_mapEngine = new MapEngine(this);
+     mapView->setScene(m_mapEngine->scene());
  
-     FriendListPanel *friendsListPanel = new FriendListPanel(this);
-     UserInfoPanel *userPanel = new UserInfoPanel(this);
+     m_friendsListPanel = new FriendListPanel(this);
+     m_userPanel = new UserInfoPanel(this);
      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)));
-     connect(mapView, SIGNAL(viewContentChanged(QPoint)),
-             mapEngine, SLOT(alignImmovableItems(QPoint)));
+             m_mapEngine, SLOT(viewResized(QSize)));
 -    connect(mapView, SIGNAL(viewContentChanged(QPoint)),
 -            m_mapEngine, SLOT(alignImmovableItems(QPoint)));
      connect(mapView, SIGNAL(viewZoomFinished()),
-             mapEngine, SLOT(viewZoomFinished()));
+             m_mapEngine, SLOT(viewZoomFinished()));
  
      connect(this, SIGNAL(zoomInKeyPressed()),
-             mapEngine, SLOT(zoomIn()));
+             m_mapEngine, SLOT(zoomIn()));
      connect(this, SIGNAL(zoomOutKeyPressed()),
-             mapEngine, SLOT(zoomOut()));
+             m_mapEngine, SLOT(zoomOut()));
  
-     connect(mapView, SIGNAL(viewResizedNewSize(int,int)),
+     connect(mapView, SIGNAL(viewResizedNewSize(int, int)),
              this, SLOT(drawOsmLicense(int, int)));
-     connect(mapView, SIGNAL(viewResizedNewSize(int,int)),
-             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(mapView, SIGNAL(viewResizedNewSize(int, int)),
+             m_friendsListPanel, SLOT(reDrawFriendsPanel(int, int)));
+     connect(mapView, SIGNAL(viewResizedNewSize(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(mapScrolledManually()),
 -    connect(m_mapEngine, SIGNAL(mapScrolled()),
 -            this, SLOT(locationChanged()));
++    connect(m_mapEngine, SIGNAL(mapScrolledManually()),
 +            this, SIGNAL(mapLocationChanged()));
 +
 +    connect(this, SIGNAL(positionReceived(QPointF,qreal)),
-             mapEngine, SLOT(gpsPositionUpdate(QPointF,qreal)));
++            m_mapEngine, SLOT(gpsPositionUpdate(QPointF,qreal)));
 +    connect(this, SIGNAL(enableAutoCentering(bool)),
-             mapEngine, SLOT(setAutoCentering(bool)));
++            m_mapEngine, SLOT(setAutoCentering(bool)));
 +    connect(this, SIGNAL(gpsEnabled(bool)),
-             mapEngine, SLOT(gpsEnabled(bool)));
++            m_mapEngine, SLOT(gpsEnabled(bool)));
  
      QHBoxLayout *mapViewLayout = new QHBoxLayout;
  
  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::locationChanged()
 -{
 -    qDebug() << __PRETTY_FUNCTION__;
 -
 -    if (m_autoCenteringEnabled)
 -        emit mapLocationChanged();
 -}
 -
 -void MapViewScreen::positionReceived(QPointF position, qreal accuracy)
 -{
 -    qDebug() << __PRETTY_FUNCTION__;
 -
 -    if (m_autoCenteringEnabled)
 -        m_mapEngine->setViewLocation(position);
 -}
 -
 -void MapViewScreen::enableAutoCentering(bool enabled)
 -{
 -    qDebug() << __PRETTY_FUNCTION__;
 -
 -    m_autoCenteringEnabled = enabled;
 -    m_mapEngine->setAutoCentering(enabled);
 -}
@@@ -117,10 -118,12 +118,11 @@@ signals
   * DATA MEMBERS
   ******************************************************************************/
  private:
-     FriendListPanel *friendsListPanel; ///< Instance of friends list panel
-     MapEngine *mapEngine; ///< MapEngine
-     QLabel *osmLicense; ///< Label for Open Street Map license
-     UserInfoPanel *userPanel; ///< Instance of the user information panel
 -    MapEngine *m_mapEngine;                 ///< MapEngine
 -    UserInfoPanel *m_userPanel;             ///< Instance of the user information panel
 -    FriendListPanel *m_friendsListPanel;    ///< Instance of friends list panel
 -    ZoomButtonPanel *m_zoomButtonPanel;     ///< Instance of zoom button panel
 -    QLabel *m_osmLicense;                   ///< Label for Open Street Map license
 -    bool m_autoCenteringEnabled;            ///< Enable
++    FriendListPanel *m_friendsListPanel; ///< Instance of friends list panel
++    MapEngine *m_mapEngine;              ///< MapEngine
++    QLabel *m_osmLicense;                ///< Label for Open Street Map license
++    UserInfoPanel *m_userPanel;          ///< Instance of the user information panel
++    ZoomButtonPanel *m_zoomButtonPanel;  ///< Instance of zoom button panel
  };
  
  #endif // MAPVIEWTAB_H