summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/configure.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt/configure.cpp')
-rw-r--r--rbutil/rbutilqt/configure.cpp74
1 files changed, 39 insertions, 35 deletions
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)
205void Config::setUserSettings() 205void 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
673void Config::configEnc() 677void 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();