Modified header files function and member order.
authorJussi Laitinen <jupe@l3l7588.ixonos.local>
Mon, 19 Apr 2010 07:29:51 +0000 (10:29 +0300)
committerJussi Laitinen <jupe@l3l7588.ixonos.local>
Mon, 19 Apr 2010 07:29:51 +0000 (10:29 +0300)
src/map/mapcommon.h
src/map/mapengine.cpp
src/map/mapengine.h
src/map/mapfetcher.cpp
src/map/mapfetcher.h
src/map/mapview.cpp

index 877623d..74785e8 100644 (file)
    USA.
 */
 
-#ifndef COMMON_H
-#define COMMON_H
+#ifndef MAPCOMMON_H
+#define MAPCOMMON_H
 
 #include <QtCore>
 
-static const int TILE_SIZE_X = 256; ///< Tile image size in x direction
-static const int TILE_SIZE_Y = 256; ///< Tile image size in y direction
+const int TILE_SIZE_X = 256; ///< Tile image size in x direction
+const int TILE_SIZE_Y = 256; ///< Tile image size in y direction
 
-static const int MIN_MAP_ZOOM_LEVEL = 0; ///< Minimum zoom level
-static const int MAX_MAP_ZOOM_LEVEL = 18; ///< Maximum zoom level
-static const int MIN_MAP_SCENE_NORMAL_LEVEL = MAX_MAP_ZOOM_LEVEL + 1;
+const int MIN_MAP_ZOOM_LEVEL = 0; ///< Minimum zoom level
+const int MAX_MAP_ZOOM_LEVEL = 18; ///< Maximum zoom level
+const int MIN_MAP_SCENE_NORMAL_LEVEL = MAX_MAP_ZOOM_LEVEL + 1;
 
-static const int ZOOM_FPS = 30; ///< FPS for the zoom effect
-static const qreal ZOOM_TIME = 0.25; ///< Length of the zoom effect (seconds)
+const int ZOOM_FPS = 30; ///< FPS for the zoom effect
+const qreal ZOOM_TIME = 0.25; ///< Length of the zoom effect (seconds)
 
-static const qreal MAX_LATITUDE = 85.05112877980659237802;  ///< Maximum latitude value
-static const qreal MIN_LATITUDE = -MAX_LATITUDE; ///< Minimum latitude value
-static const qreal MIN_LONGITUDE = -180.0;  ///< Minimum longitude value
-static const qreal MAX_LONGITUDE = 180.0;  ///< Maximum longitude value
+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
+const qreal MAX_LONGITUDE = 180.0;  ///< Maximum longitude value
 
-static const int DEFAULT_SCREEN_WIDTH = 973;    ///< Default screen width
-static const int DEFAULT_SCREEN_HEIGHT = 614;   ///< Default screen height
-static const int DEFAULT_ZOOM_LEVEL = 14;       ///< Default zoom level
-static const qreal DEFAULT_LONGITUDE = 25.5000; ///< Default longitude value
-static const qreal DEFAULT_LATITUDE = 65.0000;  ///< Default latitude value
+const int DEFAULT_SCREEN_WIDTH = 973;    ///< Default screen width
+const int DEFAULT_SCREEN_HEIGHT = 614;   ///< Default screen height
+const int DEFAULT_ZOOM_LEVEL = 14;       ///< Default zoom level
+const qreal DEFAULT_LONGITUDE = 25.5000; ///< Default longitude value
+const qreal DEFAULT_LATITUDE = 65.0000;  ///< Default latitude value
 
-static const int GRID_PADDING = 1;  ///< Grid padding used in tile grid calculation
+const int GRID_PADDING = 1;  ///< Grid padding used in tile grid calculation
 
 /**
 * \var UNDEFINED
 * \brief Value to be used when zoom level, tile numbers or position are not defined
 */
-static const int UNDEFINED = -1;
+const int UNDEFINED = -1;
 
