Cleanup & commenting
authorSami Rämö <sami.ramo@ixonos.com>
Fri, 21 May 2010 05:48:16 +0000 (08:48 +0300)
committerSami Rämö <sami.ramo@ixonos.com>
Fri, 21 May 2010 05:48:16 +0000 (08:48 +0300)
src/engine/engine.cpp
src/engine/engine.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/mainwindow.h
src/ui/mapviewscreen.cpp [deleted file]
src/ui/mapviewscreen.h [deleted file]

index 11a2e0f..b6ba7cb 100644 (file)
@@ -5,6 +5,7 @@
         Kaj Wallin - kaj.wallin@ixonos.com
         Henri Lampela - henri.lampela@ixonos.com
         Jussi Laitinen jussi.laitinen@ixonos.com
+        Sami Rämö - sami.ramo@ixonos.com
 
     Situare is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
@@ -46,12 +47,10 @@ SituareEngine::SituareEngine(QMainWindow *parent)
     m_ui = new MainWindow;
 
     // build MapEngine
-
     m_mapEngine = new MapEngine(this);
     m_ui->setMapViewScene(m_mapEngine->scene());
 
     // build GPS
-
 #ifdef Q_WS_MAEMO_5
     m_gps = new GPSPosition(this);
 #else
@@ -60,37 +59,24 @@ SituareEngine::SituareEngine(QMainWindow *parent)
     m_gps->setMode(GPSPositionInterface::Default);
 
     // build SituareService
-
     m_situareService = new SituareService(this);
 
     // build FacebookAuthenticator
-
     m_facebookAuthenticator = new FacebookAuthentication(this);
 
     // connect signals
-
     signalsFromMapEngine();
     signalsFromGPS();
     signalsFromSituareService();
     signalsFromMainWindow();
-
-    connect(m_facebookAuthenticator, SIGNAL(credentialsReady(FacebookCredentials)),
-            m_situareService, SLOT(credentialsReady(FacebookCredentials)));
-    connect(m_facebookAuthenticator, SIGNAL(credentialsReady(FacebookCredentials)),
-            this, SLOT(loginOk()));
+    signalsFromFacebookAuthenticator();
 
     connect(this, SIGNAL(userLocationReady(User*)),
             m_ui, SIGNAL(userLocationReady(User*)));
+
     connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
             m_ui, SIGNAL(friendsLocationsReady(QList<User*>&)));
 
-    connect(m_facebookAuthenticator, SIGNAL(newLoginRequest(QUrl)),
-            m_ui, SLOT(startLoginProcess(QUrl)));
-    connect(m_ui, SIGNAL(updateCredentials(QUrl)),
-            m_facebookAuthenticator, SLOT(updateCredentials(QUrl)));
-    connect(m_facebookAuthenticator, SIGNAL(loginFailure()),
-            m_ui, SLOT(loginFailed()));
-
     QSettings settings(DIRECTORY_NAME, FILE_NAME);
     QVariant gpsEnabled = settings.value(SETTINGS_GPS_ENABLED);
     QVariant autoCenteringEnabled = settings.value(SETTINGS_AUTO_CENTERING_ENABLED);
@@ -223,6 +209,21 @@ void SituareEngine::requestUpdateLocation(const QString &status, bool publish)
     }
 }
 
