Subversion Repositories Projects

Rev

Rev 391 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
305 KeyOz 1
/*
2
*
3
* This file is part of QMapControl,
4
* an open-source cross-platform map widget
5
*
6
* Copyright (C) 2007 - 2008 Kai Winter
7
*
8
* This program is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU Lesser General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (at your option) any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
* GNU Lesser General Public License for more details.
17
*
18
* You should have received a copy of the GNU Lesser General Public License
19
* along with QMapControl. If not, see <http://www.gnu.org/licenses/>.
20
*
21
* Contact e-mail: kaiwinter@gmx.de
22
* Program URL   : http://qmapcontrol.sourceforge.net/
23
*
24
*/
25
 
26
#ifndef MAPNETWORK_H
27
#define MAPNETWORK_H
28
 
29
#include <QObject>
30
#include <QDebug>
31
#include <QHttp>
32
#include <QVector>
33
#include <QPixmap>
34
#include "imagemanager.h"
35
/**
36
        @author Kai Winter <kaiwinter@gmx.de>
37
 */
38
namespace qmapcontrol
39
{
40
    class ImageManager;
41
    class MapNetwork : QObject
42
    {
43
        Q_OBJECT
44
 
45
    public:
46
        MapNetwork(ImageManager* parent);
47
        ~MapNetwork();
48
 
49
        void loadImage(const QString& host, const QString& url);
50
 
51
        /*!
52
         * checks if the given url is already loading
53
         * @param url the url of the image
54
         * @return boolean, if the image is already loading
55
         */
56
        bool imageIsLoading(QString url);
57
 
58
        /*!
59
         * Aborts all current loading threads.
60
         * This is useful when changing the zoom-factor, though newly needed images loads faster
61
         */
62
        void abortLoading();
63
        void setProxy(QString host, int port);
64
 
65
    private:
66
        ImageManager* parent;
67
        QHttp* http;
68
        QMap<int, QString> loadingMap;
69
        qreal loaded;
70
        QMutex vectorMutex;
71
        MapNetwork& operator=(const MapNetwork& rhs);
72
        MapNetwork(const MapNetwork& old);
73
 
74
    private slots:
75
        void requestFinished(int id, bool error);
76
    };
77
}
78
#endif