-#endif // COMMON_H
+#endif // MAPCOMMON_H
index 708a959..d6832c7 100644 (file)
@@ -93,14 +93,14 @@ void MapEngine::mapImageReceived(const QUrl &url, const QPixmap &pixmap)
 
     parseURL(url, zoom, x, y);
 
-    if (!mapTilesInScene.contains(tilePath(zoom, x, y))) {
+    if (!m_mapTilesInScene.contains(tilePath(zoom, x, y))) {
 
         MapTile *mapTile = new MapTile();
         mapTile->setZoomLevel(zoom);
         mapTile->setTileNumber(QPoint(x, y));
         mapTile->setPixmap(pixmap);
 
-        mapTilesInScene.insert(tilePath(zoom, x, y), mapTile);
+        m_mapTilesInScene.insert(tilePath(zoom, x, y), mapTile);
         m_mapScene->addMapTile(mapTile);
 
         removeStackedTiles(mapTile);
@@ -154,12 +154,12 @@ void MapEngine::calculateNewTiles(QPoint sceneCoordinate)
 {
     //qDebug() << __PRETTY_FUNCTION__;
 
-    viewGrid = calculateGrid(sceneCoordinate);
+    m_viewGrid = calculateGrid(sceneCoordinate);
 
-    int topLeftX = viewGrid.topLeft().x();
-    int topLeftY = viewGrid.topLeft().y();
-    int bottomRightX = viewGrid.bottomRight().x();
-    int bottomRightY = viewGrid.bottomRight().y();
+    int topLeftX = m_viewGrid.topLeft().x();
+    int topLeftY = m_viewGrid.topLeft().y();
+    int bottomRightX = m_viewGrid.bottomRight().x();
+    int bottomRightY = m_viewGrid.bottomRight().y();
 
     int tileMaxVal = tileMaxValue(m_zoomLevel);
 
@@ -181,7 +181,7 @@ void MapEngine::calculateNewTiles(QPoint sceneCoordinate)
 
             QUrl url = buildURL(m_zoomLevel, QPoint(tileX, tileY));
 
-            if (!mapTilesInScene.contains(tilePath(m_zoomLevel, tileX, tileY)))
+            if (!m_mapTilesInScene.contains(tilePath(m_zoomLevel, tileX, tileY)))
                 emit fetchImage(url);
         }
     }
@@ -192,7 +192,8 @@ void MapEngine::removeTile(MapTile *tile)
     //qDebug() << __PRETTY_FUNCTION__;
 
     if (tile) {
-       mapTilesInScene.remove(tilePath(tile->zoomLevel(), tile->tileNumber().x(), tile->tileNumber().y()));
+       m_mapTilesInScene.remove(tilePath(tile->zoomLevel(), tile->tileNumber().x(),
+                                         tile->tileNumber().y()));
        m_mapScene->removeItem(tile);
        delete tile;
     }
@@ -202,26 +203,30 @@ void MapEngine::removeOldTiles()
 {
     //qDebug() << __PRETTY_FUNCTION__;
 
-    QPointF topLeft = convertTileNumberToSceneCoordinate(m_zoomLevel, viewGrid.topLeft());
-    QPointF bottomRight = convertTileNumberToSceneCoordinate(m_zoomLevel, viewGrid.bottomRight() + QPoint(1, 1));
+    QPointF topLeft = convertTileNumberToSceneCoordinate(m_zoomLevel, m_viewGrid.topLeft());
+    QPointF bottomRight = convertTileNumberToSceneCoordinate(m_zoomLevel, m_viewGrid.bottomRight()
+                                                             + QPoint(1, 1));
     qreal width = bottomRight.x() - topLeft.x();
     qreal height = bottomRight.y() - topLeft.y();
 
-    QList<QGraphicsItem *> viewTiles = m_mapScene->items(topLeft.x(), topLeft.y(), width, height, Qt::ContainsItemBoundingRect);
+    QList<QGraphicsItem *> viewTiles = m_mapScene->items(topLeft.x(), topLeft.y(), width, height,
+                                                         Qt::ContainsItemBoundingRect);
     QList<QGraphicsItem *> allTiles = m_mapScene->items();
 
     foreach (QGraphicsItem *tile, viewTiles)
         allTiles.removeOne(tile);
 
-    QHashIterator<QString, MapTile *> i(mapTilesInScene);
+    QHashIterator<QString, MapTile *> i(m_mapTilesInScene);
 
      while (i.hasNext()) {
          i.next();
-         if (allTiles.contains(i.value()) && mapTilesInScene.contains(i.key())) {
+         if (allTiles.contains(i.value()) && m_mapTilesInScene.contains(i.key())) {
              MapTile *tile = i.value();
              removeTile(tile);
          }
      }
+
+//     qDebug() << m_mapScene->items().count();
 }
 
 void MapEngine::removeStackedTiles(MapTile *newTile)
@@ -244,7 +249,8 @@ void MapEngine::removeStackedTiles(MapTile *newTile)
 
         else {
             //Get tiles below removal candidate
-            QList<QGraphicsItem *> stackedItems = m_mapScene->items(collidingItemSceneRect, Qt::ContainsItemBoundingRect);
+            QList<QGraphicsItem *> stackedItems = m_mapScene->items(collidingItemSceneRect,
+                                                                    Qt::ContainsItemBoundingRect);
             QRectF combined;
             int count = 0;
 
@@ -264,6 +270,8 @@ void MapEngine::removeStackedTiles(MapTile *newTile)
             }
         }
     }
