libosmscout  1.1.1
Voice.h
Go to the documentation of this file.
1 #ifndef OSMSCOUT_CLIENT_QT_VOICE_H
2 #define OSMSCOUT_CLIENT_QT_VOICE_H
3 /*
4  OSMScout - a Qt backend for libosmscout and libosmscout-map
5  Copyright (C) 2020 Lukas Karas
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Lesser General Public
9  License as published by the Free Software Foundation; either
10  version 2.1 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public
18  License along with this library; if not, write to the Free Software
19  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21 
23 #include <osmscout/VoiceProvider.h>
24 
25 #include <QObject>
26 #include <QDir>
27 
28 namespace osmscout {
29 
30 class OSMSCOUT_CLIENT_QT_API AvailableVoice : public QObject {
31  Q_OBJECT
32 
33  Q_PROPERTY(bool valid READ isValid() CONSTANT)
34 
35  Q_PROPERTY(QString lang READ getLang() CONSTANT)
36  Q_PROPERTY(QString gender READ getGender() CONSTANT)
37  Q_PROPERTY(QString name READ getName() CONSTANT)
38  Q_PROPERTY(QString license READ getLicense() CONSTANT)
39  Q_PROPERTY(QString directory READ getDirectory() CONSTANT)
40  Q_PROPERTY(QString author READ getAuthor() CONSTANT)
41  Q_PROPERTY(QString description READ getDescription() CONSTANT)
42 
43 private:
44  bool valid{false};
45 
46  VoiceProvider provider;
47 
48  QString lang;
49  QString gender;
50  QString name;
51  QString license;
52  QString directory;
53  QString author;
54  QString description;
55 
56 public:
57  AvailableVoice() = default;
58 
59  AvailableVoice(const VoiceProvider &provider,
60  const QString &lang,
61  const QString &gender,
62  const QString &name,
63  const QString &license,
64  const QString &directory,
65  const QString &author,
66  const QString &description);
67 
69 
70  ~AvailableVoice() override = default;
71 
72  inline VoiceProvider getProvider() const
73  {
74  return provider;
75  }
76 
77  inline QString getLang() const
78  {
79  return lang;
80  }
81  inline QString getGender() const
82  {
83  return gender;
84  }
85  inline QString getName() const
86  {
87  return name;
88  }
89  inline QString getLicense() const
90  {
91  return license;
92  }
93  inline QString getDirectory() const
94  {
95  return directory;
96  }
97  inline QString getAuthor() const
98  {
99  return author;
100  }
101  inline QString getDescription() const
102  {
103  return description;
104  }
105 
106  inline bool isValid() const
107  {
108  return valid;
109  }
110 };
111 
118 {
119 public:
120  Voice() = default;
121  explicit Voice(QDir dir);
122  ~Voice() = default;
123 
124  Voice(const Voice &other) = default;
125  Voice &operator=(const Voice &other) = default;
126 
127  Voice(Voice &&other) = default;
128  Voice &operator=(Voice &&other) = default;
129 
130  QDir getDir() const
131  {
132  return dir;
133  }
134 
135  inline QString getLang() const
136  {
137  return lang;
138  }
139 
140  inline QString getGender() const
141  {
142  return gender;
143  }
144 
145  inline QString getName() const
146  {
147  return name;
148  }
149 
150  inline QString getLicense() const
151  {
152  return license;
153  }
154 
155  inline QString getAuthor() const
156  {
157  return author;
158  }
159 
160  inline QString getDescription() const
161  {
162  return description;
163  }
164 
165  inline bool isValid() const
166  {
167  return valid;
168  }
169 
170  bool deleteVoice();
171 
172  static QStringList files();
173 
174 private:
175  QDir dir;
176  bool valid{false};
177  bool metadata{false};
178 
179  QString lang;
180  QString gender;
181  QString name;
182  QString license;
183  QString author;
184  QString description;
185 };
186 
187 }
188 
189 #endif //OSMSCOUT_CLIENT_QT_VOICE_H
#define OSMSCOUT_CLIENT_QT_API
Definition: ClientQtImportExport.h:45
QString getGender() const
Definition: Voice.h:81
QString getAuthor() const
Definition: Voice.h:155
bool isValid() const
Definition: Voice.h:106
QString getDescription() const
Definition: Voice.h:160
Definition: Voice.h:117
QString getName() const
Definition: Voice.h:85
QString getLicense() const
Definition: Voice.h:150
QString getAuthor() const
Definition: Voice.h:97
VoiceProvider getProvider() const
Definition: Voice.h:72
QString getGender() const
Definition: Voice.h:140
QString getName() const
Definition: Voice.h:145
Definition: Area.h:38
QString getLang() const
Definition: Voice.h:77
bool isValid() const
Definition: Voice.h:165
Definition: Voice.h:30
Definition: VoiceProvider.h:38
QDir getDir() const
Definition: Voice.h:130
QString getLicense() const
Definition: Voice.h:89
QString getLang() const
Definition: Voice.h:135
QString getDescription() const
Definition: Voice.h:101
QString getDirectory() const
Definition: Voice.h:93