libosmscout
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libosmscout-client-qt
include
osmscoutclientqt
MapDownloader.h
Go to the documentation of this file.
1
#ifndef OSMSCOUT_CLIENT_QT_MAPMANAGER_H
2
#define OSMSCOUT_CLIENT_QT_MAPMANAGER_H
3
4
/*
5
OSMScout - a Qt backend for libosmscout and libosmscout-map
6
Copyright (C) 2016 Lukas Karas
7
8
This library is free software; you can redistribute it and/or
9
modify it under the terms of the GNU Lesser General Public
10
License as published by the Free Software Foundation; either
11
version 2.1 of the License, or (at your option) any later version.
12
13
This library 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 GNU
16
Lesser General Public License for more details.
17
18
You should have received a copy of the GNU Lesser General Public
19
License along with this library; if not, write to the Free Software
20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
*/
22
23
#include <
osmscoutclientqt/ClientQtImportExport.h
>
24
25
#include <osmscoutclient/MapProvider.h>
26
#include <osmscoutclient/Settings.h>
27
#include <osmscoutclient/MapDirectory.h>
28
#include <osmscoutclient/MapManager.h>
29
30
#include <
osmscoutclientqt/AvailableMapsModel.h
>
31
#include <
osmscoutclientqt/FileDownloader.h
>
32
33
#include <QObject>
34
#include <QStringList>
35
#include <QList>
36
#include <QDir>
37
#include <QTimer>
38
#include <QtGlobal>
39
#include <QStorageInfo>
40
41
namespace
osmscout
{
42
48
class
OSMSCOUT_CLIENT_QT_API
MapDownloadJob
:
public
DownloadJob
49
{
50
Q_OBJECT
51
52
AvailableMapsModelMap
map;
53
54
public
:
55
56
MapDownloadJob
(QNetworkAccessManager *
webCtrl
,
AvailableMapsModelMap
map, QDir
target
,
bool
replaceExisting
);
57
63
~MapDownloadJob
()
override
;
64
65
void
start
();
66
67
QString
getMapName
()
const
68
{
69
return
map.getName();
70
}
71
72
QStringList
getMapPath
()
const
73
{
74
return
map.getPath();
75
}
76
77
uint64_t
expectedSize
()
const override
78
{
79
return
map.getSize();
80
}
81
};
82
88
class
OSMSCOUT_CLIENT_QT_API
MapDownloader
:
public
QObject
89
{
90
Q_OBJECT
91
92
private
:
93
QList<MapDownloadJob*> downloadJobs;
94
QNetworkAccessManager webCtrl;
95
MapManagerRef mapManager;
96
97
public
slots:
98
void
onJobFinished
();
99
void
onJobFailed
(QString errorMessage);
100
101
signals:
102
void
mapDownloadFails
(QString message);
103
void
downloadJobsChanged
();
104
105
public
:
106
MapDownloader
(MapManagerRef mapManager, SettingsRef settings);
107
108
~MapDownloader
()
override
;
109
117
void
downloadMap
(
AvailableMapsModelMap
map, QDir dir,
bool
replaceExisting =
true
);
118
void
downloadNext
();
119
120
QList<MapDownloadJob*>
getDownloadJobs
()
const
{
121
return
downloadJobs;
122
}
123
};
124
128
using
MapDownloaderRef
= std::shared_ptr<MapDownloader>;
129
130
}
131
132
#endif
/* OSMSCOUT_CLIENT_QT_MAPMANAGER_H */
AvailableMapsModel.h
ClientQtImportExport.h
OSMSCOUT_CLIENT_QT_API
#define OSMSCOUT_CLIENT_QT_API
Definition
ClientQtImportExport.h:45
FileDownloader.h
osmscout::AvailableMapsModelMap
Definition
AvailableMapsModel.h:122
osmscout::DownloadJob::DownloadJob
DownloadJob(QNetworkAccessManager *webCtrl, QDir target, bool replaceExisting)
osmscout::DownloadJob::webCtrl
QNetworkAccessManager * webCtrl
Definition
FileDownloader.h:138
osmscout::DownloadJob::target
QDir target
Definition
FileDownloader.h:140
osmscout::DownloadJob::replaceExisting
bool replaceExisting
Definition
FileDownloader.h:151
osmscout::MapDownloadJob::getMapName
QString getMapName() const
Definition
MapDownloader.h:67
osmscout::MapDownloadJob::expectedSize
uint64_t expectedSize() const override
Definition
MapDownloader.h:77
osmscout::MapDownloadJob::start
void start()
osmscout::MapDownloadJob::getMapPath
QStringList getMapPath() const
Definition
MapDownloader.h:72
osmscout::MapDownloadJob::~MapDownloadJob
~MapDownloadJob() override
osmscout::MapDownloadJob::MapDownloadJob
MapDownloadJob(QNetworkAccessManager *webCtrl, AvailableMapsModelMap map, QDir target, bool replaceExisting)
osmscout::MapDownloader::getDownloadJobs
QList< MapDownloadJob * > getDownloadJobs() const
Definition
MapDownloader.h:120
osmscout::MapDownloader::downloadNext
void downloadNext()
osmscout::MapDownloader::mapDownloadFails
void mapDownloadFails(QString message)
osmscout::MapDownloader::~MapDownloader
~MapDownloader() override
osmscout::MapDownloader::onJobFinished
void onJobFinished()
osmscout::MapDownloader::MapDownloader
MapDownloader(MapManagerRef mapManager, SettingsRef settings)
osmscout::MapDownloader::onJobFailed
void onJobFailed(QString errorMessage)
osmscout::MapDownloader::downloadJobsChanged
void downloadJobsChanged()
osmscout::MapDownloader::downloadMap
void downloadMap(AvailableMapsModelMap map, QDir dir, bool replaceExisting=true)
osmscout::MapDownloaderRef
std::shared_ptr< MapDownloader > MapDownloaderRef
Definition
MapDownloader.h:128
osmscout
Definition
Area.h:39
Generated by
1.17.0