+
+//    qDebug() << m_mapScene->items().count();
 }
 
 void MapEngine::viewResized(const QSize &size)
@@ -290,7 +298,7 @@ void MapEngine::zoomIn()
     /**
     * @todo Remove old tiles after zoom
     */
-    removeOldTiles();
+    QTimer::singleShot(500, this, SLOT(removeOldTiles()));
 }
 
 void MapEngine::zoomOut()
@@ -335,3 +343,42 @@ void MapEngine::scalingFactorChanged(qreal scaleFactor)
 {
     qDebug() << __PRETTY_FUNCTION__;
 }
+
+QPoint MapEngine::convertSceneCoordinateToTileNumber(int zoomLevel, QPoint sceneCoordinate)
+{
+    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));
+
+    return QPoint(x, y);
+}
+
+QPoint MapEngine::convertTileNumberToSceneCoordinate(int zoomLevel, QPoint tileNumber)
+{
+    int pow = 1 << (MAX_MAP_ZOOM_LEVEL - zoomLevel);
+    int x = tileNumber.x() * TILE_SIZE_X * pow;
+    int y = tileNumber.y() * TILE_SIZE_Y * pow;
+
+    return QPoint(x, y);
+}
+
+QPoint MapEngine::convertLatLonToSceneCoordinate(QPointF latLonCoordinate)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    qreal longitude = latLonCoordinate.x();
+    qreal latitude = latLonCoordinate.y();
+
+    if ((longitude > MAX_LONGITUDE) || (longitude < MIN_LONGITUDE))
+        return QPoint(UNDEFINED, UNDEFINED);
+    if ((latitude > MAX_LATITUDE) || (latitude < MIN_LATITUDE))
+        return QPoint(UNDEFINED, UNDEFINED);
+
+    qreal z = static_cast<qreal>(1 << MAX_MAP_ZOOM_LEVEL);
+
+    qreal x = static_cast<qreal>((longitude + 180.0) / 360.0);
+    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();
+}
index d1507ca..6cae423 100644 (file)
@@ -50,29 +50,12 @@ public:
     MapEngine(QObject *parent = 0);
 
     /**
-    * @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 Convert tile x & y numbers to MapScene coordinates
+    * @brief Convert latitude and longitude to scene coordinates.
     *
-    * @param zoomLevel Zoom level
-    * @param tileNumber x & y numbers of the tile
-    * @return QPoint MapScene coordinate
+    * @param latLonCoordinate latitude and longitude values
+    * @return scene coordinate
     */
