From ca3fc5e3d53e3c3ae3bf48b1b6ea33f565f23105 Mon Sep 17 00:00:00 2001 From: Pekka Nissinen Date: Mon, 14 Jun 2010 16:09:12 +0300 Subject: [PATCH] Some minor cosmetic changes, re-organized src.pro file --- src/map/baselocationitem.h | 28 +-- src/map/friendgroupitem.cpp | 7 +- src/map/friendgroupitem.h | 6 +- src/map/friendlocationitem.cpp | 9 +- src/map/friendlocationitem.h | 144 ++++++++-------- src/map/mapengine.h | 371 ++++++++++++++++++++-------------------- src/src.pro | 1 - 7 files changed, 284 insertions(+), 282 deletions(-) diff --git a/src/map/baselocationitem.h b/src/map/baselocationitem.h index 0de62fe..533ba5d 100644 --- a/src/map/baselocationitem.h +++ b/src/map/baselocationitem.h @@ -27,11 +27,11 @@ /** -* @brief Baseclass for showing own and friends locations on the map. -* -* @author Ville Tiensuu - ville.tiensuu@ixonos.com -* @author Sami Rämö - sami.ramo@ixonos.com -*/ + * @brief Baseclass for showing own and friends locations on the map. + * + * @author Ville Tiensuu - ville.tiensuu@ixonos.com + * @author Sami Rämö - sami.ramo@ixonos.com + */ class BaseLocationItem : public QGraphicsPixmapItem, public QObject { @@ -49,15 +49,15 @@ public: ******************************************************************************/ public: /** - *@brief Return item sceneBoundingRect transformed to given zoom level - * - * Because of using ItemIgnoresTransformations, and not scaling the item, the default - * sceneBoundingRect does always return the lowest map tile level scene bounding rect which - * must be scaled to current zoom level. - * - * @param zoomLevel Zoom level for which the sceneBoundingRect should be transformed - * @return sceneBoundingRect transformed to given zoom level - */ + *@brief Return item sceneBoundingRect transformed to given zoom level + * + * Because of using ItemIgnoresTransformations, and not scaling the item, the default + * sceneBoundingRect does always return the lowest map tile level scene bounding rect which + * must be scaled to current zoom level. + * + * @param zoomLevel Zoom level for which the sceneBoundingRect should be transformed + * @return sceneBoundingRect transformed to given zoom level + */ QRect sceneTransformedBoundingRect(int zoomLevel) const; }; diff --git a/src/map/friendgroupitem.cpp b/src/map/friendgroupitem.cpp index 3911226..1fa53ed 100644 --- a/src/map/friendgroupitem.cpp +++ b/src/map/friendgroupitem.cpp @@ -27,8 +27,8 @@ #include #include "friendlocationitem.h" -#include "mapcommon.h" #include "friendgroupitem.h" +#include "mapcommon.h" #include "common.h" FriendGroupItem::FriendGroupItem(FriendLocationItem *item) @@ -38,7 +38,7 @@ FriendGroupItem::FriendGroupItem(FriendLocationItem *item) setPixmap(QPixmap(":/res/images/friend_group.png")); - setOffset(-pixmap().width()/2, -pixmap().height()/2); + setOffset(-pixmap().width() / 2, -pixmap().height() / 2); setZValue(FRIEND_LOCATION_ICON_Z_LEVEL); joinFriend(item); @@ -102,8 +102,7 @@ void FriendGroupItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *o icon.addPixmap(pixmap()); painter->drawPixmap(offset(), icon.pixmap(pixmap().size(), QIcon::Selected, QIcon::On)); - } - else { + } else { QGraphicsPixmapItem::paint(painter, option, widget); } diff --git a/src/map/friendgroupitem.h b/src/map/friendgroupitem.h index 44f636a..9ccd5c2 100644 --- a/src/map/friendgroupitem.h +++ b/src/map/friendgroupitem.h @@ -144,9 +144,9 @@ signals: * DATA MEMBERS ******************************************************************************/ private: - QList m_friends; ///< List of joined FriendLocationItem items - QPointF m_mousePressPosition; ///< Mouse press position - bool m_clickEvent; ///< Mouse click event flag + QList m_friends; ///< List of joined FriendLocationItem items + QPointF m_mousePressPosition; ///< Mouse press position + bool m_clickEvent; ///< Mouse click event flag }; #endif // FRIENDGROUPITEM_H diff --git a/src/map/friendlocationitem.cpp b/src/map/friendlocationitem.cpp index 957973f..3e1c201 100644 --- a/src/map/friendlocationitem.cpp +++ b/src/map/friendlocationitem.cpp @@ -42,6 +42,8 @@ FriendLocationItem::FriendLocationItem(const QString &userId, bool FriendLocationItem::isPartOfGroup() const { + qDebug() << __PRETTY_FUNCTION__; + return m_partOfGroup; } @@ -93,14 +95,15 @@ void FriendLocationItem::paint(QPainter *painter, const QStyleOptionGraphicsItem icon.addPixmap(pixmap()); painter->drawPixmap(offset(), icon.pixmap(pixmap().size(), QIcon::Selected, QIcon::On)); - } - else { + } else { BaseLocationItem::paint(painter, option, widget); } } void FriendLocationItem::setPartOfGroup(bool value) { + qDebug() << __PRETTY_FUNCTION__; + m_partOfGroup = value; if (value) @@ -112,6 +115,7 @@ void FriendLocationItem::setPartOfGroup(bool value) QString FriendLocationItem::userId() const { qDebug() << __PRETTY_FUNCTION__; + return m_userId; } @@ -127,6 +131,7 @@ void FriendLocationItem::setProfileImage(const QPixmap image, const QUrl &url) QUrl FriendLocationItem::profileImageUrl() const { qDebug() << __PRETTY_FUNCTION__; + return m_profileImageUrl; } diff --git a/src/map/friendlocationitem.h b/src/map/friendlocationitem.h index a2db728..d709888 100644 --- a/src/map/friendlocationitem.h +++ b/src/map/friendlocationitem.h @@ -32,29 +32,29 @@ #include "baselocationitem.h" /** -* @brief Class that shows friends location icons on the map -* -* @class FriendLocationItem friendlocationitem.h "map/friendlocationitem.h" -* @author Ville Tiensuu. -* @author Sami Rämö - sami.ramo@ixonos.com -*/ + * @brief Class that shows friends location icons on the map + * + * @class FriendLocationItem friendlocationitem.h "map/friendlocationitem.h" + * @author Ville Tiensuu. + * @author Sami Rämö - sami.ramo@ixonos.com + */ class FriendLocationItem : public BaseLocationItem { Q_OBJECT public: /** - * @brief Constructor of FriendLocationItem - * - * Sets user ID - * Sets position to UNDEFINED. - * Sets default Z-value. - * Sets item to ignore transformations. this feature is needed to make icon on the map - * immune to scaling - * - * @param userId Used ID of the friend - * @param parent Parent - */ + * @brief Constructor of FriendLocationItem + * + * Sets user ID + * Sets position to UNDEFINED. + * Sets default Z-value. + * Sets item to ignore transformations. this feature is needed to make icon on the map + * immune to scaling + * + * @param userId Used ID of the friend + * @param parent Parent + */ FriendLocationItem(const QString &userId, QObject *parent = 0); /******************************************************************************* @@ -62,14 +62,14 @@ public: ******************************************************************************/ public: /** - * @brief Paints item pixmap. - * - * Paints normal or highlighted pixmap image. - * - * @param painter QPainter - * @param option QStyleOptionGraphicsItem - * @param widget QWidget - */ + * @brief Paints item pixmap. + * + * Paints normal or highlighted pixmap image. + * + * @param painter QPainter + * @param option QStyleOptionGraphicsItem + * @param widget QWidget + */ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); /******************************************************************************* @@ -77,82 +77,82 @@ public: ******************************************************************************/ public: /** - * @brief Is item part of any group - * - * @return True if item is part of group, otherwise false. - */ + * @brief Is item part of any group + * + * @return True if item is part of group, otherwise false. + */ bool isPartOfGroup() const; /** - * @brief getter for friends profile image URL - * - * @return QUrl friends profile images URL - */ + * @brief getter for friends profile image URL + * + * @return QUrl friends profile images URL + */ QUrl profileImageUrl() const; /** - * @brief Set profile image and it's URL for friend - * - * Also offset is set matching new image dimensions. - * - * @param image New profile image - * @param url URL of the new profile image - */ + * @brief Set profile image and it's URL for friend + * + * Also offset is set matching new image dimensions. + * + * @param image New profile image + * @param url URL of the new profile image + */ void setProfileImage(const QPixmap image, const QUrl &url); /** - * @brief Set value for m_partOfGroup flag - * - * @param value New value - */ + * @brief Set value for m_partOfGroup flag + * + * @param value New value + */ void setPartOfGroup(bool value); /** - * @brief getter for m_userId - * - * @return QString friends user identity - */ + * @brief getter for m_userId + * + * @return QString friends user identity + */ QString userId() const; protected: /** - * @brief method that detects when friend icon is moved - * - * Disables m_clickEvent flag if press and release where not - * in same area. - * - * @param event detects the mouse move (or touch in Maemo) - */ + * @brief method that detects when friend icon is moved + * + * Disables m_clickEvent flag if press and release where not + * in same area. + * + * @param event detects the mouse move (or touch in Maemo) + */ void mouseMoveEvent(QGraphicsSceneMouseEvent *event); /** - * @brief method that detects when friend icon is clicked - * - * @param event detects the mouse click (or touch in Maemo) - */ + * @brief method that detects when friend icon is clicked + * + * @param event detects the mouse click (or touch in Maemo) + */ void mousePressEvent(QGraphicsSceneMouseEvent *event); /** - * @brief method that detects when friend icon press is released - * - * @param event detects the mouse release event (or touch in Maemo) - */ + * @brief method that detects when friend icon press is released + * + * @param event detects the mouse release event (or touch in Maemo) + */ void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - /******************************************************************************* - * SIGNALS - ******************************************************************************/ +/******************************************************************************* + * SIGNALS + ******************************************************************************/ signals: /** - * @brief Signal is emitted when l item is clicked. - * - * @param userIDs list of friends user IDs in the group - */ + * @brief Signal is emitted when l item is clicked. + * + * @param userIDs list of friends user IDs in the group + */ void locationItemClicked(const QList &userIDs); /******************************************************************************* -* DATA MEMBERS -******************************************************************************/ + * DATA MEMBERS + ******************************************************************************/ private: bool m_partOfGroup; ///< Flag to mark if item is part of any group const QString m_userId; ///< Friends user ID. Can't be changed afterwards diff --git a/src/map/mapengine.h b/src/map/mapengine.h index 9bb207b..1b38012 100644 --- a/src/map/mapengine.h +++ b/src/map/mapengine.h @@ -38,32 +38,32 @@ class OwnLocationItem; class User; /** -* @brief Map engine -* -* 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 -* @author Ville Tiensuu - ville.tiensuu (at) ixonos.com -*/ + * @brief Map engine + * + * 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 + * @author Ville Tiensuu - ville.tiensuu (at) ixonos.com + */ class MapEngine : public QObject { Q_OBJECT public: /** - * @brief Constructor - * - * @param parent Parent - */ + * @brief Constructor + * + * @param parent Parent + */ MapEngine(QObject *parent = 0); /** - * @brief Destructor - * Saves view of the map to settings file - */ + * @brief Destructor + * Saves view of the map to settings file + */ ~MapEngine(); /******************************************************************************* @@ -71,44 +71,44 @@ public: ******************************************************************************/ public: /** - * @brief Coordinates of the current center point - * - * @return Current coordinates (latitude & longitude) - */ + * @brief Coordinates of the current center point + * + * @return Current coordinates (latitude & longitude) + */ QPointF centerGeoCoordinate(); /** - * @brief Convert latitude and longitude to scene coordinates. - * - * @param latLonCoordinate latitude and longitude values - * @return scene coordinate - */ + * @brief Convert latitude and longitude to scene coordinates. + * + * @param latLonCoordinate latitude and longitude values + * @return scene coordinate + */ static QPoint convertLatLonToSceneCoordinate(QPointF latLonCoordinate); /** - * @brief converts scene coordinates to latitude and longitude - * - * @param zoomLevel current zoom level - * @param sceneCoordinate that will be converted - */ + * @brief converts scene coordinates to latitude and longitude + * + * @param zoomLevel current zoom level + * @param sceneCoordinate that will be converted + */ QPointF convertSceneCoordinateToLatLon(int zoomLevel, QPoint sceneCoordinate); /** - * @brief Convert MapScene coordinate to tile x & y numbers. - * - * @param zoomLevel ZoomLevel - * @param sceneCoordinate MapScene coordinate - * @return QPoint tile x & y numbers - */ + * @brief Convert MapScene coordinate to tile x & y numbers. + * + * @param zoomLevel ZoomLevel + * @param sceneCoordinate MapScene coordinate + * @return QPoint tile x & y numbers + */ static QPoint convertSceneCoordinateToTileNumber(int zoomLevel, QPoint sceneCoordinate); /** - * @brief Convert tile x & y numbers to MapScene coordinates - * - * @param zoomLevel Zoom level - * @param tileNumber x & y numbers of the tile - * @return QPoint MapScene coordinate - */ + * @brief Convert tile x & y numbers to MapScene coordinates + * + * @param zoomLevel Zoom level + * @param tileNumber x & y numbers of the tile + * @return QPoint MapScene coordinate + */ static QPoint convertTileNumberToSceneCoordinate(int zoomLevel, QPoint tileNumber); /** @@ -124,127 +124,126 @@ public: qreal greatCircleDistance(QPointF firstLocation, QPointF secondLocation); /** - * @brief MapEngine initializer - * - * Set initial location and zoom level for the engine. locationChanged and - * zoomLevelChanged signals are emitted, so init should be called after - * those signals are connected to MapView. - */ + * @brief MapEngine initializer + * + * Set initial location and zoom level for the engine. locationChanged and + * zoomLevelChanged signals are emitted, so init should be called after + * those signals are connected to MapView. + */ void init(); /** - * @brief Getter for scene - * - * @return QGraphicsScene - */ + * @brief Getter for scene + * + * @return QGraphicsScene + */ QGraphicsScene* scene(); /** - * @brief Sets new zoom level - * - * @return newZoomLevel value that is set to new zoom level - */ + * @brief Sets new zoom level + * + * @return newZoomLevel value that is set to new zoom level + */ void setZoomLevel(const int newZoomLevel); /** - * @brief Return tile path created from tile values. - * - * @param zoomLevel tile's zoom level - * @param x tile's x value - * @param y tile's y value - * @return QString tile path - */ + * @brief Return tile path created from tile values. + * + * @param zoomLevel tile's zoom level + * @param x tile's x value + * @param y tile's y value + * @return QString tile path + */ static QString tilePath(int zoomLevel, int x, int y); public slots: - /** - * @brief Slot to catch user own location data - * - * @param user User info - */ + * @brief Slot to catch user own location data + * + * @param user User info + */ void receiveOwnLocation(User *user); /** - * @brief Set auto centering. - * - * @param enabled true if enabled, false otherwise - */ + * @brief Set auto centering. + * + * @param enabled true if enabled, false otherwise + */ void setAutoCentering(bool enabled); /** - * @brief Slot for enabling / disabling GPS - * - * GPS location item is disabled or enabled based on GPS state - * - * @param enabled True is GPS is enabled, otherwise false - */ + * @brief Slot for enabling / disabling GPS + * + * GPS location item is disabled or enabled based on GPS state + * + * @param enabled True is GPS is enabled, otherwise false + */ void setGPSEnabled(bool enabled); /** - * @brief Slot for setting current view location - * - * Emits locationChanged signal. - * @param sceneCoordinate Scene coordinates for new position - */ + * @brief Slot for setting current view location + * + * Emits locationChanged signal. + * @param sceneCoordinate Scene coordinates for new position + */ void setLocation(QPoint sceneCoordinate); /** - * @brief Helper for setting view location based on latitude and longitude - * coordinates - * - * @param latLonCoordinate Latitude & longitude coordinates for location - */ + * @brief Helper for setting view location based on latitude and longitude + * coordinates + * + * @param latLonCoordinate Latitude & longitude coordinates for location + */ void setViewLocation(QPointF latLonCoordinate); /** - * @brief Slot for view resizing. - * - * @param size view size - */ + * @brief Slot for view resizing. + * + * @param size view size + */ void viewResized(const QSize &size); private: /** - * @brief Calculate grid of tile coordinates from current scene coordinate. - * - * Grid size is calculated from view size and scene's current center coordinate. - * - * @param sceneCoordinate scene's current center coordinate - * @return QRect grid of tile coordinates - */ + * @brief Calculate grid of tile coordinates from current scene coordinate. + * + * Grid size is calculated from view size and scene's current center coordinate. + * + * @param sceneCoordinate scene's current center coordinate + * @return QRect grid of tile coordinates + */ QRect calculateTileGrid(QPoint sceneCoordinate); /** - * @brief Check if auto centering should be disabled. - * - * @param sceneCoordinate scene's center coordinate - * @return bool true if auto centering should be disabled - */ + * @brief Check if auto centering should be disabled. + * + * @param sceneCoordinate scene's center coordinate + * @return bool true if auto centering should be disabled + */ bool disableAutoCentering(QPoint sceneCoordinate); /** - * @brief Get new tiles. - * - * Calculates which tiles has to be fetched. Does emit fetchImage for tiles which - * aren't already in the scene. - * @param sceneCoordinate scene's center coordinate - */ + * @brief Get new tiles. + * + * Calculates which tiles has to be fetched. Does emit fetchImage for tiles which + * aren't already in the scene. + * @param sceneCoordinate scene's center coordinate + */ void getTiles(QPoint sceneCoordinate); /** - * @brief Check if auto centering is enabled - * - * @return true if enabled, false otherwise - */ + * @brief Check if auto centering is enabled + * + * @return true if enabled, false otherwise + */ bool isAutoCenteringEnabled(); /** - * @brief Check if center tile has changed. - * - * @param sceneCoordinate scene's center coordinate - * @return bool true if center tile changed, false otherwise - */ + * @brief Check if center tile has changed. + * + * @param sceneCoordinate scene's center coordinate + * @return bool true if center tile changed, false otherwise + */ bool isCenterTileChanged(QPoint sceneCoordinate); /** @@ -255,59 +254,59 @@ private: qreal sceneResolution(); /** - * @brief Calculate maximum value for tile in this zoom level. - * - * @param zoomLevel zoom level - * @return int tile's maximum value - */ + * @brief Calculate maximum value for tile in this zoom level. + * + * @param zoomLevel zoom level + * @return int tile's maximum value + */ int tileMaxValue(int zoomLevel); /** - * @brief Updates the current view rect including margins - * - * Calculates tiles rect in scene based on m_viewTilesGrid and - * calls MapScene::viewRectUpdated() - */ + * @brief Updates the current view rect including margins + * + * Calculates tiles rect in scene based on m_viewTilesGrid and + * calls MapScene::viewRectUpdated() + */ void updateViewTilesSceneRect(); private slots: /** - * @brief Slot for GPS position updates - * - * GPS location item is updated and map centered to new location (if automatic - * centering is enabled). - * - * @param position New coordinates from GPS - * @param accuracy Accuracy of the GPS fix - */ + * @brief Slot for GPS position updates + * + * GPS location item is updated and map centered to new location (if automatic + * centering is enabled). + * + * @param position New coordinates from GPS + * @param accuracy Accuracy of the GPS fix + */ void gpsPositionUpdate(QPointF position, qreal accuracy); /** - * @brief Slot for received map tile images - * - * Does add MapTile objects to MapScene. - * @param zoomLevel Zoom level - * @param x Tile x index - * @param y Tile y index - * @param image Received pixmap - */ + * @brief Slot for received map tile images + * + * Does add MapTile objects to MapScene. + * @param zoomLevel Zoom level + * @param x Tile x index + * @param y Tile y index + * @param image Received pixmap + */ void mapImageReceived(int zoomLevel, int x, int y, const QPixmap &image); /** - * @brief Slot for actions after view zoom is finished - * - * Does run removeOutOfViewTiles - */ + * @brief Slot for actions after view zoom is finished + * + * Does run removeOutOfViewTiles + */ void viewZoomFinished(); /** - * @brief Slot for zooming in - */ + * @brief Slot for zooming in + */ void zoomIn(); /** - * @brief Slot for zooming out - */ + * @brief Slot for zooming out + */ void zoomOut(); /******************************************************************************* @@ -315,55 +314,55 @@ private slots: ******************************************************************************/ signals: /** - * @brief Signals error - * - * @param error error code - */ + * @brief Signals error + * + * @param error error code + */ void error(const int error); /** - * @brief Signal for image fetching. - * - * @param zoomLevel Zoom level - * @param x Tile x index - * @param y Tile y index - */ + * @brief Signal for image fetching. + * + * @param zoomLevel Zoom level + * @param x Tile x index + * @param y Tile y index + */ void fetchImage(int zoomLevel, int x, int y); /** - * @brief Signal when friend list locations are fetched - * - * @param friendsList Friends list data - */ + * @brief Signal when friend list locations are fetched + * + * @param friendsList Friends list data + */ void friendsLocationsReady(QList &friendsList); /** - * @brief Request view centering to new locaiton - * - * @param sceneCoordinate New scene coordinates - */ + * @brief Request view centering to new locaiton + * + * @param sceneCoordinate New scene coordinates + */ void locationChanged(QPoint sceneCoordinate); /** - * @brief Signal is emitted when location item is clicked. - * - * @param userIDs list of friends user IDs in the group - */ + * @brief Signal is emitted when location item is clicked. + * + * @param userIDs list of friends user IDs in the group + */ void locationItemClicked(const QList &userIDs); /** - * @brief Signal to notify map scrolling. - */ + * @brief Signal to notify map scrolling. + */ void mapScrolledManually(); /** - * @brief Signal to notify when map is zoomed in to the maxmimum. - */ + * @brief Signal to notify when map is zoomed in to the maxmimum. + */ void maxZoomLevelReached(); /** - * @brief Signal to notify when map is zoomed out to the minimum. - */ + * @brief Signal to notify when map is zoomed out to the minimum. + */ void minZoomLevelReached(); /** @@ -372,10 +371,10 @@ signals: void newMapResolution(qreal scale); /** - * @brief Request view changing zoom level - * - * @param newZoomLevel New zoom level - */ + * @brief Request view changing zoom level + * + * @param newZoomLevel New zoom level + */ void zoomLevelChanged(int newZoomLevel); /******************************************************************************* diff --git a/src/src.pro b/src/src.pro index 288513a..77c017e 100644 --- a/src/src.pro +++ b/src/src.pro @@ -99,7 +99,6 @@ HEADERS += ui/mainwindow.h \ ui/mapscale.h QT += network \ webkit - DEFINES += QT_NO_DEBUG_OUTPUT simulator { -- 1.7.9.5