diff options
Diffstat (limited to 'rbutil/rbutilqt/rbsettings.cpp')
-rw-r--r-- | rbutil/rbutilqt/rbsettings.cpp | 556 |
1 files changed, 133 insertions, 423 deletions
diff --git a/rbutil/rbutilqt/rbsettings.cpp b/rbutil/rbutilqt/rbsettings.cpp index 5a60a67c1b..12654cd288 100644 --- a/rbutil/rbutilqt/rbsettings.cpp +++ b/rbutil/rbutilqt/rbsettings.cpp | |||
@@ -25,10 +25,79 @@ | |||
25 | #include <unistd.h> | 25 | #include <unistd.h> |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | // device settings | ||
29 | const static struct { | ||
30 | RbSettings::SystemSettings setting; | ||
31 | const char* name; | ||
32 | const char* def; | ||
33 | } SystemSettingsList[] = { | ||
34 | { RbSettings::ManualUrl, "manual_url", "" }, | ||
35 | { RbSettings::BleedingUrl, "bleeding_url", "" }, | ||
36 | { RbSettings::BootloaderUrl, "bootloader_url", "" }, | ||
37 | { RbSettings::BootloaderInfoUrl, "bootloader_info_url", "" }, | ||
38 | { RbSettings::FontUrl, "font_url", "" }, | ||
39 | { RbSettings::VoiceUrl, "voice_url", "" }, | ||
40 | { RbSettings::DoomUrl, "doom_url", "" }, | ||
41 | { RbSettings::ReleaseUrl, "release_url", "" }, | ||
42 | { RbSettings::DailyUrl, "daily_url", "" }, | ||
43 | { RbSettings::ServerConfUrl, "server_conf_url", "" }, | ||
44 | { RbSettings::GenlangUrl, "genlang_url", "" }, | ||
45 | { RbSettings::ThemesUrl, "themes_url", "" }, | ||
46 | { RbSettings::BleedingInfo, "bleeding_info", "" }, | ||
47 | { RbSettings::CurPlatformName, ":platform:/name", "" }, | ||
48 | { RbSettings::CurManual, ":platform:/manual", "rockbox-:platform:" }, | ||
49 | { RbSettings::CurBootloaderMethod, ":platform:/bootloadermethod", "none" }, | ||
50 | { RbSettings::CurBootloaderName, ":platform:/bootloadername", "" }, | ||
51 | { RbSettings::CurBootloaderFile, ":platform:/bootloaderfile", "" }, | ||
52 | { RbSettings::CurEncoder, ":platform:/encoder", "" }, | ||
53 | { RbSettings::CurResolution, ":platform:/resolution", "" }, | ||
54 | { RbSettings::CurBrand, ":platform:/brand", "" }, | ||
55 | { RbSettings::CurName, ":platform:/name", "" }, | ||
56 | { RbSettings::CurBuildserverModel, ":platform:/buildserver_modelname", "" }, | ||
57 | { RbSettings::CurConfigureModel, ":platform:/configure_modelname", "" }, | ||
58 | { RbSettings::CurTargetId, ":platform:/targetid", "" }, | ||
59 | }; | ||
60 | |||
61 | // user settings | ||
62 | const static struct { | ||
63 | RbSettings::UserSettings setting; | ||
64 | const char* name; | ||
65 | const char* def; | ||
66 | } UserSettingsList[] = { | ||
67 | { RbSettings::RbutilVersion, "rbutil_version", "" }, | ||
68 | { RbSettings::CurrentPlatform, "platform", "" }, | ||
69 | { RbSettings::Mountpoint, "mountpoint", "" }, | ||
70 | { RbSettings::CachePath, "cachepath", "" }, | ||
71 | { RbSettings::Build, "build", "" }, | ||
72 | { RbSettings::ProxyType, "proxytype", "" }, | ||
73 | { RbSettings::Proxy, "proxy", "" }, | ||
74 | { RbSettings::OfPath, "ofpath", "" }, | ||
75 | { RbSettings::Platform, "platform", "" }, | ||
76 | { RbSettings::Language, "lang", "" }, | ||
77 | { RbSettings::Tts, "tts", "" }, | ||
78 | { RbSettings::LastTalkedFolder, "last_talked_folder", "" }, | ||
79 | { RbSettings::VoiceLanguage, "voicelanguage", "" }, | ||
80 | { RbSettings::TtsLanguage, ":tts:/language", "" }, | ||
81 | { RbSettings::TtsOptions, ":tts:/options", "" }, | ||
82 | { RbSettings::TtsPath, ":tts:/path", "" }, | ||
83 | { RbSettings::TtsVoice, ":tts:/voice", "" }, | ||
84 | { RbSettings::EncoderPath, ":encoder:/encoderpath", "" }, | ||
85 | { RbSettings::EncoderOptions, ":encoder:/encoderoptions", "" }, | ||
86 | { RbSettings::CacheOffline, "offline", "false" }, | ||
87 | { RbSettings::CacheDisabled, "cachedisable", "false" }, | ||
88 | { RbSettings::TtsUseSapi4, "sapi/useSapi4", "false" }, | ||
89 | { RbSettings::EncoderNarrowBand, ":encoder:/narrowband", "false" }, | ||
90 | { RbSettings::WavtrimThreshold, "wavtrimthreshold", "500"}, | ||
91 | { RbSettings::TtsSpeed, ":tts:/speed", "0" }, | ||
92 | { RbSettings::EncoderComplexity, ":encoder:/complexity", "10" }, | ||
93 | { RbSettings::EncoderQuality, ":encoder:/quality", "8.0" }, | ||
94 | { RbSettings::EncoderVolume, ":encoder:/volume", "1.0" }, | ||
95 | }; | ||
96 | |||
28 | void RbSettings::open() | 97 | void RbSettings::open() |
29 | { | 98 | { |
30 | // only use built-in rbutil.ini | 99 | // only use built-in rbutil.ini |
31 | devices = new QSettings(":/ini/rbutil.ini", QSettings::IniFormat, 0); | 100 | systemSettings = new QSettings(":/ini/rbutil.ini", QSettings::IniFormat, 0); |
32 | // portable installation: | 101 | // portable installation: |
33 | // check for a configuration file in the program folder. | 102 | // check for a configuration file in the program folder. |
34 | QFileInfo config; | 103 | QFileInfo config; |
@@ -74,331 +143,99 @@ void RbSettings::sync() | |||
74 | #endif | 143 | #endif |
75 | } | 144 | } |
76 | 145 | ||
77 | QVariant RbSettings::deviceSettingCurGet(QString entry,QString def) | ||
78 | { | ||
79 | QString platform = userSettings->value("platform").toString(); | ||
80 | devices->beginGroup(platform); | ||
81 | QVariant result = devices->value(entry,def); | ||
82 | devices->endGroup(); | ||
83 | return result; | ||
84 | } | ||
85 | 146 | ||
86 | QVariant RbSettings::userSettingsGroupGet(QString group,QString entry,QVariant def) | 147 | QVariant RbSettings::value(enum SystemSettings setting) |
87 | { | 148 | { |
88 | userSettings->beginGroup(group); | 149 | // locate setting item |
89 | QVariant result = userSettings->value(entry,def); | 150 | int i = 0; |
90 | userSettings->endGroup(); | 151 | while(SystemSettingsList[i].setting != setting) |
91 | return result; | 152 | i++; |
92 | } | ||
93 | 153 | ||
94 | void RbSettings::userSettingsGroupSet(QString group,QString entry,QVariant value) | 154 | QString s = constructSettingPath(SystemSettingsList[i].name); |
95 | { | 155 | QString d = SystemSettingsList[i].def; |
96 | userSettings->beginGroup(group); | 156 | d.replace(":platform:", userSettings->value("platform").toString()); |
97 | userSettings->setValue(entry,value); | 157 | qDebug() << "[Settings] GET S:" << s << systemSettings->value(s, d).toString(); |
98 | userSettings->endGroup(); | 158 | return systemSettings->value(s, d); |
99 | } | 159 | } |
100 | 160 | ||
161 | |||
101 | QString RbSettings::userSettingFilename() | 162 | QString RbSettings::userSettingFilename() |
102 | { | 163 | { |
103 | return userSettings->fileName(); | 164 | return userSettings->fileName(); |
104 | } | 165 | } |
105 | 166 | ||
106 | QString RbSettings::curVersion() | ||
107 | { | ||
108 | return userSettings->value("rbutil_version").toString(); | ||
109 | } | ||
110 | |||
111 | bool RbSettings::cacheOffline() | ||
112 | { | ||
113 | return userSettings->value("offline").toBool(); | ||
114 | } | ||
115 | |||
116 | QString RbSettings::mountpoint() | ||
117 | { | ||
118 | return userSettings->value("mountpoint").toString(); | ||
119 | } | ||
120 | |||
121 | QString RbSettings::manualUrl() | ||
122 | { | ||
123 | return devices->value("manual_url").toString(); | ||
124 | } | ||
125 | |||
126 | QString RbSettings::bleedingUrl() | ||
127 | { | ||
128 | return devices->value("bleeding_url").toString(); | ||
129 | } | ||
130 | |||
131 | QString RbSettings::cachePath() | ||
132 | { | ||
133 | return userSettings->value("cachepath", QDir::tempPath()).toString(); | ||
134 | } | ||
135 | |||
136 | QString RbSettings::build() | ||
137 | { | ||
138 | return userSettings->value("build").toString(); | ||
139 | } | ||
140 | |||
141 | QString RbSettings::bootloaderUrl() | ||
142 | { | ||
143 | return devices->value("bootloader_url").toString(); | ||
144 | } | ||
145 | |||
146 | QString RbSettings::bootloaderInfoUrl() | ||
147 | { | ||
148 | return devices->value("bootloader_info_url").toString(); | ||
149 | } | ||
150 | |||
151 | QString RbSettings::fontUrl() | ||
152 | { | ||
153 | return devices->value("font_url").toString(); | ||
154 | } | ||
155 | |||
156 | QString RbSettings::voiceUrl() | ||
157 | { | ||
158 | return devices->value("voice_url").toString(); | ||
159 | } | ||
160 | |||
161 | QString RbSettings::doomUrl() | ||
162 | { | ||
163 | return devices->value("doom_url").toString(); | ||
164 | } | ||
165 | |||
166 | QString RbSettings::releaseUrl() | ||
167 | { | ||
168 | return devices->value("release_url").toString(); | ||
169 | } | ||
170 | |||
171 | QString RbSettings::dailyUrl() | ||
172 | { | ||
173 | return devices->value("daily_url").toString(); | ||
174 | } | ||
175 | |||
176 | QString RbSettings::serverConfUrl() | ||
177 | { | ||
178 | return devices->value("server_conf_url").toString(); | ||
179 | } | ||
180 | |||
181 | QString RbSettings::genlangUrl() | ||
182 | { | ||
183 | return devices->value("genlang_url").toString(); | ||
184 | } | ||
185 | |||
186 | QString RbSettings::themeUrl() | ||
187 | { | ||
188 | return devices->value("themes_url").toString(); | ||
189 | } | ||
190 | |||
191 | QString RbSettings::bleedingInfo() | ||
192 | { | ||
193 | return devices->value("bleeding_info").toString(); | ||
194 | } | ||
195 | |||
196 | bool RbSettings::cacheDisabled() | ||
197 | { | ||
198 | return userSettings->value("cachedisable").toBool(); | ||
199 | } | ||
200 | |||
201 | QString RbSettings::proxyType() | ||
202 | { | ||
203 | return userSettings->value("proxytype", "none").toString(); | ||
204 | } | ||
205 | |||
206 | QString RbSettings::proxy() | ||
207 | { | ||
208 | return userSettings->value("proxy").toString(); | ||
209 | } | ||
210 | |||
211 | QString RbSettings::ofPath() | ||
212 | { | ||
213 | return userSettings->value("ofpath").toString(); | ||
214 | } | ||
215 | |||
216 | QString RbSettings::curBrand() | ||
217 | { | ||
218 | QString platform = userSettings->value("platform").toString(); | ||
219 | return brand(platform); | ||
220 | } | ||
221 | |||
222 | QString RbSettings::curName() | ||
223 | { | ||
224 | QString platform = userSettings->value("platform").toString(); | ||
225 | return name(platform); | ||
226 | } | ||
227 | |||
228 | QString RbSettings::curPlatform() | ||
229 | { | ||
230 | return userSettings->value("platform").toString(); | ||
231 | } | ||
232 | |||
233 | QString RbSettings::curBuildserver_Modelname() | ||
234 | { | ||
235 | return deviceSettingCurGet("buildserver_modelname").toString(); | ||
236 | } | ||
237 | |||
238 | QString RbSettings::curManual() | ||
239 | { | ||
240 | return deviceSettingCurGet("manualname","rockbox-" + | ||
241 | devices->value("platform").toString()).toString(); | ||
242 | } | ||
243 | |||
244 | QString RbSettings::curBootloaderMethod() | ||
245 | { | ||
246 | return deviceSettingCurGet("bootloadermethod", "none").toString(); | ||
247 | } | ||
248 | |||
249 | QString RbSettings::curBootloaderName() | ||
250 | { | ||
251 | return deviceSettingCurGet("bootloadername").toString(); | ||
252 | } | ||
253 | |||
254 | QString RbSettings::curBootloaderFile() | ||
255 | { | ||
256 | return deviceSettingCurGet("bootloaderfile").toString(); | ||
257 | } | ||
258 | |||
259 | QString RbSettings::curConfigure_Modelname() | ||
260 | { | ||
261 | return deviceSettingCurGet("configure_modelname").toString(); | ||
262 | } | ||
263 | |||
264 | QString RbSettings::curLang() | ||
265 | { | ||
266 | // QSettings::value only returns the default when the setting | ||
267 | // doesn't exist. Make sure to return the system language if | ||
268 | // the language in the configuration is present but empty too. | ||
269 | QString lang = userSettings->value("lang").toString(); | ||
270 | if(lang.isEmpty()) | ||
271 | lang = QLocale::system().name(); | ||
272 | return lang; | ||
273 | } | ||
274 | |||
275 | QString RbSettings::curEncoder() | ||
276 | { | ||
277 | return deviceSettingCurGet("encoder").toString(); | ||
278 | } | ||
279 | |||
280 | QString RbSettings::curTTS() | ||
281 | { | ||
282 | return userSettings->value("tts").toString(); | ||
283 | } | ||
284 | 167 | ||
285 | QString RbSettings::lastTalkedFolder() | 168 | QVariant RbSettings::subValue(QString& sub, enum UserSettings setting) |
286 | { | 169 | { |
287 | return userSettings->value("last_talked_folder").toString(); | 170 | // locate setting item |
288 | } | 171 | int i = 0; |
172 | while(UserSettingsList[i].setting != setting) | ||
173 | i++; | ||
289 | 174 | ||
290 | QString RbSettings::voiceLanguage() | 175 | QString s = constructSettingPath(UserSettingsList[i].name, sub); |
291 | { | 176 | qDebug() << "[Settings] GET U:" << s << userSettings->value(s).toString(); |
292 | return userSettings->value("voicelanguage").toString(); | 177 | return userSettings->value(s, UserSettingsList[i].def); |
293 | } | 178 | } |
294 | 179 | ||
295 | int RbSettings::wavtrimTh() | ||
296 | { | ||
297 | return userSettings->value("wavtrimthreshold",500).toInt(); | ||
298 | } | ||
299 | 180 | ||
300 | QString RbSettings::ttsPath(QString tts) | 181 | void RbSettings::setSubValue(QString& sub, enum UserSettings setting, QVariant value) |
301 | { | ||
302 | return userSettingsGroupGet(tts,"ttspath").toString(); | ||
303 | } | ||
304 | QString RbSettings::ttsOptions(QString tts) | ||
305 | { | 182 | { |
306 | return userSettingsGroupGet(tts,"ttsoptions").toString(); | 183 | // locate setting item |
307 | } | 184 | int i = 0; |
308 | QString RbSettings::ttsVoice(QString tts) | 185 | while(UserSettingsList[i].setting != setting) |
309 | { | 186 | i++; |
310 | return userSettingsGroupGet(tts,"ttsvoice","Microsoft Sam").toString(); | ||
311 | } | ||
312 | int RbSettings::ttsSpeed(QString tts) | ||
313 | { | ||
314 | return userSettingsGroupGet(tts,"ttsspeed",0).toInt(); | ||
315 | } | ||
316 | QString RbSettings::ttsLang(QString tts) | ||
317 | { | ||
318 | return userSettingsGroupGet(tts,"ttslanguage","english").toString(); | ||
319 | } | ||
320 | 187 | ||
321 | bool RbSettings::ttsUseSapi4() | 188 | QString s = constructSettingPath(UserSettingsList[i].name, sub); |
322 | { | 189 | qDebug() << "[Settings] SET U:" << s << userSettings->value(s).toString(); |
323 | return userSettingsGroupGet("sapi","useSapi4",false).toBool(); | 190 | userSettings->setValue(s, value); |
324 | } | 191 | } |
325 | 192 | ||
326 | QString RbSettings::encoderPath(QString enc) | ||
327 | { | ||
328 | return userSettingsGroupGet(enc,"encoderpath").toString(); | ||
329 | } | ||
330 | QString RbSettings::encoderOptions(QString enc) | ||
331 | { | ||
332 | return userSettingsGroupGet(enc,"encoderoptions").toString(); | ||
333 | } | ||
334 | 193 | ||
335 | double RbSettings::encoderQuality(QString enc) | ||
336 | { | ||
337 | return userSettingsGroupGet(enc,"quality",8.f).toDouble(); | ||
338 | } | ||
339 | int RbSettings::encoderComplexity(QString enc) | ||
340 | { | ||
341 | return userSettingsGroupGet(enc,"complexity",10).toInt(); | ||
342 | } | ||
343 | double RbSettings::encoderVolume(QString enc) | ||
344 | { | ||
345 | return userSettingsGroupGet(enc,"volume",1.f).toDouble(); | ||
346 | } | ||
347 | bool RbSettings::encoderNarrowband(QString enc) | ||
348 | { | ||
349 | return userSettingsGroupGet(enc,"narrowband",false).toBool(); | ||
350 | } | ||
351 | 194 | ||
352 | QStringList RbSettings::allPlatforms() | 195 | QStringList RbSettings::platforms() |
353 | { | 196 | { |
354 | QStringList result; | 197 | QStringList result; |
355 | devices->beginGroup("platforms"); | 198 | systemSettings->beginGroup("platforms"); |
356 | QStringList a = devices->childKeys(); | 199 | QStringList a = systemSettings->childKeys(); |
357 | for(int i = 0; i < a.size(); i++) | 200 | for(int i = 0; i < a.size(); i++) |
358 | { | 201 | { |
359 | result.append(devices->value(a.at(i), "null").toString()); | 202 | result.append(systemSettings->value(a.at(i), "null").toString()); |
360 | } | 203 | } |
361 | devices->endGroup(); | 204 | systemSettings->endGroup(); |
362 | return result; | 205 | return result; |
363 | } | 206 | } |
364 | 207 | ||
365 | QStringList RbSettings::allLanguages() | 208 | QStringList RbSettings::languages() |
366 | { | 209 | { |
367 | QStringList result; | 210 | QStringList result; |
368 | devices->beginGroup("languages"); | 211 | systemSettings->beginGroup("languages"); |
369 | QStringList a = devices->childKeys(); | 212 | QStringList a = systemSettings->childKeys(); |
370 | for(int i = 0; i < a.size(); i++) | 213 | for(int i = 0; i < a.size(); i++) |
371 | { | 214 | { |
372 | result.append(devices->value(a.at(i), "null").toString()); | 215 | result.append(systemSettings->value(a.at(i), "null").toString()); |
373 | } | 216 | } |
374 | devices->endGroup(); | 217 | systemSettings->endGroup(); |
375 | return result; | 218 | return result; |
376 | } | 219 | } |
377 | 220 | ||
378 | QString RbSettings::name(QString plattform) | 221 | QString RbSettings::name(QString platform) |
379 | { | 222 | { |
380 | devices->beginGroup(plattform); | 223 | return systemSettings->value(platform + "/name").toString(); |
381 | QString name = devices->value("name").toString(); | ||
382 | devices->endGroup(); | ||
383 | return name; | ||
384 | } | 224 | } |
385 | 225 | ||
386 | QString RbSettings::brand(QString plattform) | 226 | QString RbSettings::brand(QString platform) |
387 | { | 227 | { |
388 | devices->beginGroup(plattform); | 228 | return systemSettings->value(platform + "/brand").toString(); |
389 | QString brand = devices->value("brand").toString(); | ||
390 | devices->endGroup(); | ||
391 | return brand; | ||
392 | } | 229 | } |
393 | 230 | ||
394 | QMap<int, QString> RbSettings::usbIdMap(enum MapType type) | 231 | QMap<int, QString> RbSettings::usbIdMap(enum MapType type) |
395 | { | 232 | { |
396 | QMap<int, QString> map; | 233 | QMap<int, QString> map; |
397 | // get a list of ID -> target name | 234 | // get a list of ID -> target name |
398 | QStringList platforms; | 235 | QStringList platforms; |
399 | devices->beginGroup("platforms"); | 236 | systemSettings->beginGroup("platforms"); |
400 | platforms = devices->childKeys(); | 237 | platforms = systemSettings->childKeys(); |
401 | devices->endGroup(); | 238 | systemSettings->endGroup(); |
402 | 239 | ||
403 | QString t; | 240 | QString t; |
404 | switch(type) { | 241 | switch(type) { |
@@ -415,161 +252,34 @@ QMap<int, QString> RbSettings::usbIdMap(enum MapType type) | |||
415 | 252 | ||
416 | for(int i = 0; i < platforms.size(); i++) | 253 | for(int i = 0; i < platforms.size(); i++) |
417 | { | 254 | { |
418 | devices->beginGroup("platforms"); | 255 | systemSettings->beginGroup("platforms"); |
419 | QString target = devices->value(platforms.at(i)).toString(); | 256 | QString target = systemSettings->value(platforms.at(i)).toString(); |
420 | devices->endGroup(); | 257 | systemSettings->endGroup(); |
421 | devices->beginGroup(target); | 258 | systemSettings->beginGroup(target); |
422 | QStringList ids = devices->value(t).toStringList(); | 259 | QStringList ids = systemSettings->value(t).toStringList(); |
423 | int j = ids.size(); | 260 | int j = ids.size(); |
424 | while(j--) | 261 | while(j--) |
425 | map.insert(ids.at(j).toInt(0, 16), target); | 262 | map.insert(ids.at(j).toInt(0, 16), target); |
426 | 263 | ||
427 | devices->endGroup(); | 264 | systemSettings->endGroup(); |
428 | } | 265 | } |
429 | return map; | 266 | return map; |
430 | } | 267 | } |
431 | 268 | ||
432 | 269 | ||
433 | QString RbSettings::curResolution() | 270 | QString RbSettings::constructSettingPath(QString path, QString substitute) |
434 | { | ||
435 | return deviceSettingCurGet("resolution").toString(); | ||
436 | } | ||
437 | |||
438 | int RbSettings::curTargetId() | ||
439 | { | ||
440 | return deviceSettingCurGet("targetid").toInt(); | ||
441 | } | ||
442 | |||
443 | void RbSettings::setCurVersion(QString version) | ||
444 | { | ||
445 | userSettings->setValue("rbutil_version",version); | ||
446 | } | ||
447 | |||
448 | void RbSettings::setOfPath(QString path) | ||
449 | { | ||
450 | userSettings->setValue("ofpath",path); | ||
451 | } | ||
452 | |||
453 | void RbSettings::setCachePath(QString path) | ||
454 | { | ||
455 | userSettings->setValue("cachepath", path); | ||
456 | } | ||
457 | |||
458 | void RbSettings::setBuild(QString build) | ||
459 | { | ||
460 | userSettings->setValue("build", build); | ||
461 | } | ||
462 | |||
463 | void RbSettings::setLastTalkedDir(QString dir) | ||
464 | { | ||
465 | userSettings->setValue("last_talked_folder", dir); | ||
466 | } | ||
467 | |||
468 | void RbSettings::setVoiceLanguage(QString dir) | ||
469 | { | ||
470 | userSettings->setValue("voicelanguage", dir); | ||
471 | } | ||
472 | |||
473 | void RbSettings::setWavtrimTh(int th) | ||
474 | { | 271 | { |
475 | userSettings->setValue("wavtrimthreshold", th); | 272 | QString platform = userSettings->value("platform").toString(); |
476 | } | 273 | if(!substitute.isEmpty()) { |
477 | 274 | path.replace(":tts:", substitute); | |
478 | void RbSettings::setProxy(QString proxy) | 275 | path.replace(":encoder:", substitute); |
479 | { | 276 | } |
480 | userSettings->setValue("proxy", proxy); | 277 | else { |
481 | } | 278 | path.replace(":tts:", userSettings->value("tts").toString()); |
482 | 279 | path.replace(":encoder:", systemSettings->value(platform + "/encoder").toString()); | |
483 | void RbSettings::setProxyType(QString proxytype) | 280 | } |
484 | { | 281 | path.replace(":platform:", platform); |
485 | userSettings->setValue("proxytype", proxytype); | ||
486 | } | ||
487 | |||
488 | void RbSettings::setLang(QString lang) | ||
489 | { | ||
490 | userSettings->setValue("lang", lang); | ||
491 | } | ||
492 | |||
493 | void RbSettings::setMountpoint(QString mp) | ||
494 | { | ||
495 | userSettings->setValue("mountpoint",mp); | ||
496 | } | ||
497 | |||
498 | void RbSettings::setCurPlatform(QString platt) | ||
499 | { | ||
500 | userSettings->setValue("platform",platt); | ||
501 | } | ||
502 | |||
503 | |||
504 | void RbSettings::setCacheDisable(bool on) | ||
505 | { | ||
506 | userSettings->setValue("cachedisable",on); | ||
507 | } | ||
508 | |||
509 | void RbSettings::setCacheOffline(bool on) | ||
510 | { | ||
511 | userSettings->setValue("offline",on); | ||
512 | } | ||
513 | |||
514 | void RbSettings::setCurTTS(QString tts) | ||
515 | { | ||
516 | userSettings->setValue("tts",tts); | ||
517 | } | ||
518 | |||
519 | void RbSettings::setTTSPath(QString tts, QString path) | ||
520 | { | ||
521 | userSettingsGroupSet(tts,"ttspath",path); | ||
522 | } | ||
523 | |||
524 | void RbSettings::setTTSOptions(QString tts, QString options) | ||
525 | { | ||
526 | userSettingsGroupSet(tts,"ttsoptions",options); | ||
527 | } | ||
528 | |||
529 | void RbSettings::setTTSVoice(QString tts, QString voice) | ||
530 | { | ||
531 | userSettingsGroupSet(tts,"ttsvoice",voice); | ||
532 | } | ||
533 | |||
534 | void RbSettings::setTTSSpeed(QString tts, int speed) | ||
535 | { | ||
536 | userSettingsGroupSet(tts,"ttsspeed",speed); | ||
537 | } | ||
538 | |||
539 | void RbSettings::setTTSLang(QString tts, QString lang) | ||
540 | { | ||
541 | userSettingsGroupSet(tts,"ttslanguage",lang); | ||
542 | } | ||
543 | |||
544 | void RbSettings::setTTSUseSapi4(bool value) | ||
545 | { | ||
546 | userSettingsGroupSet("sapi","useSapi4",value); | ||
547 | } | ||
548 | |||
549 | void RbSettings::setEncoderPath(QString enc, QString path) | ||
550 | { | ||
551 | userSettingsGroupSet(enc,"encoderpath",path); | ||
552 | } | ||
553 | |||
554 | void RbSettings::setEncoderOptions(QString enc, QString options) | ||
555 | { | ||
556 | userSettingsGroupSet(enc,"encoderoptions",options); | ||
557 | } | ||
558 | 282 | ||
559 | void RbSettings::setEncoderQuality(QString enc, double q) | 283 | return path; |
560 | { | ||
561 | userSettingsGroupSet(enc,"quality",q); | ||
562 | } | ||
563 | void RbSettings::setEncoderComplexity(QString enc, int c) | ||
564 | { | ||
565 | userSettingsGroupSet(enc,"complexity",c); | ||
566 | } | ||
567 | void RbSettings::setEncoderVolume(QString enc,double v) | ||
568 | { | ||
569 | userSettingsGroupSet(enc,"volume",v); | ||
570 | } | ||
571 | void RbSettings::setEncoderNarrowband(QString enc,bool nb) | ||
572 | { | ||
573 | userSettingsGroupSet(enc,"narrowband",nb); | ||
574 | } | 284 | } |
575 | 285 | ||