-    static QPoint convertTileNumberToSceneCoordinate(int zoomLevel, QPoint tileNumber)
-    {
-        int pow = 1 << (MAX_MAP_ZOOM_LEVEL - zoomLevel);
-        int x = tileNumber.x() * TILE_SIZE_X * pow;
-        int y = tileNumber.y() * TILE_SIZE_Y * pow;
-
-        return QPoint(x, y);
-    }
+    static QPoint convertLatLonToSceneCoordinate(QPointF latLonCoordinate);
 
     /**
     * @brief Convert MapScene coordinate to tile x & y numbers.
@@ -81,21 +64,25 @@ public:
     * @param sceneCoordinate MapScene coordinate
     * @return QPoint tile x & y numbers
     */
-    static QPoint convertSceneCoordinateToTileNumber(int zoomLevel, QPoint sceneCoordinate)
-    {
-        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));
+    static QPoint convertSceneCoordinateToTileNumber(int zoomLevel, QPoint sceneCoordinate);
 
-        return QPoint(x, y);
-    }
+    /**
+    * @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);
 
     /**
-    * @brief Getter for scene
+    * @brief MapEngine initializer
     *
-    * @return QGraphicsScene
+    * 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.
     */
-    QGraphicsScene* scene();
+    void init();
 
     /**
     * @brief Helper for setting view location based on latitude and longitude
@@ -106,31 +93,11 @@ public:
     void setViewLocation(QPointF latLonCoordinate);
 
     /**
-    * @brief Convert latitude and longitude to scene coordinates.
+    * @brief Getter for scene
     *
-    * @param latLonCoordinate latitude and longitude values
-    * @return scene coordinate
+    * @return QGraphicsScene
     */
-    static QPoint convertLatLonToSceneCoordinate(QPointF latLonCoordinate)
-    {
-        qDebug() << __PRETTY_FUNCTION__;
-
-        qreal longitude = latLonCoordinate.x();
-        qreal latitude = latLonCoordinate.y();
-
-        if ((longitude > MAX_LONGITUDE) || (longitude < MIN_LONGITUDE))
-            return QPoint(UNDEFINED, UNDEFINED);
-        if ((latitude > MAX_LATITUDE) || (latitude < MIN_LATITUDE))
-            return QPoint(UNDEFINED, UNDEFINED);
-
-        qreal z = static_cast<qreal>(1 << MAX_MAP_ZOOM_LEVEL);
-
-        qreal x = static_cast<qreal>((longitude + 180.0) / 360.0);
-        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();
-    }
+    QGraphicsScene* scene();
 
 public slots:
     /**
@@ -141,6 +108,11 @@ public slots:
     */
     void setLocation(QPoint sceneCoordinate);
 
+    /**
+    * @brief Slot for view resizing.
+    *
+    * @param size view size
+    */
     void viewResized(const QSize &size);
 
 private:
@@ -154,32 +126,6 @@ private:
     QUrl buildURL(int zoomLevel, QPoint tileNumbers);
 
     /**
-    * @brief Parse given URL to zoom, x and y values. Parsed values are
-    * placed in variables given as parameters.
-    *
-    * @param url url to parse
-    * @param [out] zoom zoom variable
-    * @param [out] x x variable
-    * @param [out] y y variable
-    */
-    void parseURL(const QUrl &url, int &zoom, int &x, int &y);
-
-    /**
-    * @brief Set drawing order of all tiles in the scene
-    *
-    * Check MapTile::setSceneLevel for more information.
-    */
-    void setTilesDrawingLevels();
-
-    /**
-    * @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 Calculate grid of tile coordinates from current scene coordinate.
     *
     * Grid size is calculated from view size and scene's current center coordinate.
@@ -197,9 +143,23 @@ private:
     void calculateNewTiles(QPoint sceneCoordinate);
 
     /**
-    * @brief Remove tiles which are out of view bounds.
+    * @brief Check if center tile has changed.
+    *
+    * @param sceneCoordinate scene's center coordinate
+    * @return bool true if center tile changed, false otherwise
     */