+void SituareEngine::signalsFromFacebookAuthenticator()
+{
+    connect(m_facebookAuthenticator, SIGNAL(credentialsReady(FacebookCredentials)),
+            m_situareService, SLOT(credentialsReady(FacebookCredentials)));
+
+    connect(m_facebookAuthenticator, SIGNAL(credentialsReady(FacebookCredentials)),
+            this, SLOT(loginOk()));
+
+    connect(m_facebookAuthenticator, SIGNAL(newLoginRequest(QUrl)),
+            m_ui, SLOT(startLoginProcess(QUrl)));
+
+    connect(m_facebookAuthenticator, SIGNAL(loginFailure()),
+            m_ui, SLOT(loginFailed()));
+}
+
 void SituareEngine::signalsFromGPS()
 {
     connect(m_gps, SIGNAL(position(QPointF,qreal)),
@@ -237,22 +238,20 @@ void SituareEngine::signalsFromGPS()
 
 void SituareEngine::signalsFromMainWindow()
 {
-    // signals from map view
+    connect(m_ui, SIGNAL(updateCredentials(QUrl)),
+            m_facebookAuthenticator, SLOT(updateCredentials(QUrl)));
 
+    // signals from map view
     connect(m_ui, SIGNAL(mapViewScrolled(QPoint)),
             m_mapEngine, SLOT(setLocation(QPoint)));
 
     connect(m_ui, SIGNAL(mapViewResized(QSize)),
             m_mapEngine, SLOT(viewResized(QSize)));
 
-    connect(m_ui, SIGNAL(updateMapViewContent(QRect)),
-            m_mapEngine, SLOT(receiveViewSceneRect(QRect)));
-
     connect(m_ui, SIGNAL(viewZoomFinished()),
             m_mapEngine, SLOT(viewZoomFinished()));
 
     // signals from zoom buttons (zoom panel and volume buttons)
-
     connect(m_ui, SIGNAL(zoomIn()),
             m_mapEngine, SLOT(zoomIn()));
 
@@ -260,7 +259,6 @@ void SituareEngine::signalsFromMainWindow()
             m_mapEngine, SLOT(zoomOut()));
 
     // signals from menu buttons
-
     connect(m_ui, SIGNAL(autoCenteringTriggered(bool)),
             this, SLOT(changeAutoCenteringSetting(bool)));
 
@@ -268,7 +266,6 @@ void SituareEngine::signalsFromMainWindow()
             this, SLOT(enableGPS(bool)));
 
     //signals from dialogs
-
     connect(m_ui, SIGNAL(cancelLoginProcess()),
             this, SLOT(loginProcessCancelled()));
 
@@ -279,12 +276,10 @@ void SituareEngine::signalsFromMainWindow()
             this, SLOT(requestUpdateLocation(QString,bool)));
 
     // signals from user info tab
-
     connect(m_ui, SIGNAL(refreshUserData()),
             this, SLOT(refreshUserData()));
 
     // signals from friend list tab
-
     connect(m_ui, SIGNAL(findFriend(QPointF)),
             m_mapEngine, SLOT(setViewLocation(QPointF)));
 }
@@ -300,9 +295,6 @@ void SituareEngine::signalsFromMapEngine()
     connect(m_mapEngine, SIGNAL(mapScrolledManually()),
             this, SLOT(disableAutoCentering()));
 
-//    connect(m_mapEngine, SIGNAL(ownLocation(QPointF)),
-//            this, SIGNAL(ownLocation(QPointF)));
-
     connect(m_mapEngine, SIGNAL(maxZoomLevelReached()),
             m_ui, SIGNAL(maxZoomLevelReached()));
 
index 95dd972..5ced8e2 100644 (file)
@@ -5,6 +5,7 @@
         Kaj Wallin - kaj.wallin@ixonos.com
         Henri Lampela - henri.lampela@ixonos.com
         Jussi Laitinen - jussi.laitinen@ixonos.com
+        Sami Rämö - sami.ramo@ixonos.com
 
     Situare is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
@@ -39,8 +40,6 @@ class MapEngine;
 *
 * This class handles all the underlaying login of the Situare
 * application.
