Modified mapEngine and mapFetcher classes.
[situare] / src / map / mapfetcher.h
1 #ifndef MAPFETCHER_H
2 #define MAPFETCHER_H
3
4 #include <QtCore>
5 #include <QNetworkAccessManager>
6
7 class QNetworkReply;
8 class QUrl;
9
10 #include "mapfetcher.h"
11
12 /**
13 * @brief MapFetcher handles requests to get map tiles.
14 *
15 *
16 *
17 * @class MapFetcher mapfetcher.h "map/mapfetcher.h"
18 */
19 class MapFetcher : public QObject
20 {
21     Q_OBJECT
22
23 public:
24     /**
25     * @brief Constructor for MapFetcher.
26     *
27     * @fn MapFetcher
28     * @param parent parent object
29     */
30     MapFetcher(QObject *parent = 0);
31
32     ~MapFetcher();
33
34     /**
35     * @brief Fetch image from given URL.
36     *
37     * @fn fetchMapImage
38     * @param url URL to image
39     */
40     void fetchMapImage(const QUrl &url);
41
42 signals:    
43     /**
44     * @brief Signal which is emitted when a map tile
45     * is received from the server and loaded to pixmap.
46     *
47     * @fn mapImageReceived
48     * @param url URL to image
49     * @param image image pixmap
50     */
51     void mapImageReceived(const QUrl &url, const QPixmap &image);
52
53     /**
54     * @brief Signal which is emitted when there is error
55     * in network reply.
56     *
57     * @fn error
58     * @param message error message
59     */
60     void error(const QString &message);
61
62 private slots:
63     /**
64     * @brief This slot is called when network manager has finished
65     * the download.
66     *
67     * @fn downloadFinished
68     * @param reply
69     */
70     void downloadFinished(QNetworkReply *reply);
71
72 private:
73     QNetworkAccessManager m_manager;
74 };
75
76 #endif