-    void removeOldTiles();
+    bool centerTileChanged(QPoint sceneCoordinate);
+
+    /**
+    * @brief Parse given URL to zoom, x and y values. Parsed values are
+    * placed in variables given as parameters.
+    *
+    * @param url url to parse
+    * @param [out] zoom zoom variable
+    * @param [out] x x variable
+    * @param [out] y y variable
+    */
+    void parseURL(const QUrl &url, int &zoom, int &x, int &y);
 
     /**
     * @brief Remove tiles which are stacked.
@@ -212,12 +172,27 @@ private:
     void removeStackedTiles(MapTile *newTile);
 
     /**
-    * @brief Check if center tile has changed.
+    * @brief Remove tile.
     *
-    * @param sceneCoordinate scene's center coordinate
-    * @return bool true if center tile changed, false otherwise
+    * Removes tile from scene and list of current tiles in scene.
+    * @param tile MapTile to remove
     */
-    bool centerTileChanged(QPoint sceneCoordinate);
+    void removeTile(MapTile *tile);
+
+    /**
+    * @brief Set drawing order of all tiles in the scene
+    *
+    * Check MapTile::setSceneLevel for more information.
+    */
+    void setTilesDrawingLevels();
+
+    /**
+    * @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 Return tile path created from tile values.
@@ -229,14 +204,6 @@ private:
     */
     inline QString tilePath(int zoomLevel, int x, int y);
 
-    /**
-    * @brief Remove tile.
-    *
-    * Removes tile from scene and list of current tiles in scene.
-    * @param tile MapTile to remove
-    */
-    void removeTile(MapTile *tile);
-
 private slots:
     /**
     * @brief Slot for received map tile images
@@ -248,6 +215,11 @@ private slots:
     void mapImageReceived(const QUrl &url, const QPixmap &pixmap);
 
     /**
+    * @brief Remove tiles which are out of view bounds.
+    */
+    void removeOldTiles();
+
+    /**
     * @brief Slot for view scaling factor change events
     *
     * Can be used to trigger scaling of zoom buttons, friend indicators and other
@@ -268,7 +240,14 @@ private slots:
     */
     void zoomOut();
 
-signals:
+signals:   
+    /**
+    * @brief Signal for image fetching.
+    *
+    * @param url image url
+    */
+    void fetchImage(const QUrl &url);
+
     /**
     * @brief Signal for view location change
     *
@@ -283,23 +262,15 @@ signals:
     */
     void zoomLevelChanged(int newZoomLevel);
 
-    /**
-    * @brief Signal for image fetching.
-    *
-    * @param url image url
-    */
-    void fetchImage(const QUrl &url);
-
 private:
-
     MapScene *m_mapScene; ///< Scene for map tiles
     MapFetcher *m_mapFetcher; ///< Fetcher for map tiles
     int m_zoomLevel; ///< Current zoom level
-    QHash<QString, MapTile *> mapTilesInScene;  ///< List of map tiles in map scene
+    QHash<QString, MapTile *> m_mapTilesInScene;  ///< List of map tiles in map scene
     QSize m_viewSize;   ///< Current view size
     QPoint m_sceneCoordinate;  ///< Current center coordinate
     QPoint m_centerTile;    ///< Current center tile
-    QRect viewGrid; ///< Current grid of tiles in view
+    QRect m_viewGrid; ///< Current grid of tiles in view
 };
 
 #endif // MAPENGINE_H
index f9e349e..128b5f8 100644 (file)
@@ -55,12 +55,12 @@ void MapFetcher::fetchMapImage(const QUrl &url)
     if (loadImageFromCache(url))
         return;
 
-    if (downloadQueue.size() >= DOWNLOAD_QUEUE_SIZE)
-        downloadQueue.dequeue();
+    if (m_downloadQueue.size() >= DOWNLOAD_QUEUE_SIZE)
+        m_downloadQueue.dequeue();
 
-    downloadQueue.enqueue(url);
+    m_downloadQueue.enqueue(url);
 