-*
-* @class SituareEngine engine.h "engine/engine.h"
 */
 class SituareEngine : public QObject
 {
@@ -75,6 +74,11 @@ public slots:
     void loginOk();
 
     /**
+    * @brief Slot to intercept signal when user has cancelled login process
+    */
+    void loginProcessCancelled();
+
+    /**
     * @brief Calls reverseGeo from SituareService to translate coordinates to street address
     *
     */
@@ -109,36 +113,12 @@ public slots:
     */
     void userDataChanged(User *user, QList<User *> &friendsList);
 
+private:
     /**
-    * @brief Slot for auto centering enabling.
-    *
-    * Calls gps to send last known position
-    * @param enabled true if auto centering was enabled, false otherwise
-    */
-    void enableAutoCentering(bool enabled);
-
-    /**
-    * @brief Slot for gps enabling.
-    *
-    * @param enabled true if gps should be enabled, false otherwise
-    */
-    void enableGPS(bool enabled);
-       
-    /**
-    * @brief Slot to intercept signal when user has cancelled login process
-    */
-    void loginProcessCancelled();
-
-private slots:
-
-    void changeAutoCenteringSetting(bool enabled);
-
-    /**
-      * @brief Slot for disabling automatic centering when map is scrolled manually
+      * @brief Connect signals coming from Facdebook authenticator
       */
-    void disableAutoCentering();
+    void signalsFromFacebookAuthenticator();
 
-private:
     /**
       * @brief Connect signals coming from GPS
       */
@@ -164,6 +144,33 @@ private:
       */
     void signalsFromSituareService();
 
+private slots:
+    /**
+      * @brief Set auto centering feature enabled / disabled
+      */
+    void changeAutoCenteringSetting(bool enabled);
+
+    /**
+      * @brief Slot for disabling automatic centering when map is scrolled manually
+      */
+    void disableAutoCentering();
+
+    /**
+    * @brief Slot for auto centering enabling.
+    *
+    * Calls gps to send last known position
+    *
+    * @param enabled true if auto centering was enabled, false otherwise
+    */
+    void enableAutoCentering(bool enabled);
+
+    /**
+    * @brief Slot for gps enabling.
+    *
+    * @param enabled true if gps should be enabled, false otherwise
+    */
+    void enableGPS(bool enabled);
+
 /*******************************************************************************
  * SIGNALS
  ******************************************************************************/
@@ -187,15 +194,15 @@ signals:
  * DATA MEMBERS
  ******************************************************************************/
 private:
-    bool m_autoCenteringEnabled;    ///< Auto centering enabled
+    bool m_autoCenteringEnabled;  ///< Auto centering enabled
 
-    QPointF m_latestLocation; ///< Placeholder for user's latest asked location
+    QPointF m_latestLocation;     ///< Placeholder for user's latest asked location
 
     FacebookAuthentication *m_facebookAuthenticator; ///< Instance for facebook authenticator
-    GPSPositionInterface *m_gps;   ///< Instance of the gps position
-    MainWindow *m_ui; ///< Instance of the MainWindow UI
-    MapEngine *m_mapEngine;                 ///< MapEngine
-    SituareService *m_situareService; ///< Instance of the situare server communication service    
+    GPSPositionInterface *m_gps;                     ///< Instance of the gps position
+    MainWindow *m_ui;                                ///< Instance of the MainWindow UI
+    MapEngine *m_mapEngine;                          ///< MapEngine
+    SituareService *m_situareService;  ///< Instance of the situare server communication service
 };
 
 #endif // ENGINE_H
index c6b340e..05ed940 100644 (file)
 #include "maptile.h"
 
 MapEngine::MapEngine(QObject *parent)
-    : QObject(parent)
-    , m_autoCenteringEnabled(false)
-    , m_centerTile(QPoint(UNDEFINED, UNDEFINED))
-    , m_lastManualPosition(QPoint(0, 0))
-    , m_viewSize(QSize(DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT))
-    , m_zoomedIn(false)
-    , m_zoomLevel(DEFAULT_ZOOM_LEVEL)
+    : QObject(parent),
+      m_autoCenteringEnabled(false),
+      m_zoomedIn(false),
+      m_zoomLevel(DEFAULT_ZOOM_LEVEL),
+      m_centerTile(QPoint(UNDEFINED, UNDEFINED)),
+      m_lastManualPosition(QPoint(0, 0)),
+      m_viewSize(QSize(DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT))
 {
     qDebug() << __PRETTY_FUNCTION__;
 
@@ -405,10 +405,3 @@ QPointF MapEngine::centerGeoCoordinate()
 
     return convertSceneCoordinateToLatLon(m_zoomLevel, m_sceneCoordinate);
 }
-
-void MapEngine::receiveViewSceneRect(QRect viewSceneRect)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    m_viewArea = viewSceneRect;
-}
index d9ddbfb..3166f0f 100644 (file)
@@ -63,6 +63,11 @@ public:
  * MEMBER FUNCTIONS AND SLOTS
  ******************************************************************************/
 public:
+    /**
+      * @brief Coordinates  of the current center point
+      *
+      * @return Current coordinates (latitude & longitude)
+      */
     QPointF centerGeoCoordinate();
 
     /**
@@ -74,6 +79,14 @@ public:
     static QPoint convertLatLonToSceneCoordinate(QPointF latLonCoordinate);
 
     /**
+    * @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
@@ -117,15 +130,14 @@ public:
     */
     static QString tilePath(int zoomLevel, int x, int y);
 
