libosmscout
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libosmscout-client-qt
include
osmscoutclientqt
VoiceManager.h
Go to the documentation of this file.
1
#ifndef OSMSCOUT_CLIENT_QT_VOICEMANAGER_H
2
#define OSMSCOUT_CLIENT_QT_VOICEMANAGER_H
3
4
/*
5
OSMScout - a Qt backend for libosmscout and libosmscout-map
6
Copyright (C) 2020 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 <QObject>
24
25
#include <
osmscoutclientqt/FileDownloader.h
>
26
#include <
osmscoutclientqt/ClientQtImportExport.h
>
27
#include <
osmscoutclientqt/Voice.h
>
28
29
#include <memory>
30
31
namespace
osmscout
{
32
38
class
OSMSCOUT_CLIENT_QT_API
VoiceDownloadJob
:
public
DownloadJob
39
{
40
Q_OBJECT
41
42
public
:
43
VoiceDownloadJob
(QNetworkAccessManager *
webCtrl
,
44
const
AvailableVoice
&voice,
45
const
QDir &
target
,
46
bool
replaceExisting
);
47
48
virtual
~VoiceDownloadJob
();
49
50
void
start
();
51
52
uint64_t
expectedSize
()
const override
53
{
54
return
0;
55
}
56
57
AvailableVoice
getVoice
()
const
58
{
59
return
voice;
60
}
61
62
private
:
63
AvailableVoice
voice;
64
};
65
66
72
class
OSMSCOUT_CLIENT_QT_API
VoiceManager
:
public
QObject {
73
Q_OBJECT
74
75
signals:
76
void
reloaded
();
77
78
void
startDownloading
(
const
AvailableVoice
&item);
79
void
downloaded
(
const
AvailableVoice
&item);
80
void
removed
(
const
AvailableVoice
&item);
81
82
void
voiceDownloadFails
(
const
QString &errorMessage);
83
84
public
slots:
85
void
reload
();
86
87
void
download
(
const
AvailableVoice
&item);
88
void
remove
(
const
AvailableVoice
&item);
89
void
cancelDownload
(
const
AvailableVoice
&item);
90
91
void
onJobFinished
();
92
void
onJobFailed
(QString errorMessage);
93
94
public
:
95
VoiceManager
();
96
97
VoiceManager
(
const
VoiceManager
&) =
delete
;
98
VoiceManager
(
VoiceManager
&&) =
delete
;
99
100
VoiceManager
&
operator=
(
const
VoiceManager
&) =
delete
;
101
VoiceManager
&
operator=
(
VoiceManager
&&) =
delete
;
102
103
~VoiceManager
()
override
;
104
105
QList<Voice>
getInstalledVoices
()
const
106
{
107
return
installedVoices;
108
}
109
110
bool
isDownloaded
(
const
AvailableVoice
&voice)
const
;
111
bool
isDownloading
(
const
AvailableVoice
&voice)
const
;
112
113
void
downloadNext
();
114
115
private
:
116
QList<Voice> installedVoices;
117
QList<VoiceDownloadJob*> downloadJobs;
118
QNetworkAccessManager webCtrl;
119
QString lookupDir;
120
};
121
125
using
VoiceManagerRef
= std::shared_ptr<VoiceManager>;
126
127
}
128
#endif
//OSMSCOUT_CLIENT_QT_VOICEMANAGER_H
ClientQtImportExport.h
OSMSCOUT_CLIENT_QT_API
#define OSMSCOUT_CLIENT_QT_API
Definition
ClientQtImportExport.h:45
FileDownloader.h
Voice.h
osmscout::AvailableVoice
Definition
Voice.h:31
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::VoiceDownloadJob::start
void start()
osmscout::VoiceDownloadJob::getVoice
AvailableVoice getVoice() const
Definition
VoiceManager.h:57
osmscout::VoiceDownloadJob::expectedSize
uint64_t expectedSize() const override
Definition
VoiceManager.h:52
osmscout::VoiceDownloadJob::VoiceDownloadJob
VoiceDownloadJob(QNetworkAccessManager *webCtrl, const AvailableVoice &voice, const QDir &target, bool replaceExisting)
osmscout::VoiceDownloadJob::~VoiceDownloadJob
virtual ~VoiceDownloadJob()
osmscout::VoiceManager::reload
void reload()
osmscout::VoiceManager::getInstalledVoices
QList< Voice > getInstalledVoices() const
Definition
VoiceManager.h:105
osmscout::VoiceManager::removed
void removed(const AvailableVoice &item)
osmscout::VoiceManager::startDownloading
void startDownloading(const AvailableVoice &item)
osmscout::VoiceManager::onJobFinished
void onJobFinished()
osmscout::VoiceManager::operator=
VoiceManager & operator=(VoiceManager &&)=delete
osmscout::VoiceManager::VoiceManager
VoiceManager()
osmscout::VoiceManager::downloaded
void downloaded(const AvailableVoice &item)
osmscout::VoiceManager::isDownloading
bool isDownloading(const AvailableVoice &voice) const
osmscout::VoiceManager::VoiceManager
VoiceManager(VoiceManager &&)=delete
osmscout::VoiceManager::isDownloaded
bool isDownloaded(const AvailableVoice &voice) const
osmscout::VoiceManager::cancelDownload
void cancelDownload(const AvailableVoice &item)
osmscout::VoiceManager::reloaded
void reloaded()
osmscout::VoiceManager::~VoiceManager
~VoiceManager() override
osmscout::VoiceManager::remove
void remove(const AvailableVoice &item)
osmscout::VoiceManager::VoiceManager
VoiceManager(const VoiceManager &)=delete
osmscout::VoiceManager::onJobFailed
void onJobFailed(QString errorMessage)
osmscout::VoiceManager::voiceDownloadFails
void voiceDownloadFails(const QString &errorMessage)
osmscout::VoiceManager::operator=
VoiceManager & operator=(const VoiceManager &)=delete
osmscout::VoiceManager::downloadNext
void downloadNext()
osmscout::VoiceManager::download
void download(const AvailableVoice &item)
osmscout::VoiceManagerRef
std::shared_ptr< VoiceManager > VoiceManagerRef
Definition
VoiceManager.h:125
osmscout
Definition
Area.h:39
Generated by
1.17.0