USA.
*/
-#include "situarecommon.h"
#include "engine.h"
+#include "situarecommon.h"
#include "ui/mainwindow.h"
#include "gps/gpspositioninterface.h"
#include <QMaemo5InformationBox>
#endif // Q_WS_MAEMO_5
-#include "situarecommon.h"
#include "facebookauthentication.h"
#include "facebookcommon.h"
+#include "situarecommon.h"
#include "parser.h"
FacebookAuthentication::FacebookAuthentication(QObject *parent)
+++ /dev/null
-/*
- Situare - A location system for Facebook
- Copyright (C) 2010 Ixonos Plc. Authors:
-
- Pekka Nissinen - pekka.nissinen@ixonos.com
-
- Situare is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- version 2 as published by the Free Software Foundation.
-
- Situare is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Situare; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA.
-*/
-
-#include <QDebug>
-#include <QPixmap>
-
-#include "mapbutton.h"
-#include "mapcommon.h"
-
-MapButton::MapButton(QString fileName)
- : m_buttonMode(QIcon::Normal)
- , m_buttonWidth(MAP_ZOOM_PANEL_BUTTON_SIZE)
- , m_buttonHeight(MAP_ZOOM_PANEL_BUTTON_SIZE)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- addFile(fileName);
-}
-
-void MapButton::draw(QPainter *painter, int x, int y)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- paint(painter, x, y, m_buttonWidth, m_buttonHeight, NULL, m_buttonMode);
-}
-
-void MapButton::setMode(QIcon::Mode mode)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- m_buttonMode = mode;
-}
+++ /dev/null
-/*
- Situare - A location system for Facebook
- Copyright (C) 2010 Ixonos Plc. Authors:
-
- Pekka Nissinen - pekka.nissinen@ixonos.com
-
- Situare is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- version 2 as published by the Free Software Foundation.
-
- Situare is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Situare; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA.
-*/
-
-#ifndef MAPBUTTON_H
-#define MAPBUTTON_H
-
-#include <QIcon>
-#include <QString>
-#include <QPainter>
-
-/**
-* @brief A simple class for icon button
-*
-* @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
-*/
-class MapButton : public QIcon
-{
-public:
- /**
- * @brief Constructor
- *
- * @param fileName Icon image file name
- */
- MapButton(QString fileName);
-
-/*******************************************************************************
- * MEMBER FUNCTIONS AND SLOTS
- ******************************************************************************/
-public:
- /**
- * @brief Draws the button
- *
- * @param painter Painter
- * @param x Button x coordinate
- * @param y Button y coordinate
- */
- void draw(QPainter *painter, int x, int y);
-
- /**
- * @brief Sets the button icon mode
- *
- * @param mode Button icon mode
- */
- void setMode(QIcon::Mode mode);
-
-/*******************************************************************************
- * DATA MEMBERS
- ******************************************************************************/
-private:
- QIcon::Mode m_buttonMode; ///< Button mode (Normal, Selected etc...)
- int m_buttonWidth; ///< Button width
- int m_buttonHeight; ///< Button height
-};
-
-#endif // MAPBUTTON_H
const int ZOOM_FPS = 30; ///< FPS for the zoom effect
const qreal ZOOM_TIME = 250; ///< Length of the zoom effect (ms)
-const int MAP_ZOOM_PANEL_POSITION_X = 10 + 25; ///< Horizontal position of zoom panel
-const int MAP_ZOOM_PANEL_POSITION_Y = 10; ///< Vertical position of zoom panel
-const int MAP_ZOOM_PANEL_LEVEL = OWN_LOCATION_ICON_Z_LEVEL + 1; ///< Zepth of zoom panel (Z-axis)
-const int MAP_ZOOM_PANEL_BUTTON_SIZE = 74; ///< Size of a zoom panel button
-const int MAP_ZOOM_PANEL_BUTTON_SPACING = 4; ///< Size of a zoom button spacing
-
const qreal MAX_LATITUDE = 85.05112877980659237802; ///< Maximum latitude value
const qreal MIN_LATITUDE = -MAX_LATITUDE; ///< Minimum latitude value
const qreal MIN_LONGITUDE = -180.0; ///< Minimum longitude value
#include <QRect>
#include "frienditemshandler.h"
+#include "mapcommon.h"
#include "mapengine.h"
#include "maptile.h"
, m_viewSize(QSize(DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT))
, m_zoomedIn(false)
, m_zoomLevel(DEFAULT_ZOOM_LEVEL)
-
{
qDebug() << __PRETTY_FUNCTION__;
m_mapScene = new MapScene(this);
m_mapFetcher = new MapFetcher(new QNetworkAccessManager(this), this);
- connect(this, SIGNAL(fetchImage(int,int,int)),
- m_mapFetcher, SLOT(enqueueFetchMapImage(int,int,int)));
- connect(m_mapFetcher, SIGNAL(mapImageReceived(int,int,int,QPixmap)),
- this, SLOT(mapImageReceived(int,int,int,QPixmap)));
-
- m_mapZoomPanel = new MapZoomPanel(NULL, MAP_ZOOM_PANEL_POSITION_X, MAP_ZOOM_PANEL_POSITION_Y);
- m_mapScene->addItem(m_mapZoomPanel);
- connect(m_mapZoomPanel, SIGNAL(zoomInPressed()), this, SLOT(zoomIn()));
- connect(m_mapZoomPanel, SIGNAL(zoomOutPressed()), this, SLOT(zoomOut()));
+ connect(this, SIGNAL(fetchImage(int, int, int)),
+ m_mapFetcher, SLOT(enqueueFetchMapImage(int, int, int)));
+ connect(m_mapFetcher, SIGNAL(mapImageReceived(int, int, int, QPixmap)),
+ this, SLOT(mapImageReceived(int, int, int, QPixmap)));
m_ownLocation = new OwnLocationItem();
m_ownLocation->hide(); // hide until first location info is received
m_friendItemsHandler = new FriendItemsHandler(m_mapScene, this);
connect(this, SIGNAL(zoomLevelChanged(int)),
m_friendItemsHandler, SLOT(refactorFriendItems(int)));
-
connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
m_friendItemsHandler, SLOT(friendListUpdated(QList<User*>&)));
}
qDebug() << __PRETTY_FUNCTION__;
QPoint tileCoordinate = convertSceneCoordinateToTileNumber(m_zoomLevel, sceneCoordinate);
- int gridWidth = (m_viewSize.width()/TILE_SIZE_X + 1) + (GRID_PADDING*2);
- int gridHeight = (m_viewSize.height()/TILE_SIZE_Y + 1) + (GRID_PADDING*2);
- int topLeftX = tileCoordinate.x() - (gridWidth/2);
- int topLeftY = tileCoordinate.y() - (gridHeight/2);
+ int gridWidth = (m_viewSize.width() / TILE_SIZE_X + 1) + (GRID_PADDING * 2);
+ int gridHeight = (m_viewSize.height() / TILE_SIZE_Y + 1) + (GRID_PADDING * 2);
+ int topLeftX = tileCoordinate.x() - (gridWidth / 2);
+ int topLeftY = tileCoordinate.y() - (gridHeight / 2);
m_mapFetcher->setDownloadQueueSize(gridWidth * gridHeight);
void MapEngine::alignImmovableItems(QPoint viewTopLeft)
{
qDebug() << __PRETTY_FUNCTION__ << "viewTopLeft:" << viewTopLeft;
-
- m_mapZoomPanel->setPos(viewTopLeft);
}
void MapEngine::setLocation(QPoint sceneCoordinate)
qDebug() << __PRETTY_FUNCTION__;
int pow = 1 << (MAX_MAP_ZOOM_LEVEL - zoomLevel);
- int x = static_cast<int>(sceneCoordinate.x() / (TILE_SIZE_X*pow));
- int y = static_cast<int>(sceneCoordinate.y() / (TILE_SIZE_Y*pow));
+ int x = static_cast<int>(sceneCoordinate.x() / (TILE_SIZE_X * pow));
+ int y = static_cast<int>(sceneCoordinate.y() / (TILE_SIZE_Y * pow));
return QPoint(x, y);
}
qreal y = static_cast<qreal>((1.0 - log(tan(latitude * M_PI / 180.0) + 1.0
/ cos(latitude * M_PI / 180.0)) / M_PI) / 2.0);
- return QPointF(x*z*TILE_SIZE_X, y*z*TILE_SIZE_Y).toPoint();
+ return QPointF(x * z * TILE_SIZE_X, y * z * TILE_SIZE_Y).toPoint();
}
void MapEngine::receiveOwnLocation(User *user)
#include <QtCore>
-#include "mapcommon.h"
#include "mapfetcher.h"
#include "mapscene.h"
#include "maptile.h"
-#include "mapzoompanel.h"
#include "ownlocationitem.h"
#include "user/user.h"
*
* Logic for controlling map functionality. Does also include static methods for
* converting coordinates.
+*
* @author Sami Rämö - sami.ramo (at) ixonos.com
* @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
* @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
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)
Copyright (C) 2010 Ixonos Plc. Authors:
Sami Rämö - sami.ramo@ixonos.com
+ Pekka Nissinen - pekka.nissinen@ixonos.com
Situare is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
Copyright (C) 2010 Ixonos Plc. Authors:
Sami Rämö - sami.ramo@ixonos.com
+ Pekka Nissinen - pekka.nissinen@ixonos.com
Situare is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
* @brief Map view widget
*
* @author Sami Rämö - sami.ramo (at) ixonos.com
+* @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
*/
class MapView : public QGraphicsView
{
+++ /dev/null
-/*
- Situare - A location system for Facebook
- Copyright (C) 2010 Ixonos Plc. Authors:
-
- Pekka Nissinen - pekka.nissinen@ixonos.com
-
- Situare is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- version 2 as published by the Free Software Foundation.
-
- Situare is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Situare; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA.
-*/
-
-#include <QDebug>
-
-#include "mapcommon.h"
-#include "mapzoompanel.h"
-
-MapZoomPanel::MapZoomPanel(QGraphicsItem *parent, int x, int y) : QGraphicsItem(parent)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- m_x = x;
- m_y = y;
- m_width = MAP_ZOOM_PANEL_BUTTON_SIZE;
- m_height = MAP_ZOOM_PANEL_BUTTON_SIZE + MAP_ZOOM_PANEL_BUTTON_SPACING
- + MAP_ZOOM_PANEL_BUTTON_SIZE;
-
- m_zoomInBtn = new MapButton(":/res/images/zoom_in.png");
- m_zoomOutBtn = new MapButton(":/res/images/zoom_out.png");
-
- setFlag(QGraphicsItem::ItemIgnoresTransformations);
- setZValue(static_cast<qreal>(MAP_ZOOM_PANEL_LEVEL));
-}
-
-MapZoomPanel::~MapZoomPanel()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- delete m_zoomInBtn;
- delete m_zoomOutBtn;
- m_zoomInBtn = 0;
- m_zoomOutBtn = 0;
-}
-
-QRectF MapZoomPanel::boundingRect() const
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- return QRectF(m_x, m_y, m_width, m_height);
-}
-
-void MapZoomPanel::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- Q_UNUSED(option);
- Q_UNUSED(widget);
-
- m_zoomInBtn->draw(painter, m_x, m_y);
- m_zoomOutBtn->draw(painter, m_x, m_y + MAP_ZOOM_PANEL_BUTTON_SPACING
- + MAP_ZOOM_PANEL_BUTTON_SIZE);
-}
-
-void MapZoomPanel::mousePressEvent(QGraphicsSceneMouseEvent *event)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- if ( event->pos().y() < (m_y + MAP_ZOOM_PANEL_BUTTON_SPACING + MAP_ZOOM_PANEL_BUTTON_SIZE) )
- m_zoomInBtn->setMode(QIcon::Selected);
- else
- m_zoomOutBtn->setMode(QIcon::Selected);
-
- update();
-}
-
-void MapZoomPanel::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- Q_UNUSED(event);
-
- m_zoomInBtn->setMode(QIcon::Normal);
- m_zoomOutBtn->setMode(QIcon::Normal);
-
- if ( event->pos().y() < (m_y + MAP_ZOOM_PANEL_BUTTON_SPACING + MAP_ZOOM_PANEL_BUTTON_SIZE) )
- emit zoomInPressed();
- else
- emit zoomOutPressed();
-
- update();
-}
+++ /dev/null
-/*
- Situare - A location system for Facebook
- Copyright (C) 2010 Ixonos Plc. Authors:
-
- Pekka Nissinen - pekka.nissinen@ixonos.com
-
- Situare is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- version 2 as published by the Free Software Foundation.
-
- Situare is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Situare; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA.
-*/
-
-#ifndef MAPZOOMPANEL_H
-#define MAPZOOMPANEL_H
-
-#include <QRectF>
-#include <QWidget>
-#include <QPainter>
-#include <QGraphicsItem>
-#include <QStyleOptionGraphicsItem>
-#include <QGraphicsSceneMouseEvent>
-
-#include "mapbutton.h"
-
-/**
-* @brief Panel for zoom buttons
-*
-* @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
-*/
-class MapZoomPanel : public QObject, public QGraphicsItem
-{
- Q_OBJECT
-
-public:
- /**
- * @brief Constructor
- *
- * @param parent Parent
- * @param x Panel x coordinate
- * @param y Panel y coordinate
- */
- MapZoomPanel(QGraphicsItem *parent = 0, int x = 0, int y = 0);
-
- /**
- * @brief Destructor
- */
- ~MapZoomPanel();
-
-/*******************************************************************************
- * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
- ******************************************************************************/
-public:
- /**
- * @brief Returns the outer bounds of the panel
- */
- QRectF boundingRect() const;
-
- /**
- * @brief Paints the panel and its content
- *
- * @param painter Painter
- * @param option Style options
- * @param widget Widget
- */
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
-
-protected:
- /**
- * @brief Event handler for mouse press events
- *
- * @param event Mouse event
- */
- void mousePressEvent(QGraphicsSceneMouseEvent *event);
-
- /**
- * @brief Event handler for mouse release events
- *
- * @param event Mouse event
- */
- void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
-
-/*******************************************************************************
- * SIGNALS
- ******************************************************************************/
-signals:
- /**
- * @brief Signal for zoom in button click
- */
- void zoomInPressed();
-
- /**
- * @brief Signal for zoom out button click
- */
- void zoomOutPressed();
-
-/*******************************************************************************
- * DATA MEMBERS
- ******************************************************************************/
-private:
- MapButton *m_zoomInBtn; ///< Button for zoom in
- MapButton *m_zoomOutBtn; ///< Button for zoom out
- qreal m_x; ///< Panel x coordinate
- qreal m_y; ///< Panel y coordinate
- qreal m_width; ///< Panel width
- qreal m_height; ///< Panel height
-};
-
-#endif // MAPZOOMPANEL_H
map/mapscene.cpp \
map/maptile.cpp \
map/mapfetcher.cpp \
- map/mapzoompanel.cpp \
- map/mapbutton.cpp \
map/ownlocationitem.cpp \
map/baselocationitem.cpp \
map/friendlocationitem.cpp \
ui/panelsliderbar.cpp \
map/friendgroupitem.cpp \
map/frienditemshandler.cpp \
- gps/gpspositioninterface.cpp
+ gps/gpspositioninterface.cpp \
+ ui/zoombuttonpanel.cpp
HEADERS += ui/mainwindow.h \
ui/mapviewscreen.h \
map/mapengine.h \
map/maptile.h \
map/mapfetcher.h \
map/mapcommon.h \
- map/mapzoompanel.h \
- map/mapbutton.h \
map/ownlocationitem.h \
map/baselocationitem.h \
map/friendlocationitem.h \
map/friendgroupitem.h \
map/frienditemshandler.h \
gps/gpspositioninterface.h \
+ ui/zoombuttonpanel.h \
situarecommon.h
QT += network \
webkit
m_backgroundMiddleImage.load(":/res/images/list_item_middle.png");
m_backgroundBottomImage.load(":/res/images/list_item_bottom.png");
- connect(m_findButton, SIGNAL(clicked()), this, SLOT(findButtonClicked()));
+ connect(m_findButton, SIGNAL(clicked()),
+ this, SLOT(findButtonClicked()));
}
void FriendListItem::setData(User *user)
foreach (User *user, friendList) {
FriendListItem *item = new FriendListItem(m_friendListView);
item->setData(user);
- connect(item, SIGNAL(findFriend(QPointF)), this, SIGNAL(findFriend(QPointF)));
+ connect(item, SIGNAL(findFriend(QPointF)),
+ this, SIGNAL(findFriend(QPointF)));
m_friendListView->addWidget(item);
}
}
{
qDebug() << __PRETTY_FUNCTION__;
- QAbstractButton::mousePressEvent(event);
-
- m_buttonMode = QIcon::Selected;
- update();
+ if(m_buttonMode != QIcon::Disabled) {
+ QAbstractButton::mousePressEvent(event);
+ setMode(QIcon::Selected);
+ }
}
void ImageButton::mouseReleaseEvent(QMouseEvent *event)
{
qDebug() << __PRETTY_FUNCTION__;
- QAbstractButton::mouseReleaseEvent(event);
-
- m_buttonMode = QIcon::Normal;
- update();
+ if(m_buttonMode != QIcon::Disabled) {
+ QAbstractButton::mouseReleaseEvent(event);
+ setMode(QIcon::Normal);
+ }
}
void ImageButton::paintEvent(QPaintEvent *event)
QPainter painter(this);
icon().paint(&painter, this->rect(), NULL, m_buttonMode);
}
+
+void ImageButton::setMode(QIcon::Mode mode)
+{
+ qDebug() << __PRETTY_FUNCTION__ << "Button icon mode:" << mode;
+
+ m_buttonMode = mode;
+ update();
+}
#include <QPaintEvent>
/**
-* @brief A simple class for icon button
-*
-* @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
-*/
+ * @brief A simple class for icon button
+ *
+ * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
+ */
class ImageButton : public QPushButton
{
Q_OBJECT
public:
/**
- * @brief Constructor
- *
- * @param parent Parent
- * @param normalIconPictureFileName Normal state Icon image file name
- * @param selectedIconPictureFileName Selected state Icon image file name (optional)
- */
+ * @brief Constructor
+ *
+ * @param parent Parent
+ * @param normalIconPictureFileName Normal state Icon image file name
+ * @param selectedIconPictureFileName Selected state Icon image file name (optional)
+ */
ImageButton(QWidget *parent = 0, QString normalIconPictureFileName = "",
- QString selectedIconPictureFileName = "");
+ QString selectedIconPictureFileName = "");
/*******************************************************************************
* BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
******************************************************************************/
protected:
/**
- * @brief Event handler for mouse press events
- *
- * @param event Mouse event
- */
+ * @brief Event handler for mouse press events
+ *
+ * @param event Mouse event
+ */
void mousePressEvent(QMouseEvent *event);
/**
- * @brief Event handler for mouse release events
- *
- * @param event Mouse event
- */
+ * @brief Event handler for mouse release events
+ *
+ * @param event Mouse event
+ */
void mouseReleaseEvent(QMouseEvent *event);
/**
- * @brief Event handler for paint events
- *
- * Paints the button and its icon
- * @param event Paint event
- */
+ * @brief Event handler for paint events
+ *
+ * Paints the button and its icon
+ * @param event Paint event
+ */
void paintEvent(QPaintEvent *event);
/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+public:
+ /**
+ * @brief Sets the button icon mode
+ *
+ * @param mode Button icon mode
+ */
+ void setMode(QIcon::Mode mode);
+
+/*******************************************************************************
* DATA MEMBERS
******************************************************************************/
private:
connect(this, SIGNAL(reverseGeoReady(QString)),
m_locationDialog, SLOT(setAddress(QString)));
- connect(m_locationDialog, SIGNAL(statusUpdate(QString,bool)), this,
- SIGNAL(statusUpdate(QString,bool)));
+ connect(m_locationDialog, SIGNAL(statusUpdate(QString, bool)),
+ this, SIGNAL(statusUpdate(QString, bool)));
connect(this, SIGNAL(userLocationReady(User*)),
m_mapViewScreen, SIGNAL(userLocationReady(User*)));
m_mapViewScreen, SLOT(enableAutoCentering(bool)));
connect(this, SIGNAL(positionReceived(QPointF, qreal)),
m_mapViewScreen, SLOT(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_toSettingsAct = new QAction(tr("Settings"), this);
m_toSettingsAct->setObjectName(tr("Settings"));
- connect(m_toSettingsAct, SIGNAL(triggered()), this, SLOT(openSettingsDialog()));
- m_gpsToggleAct = new QAction(tr("GPS"), this);
+ connect(m_toSettingsAct, SIGNAL(triggered()),
+ this, SLOT(openSettingsDialog()));
+ m_gpsToggleAct = new QAction(tr("GPS"), this);
m_gpsToggleAct->setCheckable(true);
m_gpsToggleAct->setChecked(true);
- connect(m_gpsToggleAct, SIGNAL(toggled(bool)), this, SLOT(gpsToggled(bool)));
+ connect(m_gpsToggleAct, SIGNAL(toggled(bool)),
+ this, SLOT(gpsActionToggled(bool)));
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)));
-
- m_viewMenu = menuBar()->addMenu(tr("Main"));
+ connect(m_autoCenteringAct, SIGNAL(toggled(bool)),
+ this, SLOT(autoCenteringToggled(bool)));
+
+ m_viewMenu = menuBar()->addMenu(tr("Main"));
m_viewMenu->addAction(m_toSettingsAct);
m_viewMenu->addAction(m_gpsToggleAct);
*/
#include "mapviewscreen.h"
-#include "../map/mapview.h"
-#include "../map/mapengine.h"
-#include "friendlistpanel.h"
-#include "userpanel.h"
+#include "map/mapview.h"
#include "panelcommon.h"
-
#include "panelsidebar.h"
MapViewScreen::MapViewScreen(QWidget *parent)
m_autoCenteringEnabled(false)
{
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)));
+ 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()));
+ 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(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_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);
mapViewLayout->setMargin(0);
- mapEngine->init();
+ m_mapEngine->init();
setObjectName("Map view");
}
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)
- mapEngine->setViewLocation(position);
+ m_mapEngine->setViewLocation(position);
}
void MapViewScreen::enableAutoCentering(bool enabled)
qDebug() << __PRETTY_FUNCTION__;
m_autoCenteringEnabled = enabled;
- mapEngine->setAutoCentering(enabled);
+ m_mapEngine->setAutoCentering(enabled);
}
#include "map/mapengine.h"
#include "friendlistpanel.h"
#include "userpanel.h"
+#include "zoombuttonpanel.h"
/**
* @brief Map View class. Used to display Map
* MEMBER FUNCTIONS AND SLOTS
******************************************************************************/
private slots:
-
/**
* @brief Slot for enabling auto centering.
*
* DATA MEMBERS
******************************************************************************/
private:
- bool m_autoCenteringEnabled; ///< Enable
- 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
};
#endif // MAPVIEWTAB_H
#include <QtCore>
#include "map/mapcommon.h"
-
enum Side{LEFT, RIGHT}; ///< Enumerator for panel sideness
const int PANEL_PEEK_AMOUNT = 25; ///< Amount of pixels shown when panel is closed
const int SLIDINGBAR_WIDTH = 24;
const int SLIDINGBAR_HEIGHT = 424;
+const int ZOOM_BUTTON_PANEL_POSITION_X = 10 + PANEL_PEEK_AMOUNT; ///< Horizontal position of zoom panel
+const int ZOOM_BUTTON_PANEL_POSITION_Y = 10; ///< Vertical position of zoom panel
+const int ZOOM_BUTTON_PANEL_BUTTON_SPACING = 4; ///< Size of a zoom button spacing
+
#endif // PANELCOMMON_H
{
Q_OBJECT
-
public:
/**
* @brief Constructor
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Pekka Nissinen - pekka.nissinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#include <QDebug>
+#include <QPainter>
+
+#include "zoombuttonpanel.h"
+#include "panelcommon.h"
+
+ZoomButtonPanel::ZoomButtonPanel(QWidget *parent, int x, int y)
+ : QWidget(parent),
+ m_panelLayout(this),
+ m_x(x),
+ m_y(y)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_zoomInBtn = new ImageButton(this, ":/res/images/zoom_in.png");
+ m_zoomOutBtn = new ImageButton(this, ":/res/images/zoom_out.png");
+
+ m_panelLayout.setMargin(0);
+ m_panelLayout.setSpacing(0);
+ m_panelLayout.setVerticalSpacing(ZOOM_BUTTON_PANEL_BUTTON_SPACING);
+ m_panelLayout.setSizeConstraint(QLayout::SetFixedSize);
+
+ m_panelLayout.addWidget(m_zoomInBtn, 0, 0);
+ m_panelLayout.addWidget(m_zoomOutBtn, 1, 0);
+
+ move(m_x, m_y);
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Pekka Nissinen - pekka.nissinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#ifndef ZOOMBUTTONPANEL_H
+#define ZOOMBUTTONPANEL_H
+
+#include <QWidget>
+#include <QPaintEvent>
+#include <QGridLayout>
+#include <QGraphicsItem>
+
+#include "imagebutton.h"
+
+/**
+* @brief Panel for zoom buttons
+*
+* @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
+*/
+class ZoomButtonPanel : public QWidget
+{
+ Q_OBJECT
+
+public:
+ /**
+ * @brief Constructor
+ *
+ * @param parent Parent
+ * @param x Panel x coordinate
+ * @param y Panel y coordinate
+ */
+ ZoomButtonPanel(QWidget *parent = 0, int x = 0, int y = 0);
+
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
+public:
+ ImageButton *m_zoomInBtn; ///< Button for zoom in
+ ImageButton *m_zoomOutBtn; ///< Button for zoom out
+
+private:
+ QGridLayout m_panelLayout; ///< Panel layout
+ int m_x; ///< Panel x coordinate
+ int m_y; ///< Panel y coordinate
+};
+
+#endif // ZOOMBUTTONPANEL_H