+public slots:
     /**
-    * @brief converts scene coordinates to latitude and longitude
+    * @brief Slot to catch user own location data
     *
-    * @param current zoom level
-    * @param sceneCoordinate that will be converted
+    * @param user User info
     */
-    QPointF convertSceneCoordinateToLatLon(int zoomLevel, QPoint sceneCoordinate);
+    void receiveOwnLocation(User *user);
 
-public slots:
     /**
     * @brief Set auto centering.
     *
@@ -165,20 +177,6 @@ public slots:
     */
     void viewResized(const QSize &size);
 
-    /**
-    * @brief Slot to catch user own location data
-    *
-    * @param user User info
-    */
-    void receiveOwnLocation(User *user);    
-
-    /**
-    * @brief Slot to receive visible area of map scene
-    *
-    * @param visible area of map scene
-    */
-    void receiveViewSceneRect(QRect viewSceneRect);
-
 private:
     /**
     * @brief Calculate grid of tile coordinates from current scene coordinate.
@@ -191,6 +189,14 @@ private:
     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
+    */
+    bool disableAutoCentering(QPoint sceneCoordinate);
+
+    /**
     * @brief Get new tiles.
     *
     * Calculates which tiles has to be fetched. Does emit fetchImage for tiles which
@@ -215,14 +221,6 @@ private:
     bool isCenterTileChanged(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
-    */
-    bool disableAutoCentering(QPoint sceneCoordinate);
-
-    /**
     * @brief Calculate maximum value for tile in this zoom level.
     *
     * @param zoomLevel zoom level
@@ -270,13 +268,11 @@ private slots:
 
     /**
     * @brief Slot for zooming in
-    *
     */
     void zoomIn();
 
     /**
     * @brief Slot for zooming out
-    *
     */
     void zoomOut();
 
@@ -301,7 +297,7 @@ signals:
     void friendsLocationsReady(QList<User *> &friendsList);
 
     /**
-    * @brief Signal for view location change
+    * @brief Request view centering to new locaiton
     *
     * @param sceneCoordinate New scene coordinates
     */
@@ -323,7 +319,7 @@ signals:
     void minZoomLevelReached();
 
     /**
-    * @brief Signal for zoom level change
+    * @brief Request view changing zoom level
     *
     * @param newZoomLevel New zoom level
     */
@@ -333,20 +329,24 @@ signals:
  * DATA MEMBERS
  ******************************************************************************/
 private:
-    bool m_autoCenteringEnabled; ///< Auto centering enabled
-    QPoint m_centerTile; ///< Current center tile
-    FriendItemsHandler *m_friendItemsHandler; ///< Handler for friend and group items
-    GPSLocationItem *m_gpsLocationItem; ///< Item pointing current location from GPS
-    QPoint m_lastManualPosition;  ///< Last manually set position in scene coordinate
-    MapFetcher *m_mapFetcher; ///< Fetcher for map tiles
-    MapScene *m_mapScene; ///< Scene for map tiles
-    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)
-    QSize m_viewSize; ///< Current view size
-    bool m_zoomedIn; ///< Flag for checking if zoomed in when zoom is finished
-    int m_zoomLevel; ///< Current zoom level
-    QRect m_viewArea; ///< Visible area of map scene
+    bool m_autoCenteringEnabled;   ///< Auto centering enabled
+    bool m_zoomedIn;               ///< Flag for checking if zoomed in when zoom is finished
+
+    int m_zoomLevel;               ///< Current zoom level
+
+    QPoint m_centerTile;           ///< Current center tile
+    QPoint m_lastManualPosition;   ///< Last manually set position in scene coordinate
+    QPoint m_sceneCoordinate;      ///< Current center coordinate
+
+    QRect m_viewTilesGrid;         ///< Current grid of tiles in view (includes margin)
+
+    QSize m_viewSize;              ///< Current view size
+
+    FriendItemsHandler *m_friendItemsHandler;   ///< Handler for friend and group items
+    GPSLocationItem *m_gpsLocationItem;         ///< Item pointing current location from GPS
+    MapFetcher *m_mapFetcher;                   ///< Fetcher for map tiles
+    MapScene *m_mapScene;                       ///< Scene for map tiles
+    OwnLocationItem *m_ownLocation;             ///< Item to show own location
 };
 
 #endif // MAPENGINE_H
