diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2009-04-29 20:58:47 +0000 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2009-04-29 20:58:47 +0000 |
commit | 3d2e42ab4cc6306db4036983badea0c92750210b (patch) | |
tree | dd4303f36be8df6c4f808878da00963cb7316415 | |
parent | 3c5e67516bfab95afc26f618840ca3db67998028 (diff) | |
download | rockbox-3d2e42ab4cc6306db4036983badea0c92750210b.tar.gz rockbox-3d2e42ab4cc6306db4036983badea0c92750210b.zip |
Completely rework RbSettings class.
- use a single member function for accessing a settings value.
- use an enum to figure the correct value in the settings file instead of functions.
- return the settings value as QVariant instead and leave converting to the caller.
- accept QVariant as value when setting values.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20823 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | rbutil/rbutilqt/base/detect.cpp | 7 | ||||
-rw-r--r-- | rbutil/rbutilqt/configure.cpp | 74 | ||||
-rw-r--r-- | rbutil/rbutilqt/createvoicewindow.cpp | 20 | ||||
-rw-r--r-- | rbutil/rbutilqt/encoders.cpp | 22 | ||||
-rw-r--r-- | rbutil/rbutilqt/encodersgui.cpp | 24 | ||||
-rw-r--r-- | rbutil/rbutilqt/install.cpp | 38 | ||||
-rw-r--r-- | rbutil/rbutilqt/installtalkwindow.cpp | 10 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbsettings.cpp | 556 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbsettings.h | 171 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.cpp | 174 | ||||
-rw-r--r-- | rbutil/rbutilqt/talkfile.cpp | 160 | ||||
-rw-r--r-- | rbutil/rbutilqt/themesinstallwindow.cpp | 20 | ||||
-rw-r--r-- | rbutil/rbutilqt/tts.cpp | 43 | ||||
-rw-r--r-- | rbutil/rbutilqt/ttsgui.cpp | 59 | ||||
-rw-r--r-- | rbutil/rbutilqt/uninstallwindow.cpp | 2 | ||||
-rw-r--r-- | rbutil/rbutilqt/voicefile.cpp | 7 |
16 files changed, 552 insertions, 835 deletions
diff --git a/rbutil/rbutilqt/base/detect.cpp b/rbutil/rbutilqt/base/detect.cpp index 74068618f6..df1cf50647 100644 --- a/rbutil/rbutilqt/base/detect.cpp +++ b/rbutil/rbutilqt/base/detect.cpp | |||
@@ -401,12 +401,13 @@ QString Detect::check(RbSettings* settings, bool permission) | |||
401 | } | 401 | } |
402 | 402 | ||
403 | // Check TargetId | 403 | // Check TargetId |
404 | QString installed = installedTarget(settings->mountpoint()); | 404 | QString installed = installedTarget(settings->value(RbSettings::Mountpoint).toString()); |
405 | if(!installed.isEmpty() && installed != settings->curConfigure_Modelname()) | 405 | if(!installed.isEmpty() && installed != settings->value(RbSettings::CurConfigureModel).toString()) |
406 | { | 406 | { |
407 | text += QObject::tr("<li>Target mismatch detected.\n" | 407 | text += QObject::tr("<li>Target mismatch detected.\n" |
408 | "Installed target: %1, selected target: %2.</li>") | 408 | "Installed target: %1, selected target: %2.</li>") |
409 | .arg(installed, settings->curName()); | 409 | .arg(installed, settings->value(RbSettings::CurPlatformName).toString()); |
410 | // FIXME: replace installed by human-friendly name | ||
410 | } | 411 | } |
411 | 412 | ||
412 | if(!text.isEmpty()) | 413 | if(!text.isEmpty()) |
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp index 3271818af4..5731dbe78a 100644 --- a/rbutil/rbutilqt/configure.cpp +++ b/rbutil/rbutilqt/configure.cpp | |||
@@ -103,20 +103,20 @@ void Config::accept() | |||
103 | proxy.setPort(ui.proxyPort->text().toInt()); | 103 | proxy.setPort(ui.proxyPort->text().toInt()); |
104 | } | 104 | } |
105 | 105 | ||
106 | settings->setProxy(proxy.toString()); | 106 | settings->setValue(RbSettings::Proxy, proxy.toString()); |
107 | qDebug() << "new proxy:" << proxy; | 107 | qDebug() << "new proxy:" << proxy; |
108 | // proxy type | 108 | // proxy type |
109 | QString proxyType; | 109 | QString proxyType; |
110 | if(ui.radioNoProxy->isChecked()) proxyType = "none"; | 110 | if(ui.radioNoProxy->isChecked()) proxyType = "none"; |
111 | else if(ui.radioSystemProxy->isChecked()) proxyType = "system"; | 111 | else if(ui.radioSystemProxy->isChecked()) proxyType = "system"; |
112 | else proxyType = "manual"; | 112 | else proxyType = "manual"; |
113 | settings->setProxyType(proxyType); | 113 | settings->setValue(RbSettings::ProxyType, proxyType); |
114 | 114 | ||
115 | // language | 115 | // language |
116 | if(settings->curLang() != language && !language.isEmpty()) { | 116 | if(settings->value(RbSettings::Language).toString() != language && !language.isEmpty()) { |
117 | QMessageBox::information(this, tr("Language changed"), | 117 | QMessageBox::information(this, tr("Language changed"), |
118 | tr("You need to restart the application for the changed language to take effect.")); | 118 | tr("You need to restart the application for the changed language to take effect.")); |
119 | settings->setLang(language); | 119 | settings->setValue(RbSettings::Language, language); |
120 | } | 120 | } |
121 | 121 | ||
122 | // mountpoint | 122 | // mountpoint |
@@ -138,14 +138,14 @@ void Config::accept() | |||
138 | error = true; | 138 | error = true; |
139 | } | 139 | } |
140 | else { | 140 | else { |
141 | settings->setMountpoint(QDir::fromNativeSeparators(mp)); | 141 | settings->setValue(RbSettings::Mountpoint, QDir::fromNativeSeparators(mp)); |
142 | } | 142 | } |
143 | 143 | ||
144 | // platform | 144 | // platform |
145 | QString nplat; | 145 | QString nplat; |
146 | if(ui.treeDevices->selectedItems().size() != 0) { | 146 | if(ui.treeDevices->selectedItems().size() != 0) { |
147 | nplat = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); | 147 | nplat = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); |
148 | settings->setCurPlatform(nplat); | 148 | settings->setValue(RbSettings::Platform, nplat); |
149 | } | 149 | } |
150 | else { | 150 | else { |
151 | errormsg += "<li>" + tr("No player selected") + "</li>"; | 151 | errormsg += "<li>" + tr("No player selected") + "</li>"; |
@@ -160,18 +160,18 @@ void Config::accept() | |||
160 | error = true; | 160 | error = true; |
161 | } | 161 | } |
162 | else | 162 | else |
163 | settings->setCachePath(ui.cachePath->text()); | 163 | settings->setValue(RbSettings::CachePath, ui.cachePath->text()); |
164 | } | 164 | } |
165 | else // default to system temp path | 165 | else // default to system temp path |
166 | settings->setCachePath(QDir::tempPath()); | 166 | settings->setValue(RbSettings::CachePath, QDir::tempPath()); |
167 | settings->setCacheDisable(ui.cacheDisable->isChecked()); | 167 | settings->setValue(RbSettings::CacheDisabled, ui.cacheDisable->isChecked()); |
168 | settings->setCacheOffline(ui.cacheOfflineMode->isChecked()); | 168 | settings->setValue(RbSettings::CacheOffline, ui.cacheOfflineMode->isChecked()); |
169 | 169 | ||
170 | // tts settings | 170 | // tts settings |
171 | int i = ui.comboTts->currentIndex(); | 171 | int i = ui.comboTts->currentIndex(); |
172 | settings->setCurTTS(ui.comboTts->itemData(i).toString()); | 172 | settings->setValue(RbSettings::Tts, ui.comboTts->itemData(i).toString()); |
173 | 173 | ||
174 | settings->setCurVersion(PUREVERSION); | 174 | settings->setValue(RbSettings::RbutilVersion, PUREVERSION); |
175 | 175 | ||
176 | errormsg += "</ul>"; | 176 | errormsg += "</ul>"; |
177 | errormsg += tr("You need to fix the above errors before you can continue."); | 177 | errormsg += tr("You need to fix the above errors before you can continue."); |
@@ -205,7 +205,7 @@ void Config::setSettings(RbSettings* sett) | |||
205 | void Config::setUserSettings() | 205 | void Config::setUserSettings() |
206 | { | 206 | { |
207 | // set proxy | 207 | // set proxy |
208 | proxy = settings->proxy(); | 208 | proxy = settings->value(RbSettings::Proxy).toString(); |
209 | 209 | ||
210 | if(proxy.port() > 0) | 210 | if(proxy.port() > 0) |
211 | ui.proxyPort->setText(QString("%1").arg(proxy.port())); | 211 | ui.proxyPort->setText(QString("%1").arg(proxy.port())); |
@@ -214,7 +214,7 @@ void Config::setUserSettings() | |||
214 | ui.proxyUser->setText(proxy.userName()); | 214 | ui.proxyUser->setText(proxy.userName()); |
215 | ui.proxyPass->setText(proxy.password()); | 215 | ui.proxyPass->setText(proxy.password()); |
216 | 216 | ||
217 | QString proxyType = settings->proxyType(); | 217 | QString proxyType = settings->value(RbSettings::ProxyType).toString(); |
218 | if(proxyType == "manual") ui.radioManualProxy->setChecked(true); | 218 | if(proxyType == "manual") ui.radioManualProxy->setChecked(true); |
219 | else if(proxyType == "system") ui.radioSystemProxy->setChecked(true); | 219 | else if(proxyType == "system") ui.radioSystemProxy->setChecked(true); |
220 | else ui.radioNoProxy->setChecked(true); | 220 | else ui.radioNoProxy->setChecked(true); |
@@ -224,12 +224,15 @@ void Config::setUserSettings() | |||
224 | QString b; | 224 | QString b; |
225 | // find key for lang value | 225 | // find key for lang value |
226 | QMap<QString, QString>::const_iterator i = lang.constBegin(); | 226 | QMap<QString, QString>::const_iterator i = lang.constBegin(); |
227 | QString l = settings->value(RbSettings::Language).toString(); | ||
228 | if(l.isEmpty()) | ||
229 | l = QLocale::system().name(); | ||
227 | while (i != lang.constEnd()) { | 230 | while (i != lang.constEnd()) { |
228 | if(i.value() == settings->curLang()) { | 231 | if(i.value() == l) { |
229 | b = i.key(); | 232 | b = i.key(); |
230 | break; | 233 | break; |
231 | } | 234 | } |
232 | else if(settings->curLang().startsWith(i.value(), Qt::CaseInsensitive)) { | 235 | else if(l.startsWith(i.value(), Qt::CaseInsensitive)) { |
233 | // check if there is a base language (en -> en_US, etc.) | 236 | // check if there is a base language (en -> en_US, etc.) |
234 | b = i.key(); | 237 | b = i.key(); |
235 | break; | 238 | break; |
@@ -244,15 +247,15 @@ void Config::setUserSettings() | |||
244 | connect(ui.listLanguages, SIGNAL(itemSelectionChanged()), this, SLOT(updateLanguage())); | 247 | connect(ui.listLanguages, SIGNAL(itemSelectionChanged()), this, SLOT(updateLanguage())); |
245 | 248 | ||
246 | // devices tab | 249 | // devices tab |
247 | ui.mountPoint->setText(QDir::toNativeSeparators(settings->mountpoint())); | 250 | ui.mountPoint->setText(QDir::toNativeSeparators(settings->value(RbSettings::Mountpoint).toString())); |
248 | 251 | ||
249 | // cache tab | 252 | // cache tab |
250 | if(!QFileInfo(settings->cachePath()).isDir()) | 253 | if(!QFileInfo(settings->value(RbSettings::CachePath).toString()).isDir()) |
251 | settings->setCachePath(QDir::tempPath()); | 254 | settings->setValue(RbSettings::CachePath, QDir::tempPath()); |
252 | ui.cachePath->setText(QDir::toNativeSeparators(settings->cachePath())); | 255 | ui.cachePath->setText(QDir::toNativeSeparators(settings->value(RbSettings::CachePath).toString())); |
253 | ui.cacheDisable->setChecked(settings->cacheDisabled()); | 256 | ui.cacheDisable->setChecked(settings->value(RbSettings::CacheDisabled).toBool()); |
254 | ui.cacheOfflineMode->setChecked(settings->cacheOffline()); | 257 | ui.cacheOfflineMode->setChecked(settings->value(RbSettings::CacheOffline).toBool()); |
255 | updateCacheInfo(settings->cachePath()); | 258 | updateCacheInfo(settings->value(RbSettings::CachePath).toString()); |
256 | } | 259 | } |
257 | 260 | ||
258 | 261 | ||
@@ -276,7 +279,7 @@ void Config::setDevices() | |||
276 | // setup devices table | 279 | // setup devices table |
277 | qDebug() << "Config::setDevices()"; | 280 | qDebug() << "Config::setDevices()"; |
278 | 281 | ||
279 | QStringList platformList = settings->allPlatforms(); | 282 | QStringList platformList = settings->platforms(); |
280 | 283 | ||
281 | QMap <QString, QString> manuf; | 284 | QMap <QString, QString> manuf; |
282 | QMap <QString, QString> devcs; | 285 | QMap <QString, QString> devcs; |
@@ -289,7 +292,7 @@ void Config::setDevices() | |||
289 | } | 292 | } |
290 | 293 | ||
291 | QString platform; | 294 | QString platform; |
292 | platform = devcs.value(settings->curPlatform()); | 295 | platform = devcs.value(settings->value(RbSettings::Platform).toString()); |
293 | 296 | ||
294 | // set up devices table | 297 | // set up devices table |
295 | ui.treeDevices->header()->hide(); | 298 | ui.treeDevices->header()->hide(); |
@@ -342,7 +345,7 @@ void Config::setDevices() | |||
342 | for(int a = 0; a < ttslist.size(); a++) | 345 | for(int a = 0; a < ttslist.size(); a++) |
343 | ui.comboTts->addItem(TTSBase::getTTSName(ttslist.at(a)), ttslist.at(a)); | 346 | ui.comboTts->addItem(TTSBase::getTTSName(ttslist.at(a)), ttslist.at(a)); |
344 | //update index of combobox | 347 | //update index of combobox |
345 | int index = ui.comboTts->findData(settings->curTTS()); | 348 | int index = ui.comboTts->findData(settings->value(RbSettings::Tts).toString()); |
346 | if(index < 0) index = 0; | 349 | if(index < 0) index = 0; |
347 | ui.comboTts->setCurrentIndex(index); | 350 | ui.comboTts->setCurrentIndex(index); |
348 | updateTtsState(index); | 351 | updateTtsState(index); |
@@ -377,11 +380,11 @@ void Config::updateEncState() | |||
377 | return; | 380 | return; |
378 | 381 | ||
379 | QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); | 382 | QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); |
380 | QString olddevice = settings->curPlatform(); | 383 | QString olddevice = settings->value(RbSettings::Platform).toString(); |
381 | settings->setCurPlatform(devname); | 384 | settings->setValue(RbSettings::Platform, devname); |
382 | QString encoder = settings->curEncoder(); | 385 | QString encoder = settings->value(RbSettings::CurEncoder).toString(); |
383 | ui.encoderName->setText(EncBase::getEncoderName(settings->curEncoder())); | 386 | ui.encoderName->setText(EncBase::getEncoderName(settings->value(RbSettings::CurEncoder).toString())); |
384 | settings->setCurPlatform(olddevice); | 387 | settings->setValue(RbSettings::Platform, olddevice); |
385 | 388 | ||
386 | EncBase* enc = EncBase::getEncoder(encoder); | 389 | EncBase* enc = EncBase::getEncoder(encoder); |
387 | enc->setCfg(settings); | 390 | enc->setCfg(settings); |
@@ -597,9 +600,10 @@ void Config::autodetect() | |||
597 | QString text; | 600 | QString text; |
598 | // we need to set the platform here to get the brand from the | 601 | // we need to set the platform here to get the brand from the |
599 | // settings object | 602 | // settings object |
600 | settings->setCurPlatform(detector.incompatdev()); | 603 | settings->setValue(RbSettings::Platform, detector.incompatdev()); |
601 | text = tr("Detected an unsupported %1 player variant. Sorry, " | 604 | text = tr("Detected an unsupported %1 player variant. Sorry, " |
602 | "Rockbox doesn't run on your player.").arg(settings->curBrand()); | 605 | "Rockbox doesn't run on your player.") |
606 | .arg(settings->value(RbSettings::CurBrand).toString()); | ||
603 | 607 | ||
604 | QMessageBox::critical(this, tr("Fatal error: incompatible player found"), | 608 | QMessageBox::critical(this, tr("Fatal error: incompatible player found"), |
605 | text, QMessageBox::Ok); | 609 | text, QMessageBox::Ok); |
@@ -655,7 +659,7 @@ void Config::cacheClear() | |||
655 | QFile::remove(f); | 659 | QFile::remove(f); |
656 | qDebug() << "removed:" << f; | 660 | qDebug() << "removed:" << f; |
657 | } | 661 | } |
658 | updateCacheInfo(settings->cachePath()); | 662 | updateCacheInfo(settings->value(RbSettings::CachePath).toString()); |
659 | } | 663 | } |
660 | 664 | ||
661 | 665 | ||
@@ -672,7 +676,7 @@ void Config::configTts() | |||
672 | 676 | ||
673 | void Config::configEnc() | 677 | void Config::configEnc() |
674 | { | 678 | { |
675 | EncBase* enc = EncBase::getEncoder(settings->curEncoder()); | 679 | EncBase* enc = EncBase::getEncoder(settings->value(RbSettings::CurEncoder).toString()); |
676 | 680 | ||
677 | enc->setCfg(settings); | 681 | enc->setCfg(settings); |
678 | enc->showCfg(); | 682 | enc->showCfg(); |
diff --git a/rbutil/rbutilqt/createvoicewindow.cpp b/rbutil/rbutilqt/createvoicewindow.cpp index bb047cb196..2b45386589 100644 --- a/rbutil/rbutilqt/createvoicewindow.cpp +++ b/rbutil/rbutilqt/createvoicewindow.cpp | |||
@@ -49,14 +49,14 @@ void CreateVoiceWindow::accept() | |||
49 | int wvThreshold = ui.wavtrimthreshold->value(); | 49 | int wvThreshold = ui.wavtrimthreshold->value(); |
50 | 50 | ||
51 | //safe selected language | 51 | //safe selected language |
52 | settings->setVoiceLanguage(lang); | 52 | settings->setValue(RbSettings::Language, lang); |
53 | settings->setWavtrimTh(wvThreshold); | 53 | settings->setValue(RbSettings::WavtrimThreshold, wvThreshold); |
54 | settings->sync(); | 54 | settings->sync(); |
55 | 55 | ||
56 | //configure voicecreator | 56 | //configure voicecreator |
57 | voicecreator->setSettings(settings); | 57 | voicecreator->setSettings(settings); |
58 | voicecreator->setMountPoint(settings->mountpoint()); | 58 | voicecreator->setMountPoint(settings->value(RbSettings::Mountpoint).toString()); |
59 | voicecreator->setTargetId(settings->curTargetId()); | 59 | voicecreator->setTargetId(settings->value(RbSettings::CurTargetId).toInt()); |
60 | voicecreator->setLang(lang); | 60 | voicecreator->setLang(lang); |
61 | voicecreator->setWavtrimThreshold(wvThreshold); | 61 | voicecreator->setWavtrimThreshold(wvThreshold); |
62 | 62 | ||
@@ -79,14 +79,14 @@ void CreateVoiceWindow::setSettings(RbSettings* sett) | |||
79 | void CreateVoiceWindow::updateSettings(void) | 79 | void CreateVoiceWindow::updateSettings(void) |
80 | { | 80 | { |
81 | // fill in language combobox | 81 | // fill in language combobox |
82 | QStringList languages = settings->allLanguages(); | 82 | QStringList languages = settings->languages(); |
83 | languages.sort(); | 83 | languages.sort(); |
84 | ui.comboLanguage->addItems(languages); | 84 | ui.comboLanguage->addItems(languages); |
85 | // set saved lang | 85 | // set saved lang |
86 | int sel = ui.comboLanguage->findText(settings->voiceLanguage()); | 86 | int sel = ui.comboLanguage->findText(settings->value(RbSettings::VoiceLanguage).toString()); |
87 | // if no saved language is found try to figure the language from the UI lang | 87 | // if no saved language is found try to figure the language from the UI lang |
88 | if(sel == -1) { | 88 | if(sel == -1) { |
89 | QString f = settings->curLang(); | 89 | QString f = settings->value(RbSettings::Language).toString(); |
90 | // if no language is set default to english. Make sure not to check an empty string. | 90 | // if no language is set default to english. Make sure not to check an empty string. |
91 | if(f.isEmpty()) f = "english"; | 91 | if(f.isEmpty()) f = "english"; |
92 | sel = ui.comboLanguage->findText(f, Qt::MatchStartsWith); | 92 | sel = ui.comboLanguage->findText(f, Qt::MatchStartsWith); |
@@ -97,7 +97,7 @@ void CreateVoiceWindow::updateSettings(void) | |||
97 | } | 97 | } |
98 | ui.comboLanguage->setCurrentIndex(sel); | 98 | ui.comboLanguage->setCurrentIndex(sel); |
99 | 99 | ||
100 | QString ttsName = settings->curTTS(); | 100 | QString ttsName = settings->value(RbSettings::Tts).toString(); |
101 | TTSBase* tts = TTSBase::getTTS(ttsName); | 101 | TTSBase* tts = TTSBase::getTTS(ttsName); |
102 | tts->setCfg(settings); | 102 | tts->setCfg(settings); |
103 | if(tts->configOk()) | 103 | if(tts->configOk()) |
@@ -107,7 +107,7 @@ void CreateVoiceWindow::updateSettings(void) | |||
107 | ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>") | 107 | ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>") |
108 | .arg("Invalid TTS configuration!")); | 108 | .arg("Invalid TTS configuration!")); |
109 | 109 | ||
110 | QString encoder = settings->curEncoder(); | 110 | QString encoder = settings->value(RbSettings::CurEncoder).toString(); |
111 | // only proceed if encoder setting is set | 111 | // only proceed if encoder setting is set |
112 | EncBase* enc = EncBase::getEncoder(encoder); | 112 | EncBase* enc = EncBase::getEncoder(encoder); |
113 | if(enc != NULL) { | 113 | if(enc != NULL) { |
@@ -122,7 +122,7 @@ void CreateVoiceWindow::updateSettings(void) | |||
122 | else | 122 | else |
123 | ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>") | 123 | ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>") |
124 | .arg("Invalid encoder configuration!")); | 124 | .arg("Invalid encoder configuration!")); |
125 | ui.wavtrimthreshold->setValue(settings->wavtrimTh()); | 125 | ui.wavtrimthreshold->setValue(settings->value(RbSettings::WavtrimThreshold).toInt()); |
126 | emit settingsUpdated(); | 126 | emit settingsUpdated(); |
127 | } | 127 | } |
128 | 128 | ||
diff --git a/rbutil/rbutilqt/encoders.cpp b/rbutil/rbutilqt/encoders.cpp index dcd0e13c6d..a822b932f7 100644 --- a/rbutil/rbutilqt/encoders.cpp +++ b/rbutil/rbutilqt/encoders.cpp | |||
@@ -56,7 +56,7 @@ EncBase* EncBase::getEncoder(QString encoder) | |||
56 | return encoderCache.value(encoder); | 56 | return encoderCache.value(encoder); |
57 | 57 | ||
58 | EncBase* enc; | 58 | EncBase* enc; |
59 | if(encoder == "lame") | 59 | if(encoder == "lame") |
60 | { | 60 | { |
61 | enc = new EncExes(encoder); | 61 | enc = new EncExes(encoder); |
62 | encoderCache[encoder] = enc; | 62 | encoderCache[encoder] = enc; |
@@ -99,8 +99,8 @@ EncExes::EncExes(QString name,QObject *parent) : EncBase(parent) | |||
99 | 99 | ||
100 | bool EncExes::start() | 100 | bool EncExes::start() |
101 | { | 101 | { |
102 | m_EncExec = settings->encoderPath(m_name); | 102 | m_EncExec = settings->subValue(m_name, RbSettings::EncoderPath).toString(); |
103 | m_EncOpts = settings->encoderOptions(m_name); | 103 | m_EncOpts = settings->subValue(m_name, RbSettings::EncoderOptions).toString(); |
104 | 104 | ||
105 | m_EncTemplate = m_TemplateMap.value(m_name); | 105 | m_EncTemplate = m_TemplateMap.value(m_name); |
106 | 106 | ||
@@ -144,7 +144,7 @@ void EncExes::showCfg() | |||
144 | 144 | ||
145 | bool EncExes::configOk() | 145 | bool EncExes::configOk() |
146 | { | 146 | { |
147 | QString path = settings->encoderPath(m_name); | 147 | QString path = settings->subValue(m_name, RbSettings::EncoderPath).toString(); |
148 | 148 | ||
149 | if (QFileInfo(path).exists()) | 149 | if (QFileInfo(path).exists()) |
150 | return true; | 150 | return true; |
@@ -171,10 +171,10 @@ bool EncRbSpeex::start() | |||
171 | { | 171 | { |
172 | 172 | ||
173 | // try to get config from settings | 173 | // try to get config from settings |
174 | quality = settings->encoderQuality("rbspeex"); | 174 | quality = settings->subValue("rbspeex", RbSettings::EncoderQuality).toDouble(); |
175 | complexity = settings->encoderComplexity("rbspeex"); | 175 | complexity = settings->subValue("rbspeex", RbSettings::EncoderComplexity).toInt(); |
176 | volume = settings->encoderVolume("rbspeex"); | 176 | volume = settings->subValue("rbspeex", RbSettings::EncoderVolume).toDouble(); |
177 | narrowband = settings->encoderNarrowband("rbspeex"); | 177 | narrowband = settings->subValue("rbspeex", RbSettings::EncoderNarrowBand).toBool(); |
178 | 178 | ||
179 | 179 | ||
180 | return true; | 180 | return true; |
@@ -227,13 +227,13 @@ bool EncRbSpeex::configOk() | |||
227 | bool result=true; | 227 | bool result=true; |
228 | // check config | 228 | // check config |
229 | 229 | ||
230 | if(settings->encoderVolume("rbspeex") <= 0) | 230 | if(settings->subValue("rbspeex", RbSettings::EncoderVolume).toDouble() <= 0) |
231 | result =false; | 231 | result =false; |
232 | 232 | ||
233 | if(settings->encoderQuality("rbspeex") <= 0) | 233 | if(settings->subValue("rbspeex", RbSettings::EncoderQuality).toDouble() <= 0) |
234 | result =false; | 234 | result =false; |
235 | 235 | ||
236 | if(settings->encoderComplexity("rbspeex") <= 0) | 236 | if(settings->subValue("rbspeex", RbSettings::EncoderComplexity).toInt() <= 0) |
237 | result =false; | 237 | result =false; |
238 | 238 | ||
239 | return result; | 239 | return result; |
diff --git a/rbutil/rbutilqt/encodersgui.cpp b/rbutil/rbutilqt/encodersgui.cpp index 82bd8650fb..3d1619f807 100644 --- a/rbutil/rbutilqt/encodersgui.cpp +++ b/rbutil/rbutilqt/encodersgui.cpp | |||
@@ -34,8 +34,8 @@ void EncExesGui::showCfg(QString name) | |||
34 | { | 34 | { |
35 | m_name = name; | 35 | m_name = name; |
36 | // try to get config from settings | 36 | // try to get config from settings |
37 | QString exepath =settings->encoderPath(m_name); | 37 | QString exepath =settings->subValue(m_name, RbSettings::EncoderPath).toString(); |
38 | ui.encoderoptions->setText(settings->encoderOptions(m_name)); | 38 | ui.encoderoptions->setText(settings->subValue(m_name, RbSettings::EncoderOptions).toString()); |
39 | 39 | ||
40 | if(exepath == "") | 40 | if(exepath == "") |
41 | { | 41 | { |
@@ -75,8 +75,8 @@ void EncExesGui::showCfg(QString name) | |||
75 | void EncExesGui::accept(void) | 75 | void EncExesGui::accept(void) |
76 | { | 76 | { |
77 | //save settings in user config | 77 | //save settings in user config |
78 | settings->setEncoderPath(m_name,ui.encoderpath->text()); | 78 | settings->setSubValue(m_name, RbSettings::EncoderPath, ui.encoderpath->text()); |
79 | settings->setEncoderOptions(m_name,ui.encoderoptions->text()); | 79 | settings->setSubValue(m_name, RbSettings::EncoderOptions, ui.encoderoptions->text()); |
80 | 80 | ||
81 | // sync settings | 81 | // sync settings |
82 | settings->sync(); | 82 | settings->sync(); |
@@ -130,11 +130,11 @@ void EncRbSpeexGui::showCfg(float defQ,float defV,int defC, bool defB) | |||
130 | defaultBand =defB; | 130 | defaultBand =defB; |
131 | 131 | ||
132 | //fill in the usersettings | 132 | //fill in the usersettings |
133 | ui.volume->setValue(settings->encoderVolume("rbspeex")); | 133 | ui.volume->setValue(settings->subValue("rbspeex", RbSettings::EncoderVolume).toDouble()); |
134 | ui.quality->setValue(settings->encoderQuality("rbspeex")); | 134 | ui.quality->setValue(settings->subValue("rbspeex", RbSettings::EncoderQuality).toDouble()); |
135 | ui.complexity->setValue(settings->encoderComplexity("rbspeex")); | 135 | ui.complexity->setValue(settings->subValue("rbspeex", RbSettings::EncoderComplexity).toInt()); |
136 | 136 | ||
137 | if(settings->encoderNarrowband("rbspeex")) | 137 | if(settings->subValue("rbspeex", RbSettings::EncoderNarrowBand).toBool()) |
138 | ui.narrowband->setCheckState(Qt::Checked); | 138 | ui.narrowband->setCheckState(Qt::Checked); |
139 | else | 139 | else |
140 | ui.narrowband->setCheckState(Qt::Unchecked); | 140 | ui.narrowband->setCheckState(Qt::Unchecked); |
@@ -146,10 +146,10 @@ void EncRbSpeexGui::showCfg(float defQ,float defV,int defC, bool defB) | |||
146 | void EncRbSpeexGui::accept(void) | 146 | void EncRbSpeexGui::accept(void) |
147 | { | 147 | { |
148 | //save settings in user config | 148 | //save settings in user config |
149 | settings->setEncoderVolume("rbspeex",ui.volume->value()); | 149 | settings->setSubValue("rbspeex", RbSettings::EncoderVolume, ui.volume->value()); |
150 | settings->setEncoderQuality("rbspeex",ui.quality->value()); | 150 | settings->setSubValue("rbspeex", RbSettings::EncoderQuality, ui.quality->value()); |
151 | settings->setEncoderComplexity("rbspeex",ui.complexity->value()); | 151 | settings->setSubValue("rbspeex", RbSettings::EncoderComplexity, ui.complexity->value()); |
152 | settings->setEncoderNarrowband("rbspeex",ui.narrowband->isChecked() ? true : false); | 152 | settings->setSubValue("rbspeex", RbSettings::EncoderNarrowBand, ui.narrowband->isChecked() ? true : false); |
153 | 153 | ||
154 | // sync settings | 154 | // sync settings |
155 | settings->sync(); | 155 | settings->sync(); |
diff --git a/rbutil/rbutilqt/install.cpp b/rbutil/rbutilqt/install.cpp index b1020b8982..2332a713c4 100644 --- a/rbutil/rbutilqt/install.cpp +++ b/rbutil/rbutilqt/install.cpp | |||
@@ -34,12 +34,12 @@ Install::Install(RbSettings *sett,QWidget *parent) : QDialog(parent) | |||
34 | connect(ui.backup, SIGNAL(stateChanged(int)), this, SLOT(backupCheckboxChanged(int))); | 34 | connect(ui.backup, SIGNAL(stateChanged(int)), this, SLOT(backupCheckboxChanged(int))); |
35 | 35 | ||
36 | //! check if rockbox is already installed | 36 | //! check if rockbox is already installed |
37 | QString version = Detect::installedVersion(settings->mountpoint()); | 37 | QString version = Detect::installedVersion(settings->value(RbSettings::Mountpoint).toString()); |
38 | 38 | ||
39 | if(version != "") | 39 | if(version != "") |
40 | { | 40 | { |
41 | ui.Backupgroup->show(); | 41 | ui.Backupgroup->show(); |
42 | m_backupName = settings->mountpoint(); | 42 | m_backupName = settings->value(RbSettings::Mountpoint).toString(); |
43 | if(!m_backupName.endsWith("/")) m_backupName += "/"; | 43 | if(!m_backupName.endsWith("/")) m_backupName += "/"; |
44 | m_backupName += ".backup/rockbox-backup-"+version+".zip"; | 44 | m_backupName += ".backup/rockbox-backup-"+version+".zip"; |
45 | // for some reason the label doesn't return its final size yet. | 45 | // for some reason the label doesn't return its final size yet. |
@@ -91,8 +91,8 @@ void Install::accept() | |||
91 | { | 91 | { |
92 | logger = new ProgressLoggerGui(this); | 92 | logger = new ProgressLoggerGui(this); |
93 | logger->show(); | 93 | logger->show(); |
94 | QString mountPoint = settings->mountpoint(); | 94 | QString mountPoint = settings->value(RbSettings::Mountpoint).toString(); |
95 | qDebug() << "mountpoint:" << settings->mountpoint(); | 95 | qDebug() << "mountpoint:" << settings->value(RbSettings::Mountpoint).toString(); |
96 | // show dialog with error if mount point is wrong | 96 | // show dialog with error if mount point is wrong |
97 | if(!QFileInfo(mountPoint).isDir()) { | 97 | if(!QFileInfo(mountPoint).isDir()) { |
98 | logger->addItem(tr("Mount point is wrong!"),LOGERROR); | 98 | logger->addItem(tr("Mount point is wrong!"),LOGERROR); |
@@ -101,30 +101,30 @@ void Install::accept() | |||
101 | } | 101 | } |
102 | 102 | ||
103 | QString myversion; | 103 | QString myversion; |
104 | QString buildname = settings->curBuildserver_Modelname(); | 104 | QString buildname = settings->value(RbSettings::CurBuildserverModel).toString(); |
105 | if(ui.radioStable->isChecked()) { | 105 | if(ui.radioStable->isChecked()) { |
106 | file = QString("%1/%2/rockbox-%3-%4.zip") | 106 | file = QString("%1/%2/rockbox-%3-%4.zip") |
107 | .arg(settings->releaseUrl(), version.value("rel_rev"), | 107 | .arg(settings->value(RbSettings::ReleaseUrl).toString(), version.value("rel_rev"), |
108 | buildname, version.value("rel_rev")); | 108 | buildname, version.value("rel_rev")); |
109 | fileName = QString("rockbox-%1-%2.zip") | 109 | fileName = QString("rockbox-%1-%2.zip") |
110 | .arg(version.value("rel_rev"), buildname); | 110 | .arg(version.value("rel_rev"), buildname); |
111 | settings->setBuild("stable"); | 111 | settings->setValue(RbSettings::Build, "stable"); |
112 | myversion = version.value("rel_rev"); | 112 | myversion = version.value("rel_rev"); |
113 | } | 113 | } |
114 | else if(ui.radioArchived->isChecked()) { | 114 | else if(ui.radioArchived->isChecked()) { |
115 | file = QString("%1%2/rockbox-%3-%4.zip") | 115 | file = QString("%1%2/rockbox-%3-%4.zip") |
116 | .arg(settings->dailyUrl(), | 116 | .arg(settings->value(RbSettings::DailyUrl).toString(), |
117 | buildname, buildname, version.value("arch_date")); | 117 | buildname, buildname, version.value("arch_date")); |
118 | fileName = QString("rockbox-%1-%2.zip") | 118 | fileName = QString("rockbox-%1-%2.zip") |
119 | .arg(buildname, version.value("arch_date")); | 119 | .arg(buildname, version.value("arch_date")); |
120 | settings->setBuild("archived"); | 120 | settings->setValue(RbSettings::Build, "archived"); |
121 | myversion = "r" + version.value("arch_rev") + "-" + version.value("arch_date"); | 121 | myversion = "r" + version.value("arch_rev") + "-" + version.value("arch_date"); |
122 | } | 122 | } |
123 | else if(ui.radioCurrent->isChecked()) { | 123 | else if(ui.radioCurrent->isChecked()) { |
124 | file = QString("%1%2/rockbox.zip") | 124 | file = QString("%1%2/rockbox.zip") |
125 | .arg(settings->bleedingUrl(), buildname); | 125 | .arg(settings->value(RbSettings::BleedingUrl).toString(), buildname); |
126 | fileName = QString("rockbox.zip"); | 126 | fileName = QString("rockbox.zip"); |
127 | settings->setBuild("current"); | 127 | settings->setValue(RbSettings::Build, "current"); |
128 | myversion = "r" + version.value("bleed_rev"); | 128 | myversion = "r" + version.value("bleed_rev"); |
129 | } | 129 | } |
130 | else { | 130 | else { |
@@ -162,7 +162,8 @@ void Install::accept() | |||
162 | //! create backup | 162 | //! create backup |
163 | RbZip backup; | 163 | RbZip backup; |
164 | connect(&backup,SIGNAL(zipProgress(int,int)),logger,SLOT(setProgress(int,int))); | 164 | connect(&backup,SIGNAL(zipProgress(int,int)),logger,SLOT(setProgress(int,int))); |
165 | if(backup.createZip(m_backupName,settings->mountpoint() + "/.rockbox") == Zip::Ok) | 165 | if(backup.createZip(m_backupName, |
166 | settings->value(RbSettings::Mountpoint).toString() + "/.rockbox") == Zip::Ok) | ||
166 | { | 167 | { |
167 | logger->addItem(tr("Backup successful"),LOGOK); | 168 | logger->addItem(tr("Backup successful"),LOGOK); |
168 | } | 169 | } |
@@ -178,7 +179,7 @@ void Install::accept() | |||
178 | installer = new ZipInstaller(this); | 179 | installer = new ZipInstaller(this); |
179 | installer->setUrl(file); | 180 | installer->setUrl(file); |
180 | installer->setLogSection("Rockbox (Base)"); | 181 | installer->setLogSection("Rockbox (Base)"); |
181 | if(!settings->cacheDisabled() | 182 | if(!settings->value(RbSettings::CacheDisabled).toBool() |
182 | && !ui.checkBoxCache->isChecked()) | 183 | && !ui.checkBoxCache->isChecked()) |
183 | { | 184 | { |
184 | installer->setCache(true); | 185 | installer->setCache(true); |
@@ -218,9 +219,9 @@ void Install::done(bool error) | |||
218 | // no error, close the window, when the logger is closed | 219 | // no error, close the window, when the logger is closed |
219 | connect(logger,SIGNAL(closed()),this,SLOT(close())); | 220 | connect(logger,SIGNAL(closed()),this,SLOT(close())); |
220 | // add platform info to log file for later detection | 221 | // add platform info to log file for later detection |
221 | QSettings installlog(settings->mountpoint() | 222 | QSettings installlog(settings->value(RbSettings::Mountpoint).toString() |
222 | + "/.rockbox/rbutil.log", QSettings::IniFormat, 0); | 223 | + "/.rockbox/rbutil.log", QSettings::IniFormat, 0); |
223 | installlog.setValue("platform", settings->curPlatform()); | 224 | installlog.setValue("platform", settings->value(RbSettings::Platform).toString()); |
224 | installlog.sync(); | 225 | installlog.sync(); |
225 | } | 226 | } |
226 | 227 | ||
@@ -288,11 +289,12 @@ void Install::setVersionStrings(QMap<QString, QString>& ver) | |||
288 | 289 | ||
289 | // try to use the old selection first. If no selection has been made | 290 | // try to use the old selection first. If no selection has been made |
290 | // in the past, use a preselection based on released status. | 291 | // in the past, use a preselection based on released status. |
291 | if(settings->build() == "stable" && !version.value("rel_rev").isEmpty()) | 292 | if(settings->value(RbSettings::Build).toString() == "stable" |
293 | && !version.value("rel_rev").isEmpty()) | ||
292 | ui.radioStable->setChecked(true); | 294 | ui.radioStable->setChecked(true); |
293 | else if(settings->build() == "archived") | 295 | else if(settings->value(RbSettings::Build).toString() == "archived") |
294 | ui.radioArchived->setChecked(true); | 296 | ui.radioArchived->setChecked(true); |
295 | else if(settings->build() == "current") | 297 | else if(settings->value(RbSettings::Build).toString() == "current") |
296 | ui.radioCurrent->setChecked(true); | 298 | ui.radioCurrent->setChecked(true); |
297 | else if(!version.value("rel_rev").isEmpty()) { | 299 | else if(!version.value("rel_rev").isEmpty()) { |
298 | ui.radioStable->setChecked(true); | 300 | ui.radioStable->setChecked(true); |
diff --git a/rbutil/rbutilqt/installtalkwindow.cpp b/rbutil/rbutilqt/installtalkwindow.cpp index 0d2267e9f4..4caaa4fbc7 100644 --- a/rbutil/rbutilqt/installtalkwindow.cpp +++ b/rbutil/rbutilqt/installtalkwindow.cpp | |||
@@ -88,13 +88,13 @@ void InstallTalkWindow::accept() | |||
88 | return; | 88 | return; |
89 | } | 89 | } |
90 | 90 | ||
91 | settings->setLastTalkedDir(folderToTalk); | 91 | settings->setValue(RbSettings::LastTalkedFolder, folderToTalk); |
92 | 92 | ||
93 | settings->sync(); | 93 | settings->sync(); |
94 | 94 | ||
95 | talkcreator->setSettings(settings); | 95 | talkcreator->setSettings(settings); |
96 | talkcreator->setDir(QDir(folderToTalk)); | 96 | talkcreator->setDir(QDir(folderToTalk)); |
97 | talkcreator->setMountPoint(settings->mountpoint()); | 97 | talkcreator->setMountPoint(settings->value(RbSettings::Mountpoint).toString()); |
98 | 98 | ||
99 | talkcreator->setOverwriteTalk(ui.OverwriteTalk->isChecked()); | 99 | talkcreator->setOverwriteTalk(ui.OverwriteTalk->isChecked()); |
100 | talkcreator->setRecursive(ui.recursive->isChecked()); | 100 | talkcreator->setRecursive(ui.recursive->isChecked()); |
@@ -115,7 +115,7 @@ void InstallTalkWindow::setSettings(RbSettings* sett) | |||
115 | 115 | ||
116 | void InstallTalkWindow::updateSettings(void) | 116 | void InstallTalkWindow::updateSettings(void) |
117 | { | 117 | { |
118 | QString ttsName = settings->curTTS(); | 118 | QString ttsName = settings->value(RbSettings::Tts).toString(); |
119 | TTSBase* tts = TTSBase::getTTS(ttsName); | 119 | TTSBase* tts = TTSBase::getTTS(ttsName); |
120 | tts->setCfg(settings); | 120 | tts->setCfg(settings); |
121 | if(tts->configOk()) | 121 | if(tts->configOk()) |
@@ -125,7 +125,7 @@ void InstallTalkWindow::updateSettings(void) | |||
125 | ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>") | 125 | ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>") |
126 | .arg("Invalid TTS configuration!")); | 126 | .arg("Invalid TTS configuration!")); |
127 | 127 | ||
128 | QString encoder = settings->curEncoder(); | 128 | QString encoder = settings->value(RbSettings::CurEncoder).toString(); |
129 | EncBase* enc = EncBase::getEncoder(encoder); | 129 | EncBase* enc = EncBase::getEncoder(encoder); |
130 | if(enc != NULL) { | 130 | if(enc != NULL) { |
131 | enc->setCfg(settings); | 131 | enc->setCfg(settings); |
@@ -140,7 +140,7 @@ void InstallTalkWindow::updateSettings(void) | |||
140 | ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>") | 140 | ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>") |
141 | .arg("Invalid encoder configuration!")); | 141 | .arg("Invalid encoder configuration!")); |
142 | 142 | ||
143 | setTalkFolder(settings->lastTalkedFolder()); | 143 | setTalkFolder(settings->value(RbSettings::LastTalkedFolder).toString()); |
144 | emit settingsUpdated(); | 144 | emit settingsUpdated(); |
145 | } | 145 | } |
146 | 146 | ||
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 | ||
diff --git a/rbutil/rbutilqt/rbsettings.h b/rbutil/rbutilqt/rbsettings.h index 339c835d4a..341577abc8 100644 --- a/rbutil/rbutilqt/rbsettings.h +++ b/rbutil/rbutilqt/rbsettings.h | |||
@@ -46,118 +46,97 @@ class RbSettings : public QObject | |||
46 | MapError, | 46 | MapError, |
47 | MapIncompatible, | 47 | MapIncompatible, |
48 | }; | 48 | }; |
49 | enum UserSettings { | ||
50 | RbutilVersion, | ||
51 | CurrentPlatform, | ||
52 | Mountpoint, | ||
53 | CachePath, | ||
54 | Build, | ||
55 | ProxyType, | ||
56 | Proxy, | ||
57 | OfPath, | ||
58 | Platform, | ||
59 | Language, | ||
60 | Tts, | ||
61 | LastTalkedFolder, | ||
62 | VoiceLanguage, | ||
63 | TtsLanguage, | ||
64 | TtsOptions, | ||
65 | TtsPath, | ||
66 | TtsVoice, | ||
67 | EncoderPath, | ||
68 | EncoderOptions, | ||
69 | WavtrimThreshold, | ||
70 | EncoderComplexity, | ||
71 | TtsSpeed, | ||
72 | CacheOffline, | ||
73 | CacheDisabled, | ||
74 | TtsUseSapi4, | ||
75 | EncoderNarrowBand, | ||
76 | EncoderQuality, | ||
77 | EncoderVolume, | ||
78 | }; | ||
79 | enum SystemSettings { | ||
80 | ManualUrl, | ||
81 | BleedingUrl, | ||
82 | BootloaderUrl, | ||
83 | BootloaderInfoUrl, | ||
84 | FontUrl, | ||
85 | VoiceUrl, | ||
86 | DoomUrl, | ||
87 | ReleaseUrl, | ||
88 | DailyUrl, | ||
89 | ServerConfUrl, | ||
90 | GenlangUrl, | ||
91 | ThemesUrl, | ||
92 | BleedingInfo, | ||
93 | CurPlatformName, | ||
94 | CurManual, | ||
95 | CurBootloaderMethod, | ||
96 | CurBootloaderName, | ||
97 | CurBootloaderFile, | ||
98 | CurEncoder, | ||
99 | CurResolution, | ||
100 | CurBrand, | ||
101 | CurName, | ||
102 | CurBuildserverModel, | ||
103 | CurConfigureModel, | ||
104 | CurTargetId, | ||
105 | }; | ||
106 | |||
107 | QVariant value(enum SystemSettings setting); | ||
108 | // generic and "current selection" values -- getters | ||
109 | QVariant value(enum UserSettings setting) | ||
110 | { QString empty; return subValue(empty, setting); } | ||
111 | void setValue(enum UserSettings setting , QVariant value) | ||
112 | { QString empty; return setSubValue(empty, setting, value); } | ||
49 | 113 | ||
50 | //! access functions for the settings | 114 | QVariant subValue(QString& sub, enum UserSettings setting); |
51 | QString curVersion(); | 115 | QVariant subValue(const char* sub, enum UserSettings setting) |
52 | bool cacheOffline(); | 116 | { QString s = sub; return subValue(s, setting); } |
53 | bool cacheDisabled(); | 117 | void setSubValue(QString& sub, enum UserSettings setting, QVariant value); |
54 | QString mountpoint(); | 118 | void setSubValue(const char* sub, enum UserSettings setting, QVariant value) |
55 | QString manualUrl(); | 119 | { QString s = sub; return setSubValue(s, setting, value); } |
56 | QString bleedingUrl(); | 120 | |
57 | QString cachePath(); | 121 | QStringList platforms(void); |
58 | QString build(void); | 122 | QStringList languages(void); |
59 | QString bootloaderUrl(); | ||
60 | QString bootloaderInfoUrl(); | ||
61 | QString fontUrl(); | ||
62 | QString voiceUrl(); | ||
63 | QString doomUrl(); | ||
64 | QString releaseUrl(); | ||
65 | QString dailyUrl(); | ||
66 | QString serverConfUrl(); | ||
67 | QString themeUrl(); | ||
68 | QString genlangUrl(); | ||
69 | QString proxyType(); | ||
70 | QString proxy(); | ||
71 | QString bleedingInfo(); | ||
72 | QString ofPath(); | ||
73 | QString lastTalkedFolder(); | ||
74 | QString voiceLanguage(); | ||
75 | int wavtrimTh(); | ||
76 | QString ttsPath(QString tts); | ||
77 | QString ttsOptions(QString tts); | ||
78 | QString ttsVoice(QString tts); | ||
79 | int ttsSpeed(QString tts); | ||
80 | QString ttsLang(QString tts); | ||
81 | bool ttsUseSapi4(); | ||
82 | QString encoderPath(QString enc); | ||
83 | QString encoderOptions(QString enc); | ||
84 | double encoderQuality(QString enc); | ||
85 | int encoderComplexity(QString enc); | ||
86 | double encoderVolume(QString enc); | ||
87 | bool encoderNarrowband(QString enc); | ||
88 | |||
89 | QStringList allPlatforms(void); | ||
90 | QStringList allLanguages(void); | ||
91 | 123 | ||
92 | QString name(QString plattform); | 124 | QString name(QString plattform); |
93 | QString brand(QString plattform); | 125 | QString brand(QString plattform); |
94 | 126 | ||
95 | QMap<int, QString> usbIdMap(enum MapType); | 127 | QMap<int, QString> usbIdMap(enum MapType); |
96 | 128 | ||
97 | QString curBrand(); | ||
98 | QString curName(); | ||
99 | QString curPlatform(); // rbutil internal target name. | ||
100 | QString curBuildserver_Modelname(); // modelnames used by the buildserver | ||
101 | QString curManual(); | ||
102 | QString curBootloaderMethod(); | ||
103 | QString curBootloaderName(); | ||
104 | QString curConfigure_Modelname(); // modelname from configure (used for themes, voice, rockbox-info comparing. | ||
105 | QString curLang(); | ||
106 | QString curEncoder(); | ||
107 | QString curTTS(); | ||
108 | QString curResolution(); | ||
109 | QString curBootloaderFile(); | ||
110 | int curTargetId(); | ||
111 | |||
112 | //! Set Functions | ||
113 | void setCurVersion(QString version); | ||
114 | void setOfPath(QString path); | ||
115 | void setCachePath(QString path); | ||
116 | void setBuild(QString build); | ||
117 | void setLastTalkedDir(QString dir); | ||
118 | void setVoiceLanguage(QString lang); | ||
119 | void setWavtrimTh(int th); | ||
120 | void setProxy(QString proxy); | ||
121 | void setProxyType(QString proxytype); | ||
122 | void setLang(QString lang); | ||
123 | void setMountpoint(QString mp); | ||
124 | void setCurPlatform(QString platt); | ||
125 | void setCacheDisable(bool on); | ||
126 | void setCacheOffline(bool on); | ||
127 | void setCurTTS(QString tts); | ||
128 | void setTTSPath(QString tts, QString path); | ||
129 | void setTTSOptions(QString tts, QString options); | ||
130 | void setTTSSpeed(QString tts, int speed); | ||
131 | void setTTSVoice(QString tts, QString voice); | ||
132 | void setTTSLang(QString tts, QString lang); | ||
133 | void setTTSUseSapi4(bool value); | ||
134 | void setEncoderPath(QString enc, QString path); | ||
135 | void setEncoderOptions(QString enc, QString options); | ||
136 | void setEncoderQuality(QString enc, double q); | ||
137 | void setEncoderComplexity(QString enc, int c); | ||
138 | void setEncoderVolume(QString enc,double v); | ||
139 | void setEncoderNarrowband(QString enc,bool nb); | ||
140 | |||
141 | private: | 129 | private: |
142 | |||
143 | //! helper function to get an entry in the current platform section | ||
144 | QVariant deviceSettingCurGet(QString entry,QString def=""); | ||
145 | //! helper function to get an entry out of a group in the userSettings | ||
146 | QVariant userSettingsGroupGet(QString group,QString entry,QVariant def=""); | ||
147 | //! helper function to set an entry in a group in the userSettings | ||
148 | void userSettingsGroupSet(QString group,QString entry,QVariant value); | ||
149 | |||
150 | |||
151 | //! private copy constructors to prvent copying | 130 | //! private copy constructors to prvent copying |
152 | RbSettings& operator= (const RbSettings& other) | 131 | RbSettings& operator= (const RbSettings& other) |
153 | { (void)other; return *this; } | 132 | { (void)other; return *this; } |
154 | RbSettings(const RbSettings& other) :QObject() | 133 | RbSettings(const RbSettings& other) :QObject() |
155 | { (void)other; } | 134 | { (void)other; } |
135 | QString constructSettingPath(QString path, QString substitute = QString()); | ||
156 | 136 | ||
157 | //! pointers to our setting objects | 137 | //! pointers to our setting objects |
158 | QSettings *devices; | 138 | QSettings *systemSettings; |
159 | QSettings *userSettings; | 139 | QSettings *userSettings; |
160 | |||
161 | }; | 140 | }; |
162 | 141 | ||
163 | #endif | 142 | #endif |
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index 11dbe153e5..e126b0ec45 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp | |||
@@ -154,13 +154,13 @@ void RbUtilQt::downloadInfo() | |||
154 | connect(daily, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); | 154 | connect(daily, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); |
155 | connect(daily, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool))); | 155 | connect(daily, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool))); |
156 | connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort())); | 156 | connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort())); |
157 | if(settings->cacheOffline()) | 157 | if(settings->value(RbSettings::CacheOffline).toBool()) |
158 | daily->setCache(true); | 158 | daily->setCache(true); |
159 | else | 159 | else |
160 | daily->setCache(false); | 160 | daily->setCache(false); |
161 | qDebug() << "downloading build info"; | 161 | qDebug() << "downloading build info"; |
162 | daily->setFile(&buildInfo); | 162 | daily->setFile(&buildInfo); |
163 | daily->getFile(QUrl(settings->serverConfUrl())); | 163 | daily->getFile(QUrl(settings->value(RbSettings::ServerConfUrl).toString())); |
164 | } | 164 | } |
165 | 165 | ||
166 | 166 | ||
@@ -181,7 +181,7 @@ void RbUtilQt::downloadDone(bool error) | |||
181 | versmap.insert("arch_date", info.value("dailies/date").toString()); | 181 | versmap.insert("arch_date", info.value("dailies/date").toString()); |
182 | 182 | ||
183 | info.beginGroup("release"); | 183 | info.beginGroup("release"); |
184 | versmap.insert("rel_rev", info.value(settings->curBuildserver_Modelname()).toString()); | 184 | versmap.insert("rel_rev", info.value(settings->value(RbSettings::CurBuildserverModel).toString()).toString()); |
185 | info.endGroup(); | 185 | info.endGroup(); |
186 | 186 | ||
187 | if(versmap.value("rel_rev").isEmpty()) { | 187 | if(versmap.value("rel_rev").isEmpty()) { |
@@ -197,12 +197,12 @@ void RbUtilQt::downloadDone(bool error) | |||
197 | connect(bleeding, SIGNAL(done(bool)), this, SLOT(downloadBleedingDone(bool))); | 197 | connect(bleeding, SIGNAL(done(bool)), this, SLOT(downloadBleedingDone(bool))); |
198 | connect(bleeding, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool))); | 198 | connect(bleeding, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool))); |
199 | connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort())); | 199 | connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort())); |
200 | if(settings->cacheOffline()) | 200 | if(settings->value(RbSettings::CacheOffline).toBool()) |
201 | bleeding->setCache(true); | 201 | bleeding->setCache(true); |
202 | bleeding->setFile(&bleedingInfo); | 202 | bleeding->setFile(&bleedingInfo); |
203 | bleeding->getFile(QUrl(settings->bleedingInfo())); | 203 | bleeding->getFile(QUrl(settings->value(RbSettings::BleedingInfo).toString())); |
204 | 204 | ||
205 | if(settings->curVersion() != PUREVERSION) { | 205 | if(settings->value(RbSettings::RbutilVersion) != PUREVERSION) { |
206 | QApplication::processEvents(); | 206 | QApplication::processEvents(); |
207 | QMessageBox::information(this, tr("New installation"), | 207 | QMessageBox::information(this, tr("New installation"), |
208 | tr("This is a new installation of Rockbox Utility, or a new version. " | 208 | tr("This is a new installation of Rockbox Utility, or a new version. " |
@@ -303,23 +303,23 @@ void RbUtilQt::updateSettings() | |||
303 | qDebug() << "updateSettings()"; | 303 | qDebug() << "updateSettings()"; |
304 | updateDevice(); | 304 | updateDevice(); |
305 | updateManual(); | 305 | updateManual(); |
306 | if(settings->proxyType() == "system") { | 306 | if(settings->value(RbSettings::ProxyType) == "system") { |
307 | HttpGet::setGlobalProxy(Detect::systemProxy()); | 307 | HttpGet::setGlobalProxy(Detect::systemProxy()); |
308 | } | 308 | } |
309 | else if(settings->proxyType() == "manual") { | 309 | else if(settings->value(RbSettings::ProxyType) == "manual") { |
310 | HttpGet::setGlobalProxy(settings->proxy()); | 310 | HttpGet::setGlobalProxy(settings->value(RbSettings::Proxy).toString()); |
311 | } | 311 | } |
312 | else { | 312 | else { |
313 | HttpGet::setGlobalProxy(QUrl("")); | 313 | HttpGet::setGlobalProxy(QUrl("")); |
314 | } | 314 | } |
315 | HttpGet::setGlobalCache(settings->cachePath()); | 315 | HttpGet::setGlobalCache(settings->value(RbSettings::CachePath).toString()); |
316 | HttpGet::setGlobalDumbCache(settings->cacheOffline()); | 316 | HttpGet::setGlobalDumbCache(settings->value(RbSettings::CacheOffline).toBool()); |
317 | } | 317 | } |
318 | 318 | ||
319 | 319 | ||
320 | void RbUtilQt::updateDevice() | 320 | void RbUtilQt::updateDevice() |
321 | { | 321 | { |
322 | if(settings->curBootloaderMethod() == "none" ) { | 322 | if(settings->value(RbSettings::CurBootloaderMethod) == "none" ) { |
323 | ui.buttonBootloader->setEnabled(false); | 323 | ui.buttonBootloader->setEnabled(false); |
324 | ui.buttonRemoveBootloader->setEnabled(false); | 324 | ui.buttonRemoveBootloader->setEnabled(false); |
325 | ui.labelBootloader->setEnabled(false); | 325 | ui.labelBootloader->setEnabled(false); |
@@ -328,7 +328,7 @@ void RbUtilQt::updateDevice() | |||
328 | else { | 328 | else { |
329 | ui.buttonBootloader->setEnabled(true); | 329 | ui.buttonBootloader->setEnabled(true); |
330 | ui.labelBootloader->setEnabled(true); | 330 | ui.labelBootloader->setEnabled(true); |
331 | if(settings->curBootloaderMethod() == "fwpatcher") { | 331 | if(settings->value(RbSettings::CurBootloaderMethod) == "fwpatcher") { |
332 | ui.labelRemoveBootloader->setEnabled(false); | 332 | ui.labelRemoveBootloader->setEnabled(false); |
333 | ui.buttonRemoveBootloader->setEnabled(false); | 333 | ui.buttonRemoveBootloader->setEnabled(false); |
334 | } | 334 | } |
@@ -339,9 +339,9 @@ void RbUtilQt::updateDevice() | |||
339 | } | 339 | } |
340 | 340 | ||
341 | // displayed device info | 341 | // displayed device info |
342 | QString mountpoint = settings->mountpoint(); | 342 | QString mountpoint = settings->value(RbSettings::Mountpoint).toString(); |
343 | QString brand = settings->curBrand(); | 343 | QString brand = settings->value(RbSettings::CurBrand).toString(); |
344 | QString name = settings->curName(); | 344 | QString name = settings->value(RbSettings::CurName).toString(); |
345 | if(name.isEmpty()) name = "<none>"; | 345 | if(name.isEmpty()) name = "<none>"; |
346 | if(mountpoint.isEmpty()) mountpoint = "<invalid>"; | 346 | if(mountpoint.isEmpty()) mountpoint = "<invalid>"; |
347 | ui.labelDevice->setText(tr("<b>%1 %2</b> at <b>%3</b>") | 347 | ui.labelDevice->setText(tr("<b>%1 %2</b> at <b>%3</b>") |
@@ -351,16 +351,18 @@ void RbUtilQt::updateDevice() | |||
351 | 351 | ||
352 | void RbUtilQt::updateManual() | 352 | void RbUtilQt::updateManual() |
353 | { | 353 | { |
354 | if(settings->curPlatform() != "") | 354 | if(settings->value(RbSettings::Platform) != "") |
355 | { | 355 | { |
356 | QString manual= settings->curManual(); | 356 | QString manual= settings->value(RbSettings::CurManual).toString(); |
357 | 357 | ||
358 | if(manual == "") | 358 | if(manual == "") |
359 | manual = "rockbox-" + settings->curPlatform(); | 359 | manual = "rockbox-" + settings->value(RbSettings::Platform).toString(); |
360 | QString pdfmanual; | 360 | QString pdfmanual; |
361 | pdfmanual = settings->manualUrl() + "/" + manual + ".pdf"; | 361 | pdfmanual = settings->value(RbSettings::ManualUrl).toString() |
362 | + "/" + manual + ".pdf"; | ||
362 | QString htmlmanual; | 363 | QString htmlmanual; |
363 | htmlmanual = settings->manualUrl() + "/" + manual + "/rockbox-build.html"; | 364 | htmlmanual = settings->value(RbSettings::ManualUrl).toString() |
365 | + "/" + manual + "/rockbox-build.html"; | ||
364 | ui.labelPdfManual->setText(tr("<a href='%1'>PDF Manual</a>") | 366 | ui.labelPdfManual->setText(tr("<a href='%1'>PDF Manual</a>") |
365 | .arg(pdfmanual)); | 367 | .arg(pdfmanual)); |
366 | ui.labelHtmlManual->setText(tr("<a href='%1'>HTML Manual (opens in browser)</a>") | 368 | ui.labelHtmlManual->setText(tr("<a href='%1'>HTML Manual (opens in browser)</a>") |
@@ -453,7 +455,7 @@ void RbUtilQt::smallInstall() | |||
453 | 455 | ||
454 | bool RbUtilQt::smallInstallInner() | 456 | bool RbUtilQt::smallInstallInner() |
455 | { | 457 | { |
456 | QString mountpoint = settings->mountpoint(); | 458 | QString mountpoint = settings->value(RbSettings::Mountpoint).toString(); |
457 | // show dialog with error if mount point is wrong | 459 | // show dialog with error if mount point is wrong |
458 | if(!QFileInfo(mountpoint).isDir()) { | 460 | if(!QFileInfo(mountpoint).isDir()) { |
459 | logger->addItem(tr("Mount point is wrong!"),LOGERROR); | 461 | logger->addItem(tr("Mount point is wrong!"),LOGERROR); |
@@ -461,7 +463,7 @@ bool RbUtilQt::smallInstallInner() | |||
461 | return true; | 463 | return true; |
462 | } | 464 | } |
463 | // Bootloader | 465 | // Bootloader |
464 | if(settings->curBootloaderMethod() != "none") | 466 | if(settings->value(RbSettings::CurBootloaderMethod) != "none") |
465 | { | 467 | { |
466 | m_error = false; | 468 | m_error = false; |
467 | m_installed = false; | 469 | m_installed = false; |
@@ -513,14 +515,16 @@ void RbUtilQt::installBtn() | |||
513 | bool RbUtilQt::installAuto() | 515 | bool RbUtilQt::installAuto() |
514 | { | 516 | { |
515 | QString file = QString("%1/%2/rockbox-%3-%4.zip") | 517 | QString file = QString("%1/%2/rockbox-%3-%4.zip") |
516 | .arg(settings->releaseUrl(), versmap.value("rel_rev"), | 518 | .arg(settings->value(RbSettings::ReleaseUrl).toString(), |
517 | settings->curBuildserver_Modelname(), versmap.value("rel_rev")); | 519 | versmap.value("rel_rev"), |
520 | settings->value(RbSettings::CurBuildserverModel).toString(), | ||
521 | versmap.value("rel_rev")); | ||
518 | buildInfo.open(); | 522 | buildInfo.open(); |
519 | QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); | 523 | QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); |
520 | buildInfo.close(); | 524 | buildInfo.close(); |
521 | 525 | ||
522 | // check installed Version and Target | 526 | // check installed Version and Target |
523 | QString rbVersion = Detect::installedVersion(settings->mountpoint()); | 527 | QString rbVersion = Detect::installedVersion(settings->value(RbSettings::Mountpoint).toString()); |
524 | QString warning = Detect::check(settings, false); | 528 | QString warning = Detect::check(settings, false); |
525 | 529 | ||
526 | if(!warning.isEmpty()) | 530 | if(!warning.isEmpty()) |
@@ -542,7 +546,7 @@ bool RbUtilQt::installAuto() | |||
542 | QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) | 546 | QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) |
543 | { | 547 | { |
544 | logger->addItem(tr("Starting backup..."),LOGINFO); | 548 | logger->addItem(tr("Starting backup..."),LOGINFO); |
545 | QString backupName = settings->mountpoint() | 549 | QString backupName = settings->value(RbSettings::Mountpoint).toString() |
546 | + "/.backup/rockbox-backup-" + rbVersion + ".zip"; | 550 | + "/.backup/rockbox-backup-" + rbVersion + ".zip"; |
547 | 551 | ||
548 | //! create dir, if it doesnt exist | 552 | //! create dir, if it doesnt exist |
@@ -556,7 +560,8 @@ bool RbUtilQt::installAuto() | |||
556 | //! create backup | 560 | //! create backup |
557 | RbZip backup; | 561 | RbZip backup; |
558 | connect(&backup,SIGNAL(zipProgress(int,int)),logger, SLOT(setProgress(int,int))); | 562 | connect(&backup,SIGNAL(zipProgress(int,int)),logger, SLOT(setProgress(int,int))); |
559 | if(backup.createZip(backupName,settings->mountpoint() + "/.rockbox") == Zip::Ok) | 563 | if(backup.createZip(backupName, |
564 | settings->value(RbSettings::Mountpoint).toString() + "/.rockbox") == Zip::Ok) | ||
560 | { | 565 | { |
561 | logger->addItem(tr("Backup successful"),LOGOK); | 566 | logger->addItem(tr("Backup successful"),LOGOK); |
562 | } | 567 | } |
@@ -574,9 +579,9 @@ bool RbUtilQt::installAuto() | |||
574 | installer->setUrl(file); | 579 | installer->setUrl(file); |
575 | installer->setLogSection("Rockbox (Base)"); | 580 | installer->setLogSection("Rockbox (Base)"); |
576 | installer->setLogVersion(versmap.value("rel_rev")); | 581 | installer->setLogVersion(versmap.value("rel_rev")); |
577 | if(!settings->cacheDisabled()) | 582 | if(!settings->value(RbSettings::CacheDisabled).toBool()) |
578 | installer->setCache(true); | 583 | installer->setCache(true); |
579 | installer->setMountPoint(settings->mountpoint()); | 584 | installer->setMountPoint(settings->value(RbSettings::Mountpoint).toString()); |
580 | 585 | ||
581 | connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool))); | 586 | connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool))); |
582 | 587 | ||
@@ -618,13 +623,13 @@ void RbUtilQt::installBootloaderBtn() | |||
618 | 623 | ||
619 | void RbUtilQt::installBootloader() | 624 | void RbUtilQt::installBootloader() |
620 | { | 625 | { |
621 | QString platform = settings->curPlatform(); | 626 | QString platform = settings->value(RbSettings::Platform).toString(); |
622 | QString backupDestination = ""; | 627 | QString backupDestination = ""; |
623 | m_error = false; | 628 | m_error = false; |
624 | 629 | ||
625 | // create installer | 630 | // create installer |
626 | BootloaderInstallBase *bl; | 631 | BootloaderInstallBase *bl; |
627 | QString type = settings->curBootloaderMethod(); | 632 | QString type = settings->value(RbSettings::CurBootloaderMethod).toString(); |
628 | if(type == "mi4") { | 633 | if(type == "mi4") { |
629 | bl = new BootloaderInstallMi4(this); | 634 | bl = new BootloaderInstallMi4(this); |
630 | } | 635 | } |
@@ -648,21 +653,24 @@ void RbUtilQt::installBootloader() | |||
648 | 653 | ||
649 | // set bootloader filename. Do this now as installed() needs it. | 654 | // set bootloader filename. Do this now as installed() needs it. |
650 | QString blfile; | 655 | QString blfile; |
651 | blfile = settings->mountpoint() + settings->curBootloaderFile(); | 656 | blfile = settings->value(RbSettings::Mountpoint).toString() |
657 | + settings->value(RbSettings::CurBootloaderFile).toString(); | ||
652 | // special case for H10 pure: this player can have a different | 658 | // special case for H10 pure: this player can have a different |
653 | // bootloader file filename. This is handled here to keep the install | 659 | // bootloader file filename. This is handled here to keep the install |
654 | // class clean, though having it here is also not the nicest solution. | 660 | // class clean, though having it here is also not the nicest solution. |
655 | if(platform == "h10_ums" | 661 | if(settings->value(RbSettings::Platform).toString() == "h10_ums" |
656 | || platform == "h10_mtp") { | 662 | || settings->value(RbSettings::Platform) == "h10_mtp") { |
657 | if(resolvePathCase(blfile).isEmpty()) | 663 | if(resolvePathCase(blfile).isEmpty()) |
658 | blfile = settings->mountpoint() | 664 | blfile = settings->value(RbSettings::Mountpoint).toString() |
659 | + settings->curBootloaderName().replace("H10", | 665 | + settings->value(RbSettings::CurBootloaderName).toString() |
660 | "H10EMP", Qt::CaseInsensitive); | 666 | .replace("H10", "H10EMP", Qt::CaseInsensitive); |
661 | } | 667 | } |
662 | bl->setBlFile(blfile); | 668 | bl->setBlFile(blfile); |
663 | QUrl url(settings->bootloaderUrl() + settings->curBootloaderName()); | 669 | QUrl url(settings->value(RbSettings::BootloaderUrl).toString() |
670 | + settings->value(RbSettings::CurBootloaderName).toString()); | ||
664 | bl->setBlUrl(url); | 671 | bl->setBlUrl(url); |
665 | bl->setLogfile(settings->mountpoint() + "/.rockbox/rbutil.log"); | 672 | bl->setLogfile(settings->value(RbSettings::Mountpoint).toString() |
673 | + "/.rockbox/rbutil.log"); | ||
666 | 674 | ||
667 | if(bl->installed() == BootloaderInstallBase::BootloaderRockbox) { | 675 | if(bl->installed() == BootloaderInstallBase::BootloaderRockbox) { |
668 | if(QMessageBox::question(this, tr("Bootloader detected"), | 676 | if(QMessageBox::question(this, tr("Bootloader detected"), |
@@ -684,7 +692,8 @@ void RbUtilQt::installBootloader() | |||
684 | else if(bl->installed() == BootloaderInstallBase::BootloaderOther | 692 | else if(bl->installed() == BootloaderInstallBase::BootloaderOther |
685 | && bl->capabilities() & BootloaderInstallBase::Backup) | 693 | && bl->capabilities() & BootloaderInstallBase::Backup) |
686 | { | 694 | { |
687 | QString targetFolder = settings->curPlatform() + " Firmware Backup"; | 695 | QString targetFolder = settings->value(RbSettings::CurPlatformName).toString() |
696 | + " Firmware Backup"; | ||
688 | // remove invalid character(s) | 697 | // remove invalid character(s) |
689 | targetFolder.remove(QRegExp("[:/]")); | 698 | targetFolder.remove(QRegExp("[:/]")); |
690 | if(QMessageBox::question(this, tr("Create Bootloader backup"), | 699 | if(QMessageBox::question(this, tr("Create Bootloader backup"), |
@@ -777,7 +786,8 @@ void RbUtilQt::installBootloaderPost(bool error) | |||
777 | if(m_auto) | 786 | if(m_auto) |
778 | return; | 787 | return; |
779 | 788 | ||
780 | QString msg = BootloaderInstallBase::postinstallHints(settings->curPlatform()); | 789 | QString msg = BootloaderInstallBase::postinstallHints( |
790 | settings->value(RbSettings::Platform).toString()); | ||
781 | if(!msg.isEmpty()) { | 791 | if(!msg.isEmpty()) { |
782 | QMessageBox::information(this, tr("Manual steps required"), msg); | 792 | QMessageBox::information(this, tr("Manual steps required"), msg); |
783 | logger->close(); | 793 | logger->close(); |
@@ -809,11 +819,11 @@ void RbUtilQt::installFonts() | |||
809 | // create zip installer | 819 | // create zip installer |
810 | installer = new ZipInstaller(this); | 820 | installer = new ZipInstaller(this); |
811 | 821 | ||
812 | installer->setUrl(settings->fontUrl()); | 822 | installer->setUrl(settings->value(RbSettings::FontUrl).toString()); |
813 | installer->setLogSection("Fonts"); | 823 | installer->setLogSection("Fonts"); |
814 | installer->setLogVersion(versmap.value("arch_date")); | 824 | installer->setLogVersion(versmap.value("arch_date")); |
815 | installer->setMountPoint(settings->mountpoint()); | 825 | installer->setMountPoint(settings->value(RbSettings::Mountpoint).toString()); |
816 | if(!settings->cacheDisabled()) | 826 | if(!settings->value(RbSettings::CacheDisabled).toBool()) |
817 | installer->setCache(true); | 827 | installer->setCache(true); |
818 | 828 | ||
819 | connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool))); | 829 | connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool))); |
@@ -843,17 +853,17 @@ void RbUtilQt::installVoice() | |||
843 | // create zip installer | 853 | // create zip installer |
844 | installer = new ZipInstaller(this); | 854 | installer = new ZipInstaller(this); |
845 | 855 | ||
846 | QString voiceurl = settings->voiceUrl(); | 856 | QString voiceurl = settings->value(RbSettings::VoiceUrl).toString(); |
847 | 857 | ||
848 | voiceurl += settings->curConfigure_Modelname() + "-" + | 858 | voiceurl += settings->value(RbSettings::CurConfigureModel).toString() + "-" + |
849 | versmap.value("arch_date") + "-english.zip"; | 859 | versmap.value("arch_date") + "-english.zip"; |
850 | qDebug() << voiceurl; | 860 | qDebug() << voiceurl; |
851 | 861 | ||
852 | installer->setUrl(voiceurl); | 862 | installer->setUrl(voiceurl); |
853 | installer->setLogSection("Voice"); | 863 | installer->setLogSection("Voice"); |
854 | installer->setLogVersion(versmap.value("arch_date")); | 864 | installer->setLogVersion(versmap.value("arch_date")); |
855 | installer->setMountPoint(settings->mountpoint()); | 865 | installer->setMountPoint(settings->value(RbSettings::Mountpoint).toString()); |
856 | if(!settings->cacheDisabled()) | 866 | if(!settings->value(RbSettings::CacheDisabled).toBool()) |
857 | installer->setCache(true); | 867 | installer->setCache(true); |
858 | installer->install(logger); | 868 | installer->install(logger); |
859 | 869 | ||
@@ -885,7 +895,8 @@ bool RbUtilQt::installDoomAuto() | |||
885 | 895 | ||
886 | bool RbUtilQt::hasDoom() | 896 | bool RbUtilQt::hasDoom() |
887 | { | 897 | { |
888 | QFile doomrock(settings->mountpoint() +"/.rockbox/rocks/games/doom.rock"); | 898 | QFile doomrock(settings->value(RbSettings::Mountpoint).toString() |
899 | +"/.rockbox/rocks/games/doom.rock"); | ||
889 | return doomrock.exists(); | 900 | return doomrock.exists(); |
890 | } | 901 | } |
891 | 902 | ||
@@ -894,11 +905,11 @@ void RbUtilQt::installDoom() | |||
894 | // create zip installer | 905 | // create zip installer |
895 | installer = new ZipInstaller(this); | 906 | installer = new ZipInstaller(this); |
896 | 907 | ||
897 | installer->setUrl(settings->doomUrl()); | 908 | installer->setUrl(settings->value(RbSettings::DoomUrl).toString()); |
898 | installer->setLogSection("Game Addons"); | 909 | installer->setLogSection("Game Addons"); |
899 | installer->setLogVersion(versmap.value("arch_date")); | 910 | installer->setLogVersion(versmap.value("arch_date")); |
900 | installer->setMountPoint(settings->mountpoint()); | 911 | installer->setMountPoint(settings->value(RbSettings::Mountpoint).toString()); |
901 | if(!settings->cacheDisabled()) | 912 | if(!settings->value(RbSettings::CacheDisabled).toBool()) |
902 | installer->setCache(true); | 913 | installer->setCache(true); |
903 | connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool))); | 914 | connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool))); |
904 | installer->install(logger); | 915 | installer->install(logger); |
@@ -957,11 +968,11 @@ void RbUtilQt::uninstallBootloader(void) | |||
957 | logger->setProgressVisible(false); | 968 | logger->setProgressVisible(false); |
958 | logger->show(); | 969 | logger->show(); |
959 | 970 | ||
960 | QString platform = settings->curPlatform(); | 971 | QString platform = settings->value(RbSettings::Platform).toString(); |
961 | 972 | ||
962 | // create installer | 973 | // create installer |
963 | BootloaderInstallBase *bl; | 974 | BootloaderInstallBase *bl; |
964 | QString type = settings->curBootloaderMethod(); | 975 | QString type = settings->value(RbSettings::CurBootloaderMethod).toString(); |
965 | if(type == "mi4") { | 976 | if(type == "mi4") { |
966 | bl = new BootloaderInstallMi4(); | 977 | bl = new BootloaderInstallMi4(); |
967 | } | 978 | } |
@@ -983,13 +994,14 @@ void RbUtilQt::uninstallBootloader(void) | |||
983 | return; | 994 | return; |
984 | } | 995 | } |
985 | 996 | ||
986 | QString blfile = settings->mountpoint() + settings->curBootloaderFile(); | 997 | QString blfile = settings->value(RbSettings::Mountpoint).toString() |
987 | if(settings->curPlatform() == "h10_ums" | 998 | + settings->value(RbSettings::CurBootloaderFile).toString(); |
988 | || settings->curPlatform() == "h10_mtp") { | 999 | if(settings->value(RbSettings::Platform).toString() == "h10_ums" |
1000 | || settings->value(RbSettings::Platform).toString() == "h10_mtp") { | ||
989 | if(resolvePathCase(blfile).isEmpty()) | 1001 | if(resolvePathCase(blfile).isEmpty()) |
990 | blfile = settings->mountpoint() | 1002 | blfile = settings->value(RbSettings::Mountpoint).toString() |
991 | + settings->curBootloaderName().replace("H10", | 1003 | + settings->value(RbSettings::CurBootloaderName).toString() |
992 | "H10EMP", Qt::CaseInsensitive); | 1004 | .replace("H10", "H10EMP", Qt::CaseInsensitive); |
993 | } | 1005 | } |
994 | bl->setBlFile(blfile); | 1006 | bl->setBlFile(blfile); |
995 | 1007 | ||
@@ -1017,7 +1029,7 @@ void RbUtilQt::downloadManual(void) | |||
1017 | QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); | 1029 | QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); |
1018 | buildInfo.close(); | 1030 | buildInfo.close(); |
1019 | 1031 | ||
1020 | QString manual = settings->curManual(); | 1032 | QString manual = settings->value(RbSettings::CurManual).toString(); |
1021 | 1033 | ||
1022 | QString date = (info.value("dailies/date").toString()); | 1034 | QString date = (info.value("dailies/date").toString()); |
1023 | 1035 | ||
@@ -1032,14 +1044,14 @@ void RbUtilQt::downloadManual(void) | |||
1032 | target = "/" + manual + "-" + date + "-html.zip"; | 1044 | target = "/" + manual + "-" + date + "-html.zip"; |
1033 | section = "Manual (HTML)"; | 1045 | section = "Manual (HTML)"; |
1034 | } | 1046 | } |
1035 | manualurl = settings->manualUrl() + "/" + target; | 1047 | manualurl = settings->value(RbSettings::ManualUrl).toString() + "/" + target; |
1036 | qDebug() << "manualurl =" << manualurl; | 1048 | qDebug() << "manualurl =" << manualurl; |
1037 | 1049 | ||
1038 | ProgressLoggerGui* logger = new ProgressLoggerGui(this); | 1050 | ProgressLoggerGui* logger = new ProgressLoggerGui(this); |
1039 | logger->show(); | 1051 | logger->show(); |
1040 | installer = new ZipInstaller(this); | 1052 | installer = new ZipInstaller(this); |
1041 | installer->setMountPoint(settings->mountpoint()); | 1053 | installer->setMountPoint(settings->value(RbSettings::Mountpoint).toString()); |
1042 | if(!settings->cacheDisabled()) | 1054 | if(!settings->value(RbSettings::CacheDisabled).toBool()) |
1043 | installer->setCache(true); | 1055 | installer->setCache(true); |
1044 | installer->setLogSection(section); | 1056 | installer->setLogSection(section); |
1045 | installer->setLogVersion(date); | 1057 | installer->setLogVersion(date); |
@@ -1065,24 +1077,28 @@ void RbUtilQt::installPortable(void) | |||
1065 | logger->addItem(tr("Installing Rockbox Utility"), LOGINFO); | 1077 | logger->addItem(tr("Installing Rockbox Utility"), LOGINFO); |
1066 | 1078 | ||
1067 | // check mountpoint | 1079 | // check mountpoint |
1068 | if(!QFileInfo(settings->mountpoint()).isDir()) { | 1080 | if(!QFileInfo(settings->value(RbSettings::Mountpoint).toString()).isDir()) { |
1069 | logger->addItem(tr("Mount point is wrong!"),LOGERROR); | 1081 | logger->addItem(tr("Mount point is wrong!"),LOGERROR); |
1070 | logger->abort(); | 1082 | logger->abort(); |
1071 | return; | 1083 | return; |
1072 | } | 1084 | } |
1073 | 1085 | ||
1074 | // remove old files first. | 1086 | // remove old files first. |
1075 | QFile::remove(settings->mountpoint() + "/RockboxUtility.exe"); | 1087 | QFile::remove(settings->value(RbSettings::Mountpoint).toString() |
1076 | QFile::remove(settings->mountpoint() + "/RockboxUtility.ini"); | 1088 | + "/RockboxUtility.exe"); |
1089 | QFile::remove(settings->value(RbSettings::Mountpoint).toString() | ||
1090 | + "/RockboxUtility.ini"); | ||
1077 | // copy currently running binary and currently used settings file | 1091 | // copy currently running binary and currently used settings file |
1078 | if(!QFile::copy(qApp->applicationFilePath(), settings->mountpoint() | 1092 | if(!QFile::copy(qApp->applicationFilePath(), |
1093 | settings->value(RbSettings::Mountpoint).toString() | ||
1079 | + "/RockboxUtility.exe")) { | 1094 | + "/RockboxUtility.exe")) { |
1080 | logger->addItem(tr("Error installing Rockbox Utility"), LOGERROR); | 1095 | logger->addItem(tr("Error installing Rockbox Utility"), LOGERROR); |
1081 | logger->abort(); | 1096 | logger->abort(); |
1082 | return; | 1097 | return; |
1083 | } | 1098 | } |
1084 | logger->addItem(tr("Installing user configuration"), LOGINFO); | 1099 | logger->addItem(tr("Installing user configuration"), LOGINFO); |
1085 | if(!QFile::copy(settings->userSettingFilename(), settings->mountpoint() | 1100 | if(!QFile::copy(settings->userSettingFilename(), |
1101 | settings->value(RbSettings::Mountpoint).toString() | ||
1086 | + "/RockboxUtility.ini")) { | 1102 | + "/RockboxUtility.ini")) { |
1087 | logger->addItem(tr("Error installing user configuration"), LOGERROR); | 1103 | logger->addItem(tr("Error installing user configuration"), LOGERROR); |
1088 | logger->abort(); | 1104 | logger->abort(); |
@@ -1100,8 +1116,8 @@ void RbUtilQt::updateInfo() | |||
1100 | { | 1116 | { |
1101 | qDebug() << "RbUtilQt::updateInfo()"; | 1117 | qDebug() << "RbUtilQt::updateInfo()"; |
1102 | 1118 | ||
1103 | QSettings log(settings->mountpoint() + "/.rockbox/rbutil.log", | 1119 | QSettings log(settings->value(RbSettings::Mountpoint).toString() |
1104 | QSettings::IniFormat, this); | 1120 | + "/.rockbox/rbutil.log", QSettings::IniFormat, this); |
1105 | QStringList groups = log.childGroups(); | 1121 | QStringList groups = log.childGroups(); |
1106 | QList<QTreeWidgetItem *> items; | 1122 | QList<QTreeWidgetItem *> items; |
1107 | QTreeWidgetItem *w, *w2; | 1123 | QTreeWidgetItem *w, *w2; |
@@ -1137,7 +1153,7 @@ void RbUtilQt::updateInfo() | |||
1137 | 1153 | ||
1138 | for(int b = 0; b < keys.size(); b++) { | 1154 | for(int b = 0; b < keys.size(); b++) { |
1139 | QString file; | 1155 | QString file; |
1140 | file = settings->mountpoint() + "/" + keys.at(b); | 1156 | file = settings->value(RbSettings::Mountpoint).toString() + "/" + keys.at(b); |
1141 | if(QFileInfo(file).isDir()) | 1157 | if(QFileInfo(file).isDir()) |
1142 | continue; | 1158 | continue; |
1143 | w2 = new QTreeWidgetItem(w, QStringList() << "/" | 1159 | w2 = new QTreeWidgetItem(w, QStringList() << "/" |
@@ -1162,9 +1178,9 @@ void RbUtilQt::updateInfo() | |||
1162 | 1178 | ||
1163 | QUrl RbUtilQt::proxy() | 1179 | QUrl RbUtilQt::proxy() |
1164 | { | 1180 | { |
1165 | if(settings->proxyType() == "manual") | 1181 | if(settings->value(RbSettings::ProxyType) == "manual") |
1166 | return QUrl(settings->proxy()); | 1182 | return QUrl(settings->value(RbSettings::Proxy).toString()); |
1167 | else if(settings->proxy() == "system") | 1183 | else if(settings->value(RbSettings::ProxyType) == "system") |
1168 | return Detect::systemProxy(); | 1184 | return Detect::systemProxy(); |
1169 | return QUrl(""); | 1185 | return QUrl(""); |
1170 | } | 1186 | } |
@@ -1173,9 +1189,9 @@ QUrl RbUtilQt::proxy() | |||
1173 | bool RbUtilQt::chkConfig(bool warn) | 1189 | bool RbUtilQt::chkConfig(bool warn) |
1174 | { | 1190 | { |
1175 | bool error = false; | 1191 | bool error = false; |
1176 | if(settings->curPlatform().isEmpty() | 1192 | if(settings->value(RbSettings::Platform).toString().isEmpty() |
1177 | || settings->mountpoint().isEmpty() | 1193 | || settings->value(RbSettings::Mountpoint).toString().isEmpty() |
1178 | || !QFileInfo(settings->mountpoint()).isWritable()) { | 1194 | || !QFileInfo(settings->value(RbSettings::Mountpoint).toString()).isWritable()) { |
1179 | error = true; | 1195 | error = true; |
1180 | 1196 | ||
1181 | if(warn) QMessageBox::critical(this, tr("Configuration error"), | 1197 | if(warn) QMessageBox::critical(this, tr("Configuration error"), |
diff --git a/rbutil/rbutilqt/talkfile.cpp b/rbutil/rbutilqt/talkfile.cpp index 43993be436..6e872ad281 100644 --- a/rbutil/rbutilqt/talkfile.cpp +++ b/rbutil/rbutilqt/talkfile.cpp | |||
@@ -24,25 +24,25 @@ TalkFileCreator::TalkFileCreator(QObject* parent): QObject(parent) | |||
24 | 24 | ||
25 | } | 25 | } |
26 | 26 | ||
27 | //! \brief Creates Talkfiles. | 27 | //! \brief Creates Talkfiles. |
28 | //! | 28 | //! |
29 | //! \param logger A pointer to a Loggerobject | 29 | //! \param logger A pointer to a Loggerobject |
30 | bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger) | 30 | bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger) |
31 | { | 31 | { |
32 | m_abort = false; | 32 | m_abort = false; |
33 | m_logger = logger; | 33 | m_logger = logger; |
34 | 34 | ||
35 | QMultiMap<QString,QString> fileList; | 35 | QMultiMap<QString,QString> fileList; |
36 | QMultiMap<QString,QString> dirList; | 36 | QMultiMap<QString,QString> dirList; |
37 | QStringList toSpeakList, voicedEntries, encodedEntries; | 37 | QStringList toSpeakList, voicedEntries, encodedEntries; |
38 | QString errStr; | 38 | QString errStr; |
39 | 39 | ||
40 | m_logger->addItem(tr("Starting Talk file generation"),LOGINFO); | 40 | m_logger->addItem(tr("Starting Talk file generation"),LOGINFO); |
41 | 41 | ||
42 | //tts | 42 | //tts |
43 | m_tts = TTSBase::getTTS(settings->curTTS()); | 43 | m_tts = TTSBase::getTTS(settings->value(RbSettings::Tts).toString()); |
44 | m_tts->setCfg(settings); | 44 | m_tts->setCfg(settings); |
45 | 45 | ||
46 | if(!m_tts->start(&errStr)) | 46 | if(!m_tts->start(&errStr)) |
47 | { | 47 | { |
48 | m_logger->addItem(errStr.trimmed(),LOGERROR); | 48 | m_logger->addItem(errStr.trimmed(),LOGERROR); |
@@ -52,9 +52,9 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger) | |||
52 | } | 52 | } |
53 | 53 | ||
54 | // Encoder | 54 | // Encoder |
55 | m_enc = EncBase::getEncoder(settings->curEncoder()); | 55 | m_enc = EncBase::getEncoder(settings->value(RbSettings::CurEncoder).toString()); |
56 | m_enc->setCfg(settings); | 56 | m_enc->setCfg(settings); |
57 | 57 | ||
58 | if(!m_enc->start()) | 58 | if(!m_enc->start()) |
59 | { | 59 | { |
60 | m_logger->addItem(tr("Init of Encoder engine failed"),LOGERROR); | 60 | m_logger->addItem(tr("Init of Encoder engine failed"),LOGERROR); |
@@ -67,7 +67,7 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger) | |||
67 | 67 | ||
68 | connect(logger,SIGNAL(aborted()),this,SLOT(abort())); | 68 | connect(logger,SIGNAL(aborted()),this,SLOT(abort())); |
69 | m_logger->setProgressMax(0); | 69 | m_logger->setProgressMax(0); |
70 | 70 | ||
71 | // read in Maps of paths - file/dirnames | 71 | // read in Maps of paths - file/dirnames |
72 | m_logger->addItem(tr("Reading Filelist..."),LOGINFO); | 72 | m_logger->addItem(tr("Reading Filelist..."),LOGINFO); |
73 | if(createDirAndFileMaps(m_dir,&dirList,&fileList) == false) | 73 | if(createDirAndFileMaps(m_dir,&dirList,&fileList) == false) |
@@ -76,21 +76,21 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger) | |||
76 | doAbort(toSpeakList); | 76 | doAbort(toSpeakList); |
77 | return false; | 77 | return false; |
78 | } | 78 | } |
79 | 79 | ||
80 | // create List of all Files/Dirs to speak | 80 | // create List of all Files/Dirs to speak |
81 | QMapIterator<QString, QString> dirIt(dirList); | 81 | QMapIterator<QString, QString> dirIt(dirList); |
82 | while (dirIt.hasNext()) | 82 | while (dirIt.hasNext()) |
83 | { | 83 | { |
84 | dirIt.next(); | 84 | dirIt.next(); |
85 | // insert only non dublicate dir entries into list | 85 | // insert only non dublicate dir entries into list |
86 | if(!toSpeakList.contains(dirIt.value())) | 86 | if(!toSpeakList.contains(dirIt.value())) |
87 | { | 87 | { |
88 | qDebug() << "toSpeaklist dir:" << dirIt.value(); | 88 | qDebug() << "toSpeaklist dir:" << dirIt.value(); |
89 | toSpeakList.append(dirIt.value()); | 89 | toSpeakList.append(dirIt.value()); |
90 | } | 90 | } |
91 | } | 91 | } |
92 | QMapIterator<QString, QString> fileIt(fileList); | 92 | QMapIterator<QString, QString> fileIt(fileList); |
93 | while (fileIt.hasNext()) | 93 | while (fileIt.hasNext()) |
94 | { | 94 | { |
95 | fileIt.next(); | 95 | fileIt.next(); |
96 | // insert only non- dublictae file entries into list | 96 | // insert only non- dublictae file entries into list |
@@ -99,10 +99,10 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger) | |||
99 | if(m_stripExtensions) | 99 | if(m_stripExtensions) |
100 | toSpeakList.append(stripExtension(fileIt.value())); | 100 | toSpeakList.append(stripExtension(fileIt.value())); |
101 | else | 101 | else |
102 | toSpeakList.append(fileIt.value()); | 102 | toSpeakList.append(fileIt.value()); |
103 | } | 103 | } |
104 | } | 104 | } |
105 | 105 | ||
106 | // Voice entries | 106 | // Voice entries |
107 | m_logger->addItem(tr("Voicing entries..."),LOGINFO); | 107 | m_logger->addItem(tr("Voicing entries..."),LOGINFO); |
108 | TTSStatus voiceStatus= voiceList(toSpeakList,voicedEntries); | 108 | TTSStatus voiceStatus= voiceList(toSpeakList,voicedEntries); |
@@ -111,7 +111,7 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger) | |||
111 | doAbort(toSpeakList); | 111 | doAbort(toSpeakList); |
112 | return false; | 112 | return false; |
113 | } | 113 | } |
114 | 114 | ||
115 | // Encoding Entries | 115 | // Encoding Entries |
116 | m_logger->addItem(tr("Encoding files..."),LOGINFO); | 116 | m_logger->addItem(tr("Encoding files..."),LOGINFO); |
117 | if(encodeList(voicedEntries,encodedEntries) == false) | 117 | if(encodeList(voicedEntries,encodedEntries) == false) |
@@ -119,25 +119,25 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger) | |||
119 | doAbort(toSpeakList); | 119 | doAbort(toSpeakList); |
120 | return false; | 120 | return false; |
121 | } | 121 | } |
122 | 122 | ||
123 | // Copying talk files | 123 | // Copying talk files |
124 | m_logger->addItem(tr("Copying Talkfile for Dirs..."),LOGINFO); | 124 | m_logger->addItem(tr("Copying Talkfile for Dirs..."),LOGINFO); |
125 | if(copyTalkDirFiles(dirList,&errStr) == false) | 125 | if(copyTalkDirFiles(dirList,&errStr) == false) |
126 | { | 126 | { |
127 | m_logger->addItem(errStr,LOGERROR); | 127 | m_logger->addItem(errStr,LOGERROR); |
128 | doAbort(toSpeakList); | 128 | doAbort(toSpeakList); |
129 | return false; | 129 | return false; |
130 | } | 130 | } |
131 | 131 | ||
132 | //Copying file talk files | 132 | //Copying file talk files |
133 | m_logger->addItem(tr("Copying Talkfile for Files..."),LOGINFO); | 133 | m_logger->addItem(tr("Copying Talkfile for Files..."),LOGINFO); |
134 | if(copyTalkFileFiles(fileList,&errStr) == false) | 134 | if(copyTalkFileFiles(fileList,&errStr) == false) |
135 | { | 135 | { |
136 | m_logger->addItem(errStr,LOGERROR); | 136 | m_logger->addItem(errStr,LOGERROR); |
137 | doAbort(toSpeakList); | 137 | doAbort(toSpeakList); |
138 | return false; | 138 | return false; |
139 | } | 139 | } |
140 | 140 | ||
141 | // Deleting left overs | 141 | // Deleting left overs |
142 | if( !cleanup(toSpeakList)) | 142 | if( !cleanup(toSpeakList)) |
143 | return false; | 143 | return false; |
@@ -184,7 +184,7 @@ void TalkFileCreator::doAbort(QStringList cleanupList) | |||
184 | m_logger->setProgressValue(0); | 184 | m_logger->setProgressValue(0); |
185 | m_logger->abort(); | 185 | m_logger->abort(); |
186 | m_tts->stop(); | 186 | m_tts->stop(); |
187 | m_enc->stop(); | 187 | m_enc->stop(); |
188 | } | 188 | } |
189 | 189 | ||
190 | //! \brief Creates MultiMaps (paths -> File/dir names) of all Dirs and Files in a Folder. | 190 | //! \brief Creates MultiMaps (paths -> File/dir names) of all Dirs and Files in a Folder. |
@@ -194,16 +194,16 @@ void TalkFileCreator::doAbort(QStringList cleanupList) | |||
194 | //! \param startDir The dir where it beginns scanning | 194 | //! \param startDir The dir where it beginns scanning |
195 | //! \param dirMap The MulitMap where the dirs are stored | 195 | //! \param dirMap The MulitMap where the dirs are stored |
196 | //! \param filMap The MultiMap where Files are stored | 196 | //! \param filMap The MultiMap where Files are stored |
197 | //! \returns true on Success, false if User aborted. | 197 | //! \returns true on Success, false if User aborted. |
198 | bool TalkFileCreator::createDirAndFileMaps(QDir startDir,QMultiMap<QString,QString> *dirMap,QMultiMap<QString,QString> *fileMap) | 198 | bool TalkFileCreator::createDirAndFileMaps(QDir startDir,QMultiMap<QString,QString> *dirMap,QMultiMap<QString,QString> *fileMap) |
199 | { | 199 | { |
200 | // create Iterator | 200 | // create Iterator |
201 | QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags; | 201 | QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags; |
202 | if(m_recursive) | 202 | if(m_recursive) |
203 | flags = QDirIterator::Subdirectories; | 203 | flags = QDirIterator::Subdirectories; |
204 | 204 | ||
205 | QDirIterator it(startDir,flags); | 205 | QDirIterator it(startDir,flags); |
206 | 206 | ||
207 | // read in Maps of paths - file/dirnames | 207 | // read in Maps of paths - file/dirnames |
208 | while (it.hasNext()) | 208 | while (it.hasNext()) |
209 | { | 209 | { |
@@ -212,14 +212,14 @@ bool TalkFileCreator::createDirAndFileMaps(QDir startDir,QMultiMap<QString,QStri | |||
212 | { | 212 | { |
213 | return false; | 213 | return false; |
214 | } | 214 | } |
215 | 215 | ||
216 | QFileInfo fileInf = it.fileInfo(); | 216 | QFileInfo fileInf = it.fileInfo(); |
217 | 217 | ||
218 | // its a dir | 218 | // its a dir |
219 | if(fileInf.isDir()) | 219 | if(fileInf.isDir()) |
220 | { | 220 | { |
221 | QDir dir = fileInf.dir(); | 221 | QDir dir = fileInf.dir(); |
222 | 222 | ||
223 | // insert into List | 223 | // insert into List |
224 | if(!dir.dirName().isEmpty() && m_talkFolders) | 224 | if(!dir.dirName().isEmpty() && m_talkFolders) |
225 | { | 225 | { |
@@ -238,7 +238,7 @@ bool TalkFileCreator::createDirAndFileMaps(QDir startDir,QMultiMap<QString,QStri | |||
238 | } | 238 | } |
239 | QCoreApplication::processEvents(); | 239 | QCoreApplication::processEvents(); |
240 | } | 240 | } |
241 | return true; | 241 | return true; |
242 | } | 242 | } |
243 | 243 | ||
244 | //! \brief Voices a List of string to the temp dir. Progress is handled inside. | 244 | //! \brief Voices a List of string to the temp dir. Progress is handled inside. |
@@ -259,37 +259,37 @@ TTSStatus TalkFileCreator::voiceList(QStringList toSpeak,QStringList& voicedEntr | |||
259 | m_logger->addItem(tr("Talk file creation aborted"), LOGERROR); | 259 | m_logger->addItem(tr("Talk file creation aborted"), LOGERROR); |
260 | return FatalError; | 260 | return FatalError; |
261 | } | 261 | } |
262 | 262 | ||
263 | QString filename = QDir::tempPath()+ "/"+ toSpeak[i] + ".wav"; | 263 | QString filename = QDir::tempPath()+ "/"+ toSpeak[i] + ".wav"; |
264 | 264 | ||
265 | QString error; | 265 | QString error; |
266 | TTSStatus status = m_tts->voice(toSpeak[i],filename, &error); | 266 | TTSStatus status = m_tts->voice(toSpeak[i],filename, &error); |
267 | if(status == Warning) | 267 | if(status == Warning) |
268 | { | 268 | { |
269 | warnings = true; | 269 | warnings = true; |
270 | m_logger->addItem(tr("Voicing of %1 failed: %2").arg(toSpeak[i]).arg(error), | 270 | m_logger->addItem(tr("Voicing of %1 failed: %2").arg(toSpeak[i]).arg(error), |
271 | LOGWARNING); | 271 | LOGWARNING); |
272 | } | 272 | } |
273 | else if (status == FatalError) | 273 | else if (status == FatalError) |
274 | { | 274 | { |
275 | m_logger->addItem(tr("Voicing of %1 failed: %2").arg(toSpeak[i]).arg(error), | 275 | m_logger->addItem(tr("Voicing of %1 failed: %2").arg(toSpeak[i]).arg(error), |
276 | LOGERROR); | 276 | LOGERROR); |
277 | return FatalError; | 277 | return FatalError; |
278 | } | 278 | } |
279 | else | 279 | else |
280 | voicedEntries.append(toSpeak[i]); | 280 | voicedEntries.append(toSpeak[i]); |
281 | m_logger->setProgressValue(++m_progress); | 281 | m_logger->setProgressValue(++m_progress); |
282 | QCoreApplication::processEvents(); | 282 | QCoreApplication::processEvents(); |
283 | } | 283 | } |
284 | if(warnings) | 284 | if(warnings) |
285 | return Warning; | 285 | return Warning; |
286 | else | 286 | else |
287 | return NoError; | 287 | return NoError; |
288 | } | 288 | } |
289 | 289 | ||
290 | 290 | ||
291 | //! \brief Encodes a List of strings from/to the temp dir. Progress is handled inside. | 291 | //! \brief Encodes a List of strings from/to the temp dir. Progress is handled inside. |
292 | //! It expects the inputfile in the temp dir with the name in the List appended with ".wav" | 292 | //! It expects the inputfile in the temp dir with the name in the List appended with ".wav" |
293 | //! | 293 | //! |
294 | //! \param toSpeak QStringList with the Entries to encode. | 294 | //! \param toSpeak QStringList with the Entries to encode. |
295 | //! \param errString pointer to where the Error cause is written | 295 | //! \param errString pointer to where the Error cause is written |
@@ -301,21 +301,21 @@ bool TalkFileCreator::encodeList(QStringList toEncode,QStringList& encodedEntrie | |||
301 | { | 301 | { |
302 | if(m_abort) | 302 | if(m_abort) |
303 | { | 303 | { |
304 | m_logger->addItem(tr("Talk file creation aborted"), LOGERROR); | 304 | m_logger->addItem(tr("Talk file creation aborted"), LOGERROR); |
305 | return false; | 305 | return false; |
306 | } | 306 | } |
307 | 307 | ||
308 | QString wavfilename = QDir::tempPath()+ "/"+ toEncode[i] + ".wav"; | 308 | QString wavfilename = QDir::tempPath()+ "/"+ toEncode[i] + ".wav"; |
309 | QString filename = QDir::tempPath()+ "/"+ toEncode[i] + ".talk"; | 309 | QString filename = QDir::tempPath()+ "/"+ toEncode[i] + ".talk"; |
310 | 310 | ||
311 | if(!m_enc->encode(wavfilename,filename)) | 311 | if(!m_enc->encode(wavfilename,filename)) |
312 | { | 312 | { |
313 | m_logger->addItem(tr("Encoding of %1 failed").arg(filename), LOGERROR); | 313 | m_logger->addItem(tr("Encoding of %1 failed").arg(filename), LOGERROR); |
314 | return false; | 314 | return false; |
315 | } | 315 | } |
316 | encodedEntries.append(toEncode[i]); | 316 | encodedEntries.append(toEncode[i]); |
317 | m_logger->setProgressValue(++m_progress); | 317 | m_logger->setProgressValue(++m_progress); |
318 | QCoreApplication::processEvents(); | 318 | QCoreApplication::processEvents(); |
319 | } | 319 | } |
320 | return true; | 320 | return true; |
321 | } | 321 | } |
@@ -324,16 +324,16 @@ bool TalkFileCreator::encodeList(QStringList toEncode,QStringList& encodedEntrie | |||
324 | //! | 324 | //! |
325 | //! \param dirMap a MultiMap of Paths -> Dirnames | 325 | //! \param dirMap a MultiMap of Paths -> Dirnames |
326 | //! \param errString Pointer to a QString where the error cause is written. | 326 | //! \param errString Pointer to a QString where the error cause is written. |
327 | //! \returns true on success, false on error or user abort | 327 | //! \returns true on success, false on error or user abort |
328 | bool TalkFileCreator::copyTalkDirFiles(QMultiMap<QString,QString> dirMap,QString* errString) | 328 | bool TalkFileCreator::copyTalkDirFiles(QMultiMap<QString,QString> dirMap,QString* errString) |
329 | { | 329 | { |
330 | resetProgress(dirMap.size()); | 330 | resetProgress(dirMap.size()); |
331 | 331 | ||
332 | QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, 0); | 332 | QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, 0); |
333 | installlog.beginGroup("talkfiles"); | 333 | installlog.beginGroup("talkfiles"); |
334 | 334 | ||
335 | QMapIterator<QString, QString> it(dirMap); | 335 | QMapIterator<QString, QString> it(dirMap); |
336 | while (it.hasNext()) | 336 | while (it.hasNext()) |
337 | { | 337 | { |
338 | it.next(); | 338 | it.next(); |
339 | if(m_abort) | 339 | if(m_abort) |
@@ -341,51 +341,51 @@ bool TalkFileCreator::copyTalkDirFiles(QMultiMap<QString,QString> dirMap,QString | |||
341 | *errString = tr("Talk file creation aborted"); | 341 | *errString = tr("Talk file creation aborted"); |
342 | return false; | 342 | return false; |
343 | } | 343 | } |
344 | 344 | ||
345 | QString source = QDir::tempPath()+ "/"+ it.value() + ".talk"; | 345 | QString source = QDir::tempPath()+ "/"+ it.value() + ".talk"; |
346 | 346 | ||
347 | if(!QFileInfo(source).exists()) | 347 | if(!QFileInfo(source).exists()) |
348 | continue; // this file was skipped in one of the previous steps | 348 | continue; // this file was skipped in one of the previous steps |
349 | 349 | ||
350 | QString target = it.key() + "/" + "_dirname.talk"; | 350 | QString target = it.key() + "/" + "_dirname.talk"; |
351 | 351 | ||
352 | // remove target if it exists, and if we should overwrite it | 352 | // remove target if it exists, and if we should overwrite it |
353 | if(m_overwriteTalk && QFile::exists(target)) | 353 | if(m_overwriteTalk && QFile::exists(target)) |
354 | QFile::remove(target); | 354 | QFile::remove(target); |
355 | 355 | ||
356 | // copying | 356 | // copying |
357 | if(!QFile::copy(source,target)) | 357 | if(!QFile::copy(source,target)) |
358 | { | 358 | { |
359 | *errString = tr("Copying of %1 to %2 failed").arg(source).arg(target); | 359 | *errString = tr("Copying of %1 to %2 failed").arg(source).arg(target); |
360 | return false; | 360 | return false; |
361 | } | 361 | } |
362 | 362 | ||
363 | // add to installlog | 363 | // add to installlog |
364 | QString now = QDate::currentDate().toString("yyyyMMdd"); | 364 | QString now = QDate::currentDate().toString("yyyyMMdd"); |
365 | installlog.setValue(target.remove(0,m_mountpoint.length()),now); | 365 | installlog.setValue(target.remove(0,m_mountpoint.length()),now); |
366 | 366 | ||
367 | m_logger->setProgressValue(++m_progress); | 367 | m_logger->setProgressValue(++m_progress); |
368 | QCoreApplication::processEvents(); | 368 | QCoreApplication::processEvents(); |
369 | } | 369 | } |
370 | installlog.endGroup(); | 370 | installlog.endGroup(); |
371 | installlog.sync(); | 371 | installlog.sync(); |
372 | return true; | 372 | return true; |
373 | } | 373 | } |
374 | 374 | ||
375 | //! \brief copys Talkfile for Files from the temp dir to the target. Progress and installlog is handled inside | 375 | //! \brief copys Talkfile for Files from the temp dir to the target. Progress and installlog is handled inside |
376 | //! | 376 | //! |
377 | //! \param fileMap a MultiMap of Paths -> Filenames | 377 | //! \param fileMap a MultiMap of Paths -> Filenames |
378 | //! \param errString Pointer to a QString where the error cause is written. | 378 | //! \param errString Pointer to a QString where the error cause is written. |
379 | //! \returns true on success, false on error or user abort | 379 | //! \returns true on success, false on error or user abort |
380 | bool TalkFileCreator::copyTalkFileFiles(QMultiMap<QString,QString> fileMap,QString* errString) | 380 | bool TalkFileCreator::copyTalkFileFiles(QMultiMap<QString,QString> fileMap,QString* errString) |
381 | { | 381 | { |
382 | resetProgress(fileMap.size()); | 382 | resetProgress(fileMap.size()); |
383 | 383 | ||
384 | QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, 0); | 384 | QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, 0); |
385 | installlog.beginGroup("talkfiles"); | 385 | installlog.beginGroup("talkfiles"); |
386 | 386 | ||
387 | QMapIterator<QString, QString> it(fileMap); | 387 | QMapIterator<QString, QString> it(fileMap); |
388 | while (it.hasNext()) | 388 | while (it.hasNext()) |
389 | { | 389 | { |
390 | it.next(); | 390 | it.next(); |
391 | if(m_abort) | 391 | if(m_abort) |
@@ -393,58 +393,58 @@ bool TalkFileCreator::copyTalkFileFiles(QMultiMap<QString,QString> fileMap,QStri | |||
393 | *errString = tr("Talk file creation aborted"); | 393 | *errString = tr("Talk file creation aborted"); |
394 | return false; | 394 | return false; |
395 | } | 395 | } |
396 | 396 | ||
397 | QString source; | 397 | QString source; |
398 | QString target = it.key() + "/" + it.value() + ".talk"; | 398 | QString target = it.key() + "/" + it.value() + ".talk"; |
399 | 399 | ||
400 | // correct source if we hav stripExtension enabled | 400 | // correct source if we hav stripExtension enabled |
401 | if(m_stripExtensions) | 401 | if(m_stripExtensions) |
402 | source = QDir::tempPath()+ "/"+ stripExtension(it.value()) + ".talk"; | 402 | source = QDir::tempPath()+ "/"+ stripExtension(it.value()) + ".talk"; |
403 | else | 403 | else |
404 | source = QDir::tempPath()+ "/"+ it.value() + ".talk"; | 404 | source = QDir::tempPath()+ "/"+ it.value() + ".talk"; |
405 | 405 | ||
406 | if(!QFileInfo(source).exists()) | 406 | if(!QFileInfo(source).exists()) |
407 | continue; // this file was skipped in one of the previous steps | 407 | continue; // this file was skipped in one of the previous steps |
408 | 408 | ||
409 | // remove target if it exists, and if we should overwrite it | 409 | // remove target if it exists, and if we should overwrite it |
410 | if(m_overwriteTalk && QFile::exists(target)) | 410 | if(m_overwriteTalk && QFile::exists(target)) |
411 | QFile::remove(target); | 411 | QFile::remove(target); |
412 | 412 | ||
413 | // copy file | 413 | // copy file |
414 | qDebug() << "copying: " << source << " to " << target; | 414 | qDebug() << "copying: " << source << " to " << target; |
415 | if(!QFile::copy(source,target)) | 415 | if(!QFile::copy(source,target)) |
416 | { | 416 | { |
417 | *errString = tr("Copying of %1 to %2 failed").arg(source).arg(target); | 417 | *errString = tr("Copying of %1 to %2 failed").arg(source).arg(target); |
418 | return false; | 418 | return false; |
419 | } | 419 | } |
420 | 420 | ||
421 | // add to Install log | 421 | // add to Install log |
422 | QString now = QDate::currentDate().toString("yyyyMMdd"); | 422 | QString now = QDate::currentDate().toString("yyyyMMdd"); |
423 | installlog.setValue(target.remove(0,m_mountpoint.length()),now); | 423 | installlog.setValue(target.remove(0,m_mountpoint.length()),now); |
424 | 424 | ||
425 | m_logger->setProgressValue(++m_progress); | 425 | m_logger->setProgressValue(++m_progress); |
426 | QCoreApplication::processEvents(); | 426 | QCoreApplication::processEvents(); |
427 | } | 427 | } |
428 | installlog.endGroup(); | 428 | installlog.endGroup(); |
429 | installlog.sync(); | 429 | installlog.sync(); |
430 | return true; | 430 | return true; |
431 | } | 431 | } |
432 | 432 | ||
433 | 433 | ||
434 | //! \brief Cleans up Files potentially left in the temp dir | 434 | //! \brief Cleans up Files potentially left in the temp dir |
435 | //! | 435 | //! |
436 | //! \param list List of file to try to delete in the temp dir. Function appends ".wav" and ".talk" to the filenames | 436 | //! \param list List of file to try to delete in the temp dir. Function appends ".wav" and ".talk" to the filenames |
437 | bool TalkFileCreator::cleanup(QStringList list) | 437 | bool TalkFileCreator::cleanup(QStringList list) |
438 | { | 438 | { |
439 | m_logger->addItem(tr("Cleaning up.."),LOGINFO); | 439 | m_logger->addItem(tr("Cleaning up.."),LOGINFO); |
440 | 440 | ||
441 | for(int i=0; i < list.size(); i++) | 441 | for(int i=0; i < list.size(); i++) |
442 | { | 442 | { |
443 | if(QFile::exists(QDir::tempPath()+ "/"+ list[i] + ".wav")) | 443 | if(QFile::exists(QDir::tempPath()+ "/"+ list[i] + ".wav")) |
444 | QFile::remove(QDir::tempPath()+ "/"+ list[i] + ".wav"); | 444 | QFile::remove(QDir::tempPath()+ "/"+ list[i] + ".wav"); |
445 | if(QFile::exists(QDir::tempPath()+ "/"+ list[i] + ".talk")) | 445 | if(QFile::exists(QDir::tempPath()+ "/"+ list[i] + ".talk")) |
446 | QFile::remove(QDir::tempPath()+ "/"+ list[i] + ".talk"); | 446 | QFile::remove(QDir::tempPath()+ "/"+ list[i] + ".talk"); |
447 | 447 | ||
448 | QCoreApplication::processEvents(); | 448 | QCoreApplication::processEvents(); |
449 | } | 449 | } |
450 | return true; | 450 | return true; |
diff --git a/rbutil/rbutilqt/themesinstallwindow.cpp b/rbutil/rbutilqt/themesinstallwindow.cpp index 235299b1de..75d3eeb698 100644 --- a/rbutil/rbutilqt/themesinstallwindow.cpp +++ b/rbutil/rbutilqt/themesinstallwindow.cpp | |||
@@ -61,11 +61,11 @@ void ThemesInstallWindow::downloadInfo() | |||
61 | themesInfo.close(); | 61 | themesInfo.close(); |
62 | 62 | ||
63 | QUrl url; | 63 | QUrl url; |
64 | url = QUrl(settings->themeUrl() + "/rbutilqt.php?target=" | 64 | url = QUrl(settings->value(RbSettings::ThemesUrl).toString() + "/rbutilqt.php?target=" |
65 | + settings->curConfigure_Modelname()); | 65 | + settings->value(RbSettings::CurConfigureModel).toString()); |
66 | qDebug() << "downloadInfo()" << url; | 66 | qDebug() << "downloadInfo()" << url; |
67 | qDebug() << url.queryItems(); | 67 | qDebug() << url.queryItems(); |
68 | if(settings->cacheOffline()) | 68 | if(settings->value(RbSettings::CacheOffline).toBool()) |
69 | getter->setCache(true); | 69 | getter->setCache(true); |
70 | getter->setFile(&themesInfo); | 70 | getter->setFile(&themesInfo); |
71 | 71 | ||
@@ -144,7 +144,7 @@ void ThemesInstallWindow::downloadDone(bool error) | |||
144 | // check if there's a themes "MOTD" available | 144 | // check if there's a themes "MOTD" available |
145 | if(iniDetails.contains("status/msg")) { | 145 | if(iniDetails.contains("status/msg")) { |
146 | // check if there's a localized msg available | 146 | // check if there's a localized msg available |
147 | QString lang = settings->curLang().split("_").at(0); | 147 | QString lang = settings->value(RbSettings::Language).toString().split("_").at(0); |
148 | QString msg; | 148 | QString msg; |
149 | if(iniDetails.contains("status/msg." + lang)) | 149 | if(iniDetails.contains("status/msg." + lang)) |
150 | msg = iniDetails.value("status/msg." + lang).toString(); | 150 | msg = iniDetails.value("status/msg." + lang).toString(); |
@@ -191,9 +191,9 @@ void ThemesInstallWindow::updateDetails(QListWidgetItem* cur, QListWidgetItem* p | |||
191 | iniDetails.beginGroup(cur->data(Qt::UserRole).toString()); | 191 | iniDetails.beginGroup(cur->data(Qt::UserRole).toString()); |
192 | 192 | ||
193 | QUrl img, txt; | 193 | QUrl img, txt; |
194 | txt = QUrl(QString(settings->themeUrl() + "/" | 194 | txt = QUrl(QString(settings->value(RbSettings::ThemesUrl).toString() + "/" |
195 | + iniDetails.value("descriptionfile").toString())); | 195 | + iniDetails.value("descriptionfile").toString())); |
196 | img = QUrl(QString(settings->themeUrl() + "/" | 196 | img = QUrl(QString(settings->value(RbSettings::ThemesUrl).toString() + "/" |
197 | + iniDetails.value("image").toString())); | 197 | + iniDetails.value("image").toString())); |
198 | 198 | ||
199 | QString text; | 199 | QString text; |
@@ -211,7 +211,7 @@ void ThemesInstallWindow::updateDetails(QListWidgetItem* cur, QListWidgetItem* p | |||
211 | iniDetails.endGroup(); | 211 | iniDetails.endGroup(); |
212 | 212 | ||
213 | igetter.abort(); | 213 | igetter.abort(); |
214 | if(!settings->cacheDisabled()) | 214 | if(!settings->value(RbSettings::CacheDisabled).toBool()) |
215 | igetter.setCache(true); | 215 | igetter.setCache(true); |
216 | else | 216 | else |
217 | { | 217 | { |
@@ -307,7 +307,7 @@ void ThemesInstallWindow::accept() | |||
307 | QSettings iniDetails(themesInfo.fileName(), QSettings::IniFormat, this); | 307 | QSettings iniDetails(themesInfo.fileName(), QSettings::IniFormat, this); |
308 | for(int i = 0; i < ui.listThemes->selectedItems().size(); i++) { | 308 | for(int i = 0; i < ui.listThemes->selectedItems().size(); i++) { |
309 | iniDetails.beginGroup(ui.listThemes->selectedItems().at(i)->data(Qt::UserRole).toString()); | 309 | iniDetails.beginGroup(ui.listThemes->selectedItems().at(i)->data(Qt::UserRole).toString()); |
310 | zip = settings->themeUrl() | 310 | zip = settings->value(RbSettings::ThemesUrl).toString() |
311 | + "/" + iniDetails.value("archive").toString(); | 311 | + "/" + iniDetails.value("archive").toString(); |
312 | themes.append(zip); | 312 | themes.append(zip); |
313 | names.append("Theme: " + | 313 | names.append("Theme: " + |
@@ -321,7 +321,7 @@ void ThemesInstallWindow::accept() | |||
321 | 321 | ||
322 | logger = new ProgressLoggerGui(this); | 322 | logger = new ProgressLoggerGui(this); |
323 | logger->show(); | 323 | logger->show(); |
324 | QString mountPoint = settings->mountpoint(); | 324 | QString mountPoint = settings->value(RbSettings::Mountpoint).toString(); |
325 | qDebug() << "mountpoint:" << mountPoint; | 325 | qDebug() << "mountpoint:" << mountPoint; |
326 | // show dialog with error if mount point is wrong | 326 | // show dialog with error if mount point is wrong |
327 | if(!QFileInfo(mountPoint).isDir()) { | 327 | if(!QFileInfo(mountPoint).isDir()) { |
@@ -335,7 +335,7 @@ void ThemesInstallWindow::accept() | |||
335 | installer->setLogSection(names); | 335 | installer->setLogSection(names); |
336 | installer->setLogVersion(version); | 336 | installer->setLogVersion(version); |
337 | installer->setMountPoint(mountPoint); | 337 | installer->setMountPoint(mountPoint); |
338 | if(!settings->cacheDisabled()) | 338 | if(!settings->value(RbSettings::CacheDisabled).toBool()) |
339 | installer->setCache(true); | 339 | installer->setCache(true); |
340 | 340 | ||
341 | connect(logger, SIGNAL(closed()), this, SLOT(close())); | 341 | connect(logger, SIGNAL(closed()), this, SLOT(close())); |
diff --git a/rbutil/rbutilqt/tts.cpp b/rbutil/rbutilqt/tts.cpp index 68f169e875..277022b9a1 100644 --- a/rbutil/rbutilqt/tts.cpp +++ b/rbutil/rbutilqt/tts.cpp | |||
@@ -142,7 +142,7 @@ void TTSExes::setCfg(RbSettings* sett) | |||
142 | break; | 142 | break; |
143 | } | 143 | } |
144 | } | 144 | } |
145 | settings->setTTSPath(m_name,exepath); | 145 | settings->setSubValue(m_name, RbSettings::TtsPath, exepath); |
146 | settings->sync(); | 146 | settings->sync(); |
147 | } | 147 | } |
148 | 148 | ||
@@ -150,8 +150,8 @@ void TTSExes::setCfg(RbSettings* sett) | |||
150 | 150 | ||
151 | bool TTSExes::start(QString *errStr) | 151 | bool TTSExes::start(QString *errStr) |
152 | { | 152 | { |
153 | m_TTSexec = settings->ttsPath(m_name); | 153 | m_TTSexec = settings->subValue(m_name, RbSettings::TtsPath).toString(); |
154 | m_TTSOpts = settings->ttsOptions(m_name); | 154 | m_TTSOpts = settings->subValue(m_name, RbSettings::TtsOptions).toString(); |
155 | 155 | ||
156 | m_TTSTemplate = m_TemplateMap.value(m_name); | 156 | m_TTSTemplate = m_TemplateMap.value(m_name); |
157 | 157 | ||
@@ -195,7 +195,7 @@ void TTSExes::showCfg() | |||
195 | 195 | ||
196 | bool TTSExes::configOk() | 196 | bool TTSExes::configOk() |
197 | { | 197 | { |
198 | QString path = settings->ttsPath(m_name); | 198 | QString path = settings->subValue(m_name, RbSettings::TtsPath).toString(); |
199 | 199 | ||
200 | if (QFileInfo(path).exists()) | 200 | if (QFileInfo(path).exists()) |
201 | return true; | 201 | return true; |
@@ -217,12 +217,12 @@ TTSSapi::TTSSapi() : TTSBase() | |||
217 | bool TTSSapi::start(QString *errStr) | 217 | bool TTSSapi::start(QString *errStr) |
218 | { | 218 | { |
219 | 219 | ||
220 | m_TTSOpts = settings->ttsOptions("sapi"); | 220 | m_TTSOpts = settings->subValue("sapi", RbSettings::TtsOptions).toString(); |
221 | m_TTSLanguage =settings->ttsLang("sapi"); | 221 | m_TTSLanguage =settings->subValue("sapi", RbSettings::TtsLanguage).toString(); |
222 | m_TTSVoice=settings->ttsVoice("sapi"); | 222 | m_TTSVoice=settings->subValue("sapi", RbSettings::TtsVoice).toString(); |
223 | m_TTSSpeed=QString("%1").arg(settings->ttsSpeed("sapi")); | 223 | m_TTSSpeed=QString("%1").arg(settings->subValue("sapi", RbSettings::TtsSpeed).toInt()); |
224 | m_sapi4 = settings->ttsUseSapi4(); | 224 | m_sapi4 = settings->value(RbSettings::TtsUseSapi4).toBool(); |
225 | 225 | ||
226 | QFile::remove(QDir::tempPath() +"/sapi_voice.vbs"); | 226 | QFile::remove(QDir::tempPath() +"/sapi_voice.vbs"); |
227 | QFile::copy(":/builtin/sapi_voice.vbs",QDir::tempPath() + "/sapi_voice.vbs"); | 227 | QFile::copy(":/builtin/sapi_voice.vbs",QDir::tempPath() + "/sapi_voice.vbs"); |
228 | m_TTSexec = QDir::tempPath() +"/sapi_voice.vbs"; | 228 | m_TTSexec = QDir::tempPath() +"/sapi_voice.vbs"; |
@@ -284,8 +284,8 @@ QStringList TTSSapi::getVoiceList(QString language) | |||
284 | QString execstring = "cscript //nologo \"%exe\" /language:%lang /listvoices"; | 284 | QString execstring = "cscript //nologo \"%exe\" /language:%lang /listvoices"; |
285 | execstring.replace("%exe",m_TTSexec); | 285 | execstring.replace("%exe",m_TTSexec); |
286 | execstring.replace("%lang",language); | 286 | execstring.replace("%lang",language); |
287 | 287 | ||
288 | if(settings->ttsUseSapi4()) | 288 | if(settings->value(RbSettings::TtsUseSapi4).toBool()) |
289 | execstring.append(" /sapi4 "); | 289 | execstring.append(" /sapi4 "); |
290 | 290 | ||
291 | qDebug() << "init" << execstring; | 291 | qDebug() << "init" << execstring; |
@@ -363,7 +363,7 @@ void TTSSapi::showCfg() | |||
363 | 363 | ||
364 | bool TTSSapi::configOk() | 364 | bool TTSSapi::configOk() |
365 | { | 365 | { |
366 | if(settings->ttsVoice("sapi").isEmpty()) | 366 | if(settings->subValue("sapi", RbSettings::TtsVoice).toString().isEmpty()) |
367 | return false; | 367 | return false; |
368 | return true; | 368 | return true; |
369 | } | 369 | } |
@@ -380,7 +380,7 @@ void TTSFestival::startServer() | |||
380 | if(!configOk()) | 380 | if(!configOk()) |
381 | return; | 381 | return; |
382 | 382 | ||
383 | QStringList paths = settings->ttsPath("festival").split(":"); | 383 | QStringList paths = settings->subValue("festival", RbSettings::TtsPath).toString().split(":"); |
384 | 384 | ||
385 | serverProcess.start(QString("%1 --server").arg(paths[0])); | 385 | serverProcess.start(QString("%1 --server").arg(paths[0])); |
386 | serverProcess.waitForStarted(); | 386 | serverProcess.waitForStarted(); |
@@ -414,8 +414,9 @@ bool TTSFestival::start(QString* errStr) | |||
414 | { | 414 | { |
415 | (void) errStr; | 415 | (void) errStr; |
416 | ensureServerRunning(); | 416 | ensureServerRunning(); |
417 | if (!settings->ttsVoice("festival").isEmpty()) | 417 | if (!settings->subValue("festival", RbSettings::TtsVoice).toString().isEmpty()) |
418 | queryServer(QString("(voice.select '%1)").arg(settings->ttsVoice("festival"))); | 418 | queryServer(QString("(voice.select '%1)") |
419 | .arg(settings->subValue("festival", RbSettings::TtsVoice).toString())); | ||
419 | 420 | ||
420 | return true; | 421 | return true; |
421 | } | 422 | } |
@@ -432,7 +433,7 @@ TTSStatus TTSFestival::voice(QString text, QString wavfile, QString* errStr) | |||
432 | { | 433 | { |
433 | qDebug() << text << "->" << wavfile; | 434 | qDebug() << text << "->" << wavfile; |
434 | 435 | ||
435 | QStringList paths = settings->ttsPath("festival").split(":"); | 436 | QStringList paths = settings->subValue("festival", RbSettings::TtsPath).toString().split(":"); |
436 | QString cmd = QString("%1 --server localhost --otype riff --ttw --withlisp --output \"%2\" - ").arg(paths[1]).arg(wavfile); | 437 | QString cmd = QString("%1 --server localhost --otype riff --ttw --withlisp --output \"%2\" - ").arg(paths[1]).arg(wavfile); |
437 | qDebug() << cmd; | 438 | qDebug() << cmd; |
438 | 439 | ||
@@ -462,13 +463,15 @@ TTSStatus TTSFestival::voice(QString text, QString wavfile, QString* errStr) | |||
462 | 463 | ||
463 | bool TTSFestival::configOk() | 464 | bool TTSFestival::configOk() |
464 | { | 465 | { |
465 | QStringList paths = settings->ttsPath("festival").split(":"); | 466 | QStringList paths = settings->subValue("festival", RbSettings::TtsPath).toString().split(":"); |
466 | if(paths.size() != 2) | 467 | if(paths.size() != 2) |
467 | return false; | 468 | return false; |
468 | bool ret = QFileInfo(paths[0]).isExecutable() && | 469 | bool ret = QFileInfo(paths[0]).isExecutable() && |
469 | QFileInfo(paths[1]).isExecutable(); | 470 | QFileInfo(paths[1]).isExecutable(); |
470 | if(settings->ttsVoice("festival").size() > 0 && voices.size() > 0) | 471 | if(settings->subValue("festival", RbSettings::TtsVoice).toString().size() > 0 |
471 | ret = ret && (voices.indexOf(settings->ttsVoice("festival")) != -1); | 472 | && voices.size() > 0) |
473 | ret = ret && (voices.indexOf(settings->subValue("festival", | ||
474 | RbSettings::TtsVoice).toString()) != -1); | ||
472 | return ret; | 475 | return ret; |
473 | } | 476 | } |
474 | 477 | ||
diff --git a/rbutil/rbutilqt/ttsgui.cpp b/rbutil/rbutilqt/ttsgui.cpp index cd4dab1fcf..ead32f17c3 100644 --- a/rbutil/rbutilqt/ttsgui.cpp +++ b/rbutil/rbutilqt/ttsgui.cpp | |||
@@ -36,18 +36,18 @@ TTSSapiGui::TTSSapiGui(TTSSapi* sapi,QDialog* parent) : QDialog(parent) | |||
36 | void TTSSapiGui::showCfg() | 36 | void TTSSapiGui::showCfg() |
37 | { | 37 | { |
38 | // try to get config from settings | 38 | // try to get config from settings |
39 | ui.ttsoptions->setText(settings->ttsOptions("sapi")); | 39 | ui.ttsoptions->setText(settings->subValue("sapi", RbSettings::TtsOptions).toString()); |
40 | QString selLang = settings->ttsLang("sapi"); | 40 | QString selLang = settings->subValue("sapi", RbSettings::TtsLanguage).toString(); |
41 | QString selVoice = settings->ttsVoice("sapi"); | 41 | QString selVoice = settings->subValue("sapi", RbSettings::TtsVoice).toString(); |
42 | ui.speed->setValue(settings->ttsSpeed("sapi")); | 42 | ui.speed->setValue(settings->subValue("sapi", RbSettings::TtsSpeed).toInt()); |
43 | if(settings->ttsUseSapi4()) | 43 | if(settings->value(RbSettings::TtsUseSapi4).toBool()) |
44 | ui.usesapi4->setCheckState(Qt::Checked); | 44 | ui.usesapi4->setCheckState(Qt::Checked); |
45 | else | 45 | else |
46 | ui.usesapi4->setCheckState(Qt::Unchecked); | 46 | ui.usesapi4->setCheckState(Qt::Unchecked); |
47 | 47 | ||
48 | // fill in language combobox | 48 | // fill in language combobox |
49 | QStringList languages = settings->allLanguages(); | 49 | QStringList languages = settings->languages(); |
50 | 50 | ||
51 | languages.sort(); | 51 | languages.sort(); |
52 | ui.languagecombo->clear(); | 52 | ui.languagecombo->clear(); |
53 | ui.languagecombo->addItems(languages); | 53 | ui.languagecombo->addItems(languages); |
@@ -78,14 +78,14 @@ void TTSSapiGui::reset() | |||
78 | void TTSSapiGui::accept(void) | 78 | void TTSSapiGui::accept(void) |
79 | { | 79 | { |
80 | //save settings in user config | 80 | //save settings in user config |
81 | settings->setTTSOptions("sapi",ui.ttsoptions->text()); | 81 | settings->setSubValue("sapi", RbSettings::TtsOptions, ui.ttsoptions->text()); |
82 | settings->setTTSLang("sapi",ui.languagecombo->currentText()); | 82 | settings->setSubValue("sapi", RbSettings::TtsLanguage, ui.languagecombo->currentText()); |
83 | settings->setTTSVoice("sapi",ui.voicecombo->currentText()); | 83 | settings->setSubValue("sapi", RbSettings::TtsVoice, ui.voicecombo->currentText()); |
84 | settings->setTTSSpeed("sapi",ui.speed->value()); | 84 | settings->setSubValue("sapi", RbSettings::TtsSpeed, ui.speed->value()); |
85 | if(ui.usesapi4->checkState() == Qt::Checked) | 85 | if(ui.usesapi4->checkState() == Qt::Checked) |
86 | settings->setTTSUseSapi4(true); | 86 | settings->setValue(RbSettings::TtsUseSapi4, true); |
87 | else | 87 | else |
88 | settings->setTTSUseSapi4(false); | 88 | settings->setValue(RbSettings::TtsUseSapi4, false); |
89 | // sync settings | 89 | // sync settings |
90 | settings->sync(); | 90 | settings->sync(); |
91 | 91 | ||
@@ -108,9 +108,9 @@ void TTSSapiGui::updateVoices(QString language) | |||
108 | void TTSSapiGui::useSapi4Changed(int) | 108 | void TTSSapiGui::useSapi4Changed(int) |
109 | { | 109 | { |
110 | if(ui.usesapi4->checkState() == Qt::Checked) | 110 | if(ui.usesapi4->checkState() == Qt::Checked) |
111 | settings->setTTSUseSapi4(true); | 111 | settings->setValue(RbSettings::TtsUseSapi4, true); |
112 | else | 112 | else |
113 | settings->setTTSUseSapi4(false); | 113 | settings->setValue(RbSettings::TtsUseSapi4, false); |
114 | // sync settings | 114 | // sync settings |
115 | settings->sync(); | 115 | settings->sync(); |
116 | updateVoices(ui.languagecombo->currentText()); | 116 | updateVoices(ui.languagecombo->currentText()); |
@@ -136,8 +136,8 @@ void TTSExesGui::showCfg(QString name) | |||
136 | { | 136 | { |
137 | m_name = name; | 137 | m_name = name; |
138 | // try to get config from settings | 138 | // try to get config from settings |
139 | QString exepath =settings->ttsPath(m_name); | 139 | QString exepath =settings->subValue(m_name, RbSettings::TtsPath).toString(); |
140 | ui.ttsoptions->setText(settings->ttsOptions(m_name)); | 140 | ui.ttsoptions->setText(settings->subValue(m_name, RbSettings::TtsOptions).toString()); |
141 | ui.ttspath->setText(exepath); | 141 | ui.ttspath->setText(exepath); |
142 | 142 | ||
143 | //show dialog | 143 | //show dialog |
@@ -148,8 +148,8 @@ void TTSExesGui::showCfg(QString name) | |||
148 | void TTSExesGui::accept(void) | 148 | void TTSExesGui::accept(void) |
149 | { | 149 | { |
150 | //save settings in user config | 150 | //save settings in user config |
151 | settings->setTTSPath(m_name,ui.ttspath->text()); | 151 | settings->setSubValue(m_name, RbSettings::TtsPath, ui.ttspath->text()); |
152 | settings->setTTSOptions(m_name,ui.ttsoptions->text()); | 152 | settings->setSubValue(m_name, RbSettings::TtsOptions, ui.ttsoptions->text()); |
153 | // sync settings | 153 | // sync settings |
154 | settings->sync(); | 154 | settings->sync(); |
155 | 155 | ||
@@ -199,15 +199,15 @@ TTSFestivalGui::TTSFestivalGui(TTSFestival* api, QDialog* parent) : | |||
199 | 199 | ||
200 | void TTSFestivalGui::showCfg() | 200 | void TTSFestivalGui::showCfg() |
201 | { | 201 | { |
202 | qDebug() << "show\tpaths: " << settings->ttsPath("festival") << "\n" | 202 | qDebug() << "show\tpaths: " << settings->subValue("festival", RbSettings::TtsPath) << "\n" |
203 | << "\tvoice: " << settings->ttsVoice("festival"); | 203 | << "\tvoice: " << settings->subValue("festival", RbSettings::TtsVoice); |
204 | 204 | ||
205 | // will populate the voices if the paths are correct, | 205 | // will populate the voices if the paths are correct, |
206 | // otherwise, it will require the user to press Refresh | 206 | // otherwise, it will require the user to press Refresh |
207 | updateVoices(); | 207 | updateVoices(); |
208 | 208 | ||
209 | // try to get config from settings | 209 | // try to get config from settings |
210 | QStringList paths = settings->ttsPath("festival").split(":"); | 210 | QStringList paths = settings->subValue("festival", RbSettings::TtsPath).toString().split(":"); |
211 | if(paths.size() == 2) | 211 | if(paths.size() == 2) |
212 | { | 212 | { |
213 | ui.serverPath->setText(paths[0]); | 213 | ui.serverPath->setText(paths[0]); |
@@ -223,8 +223,8 @@ void TTSFestivalGui::accept(void) | |||
223 | //save settings in user config | 223 | //save settings in user config |
224 | QString newPath = QString("%1:%2").arg(ui.serverPath->text().trimmed()).arg(ui.clientPath->text().trimmed()); | 224 | QString newPath = QString("%1:%2").arg(ui.serverPath->text().trimmed()).arg(ui.clientPath->text().trimmed()); |
225 | qDebug() << "set\tpaths: " << newPath << "\n\tvoice: " << ui.voicesBox->currentText(); | 225 | qDebug() << "set\tpaths: " << newPath << "\n\tvoice: " << ui.voicesBox->currentText(); |
226 | settings->setTTSPath("festival", newPath); | 226 | settings->setSubValue("festival", RbSettings::TtsPath, newPath); |
227 | settings->setTTSVoice("festival", ui.voicesBox->currentText()); | 227 | settings->setSubValue("festival", RbSettings::TtsVoice, ui.voicesBox->currentText()); |
228 | 228 | ||
229 | settings->sync(); | 229 | settings->sync(); |
230 | 230 | ||
@@ -288,13 +288,13 @@ void TTSFestivalGui::onRefreshButton() | |||
288 | { | 288 | { |
289 | /* Temporarily commit the settings so that we get the new path when we check for voices */ | 289 | /* Temporarily commit the settings so that we get the new path when we check for voices */ |
290 | QString newPath = QString("%1:%2").arg(ui.serverPath->text().trimmed()).arg(ui.clientPath->text().trimmed()); | 290 | QString newPath = QString("%1:%2").arg(ui.serverPath->text().trimmed()).arg(ui.clientPath->text().trimmed()); |
291 | QString oldPath = settings->ttsPath("festival"); | 291 | QString oldPath = settings->subValue("festival", RbSettings::TtsPath).toString(); |
292 | qDebug() << "new path: " << newPath << "\n" << "old path: " << oldPath << "\nuse new: " << (newPath != oldPath); | 292 | qDebug() << "new path: " << newPath << "\n" << "old path: " << oldPath << "\nuse new: " << (newPath != oldPath); |
293 | 293 | ||
294 | if(newPath != oldPath) | 294 | if(newPath != oldPath) |
295 | { | 295 | { |
296 | qDebug() << "Using new paths for getVoiceList"; | 296 | qDebug() << "Using new paths for getVoiceList"; |
297 | settings->setTTSPath("festival", newPath); | 297 | settings->setSubValue("festival", RbSettings::TtsPath, newPath); |
298 | settings->sync(); | 298 | settings->sync(); |
299 | } | 299 | } |
300 | 300 | ||
@@ -302,7 +302,7 @@ void TTSFestivalGui::onRefreshButton() | |||
302 | 302 | ||
303 | if(newPath != oldPath) | 303 | if(newPath != oldPath) |
304 | { | 304 | { |
305 | settings->setTTSPath("festival", oldPath); | 305 | settings->setSubValue("festival", RbSettings::TtsPath, oldPath); |
306 | settings->sync(); | 306 | settings->sync(); |
307 | } | 307 | } |
308 | } | 308 | } |
@@ -324,9 +324,10 @@ void TTSFestivalGui::updateVoices() | |||
324 | ui.voicesBox->clear(); | 324 | ui.voicesBox->clear(); |
325 | ui.voicesBox->addItems(voiceList); | 325 | ui.voicesBox->addItems(voiceList); |
326 | 326 | ||
327 | ui.voicesBox->setCurrentIndex(ui.voicesBox->findText(settings->ttsVoice("festival"))); | 327 | ui.voicesBox->setCurrentIndex(ui.voicesBox->findText( |
328 | settings->subValue("festival", RbSettings::TtsVoice).toString())); | ||
328 | 329 | ||
329 | updateDescription(settings->ttsVoice("festival")); | 330 | updateDescription(settings->subValue("festival", RbSettings::TtsVoice).toString()); |
330 | } | 331 | } |
331 | 332 | ||
332 | void TTSFestivalGui::updateDescription(QString value) | 333 | void TTSFestivalGui::updateDescription(QString value) |
diff --git a/rbutil/rbutilqt/uninstallwindow.cpp b/rbutil/rbutilqt/uninstallwindow.cpp index b758a3cc6d..7d70f46170 100644 --- a/rbutil/rbutilqt/uninstallwindow.cpp +++ b/rbutil/rbutilqt/uninstallwindow.cpp | |||
@@ -73,7 +73,7 @@ void UninstallWindow::setSettings(RbSettings *sett) | |||
73 | { | 73 | { |
74 | settings = sett; | 74 | settings = sett; |
75 | 75 | ||
76 | QString mountpoint =settings->mountpoint(); | 76 | QString mountpoint = settings->value(RbSettings::Mountpoint).toString(); |
77 | uninstaller = new Uninstaller(this,mountpoint); | 77 | uninstaller = new Uninstaller(this,mountpoint); |
78 | 78 | ||
79 | // disable smart uninstall, if not possible | 79 | // disable smart uninstall, if not possible |
diff --git a/rbutil/rbutilqt/voicefile.cpp b/rbutil/rbutilqt/voicefile.cpp index 873329a47b..14af9adb24 100644 --- a/rbutil/rbutilqt/voicefile.cpp +++ b/rbutil/rbutilqt/voicefile.cpp | |||
@@ -65,7 +65,8 @@ bool VoiceFileCreator::createVoiceFile(ProgressloggerInterface* logger) | |||
65 | version = version.left(version.indexOf("-")).remove(0,1); | 65 | version = version.left(version.indexOf("-")).remove(0,1); |
66 | 66 | ||
67 | //prepare download url | 67 | //prepare download url |
68 | QUrl genlangUrl = settings->genlangUrl() +"?lang=" +m_lang+"&t="+target+"&rev="+version+"&f="+features; | 68 | QUrl genlangUrl = settings->value(RbSettings::GenlangUrl).toString() |
69 | +"?lang=" + m_lang + "&t=" + target + "&rev=" + version + "&f=" + features; | ||
69 | 70 | ||
70 | qDebug() << "downloading " << genlangUrl; | 71 | qDebug() << "downloading " << genlangUrl; |
71 | 72 | ||
@@ -127,7 +128,7 @@ void VoiceFileCreator::downloadDone(bool error) | |||
127 | } | 128 | } |
128 | 129 | ||
129 | //tts | 130 | //tts |
130 | m_tts = TTSBase::getTTS(settings->curTTS()); | 131 | m_tts = TTSBase::getTTS(settings->value(RbSettings::Tts).toString()); |
131 | m_tts->setCfg(settings); | 132 | m_tts->setCfg(settings); |
132 | 133 | ||
133 | QString errStr; | 134 | QString errStr; |
@@ -141,7 +142,7 @@ void VoiceFileCreator::downloadDone(bool error) | |||
141 | } | 142 | } |
142 | 143 | ||
143 | // Encoder | 144 | // Encoder |
144 | m_enc = EncBase::getEncoder(settings->curEncoder()); | 145 | m_enc = EncBase::getEncoder(settings->value(RbSettings::CurEncoder).toString()); |
145 | m_enc->setCfg(settings); | 146 | m_enc->setCfg(settings); |
146 | 147 | ||
147 | if(!m_enc->start()) | 148 | if(!m_enc->start()) |