-    if (currentDownloads.size() < MAX_PARALLEL_DOWNLOADS)
+    if (m_currentDownloads.size() < MAX_PARALLEL_DOWNLOADS)
         startNextDownload();
 }
 
@@ -92,16 +92,16 @@ void MapFetcher::startNextDownload()
 {
     //qDebug() << __PRETTY_FUNCTION__;
 
-    if (downloadQueue.isEmpty())
+    if (m_downloadQueue.isEmpty())
         return;
 
-    QUrl url = downloadQueue.dequeue();
+    QUrl url = m_downloadQueue.dequeue();
 
     QNetworkRequest request(url);
     request.setRawHeader("User-Agent", "Map Test");
     QNetworkReply *reply = m_manager->get(request);
 
-    currentDownloads.append(reply);
+    m_currentDownloads.append(reply);
 }
 
 void MapFetcher::downloadFinished(QNetworkReply *reply)
@@ -123,7 +123,7 @@ void MapFetcher::downloadFinished(QNetworkReply *reply)
         emit error(reply->errorString());
     }
 
-    currentDownloads.removeAll(reply);
+    m_currentDownloads.removeAll(reply);
     reply->deleteLater();
     startNextDownload();
 }
index a957a60..ee54244 100644 (file)
@@ -55,31 +55,24 @@ public:
     */
     ~MapFetcher();
 
-signals:    
+public slots:
     /**
-    * @brief Signal which is emitted when a map tile
-    * is received from the server and loaded to pixmap.
+    * @brief Fetch image from given URL.
     *
     * @param url URL to image
-    * @param image image pixmap
     */
-    void mapImageReceived(const QUrl &url, const QPixmap &image);
-
-    /**
-    * @brief Signal which is emitted when there is error
-    * in network reply.
-    *
-    * @param message error message
-    */
-    void error(const QString &message);
+    void fetchMapImage(const QUrl &url);
 
-public slots:
+private:
     /**
-    * @brief Fetch image from given URL.
+    * @brief Loads image from cache if it's available and emits imageReveived
+    * signal with url and image. If image is in cache returns true, false
+    * otherwise.
     *
-    * @param url URL to image
+    * @param url
+    * @return bool true if image was loaded from cache, false otherwise
     */
-    void fetchMapImage(const QUrl &url);
+    bool loadImageFromCache(const QUrl &url);
 
 private slots:
 
@@ -98,21 +91,29 @@ private slots:
     */
     void startNextDownload();
 
-private:
+signals:    
+    /**
+    * @brief Signal which is emitted when a map tile
+    * is received from the server and loaded to pixmap.
+    *
+    * @param url URL to image
+    * @param image image pixmap
+    */
+    void mapImageReceived(const QUrl &url, const QPixmap &image);
 
     /**
-    * @brief Loads image from cache if it's available and emits imageReveived
-    * signal with url and image. If image is in cache returns true, false
-    * otherwise.
+    * @brief Signal which is emitted when there is error
+    * in network reply.
     *
-    * @param url
-    * @return bool true if image was loaded from cache, false otherwise
+    * @param message error message
     */
-    bool loadImageFromCache(const QUrl &url);
+    void error(const QString &message);
+
+private:
 
     QNetworkAccessManager *m_manager;       ///< Network access manager
-    QList<QNetworkReply*> currentDownloads; ///< List of current downloads
-    QQueue<QUrl> downloadQueue;             ///< Queue of pending requests
+    QList<QNetworkReply*> m_currentDownloads; ///< List of current downloads
+    QQueue<QUrl> m_downloadQueue;             ///< Queue of pending requests
 };
 
 #endif
index ccf1a22..f05e807 100644 (file)
@@ -38,7 +38,7 @@ MapView::MapView(QWidget *parent) : QGraphicsView(parent)
   * OpenGL can't be used in scratchbox.
   */
 #ifndef Q_WS_MAEMO_5
-    //setViewport(new QGLWidget);
+    setViewport(new QGLWidget(QGLFormat(QGL::DoubleBuffer)));
 #endif // !Q_WS_MAEMO_5
 
     setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);