#include "panelsidebar.h"
MapViewScreen::MapViewScreen(QWidget *parent)
- : QWidget(parent),
- m_autoCenteringEnabled(false)
+ : QWidget(parent)
{
MapView *mapView = new MapView(this);
m_mapEngine = new MapEngine(this);
connect(mapView, SIGNAL(viewResizedNewSize(int, int)),
friendsListPanelSidebar, SLOT(reDrawSidebar(int, int)));
- connect(m_zoomButtonPanel->m_zoomInBtn, SIGNAL(clicked()),
+ connect(m_zoomButtonPanel->m_zoomInButton, SIGNAL(clicked()),
m_mapEngine, SLOT(zoomIn()));
- connect(m_zoomButtonPanel->m_zoomOutBtn, SIGNAL(clicked()),
+ connect(m_zoomButtonPanel->m_zoomOutButton, SIGNAL(clicked()),
m_mapEngine, SLOT(zoomOut()));
+ connect(m_mapEngine, SIGNAL(zoomLevelChanged(int)),
+ m_zoomButtonPanel, SLOT(resetButtons()));
+ connect(m_mapEngine, SIGNAL(maxZoomLevelReached()),
+ m_zoomButtonPanel, SLOT(disableZoomInButton()));
+ connect(m_mapEngine, SIGNAL(minZoomLevelReached()),
+ m_zoomButtonPanel, SLOT(disableZoomOutButton()));
connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
m_friendsListPanel, SLOT(friendInfoReceived(QList<User*>&)));
connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
m_mapEngine, SIGNAL(friendsLocationsReady(QList<User*>&)));
- connect(m_mapEngine, SIGNAL(mapScrolled()),
- this, SLOT(locationChanged()));
+ connect(m_mapEngine, SIGNAL(mapScrolledManually()),
+ this, SIGNAL(mapLocationChanged()));
+
+ connect(this, SIGNAL(positionReceived(QPointF,qreal)),
+ m_mapEngine, SLOT(gpsPositionUpdate(QPointF,qreal)));
+ connect(this, SIGNAL(enableAutoCentering(bool)),
+ m_mapEngine, SLOT(setAutoCentering(bool)));
+ connect(this, SIGNAL(gpsEnabled(bool)),
+ m_mapEngine, SLOT(gpsEnabled(bool)));
connect(mapView, SIGNAL(viewResizedNewSize(int, int)),
this, SLOT(drawOwnLocationCrosshair(int, int)));
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);
-}
void MapViewScreen::drawOwnLocationCrosshair(int width, int height)
{