index 8435552..37f8b81 100644 (file)
@@ -41,34 +41,11 @@ MapView::MapView(QWidget *parent)
         this, SIGNAL(viewZoomFinished()));
 }
 
-void MapView::setZoomLevel(int zoomLevel)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    if (m_zoomAnimation) {
-        m_zoomAnimation->stop();
-        m_zoomAnimation->setDuration(ZOOM_TIME);
-        m_zoomAnimation->setStartValue(viewScale());
-        m_zoomAnimation->setEndValue(pow(2, zoomLevel - MAX_MAP_ZOOM_LEVEL));
-
-        m_zoomAnimation->start();
-    }
-}
-
-qreal MapView::viewScale()
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    return transform().m11();
-}
-
-void MapView::setViewScale(qreal viewScale)
+void MapView::centerToSceneCoordinates(QPoint sceneCoordinate)
 {
-    qDebug() << __PRETTY_FUNCTION__;
+    qDebug() << __PRETTY_FUNCTION__ << "sceneCoordinate" << sceneCoordinate;
 
-    QTransform transform;
-    transform.scale(viewScale, viewScale);
-    setTransform(transform);
+    centerOn(sceneCoordinate);
 }
 
 void MapView::mouseMoveEvent(QMouseEvent *event)
@@ -92,13 +69,6 @@ void MapView::mousePressEvent(QMouseEvent *event)
     m_scenePosition = mapToScene(width() / 2 - 1, height() / 2 - 1).toPoint();
 }
 
-void MapView::centerToSceneCoordinates(QPoint sceneCoordinate)
-{
-    qDebug() << __PRETTY_FUNCTION__ << "sceneCoordinate" << sceneCoordinate;
-
-    centerOn(sceneCoordinate);
-}
-
 void MapView::resizeEvent(QResizeEvent *event)
 {
     qDebug() << __PRETTY_FUNCTION__ << "Resize:" << event->size();
@@ -107,12 +77,32 @@ void MapView::resizeEvent(QResizeEvent *event)
     emit viewResizedNewSize(viewport()->width(), viewport()->height());
 }
 
-QRect MapView::viewportContent()
+void MapView::setViewScale(qreal viewScale)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    QTransform transform;
+    transform.scale(viewScale, viewScale);
+    setTransform(transform);
+}
+
+void MapView::setZoomLevel(int zoomLevel)
 {
-    QPoint topLeft = mapToScene(viewport()->contentsRect().topLeft()).toPoint();
-    QPoint bottomRight = mapToScene(viewport()->contentsRect().bottomRight()).toPoint();   
-    emit updateViewContent(QRect(topLeft, bottomRight));
+    qDebug() << __PRETTY_FUNCTION__;
+
+    if (m_zoomAnimation) {
+        m_zoomAnimation->stop();
+        m_zoomAnimation->setDuration(ZOOM_TIME);
+        m_zoomAnimation->setStartValue(viewScale());
+        m_zoomAnimation->setEndValue(pow(2, zoomLevel - MAX_MAP_ZOOM_LEVEL));
 
-    return QRect(topLeft, bottomRight);
+        m_zoomAnimation->start();
+    }
 }
 
+qreal MapView::viewScale()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    return transform().m11();
+}
index 1bcb254..a4f16dc 100644 (file)
@@ -99,12 +99,6 @@ public slots:
     */
     void setZoomLevel(int zoomLevel);
 
-    /**
-    * @brief Slot for catching request to get view port contents.
-    * implementation of this slot sends signal that includes visble area of view port.
-    */
-    QRect viewportContent();
-
 private:
     /**
     * @brief Set new view scale
@@ -133,6 +127,15 @@ signals:
     void viewResized(const QSize &size);
 
     /**
+    * @brief Signal for drawing OSM license
+    *
+    * Signal is emitted when view is resized.
+    * @param width Viewport width
+    * @param height Viewport height
+    */
+    void viewResizedNewSize(int width, int height);
+
+    /**
     * @brief Signal for view scroll events
     *
     * Signal is emitted when view is scrolled.
@@ -145,37 +148,13 @@ 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 that sends visible area of map scene
-    *
-    * @param viewArea visible area of map scene
-    */
-    void updateViewContent(QRect viewArea);
-
-    /**
-    * @brief Signal for drawing OSM license
-    *
-    * Signal is emitted when view is resized.
-    * @param width Viewport width
-    * @param height Viewport height
-    */
-    void viewResizedNewSize(int width, int height);
-
 /*******************************************************************************
  * DATA MEMBERS
  ******************************************************************************/
 private:
-    QPoint m_mousePosition; ///< Previous mouse event position
-    QPoint m_scenePosition; ///< New center position
-    QPropertyAnimation *m_zoomAnimation; ///< Zoom animation
+    QPoint m_mousePosition;               ///< Previous mouse event position
+    QPoint m_scenePosition;               ///< New center position
+    QPropertyAnimation *m_zoomAnimation;  ///< Zoom animation
 };
 
 #endif // MAPVIEW_H
index 7f3d5d5..dc2e8c3 100644 (file)
@@ -8,7 +8,6 @@ LIBS += "-lqjson"
 RESOURCES += ../images.qrc
 SOURCES += main.cpp \
     ui/mainwindow.cpp \
-    ui/mapviewscreen.cpp \
     situareservice/situareservice.cpp \
     situareservice/imagefetcher.cpp \
     facebookservice/facebookcredentials.cpp \
@@ -43,7 +42,6 @@ SOURCES += main.cpp \
     ui/zoombuttonpanel.cpp \
     ui/userinfo.cpp
 HEADERS += ui/mainwindow.h \
-    ui/mapviewscreen.h \
     map/mapengine.h \
     map/mapview.h \
     map/mapscene.h \
index f60c9ab..1a5fc97 100644 (file)
@@ -5,6 +5,7 @@
       Henri Lampela - henri.lampela@ixonos.com
       Kaj Wallin - kaj.wallin@ixonos.com
       Jussi Laitinen jussi.laitinen@ixonos.com
+      Sami Rämö - sami.ramo@ixonos.com
 
    Situare is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
 #endif // Q_WS_MAEMO_5
 
 #include "mainwindow.h"
-//#include "mapviewscreen.h"
 #include "settingsdialog.h"
 #include "facebookservice/facebookauthentication.h"
 #include "common.h"
 
 #include "friendlistpanel.h"
-#include "map/mapengine.h"
 #include "map/mapview.h"
 #include "panelsidebar.h"
 #include "userpanel.h"
 #include "zoombuttonpanel.h"
 
-
-
 #include <QtGui/QX11Info>
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
@@ -148,6 +145,9 @@ void MainWindow::buildMap()
 
     connect(this, SIGNAL(zoomLevelChanged(int)),
             m_mapView, SLOT(setZoomLevel(int)));
+
+    connect(m_mapView, SIGNAL(viewZoomFinished()),
+            this, SIGNAL(viewZoomFinished()));
 }
 
 void MainWindow::buildOsmLicense()
@@ -466,16 +466,6 @@ void MainWindow::showMaemoInformationBox(const QString &message)
 #endif
 }
 
-void MainWindow::toggleProgressIndicator(bool value)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-#ifdef Q_WS_MAEMO_5
-    setAttribute(Qt::WA_Maemo5ShowProgressIndicator, value);
-#else
-    Q_UNUSED(value);
-#endif // Q_WS_MAEMO_5
-}
-
 void MainWindow::startLoginProcess(const QUrl &url)
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -511,3 +501,13 @@ void MainWindow::startLoginProcess(const QUrl &url)
         m_refresh = true;
     }
 }
+
+void MainWindow::toggleProgressIndicator(bool value)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+#ifdef Q_WS_MAEMO_5
+    setAttribute(Qt::WA_Maemo5ShowProgressIndicator, value);
+#else
+    Q_UNUSED(value);
+#endif // Q_WS_MAEMO_5
+}
index 1650ce8..59060eb 100644 (file)
@@ -4,6 +4,7 @@
 
       Henri Lampela - henri.lampela@ixonos.com
       Kaj Wallin - kaj.wallin@ixonos.com
