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()));
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);
-}