+      Sami Rämö - sami.ramo@ixonos.com
 
    Situare is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
@@ -46,8 +47,6 @@ class ZoomButtonPanel;
 
 /**
 * @brief Main Window Class
-*
-* @class MainWindow mainwindow.h "src/ui/mainwindow.h"
 */
 class MainWindow : public QMainWindow
 {
@@ -133,8 +132,6 @@ public slots:
     */
     void openSettingsDialog();
 
-    //////////////////////
-
     /**
     * @brief Public slot to intercept signal when old cerdentials are invalid or credentials
     *        doesn't exist yet
@@ -151,17 +148,34 @@ public slots:
     void toggleProgressIndicator(bool state);
 
 private:
-
+    /**
+      * @brief Build friend list panel and connect slots
+      */
     void buildFriendListPanel();
 
+    /**
+      * @brief Build manual location setting cross hair and connect slots
+      */
     void buildManualLocationCrosshair();
 
+    /**
+      * @brief Build map and connect slots
+      */
     void buildMap();
 
+    /**
+      * @brief Build OSM license and connect slots
+      */
     void buildOsmLicense();
 
+    /**
+      * @brief Build user info panel and connect slots
+      */
     void buildUserInfoPanel();
 
+    /**
+      * @brief Build zoom button panel and connect slots
+      */
     void buildZoomButtonPanel();
 
     /**
@@ -177,15 +191,13 @@ private:
     void grabZoomKeys(bool grab);
 
     /**
-    * @brief Set own location crosshair visibility
-    *
-    * @param visibility
-    */
+      * @brief Set own location crosshair visibility
+      *
+      * @param visible
+      */
     void setOwnLocationCrosshairVisibility(bool visible);
 
 private slots:
-//    void autoCenteringToggledActions(bool enabled);
-
     /**
     * @brief Slot for drawing the Open Street Map license text
     *
@@ -216,8 +228,6 @@ private slots:
     */
     void gpsTimeout();
 
-//    void gpsToggledActions(bool enabled);
-
     /**
     * @brief Slot to intercept signal when webview has finished loading webpage
     *
@@ -271,13 +281,6 @@ signals:
     */
     void gpsTriggered(bool enabled);
 
-//     /**
-//    * @brief Signal for auto centering enabling.
-//    *
-//    * @param enabled if auto centering should be enabled
-//    */
-//    void enableAutoCentering(bool enabled);
-
     /**
     * @brief Signal for finding friend.
     *
@@ -299,10 +302,21 @@ signals:
     */
     void mapViewResized(const QSize &size);
 
+    /**
+      * @brief Forwarding signal from MapView to MapEngine
+      *
+      * @param sceneCoordinate
+      */
     void mapViewScrolled(QPoint sceneCoordinate);
 
+    /**
+      * @brief Forwarding signal from MapEngine to MapView
+      */
     void maxZoomLevelReached();
 
+    /**
+      * @brief Forwarding signal from MapEngine to MapView
+      */
     void minZoomLevelReached();
 
     /**
@@ -312,11 +326,6 @@ signals:
     void refreshUserData();
 
     /**
-    * @brief Signal from SituareEngine to MapEngine is travelling here
-    */
-    void requestOwnLocation();
-
-    /**
     * @brief Signal for requesting reverseGeo from SituareEngine
     *
     */
@@ -345,13 +354,6 @@ signals:
     void updateCredentials(const QUrl &url);
 
     /**
-    * @brief Map view port content update
-    *
-    * @param viewArea visible area of map scene
-    */
-    void updateMapViewContent(QRect viewArea);
-
-    /**
     * @brief MapView has finished zooming
     */
     void viewZoomFinished();
@@ -368,6 +370,9 @@ signals:
     */
     void zoomIn();
 
+    /**
+      * @brief Forwarding signal from MapEngine to MapView
+      */
     void zoomLevelChanged(int zoomLevel);
 
     /**
diff --git a/src/ui/mapviewscreen.cpp b/src/ui/mapviewscreen.cpp
deleted file mode 100644 (file)
index fa46d6b..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-   Situare - A location system for Facebook
-   Copyright (C) 2010  Ixonos Plc. Authors:
-
-      Kaj Wallin - kaj.wallin@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 "mapviewscreen.h"
-#include "map/mapview.h"
-#include "panelcommon.h"
-#include "panelsidebar.h"
-
-MapViewScreen::MapViewScreen(QWidget *parent)
-   : QWidget(parent)
-
-{
-
-
-//    QHBoxLayout *mapViewLayout = new QHBoxLayout;
-
-
-
-//    mapViewLayout->addWidget(mapView);
-//    setLayout(mapViewLayout);
-
-//    mapViewLayout->setMargin(0);
-
-
-
-//    setObjectName("Map view");
-}
-
-
-
-
-
-
-
-
-
diff --git a/src/ui/mapviewscreen.h b/src/ui/mapviewscreen.h
deleted file mode 100644 (file)
index eac6989..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
- /*
-    Situare - A location system for Facebook
-    Copyright (C) 2010  Ixonos Plc. Authors:
-
-       Kaj Wallin - kaj.wallin@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 MAPVIEWTAB_H
-#define MAPVIEWTAB_H
-
-#include <QtGui>
-
-#include "map/mapengine.h"
-#include "friendlistpanel.h"
-#include "userpanel.h"
-#include "zoombuttonpanel.h"
-
-/**
-* @brief Map View class. Used to display Map
-*/
-class MapViewScreen : public QWidget
-{
-    Q_OBJECT
-
-public:
-    /**
-    * @brief Constructor
-    *
-    * @param parent Parent
-    */
-    MapViewScreen(QWidget *parent = 0);
-
-/*******************************************************************************
- * MEMBER FUNCTIONS AND SLOTS
- ******************************************************************************/
-public slots:    
-
-
-private slots:
-
-
-
-
-//    /**
-//    * @brief Slot for map location change.
-//    */
-//    void locationChanged();
-
-
-/*******************************************************************************
- * SIGNALS
- ******************************************************************************/
-signals:
-    /**
-    * @brief Signal for enabling auto centering.
-    *
-    * @param enabled true if map should center to GPS position, false otherwise
-    */
-    void enableAutoCentering(bool enabled);
-
-    /**
-    * @brief Signal when friend list locations are fetched
-    *
-    * Forwarded to map engine and friends list panel
-    *
-    * @param friendsList Friends list data
-    */
-    void friendsLocationsReady(QList<User *> &friendsList);
-
-    /**
-      * @brief Signal for GPS enabling / disabling
-      *
-      * @param enabled True is GPS is enabled, otherwise false
-      */
-    void gpsEnabled(bool enabled);
-
-    /**
-    * @brief Signal for map location change.
-    */
-    void mapLocationChanged();
-
-    /**
-    * @brief Slot for GPS position.
-    *
-    * @param position latitude and longitude values
-    * @param accuracy coordinate accuracy in metres
-    */
-    void positionReceived(QPointF position, qreal accuracy);
-
-    /**
-    * @brief Signal from MapEngine to SituareEngine is travelling here
-    */
-    void ownLocation(QPointF ownLatitudeLongitudeLocation);
-
-    /**
-    * @brief Signal from SituareEngine to MapEngine is travelling here
-    */
-    void requestOwnLocation();
-
-    /**
-    * @brief Signal for refreshing user data.
-    *
-    */
-    void refreshUserData();
-
-    /**
-    * @brief Signal for requesting reverseGeo from SituareEngine
-    *
-    */
-    void requestReverseGeo();
-
-    /**
-    * @brief Signals, when address data is ready
-    *
-    * @param address Street address
-    */
-    void reverseGeoReady(const QString &address);
-
-    /**
-    * @brief Signal Signal for requestLocationUpdate from SituareEngine via MainWindow class
-    *
-    * @param status Status message
-    * @param publish Publish on Facebook
-    */
-    void statusUpdate(const QString &status, const bool &publish);
-
-    /**
-    * @brief Signal when user location is fetched
-    *
-    * @param user User data
-    */
-    void userLocationReady(User *user);
-
-    /**
-      * @brief Signal for HW increase button
-      */
-    void zoomInKeyPressed();
-
-    /**
-      * @brief Signal for HW decrease button
-      */
-    void zoomOutKeyPressed();
-
-/*******************************************************************************
- * DATA MEMBERS
- ******************************************************************************/
-private:
-
-};
-
-#endif // MAPVIEWTAB_H