diff options
| author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2007-09-03 14:37:00 +0000 |
|---|---|---|
| committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2007-09-03 14:37:00 +0000 |
| commit | b9dbd4ee9c3c91e3acae03b1f46f01b3ebef90d6 (patch) | |
| tree | 66411741e94e4ab8be1634aa525a758a984e7519 | |
| parent | a449a3a7a325852b9c505815d4c966bfc36f4866 (diff) | |
| download | rockbox-b9dbd4ee9c3c91e3acae03b1f46f01b3ebef90d6.zip rockbox-b9dbd4ee9c3c91e3acae03b1f46f01b3ebef90d6.tar.gz rockbox-b9dbd4ee9c3c91e3acae03b1f46f01b3ebef90d6.tar.bz2 rockbox-b9dbd4ee9c3c91e3acae03b1f46f01b3ebef90d6.tar.xz | |
- rework language selection a bit: use language string as key instead of language file basename. Display the language string in the selection list too. This makes it possible to distinguish between two variants of the same language without adjusting the language name.
- move user settings from "defaults" section to "general". Makes the code cleaner and has been that way for historical reasons only anyway.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14592 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | rbutil/rbutilqt/configure.cpp | 74 | ||||
| -rw-r--r-- | rbutil/rbutilqt/install.cpp | 20 | ||||
| -rw-r--r-- | rbutil/rbutilqt/installtalkwindow.cpp | 2 | ||||
| -rw-r--r-- | rbutil/rbutilqt/installthemes.cpp | 18 | ||||
| -rw-r--r-- | rbutil/rbutilqt/main.cpp | 7 | ||||
| -rw-r--r-- | rbutil/rbutilqt/rbutilqt.cpp | 92 | ||||
| -rw-r--r-- | rbutil/rbutilqt/uninstallwindow.cpp | 2 |
7 files changed, 114 insertions, 101 deletions
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp index 5120e36..527d3f8 100644 --- a/rbutil/rbutilqt/configure.cpp +++ b/rbutil/rbutilqt/configure.cpp @@ -26,7 +26,7 @@ #include <stdio.h> -#define DEFAULT_LANG "English (builtin)" +#define DEFAULT_LANG "English (C)" Config::Config(QWidget *parent) : QDialog(parent) { @@ -43,7 +43,7 @@ Config::Config(QWidget *parent) : QDialog(parent) // build language list and sort alphabetically QStringList langs = findLanguageFiles(); for(int i = 0; i < langs.size(); ++i) - lang.insert(languageName(langs[i]), langs[i]); + lang.insert(languageName(langs.at(i)) + tr(" (%1)").arg(langs.at(i)), langs.at(i)); lang.insert(DEFAULT_LANG, ""); QMap<QString, QString>::const_iterator i = lang.constBegin(); while (i != lang.constEnd()) { @@ -85,40 +85,40 @@ void Config::accept() proxy.setHost(ui.proxyHost->text()); proxy.setPort(ui.proxyPort->text().toInt()); } - userSettings->setValue("defaults/proxy", proxy.toString()); + userSettings->setValue("proxy", proxy.toString()); qDebug() << "new proxy:" << proxy; // proxy type QString proxyType; if(ui.radioNoProxy->isChecked()) proxyType = "none"; else if(ui.radioSystemProxy->isChecked()) proxyType = "system"; else proxyType = "manual"; - userSettings->setValue("defaults/proxytype", proxyType); + userSettings->setValue("proxytype", proxyType); // language - if(userSettings->value("defaults/lang").toString() != language) + if(userSettings->value("lang").toString() != language) QMessageBox::information(this, tr("Language changed"), tr("You need to restart the application for the changed language to take effect.")); - userSettings->setValue("defaults/lang", language); + userSettings->setValue("lang", language); // mountpoint QString mp = ui.mountPoint->text(); if(QFileInfo(mp).isDir()) - userSettings->setValue("defaults/mountpoint", mp); + userSettings->setValue("mountpoint", mp); // platform QString nplat; if(ui.treeDevices->selectedItems().size() != 0) { nplat = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); - userSettings->setValue("defaults/platform", nplat); + userSettings->setValue("platform", nplat); } // cache settings if(QFileInfo(ui.cachePath->text()).isDir()) - userSettings->setValue("defaults/cachepath", ui.cachePath->text()); + userSettings->setValue("cachepath", ui.cachePath->text()); else // default to system temp path - userSettings->setValue("defaults/cachepath", QDir::tempPath()); - userSettings->setValue("defaults/cachedisable", ui.cacheDisable->isChecked()); - userSettings->setValue("defaults/offline", ui.cacheOfflineMode->isChecked()); + userSettings->setValue("cachepath", QDir::tempPath()); + userSettings->setValue("cachedisable", ui.cacheDisable->isChecked()); + userSettings->setValue("offline", ui.cacheOfflineMode->isChecked()); // tts settings if(QFileInfo(ui.ttsExecutable->text()).isExecutable()) @@ -151,7 +151,7 @@ void Config::setUserSettings(QSettings *user) { userSettings = user; // set proxy - proxy = userSettings->value("defaults/proxy").toString(); + proxy = userSettings->value("proxy").toString(); if(proxy.port() > 0) ui.proxyPort->setText(QString("%1").arg(proxy.port())); @@ -160,7 +160,7 @@ void Config::setUserSettings(QSettings *user) ui.proxyUser->setText(proxy.userName()); ui.proxyPass->setText(proxy.password()); - QString proxyType = userSettings->value("defaults/proxytype").toString(); + QString proxyType = userSettings->value("proxytype").toString(); if(proxyType == "manual") ui.radioManualProxy->setChecked(true); else if(proxyType == "system") ui.radioSystemProxy->setChecked(true); else ui.radioNoProxy->setChecked(true); @@ -171,7 +171,7 @@ void Config::setUserSettings(QSettings *user) // find key for lang value QMap<QString, QString>::const_iterator i = lang.constBegin(); while (i != lang.constEnd()) { - if(i.value() == userSettings->value("defaults/lang").toString() + ".qm") { + if(i.value() == userSettings->value("lang").toString()) { b = i.key(); break; } @@ -184,15 +184,15 @@ void Config::setUserSettings(QSettings *user) ui.listLanguages->setCurrentItem(a.at(0)); // devices tab - ui.mountPoint->setText(userSettings->value("defaults/mountpoint").toString()); + ui.mountPoint->setText(userSettings->value("mountpoint").toString()); // cache tab - if(!QFileInfo(userSettings->value("defaults/cachepath").toString()).isDir()) - userSettings->setValue("defaults/cachepath", QDir::tempPath()); - ui.cachePath->setText(userSettings->value("defaults/cachepath").toString()); - ui.cacheDisable->setChecked(userSettings->value("defaults/cachedisable", true).toBool()); - ui.cacheOfflineMode->setChecked(userSettings->value("defaults/offline").toBool()); - QList<QFileInfo> fs = QDir(userSettings->value("defaults/cachepath").toString() + "/rbutil-cache/").entryInfoList(QDir::Files | QDir::NoDotAndDotDot); + if(!QFileInfo(userSettings->value("cachepath").toString()).isDir()) + userSettings->setValue("cachepath", QDir::tempPath()); + ui.cachePath->setText(userSettings->value("cachepath").toString()); + ui.cacheDisable->setChecked(userSettings->value("cachedisable", true).toBool()); + ui.cacheOfflineMode->setChecked(userSettings->value("offline").toBool()); + QList<QFileInfo> fs = QDir(userSettings->value("cachepath").toString() + "/rbutil-cache/").entryInfoList(QDir::Files | QDir::NoDotAndDotDot); qint64 sz = 0; for(int i = 0; i < fs.size(); i++) { sz += fs.at(i).size(); @@ -230,7 +230,7 @@ void Config::setDevices(QSettings *dev) } QString platform; - platform = devcs.value(userSettings->value("defaults/platform").toString()); + platform = devcs.value(userSettings->value("platform").toString()); // set up devices table ui.treeDevices->header()->hide(); @@ -248,7 +248,6 @@ void Config::setDevices(QSettings *dev) w = new QTreeWidgetItem(); w->setFlags(Qt::ItemIsEnabled); w->setText(0, brands.at(c)); -// w->setData(0, Qt::DecorationRole, <icon>); items.append(w); // go through platforms again for sake of order @@ -261,11 +260,16 @@ void Config::setDevices(QSettings *dev) devices->beginGroup(curdev); curname = devices->value("name", "null").toString(); QString curbrand = devices->value("brand", "").toString(); + QString curicon = devices->value("icon", "").toString(); devices->endGroup(); if(curbrand != brands.at(c)) continue; qDebug() << "adding:" << brands.at(c) << curname << curdev; w2 = new QTreeWidgetItem(w, QStringList(curname)); w2->setData(0, Qt::UserRole, curdev); +// QIcon icon; +// icon.addFile(":/icons/devices/" + curicon + "-tiny.png"); +// w2->setIcon(0, icon); +// ui.treeDevices->setIconSize(QSize(32, 32)); if(platform.contains(curname)) { w2->setSelected(true); w->setExpanded(true); @@ -439,15 +443,22 @@ QStringList Config::findLanguageFiles() { QDir dir(programPath); QStringList fileNames; + QStringList langs; fileNames = dir.entryList(QStringList("*.qm"), QDir::Files, QDir::Name); QDir resDir(":/lang"); fileNames += resDir.entryList(QStringList("*.qm"), QDir::Files, QDir::Name); - fileNames.sort(); - qDebug() << "Config::findLanguageFiles()" << fileNames; + QRegExp exp("^rbutil_(.*)\\.qm"); + for(int i = 0; i < fileNames.size(); i++) { + QString a = fileNames.at(i); + a.replace(exp, "\\1"); + langs.append(a); + } + langs.sort(); + qDebug() << "Config::findLanguageFiles()" << langs; - return fileNames; + return langs; } @@ -455,8 +466,9 @@ QString Config::languageName(const QString &qmFile) { QTranslator translator; - if(!translator.load(qmFile, programPath)) - translator.load(qmFile, ":/lang"); + QString file = "rbutil_" + qmFile; + if(!translator.load(file, programPath)) + translator.load(file, ":/lang"); return translator.translate("Configure", "English"); } @@ -467,7 +479,8 @@ void Config::updateLanguage() qDebug() << "updateLanguage()"; QList<QListWidgetItem*> a = ui.listLanguages->selectedItems(); if(a.size() > 0) - language = QFileInfo(lang.value(a.at(0)->text())).baseName(); + language = lang.value(a.at(0)->text()); + qDebug() << language; } @@ -540,6 +553,7 @@ void Config::autodetect() { itmList.at(i)->child(j)->setSelected(true); //select the item itmList.at(i)->setExpanded(true); //expand the platform item + //ui.treeDevices->indexOfTopLevelItem(itmList.at(i)->child(j)); break; } } diff --git a/rbutil/rbutilqt/install.cpp b/rbutil/rbutilqt/install.cpp index 5edef5b..f6e4509 100644 --- a/rbutil/rbutilqt/install.cpp +++ b/rbutil/rbutilqt/install.cpp @@ -48,8 +48,8 @@ void Install::accept() { logger = new ProgressLoggerGui(this); logger->show(); - QString mountPoint = userSettings->value("defaults/mountpoint").toString(); - qDebug() << "mountpoint:" << userSettings->value("defaults/mountpoint").toString(); + QString mountPoint = userSettings->value("mountpoint").toString(); + qDebug() << "mountpoint:" << userSettings->value("mountpoint").toString(); // show dialog with error if mount point is wrong if(!QFileInfo(mountPoint).isDir()) { logger->addItem(tr("Mount point is wrong!"),LOGERROR); @@ -59,7 +59,7 @@ void Install::accept() QString myversion; QString buildname; - devices->beginGroup(userSettings->value("defaults/platform").toString()); + devices->beginGroup(userSettings->value("platform").toString()); buildname = devices->value("platform").toString(); devices->endGroup(); if(ui.radioStable->isChecked()) { @@ -68,7 +68,7 @@ void Install::accept() devices->value("last_release").toString(), buildname); fileName = QString("rockbox-%1-%2.zip") .arg(devices->value("last_release").toString(), buildname); - userSettings->setValue("defaults/build", "stable"); + userSettings->setValue("build", "stable"); myversion = version.value("rel_rev"); } else if(ui.radioArchived->isChecked()) { @@ -77,14 +77,14 @@ void Install::accept() buildname, buildname, version.value("arch_date")); fileName = QString("rockbox-%1-%2.zip") .arg(buildname, version.value("arch_date")); - userSettings->setValue("defaults/build", "archived"); + userSettings->setValue("build", "archived"); myversion = "r" + version.value("arch_rev") + "-" + version.value("arch_date"); } else if(ui.radioCurrent->isChecked()) { file = QString("%1%2/rockbox.zip") .arg(devices->value("bleeding_url").toString(), buildname); fileName = QString("rockbox.zip"); - userSettings->setValue("defaults/build", "current"); + userSettings->setValue("build", "current"); myversion = "r" + version.value("bleed_rev"); } else { @@ -97,10 +97,10 @@ void Install::accept() installer->setUrl(file); installer->setProxy(proxy); installer->setLogSection("Rockbox (Base)"); - if(!userSettings->value("defaults/cachedisable").toBool() + if(!userSettings->value("cachedisable").toBool() && !ui.radioCurrent->isChecked() && !ui.checkBoxCache->isChecked()) - installer->setCache(userSettings->value("defaults/cachepath", + installer->setCache(userSettings->value("cachepath", QDir::tempPath()).toString()); installer->setLogVersion(myversion); @@ -125,9 +125,9 @@ void Install::done(bool error) // no error, close the window, when the logger is closed connect(logger,SIGNAL(closed()),this,SLOT(close())); // add platform info to log file for later detection - QSettings installlog(userSettings->value("defaults/mountpoint").toString() + QSettings installlog(userSettings->value("mountpoint").toString() + "/.rockbox/rbutil.log", QSettings::IniFormat, 0); - installlog.setValue("platform", userSettings->value("defaults/platform").toString()); + installlog.setValue("platform", userSettings->value("platform").toString()); installlog.sync(); } diff --git a/rbutil/rbutilqt/installtalkwindow.cpp b/rbutil/rbutilqt/installtalkwindow.cpp index a1d825a..324fe44 100644 --- a/rbutil/rbutilqt/installtalkwindow.cpp +++ b/rbutil/rbutilqt/installtalkwindow.cpp @@ -154,7 +154,7 @@ void InstallTalkWindow::setUserSettings(QSettings *user) { userSettings = user; - talkcreator->setMountPoint(userSettings->value("defaults/mountpoint").toString()); + talkcreator->setMountPoint(userSettings->value("mountpoint").toString()); setTalkFolder(userSettings->value("last_talked_folder").toString()); diff --git a/rbutil/rbutilqt/installthemes.cpp b/rbutil/rbutilqt/installthemes.cpp index 33bee10..ba6b7f9 100644 --- a/rbutil/rbutilqt/installthemes.cpp +++ b/rbutil/rbutilqt/installthemes.cpp @@ -41,7 +41,7 @@ ThemesInstallWindow::ThemesInstallWindow(QWidget *parent) : QDialog(parent) QString ThemesInstallWindow::resolution() { QString resolution; - devices->beginGroup(userSettings->value("defaults/platform").toString()); + devices->beginGroup(userSettings->value("platform").toString()); resolution = devices->value("resolution").toString(); devices->endGroup(); return resolution; @@ -77,8 +77,8 @@ void ThemesInstallWindow::downloadInfo() qDebug() << "downloadInfo()" << url; qDebug() << url.queryItems(); getter->setProxy(proxy); - if(userSettings->value("defaults/offline").toBool()) - getter->setCache(userSettings->value("defaults/cachepath", QDir::tempPath()).toString()); + if(userSettings->value("offline").toBool()) + getter->setCache(userSettings->value("cachepath", QDir::tempPath()).toString()); getter->setFile(&themesInfo); getter->getFile(url); } @@ -184,8 +184,8 @@ void ThemesInstallWindow::updateDetails(int row) igetter.abort(); igetter.setProxy(proxy); - if(!userSettings->value("defaults/cachedisable").toBool()) - igetter.setCache(userSettings->value("defaults/cachepath", QDir::tempPath()).toString()); + if(!userSettings->value("cachedisable").toBool()) + igetter.setCache(userSettings->value("cachepath", QDir::tempPath()).toString()); igetter.getFile(img); connect(&igetter, SIGNAL(done(bool)), this, SLOT(updateImage(bool))); } @@ -283,8 +283,8 @@ void ThemesInstallWindow::accept() logger = new ProgressLoggerGui(this); logger->show(); - QString mountPoint = userSettings->value("defaults/mountpoint").toString(); - qDebug() << "mountpoint:" << userSettings->value("defaults/mountpoint").toString(); + QString mountPoint = userSettings->value("mountpoint").toString(); + qDebug() << "mountpoint:" << userSettings->value("mountpoint").toString(); // show dialog with error if mount point is wrong if(!QFileInfo(mountPoint).isDir()) { logger->addItem(tr("Mount point is wrong!"),LOGERROR); @@ -298,8 +298,8 @@ void ThemesInstallWindow::accept() installer->setLogSection(names); installer->setLogVersion(version); installer->setMountPoint(mountPoint); - if(!userSettings->value("defaults/cachedisable").toBool()) - installer->setCache(userSettings->value("defaults/cachepath", QDir::tempPath()).toString()); + if(!userSettings->value("cachedisable").toBool()) + installer->setCache(userSettings->value("cachepath", QDir::tempPath()).toString()); installer->install(logger); connect(logger, SIGNAL(closed()), this, SLOT(close())); } diff --git a/rbutil/rbutilqt/main.cpp b/rbutil/rbutilqt/main.cpp index a6b2a3e..a246f6a 100644 --- a/rbutil/rbutilqt/main.cpp +++ b/rbutil/rbutilqt/main.cpp @@ -38,11 +38,10 @@ int main( int argc, char ** argv ) { else user = new QSettings(QSettings::IniFormat, QSettings::UserScope, "rockbox.org", "RockboxUtility"); QTranslator translator; - if(user->value("defaults/lang").toString() != "") // install translator - if(user->value("defaults/lang", "").toString() != "") { - if(!translator.load(user->value("defaults/lang").toString(), absolutePath)) - translator.load(user->value("defaults/lang").toString(), ":/lang"); + if(!user->value("lang", "").toString().isEmpty()) { + if(!translator.load("rbutil_" + user->value("lang").toString(), absolutePath)) + translator.load("rbutil_" + user->value("lang").toString(), ":/lang"); } delete user; app.installTranslator(&translator); diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index b3bd36b..7013041 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp @@ -130,8 +130,8 @@ void RbUtilQt::downloadInfo() connect(daily, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool))); connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort())); daily->setProxy(proxy()); - if(userSettings->value("defaults/offline").toBool()) - daily->setCache(userSettings->value("defaults/cachepath", QDir::tempPath()).toString()); + if(userSettings->value("offline").toBool()) + daily->setCache(userSettings->value("cachepath", QDir::tempPath()).toString()); qDebug() << "downloading build info"; daily->setFile(&buildInfo); daily->getFile(QUrl(devices->value("server_conf_url").toString())); @@ -157,8 +157,8 @@ void RbUtilQt::downloadDone(bool error) connect(bleeding, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool))); connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort())); bleeding->setProxy(proxy()); - if(userSettings->value("defaults/offline").toBool()) - bleeding->setCache(userSettings->value("defaults/cachepath", QDir::tempPath()).toString()); + if(userSettings->value("offline").toBool()) + bleeding->setCache(userSettings->value("cachepath", QDir::tempPath()).toString()); bleeding->setFile(&bleedingInfo); bleeding->getFile(QUrl(devices->value("bleeding_info").toString())); } @@ -245,7 +245,7 @@ void RbUtilQt::updateSettings() void RbUtilQt::updateDevice() { - platform = userSettings->value("defaults/platform").toString(); + platform = userSettings->value("platform").toString(); // buttons devices->beginGroup(platform); if(devices->value("needsbootloader", "") == "no") { @@ -268,8 +268,8 @@ void RbUtilQt::updateDevice() } devices->endGroup(); // displayed device info - platform = userSettings->value("defaults/platform").toString(); - QString mountpoint = userSettings->value("defaults/mountpoint").toString(); + platform = userSettings->value("platform").toString(); + QString mountpoint = userSettings->value("mountpoint").toString(); devices->beginGroup(platform); QString brand = devices->value("brand").toString(); QString name = devices->value("name").toString(); @@ -283,9 +283,9 @@ void RbUtilQt::updateDevice() void RbUtilQt::updateManual() { - if(userSettings->value("defaults/platform").toString() != "") + if(userSettings->value("platform").toString() != "") { - devices->beginGroup(userSettings->value("defaults/platform").toString()); + devices->beginGroup(userSettings->value("platform").toString()); QString manual; manual = devices->value("manualname", "").toString(); @@ -319,7 +319,7 @@ void RbUtilQt::completeInstall() logger = new ProgressLoggerGui(this); logger->show(); - QString mountpoint = userSettings->value("defaults/mountpoint").toString(); + QString mountpoint = userSettings->value("mountpoint").toString(); // show dialog with error if mount point is wrong if(!QFileInfo(mountpoint).isDir()) { logger->addItem(tr("Mount point is wrong!"),LOGERROR); @@ -400,7 +400,7 @@ void RbUtilQt::smallInstall() logger = new ProgressLoggerGui(this); logger->show(); - QString mountpoint = userSettings->value("defaults/mountpoint").toString(); + QString mountpoint = userSettings->value("mountpoint").toString(); // show dialog with error if mount point is wrong if(!QFileInfo(mountpoint).isDir()) { logger->addItem(tr("Mount point is wrong!"),LOGERROR); @@ -450,7 +450,7 @@ bool RbUtilQt::installAuto() { QString file = QString("%1%2/rockbox.zip") .arg(devices->value("bleeding_url").toString(), - userSettings->value("defaults/platform").toString()); + userSettings->value("platform").toString()); buildInfo.open(); QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); @@ -473,9 +473,9 @@ bool RbUtilQt::installAuto() installer->setProxy(proxy()); installer->setLogSection("Rockbox (Base)"); installer->setLogVersion(myversion); - if(!userSettings->value("defaults/cachedisable").toBool()) - installer->setCache(userSettings->value("defaults/cachepath", QDir::tempPath()).toString()); - installer->setMountPoint(userSettings->value("defaults/mountpoint").toString()); + if(!userSettings->value("cachedisable").toBool()) + installer->setCache(userSettings->value("cachepath", QDir::tempPath()).toString()); + installer->setMountPoint(userSettings->value("mountpoint").toString()); installer->install(logger); connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool))); @@ -530,12 +530,12 @@ void RbUtilQt::installBootloaderBtn() void RbUtilQt::installBootloader() { - QString platform = userSettings->value("defaults/platform").toString(); + QString platform = userSettings->value("platform").toString(); // create installer blinstaller = new BootloaderInstaller(this); - blinstaller->setMountPoint(userSettings->value("defaults/mountpoint").toString()); + blinstaller->setMountPoint(userSettings->value("mountpoint").toString()); blinstaller->setProxy(proxy()); blinstaller->setDevice(platform); @@ -579,7 +579,7 @@ void RbUtilQt::installBootloader() if(devices->value(platform + "/bootloadermethod").toString() == "fwpatcher") { BrowseOF ofbrowser(this); - ofbrowser.setFile(userSettings->value("defaults/ofpath").toString()); + ofbrowser.setFile(userSettings->value("ofpath").toString()); if(ofbrowser.exec() == QDialog::Accepted) { offirmware = ofbrowser.getFile(); @@ -593,7 +593,7 @@ void RbUtilQt::installBootloader() } else { - userSettings->setValue("defaults/ofpath",offirmware); + userSettings->setValue("ofpath",offirmware); userSettings->sync(); } } @@ -637,9 +637,9 @@ void RbUtilQt::installFonts() installer->setProxy(proxy()); installer->setLogSection("Fonts"); installer->setLogVersion(versmap.value("arch_date")); - installer->setMountPoint(userSettings->value("defaults/mountpoint").toString()); - if(!userSettings->value("defaults/cachedisable").toBool()) - installer->setCache(userSettings->value("defaults/cachepath", QDir::tempPath()).toString()); + installer->setMountPoint(userSettings->value("mountpoint").toString()); + if(!userSettings->value("cachedisable").toBool()) + installer->setCache(userSettings->value("cachepath", QDir::tempPath()).toString()); installer->install(logger); } @@ -658,7 +658,7 @@ void RbUtilQt::installVoice() installer->setUnzip(false); QString voiceurl = devices->value("voice_url").toString() + "/" + - userSettings->value("defaults/platform").toString() + "-" + + userSettings->value("platform").toString() + "-" + versmap.value("arch_date") + "-english.voice"; qDebug() << voiceurl; @@ -666,10 +666,10 @@ void RbUtilQt::installVoice() installer->setUrl(voiceurl); installer->setLogSection("Voice"); installer->setLogVersion(versmap.value("arch_date")); - installer->setMountPoint(userSettings->value("defaults/mountpoint").toString()); + installer->setMountPoint(userSettings->value("mountpoint").toString()); installer->setTarget("/.rockbox/langs/english.voice"); - if(!userSettings->value("defaults/cachedisable").toBool()) - installer->setCache(userSettings->value("defaults/cachepath", QDir::tempPath()).toString()); + if(!userSettings->value("cachedisable").toBool()) + installer->setCache(userSettings->value("cachepath", QDir::tempPath()).toString()); installer->install(logger); //connect(installer, SIGNAL(done(bool)), this, SLOT(done(bool))); @@ -702,9 +702,9 @@ void RbUtilQt::installDoom() installer->setProxy(proxy()); installer->setLogSection("Game Addons"); installer->setLogVersion(versmap.value("arch_date")); - installer->setMountPoint(userSettings->value("defaults/mountpoint").toString()); - if(!userSettings->value("defaults/cachedisable").toBool()) - installer->setCache(userSettings->value("defaults/cachepath", QDir::tempPath()).toString()); + installer->setMountPoint(userSettings->value("mountpoint").toString()); + if(!userSettings->value("cachedisable").toBool()) + installer->setCache(userSettings->value("cachepath", QDir::tempPath()).toString()); installer->install(logger); } @@ -747,10 +747,10 @@ void RbUtilQt::uninstallBootloader(void) ProgressLoggerGui* logger = new ProgressLoggerGui(this); logger->show(); - QString plattform = userSettings->value("defaults/platform").toString(); + QString plattform = userSettings->value("platform").toString(); BootloaderInstaller blinstaller(this); - blinstaller.setMountPoint(userSettings->value("defaults/mountpoint").toString()); - blinstaller.setDevice(userSettings->value("defaults/platform").toString()); + blinstaller.setMountPoint(userSettings->value("mountpoint").toString()); + blinstaller.setDevice(userSettings->value("platform").toString()); blinstaller.setBootloaderMethod(devices->value(plattform + "/bootloadermethod").toString()); blinstaller.setBootloaderName(devices->value(plattform + "/bootloadername").toString()); blinstaller.setBootloaderBaseUrl(devices->value("bootloader_url").toString()); @@ -779,7 +779,7 @@ void RbUtilQt::downloadManual(void) QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); buildInfo.close(); - devices->beginGroup(userSettings->value("defaults/platform").toString()); + devices->beginGroup(userSettings->value("platform").toString()); QString manual; manual = devices->value("manualname", "rockbox-" + devices->value("platform").toString()).toString(); devices->endGroup(); @@ -803,9 +803,9 @@ void RbUtilQt::downloadManual(void) ProgressLoggerGui* logger = new ProgressLoggerGui(this); logger->show(); installer = new ZipInstaller(this); - installer->setMountPoint(userSettings->value("defaults/mountpoint").toString()); - if(!userSettings->value("defaults/cachedisable").toBool()) - installer->setCache(userSettings->value("defaults/cachepath", QDir::tempPath()).toString()); + installer->setMountPoint(userSettings->value("mountpoint").toString()); + if(!userSettings->value("cachedisable").toBool()) + installer->setCache(userSettings->value("cachepath", QDir::tempPath()).toString()); installer->setProxy(proxy()); installer->setLogSection(section); installer->setUrl(manualurl); @@ -828,23 +828,23 @@ void RbUtilQt::installPortable(void) logger->addItem(tr("Installing Rockbox Utility"), LOGINFO); // check mountpoint - if(!QFileInfo(userSettings->value("defaults/mountpoint").toString()).isDir()) { + if(!QFileInfo(userSettings->value("mountpoint").toString()).isDir()) { logger->addItem(tr("Mount point is wrong!"),LOGERROR); logger->abort(); return; } // remove old files first. - QFile::remove(userSettings->value("defaults/mountpoint").toString() + "/RockboxUtility.exe"); - QFile::remove(userSettings->value("defaults/mountpoint").toString() + "/RockboxUtility.ini"); + QFile::remove(userSettings->value("mountpoint").toString() + "/RockboxUtility.exe"); + QFile::remove(userSettings->value("mountpoint").toString() + "/RockboxUtility.ini"); // copy currently running binary and currently used settings file - if(!QFile::copy(qApp->applicationFilePath(), userSettings->value("defaults/mountpoint").toString() + "/RockboxUtility.exe")) { + if(!QFile::copy(qApp->applicationFilePath(), userSettings->value("mountpoint").toString() + "/RockboxUtility.exe")) { logger->addItem(tr("Error installing Rockbox Utility"), LOGERROR); logger->abort(); return; } logger->addItem(tr("Installing user configuration"), LOGINFO); - if(!QFile::copy(userSettings->fileName(), userSettings->value("defaults/mountpoint").toString() + "/RockboxUtility.ini")) { + if(!QFile::copy(userSettings->fileName(), userSettings->value("mountpoint").toString() + "/RockboxUtility.ini")) { logger->addItem(tr("Error installing user configuration"), LOGERROR); logger->abort(); return; @@ -859,7 +859,7 @@ void RbUtilQt::updateInfo() { qDebug() << "RbUtilQt::updateInfo()"; - QSettings log(userSettings->value("defaults/mountpoint").toString() + "/.rockbox/rbutil.log", QSettings::IniFormat, this); + QSettings log(userSettings->value("mountpoint").toString() + "/.rockbox/rbutil.log", QSettings::IniFormat, this); QStringList groups = log.childGroups(); QList<QTreeWidgetItem *> items; QTreeWidgetItem *w, *w2; @@ -895,7 +895,7 @@ void RbUtilQt::updateInfo() for(int b = 0; b < keys.size(); b++) { QString file; - file = userSettings->value("defaults/mountpoint").toString() + "/" + keys.at(b); + file = userSettings->value("mountpoint").toString() + "/" + keys.at(b); if(QFileInfo(file).isDir()) continue; w2 = new QTreeWidgetItem(w, QStringList() << "/" @@ -920,10 +920,10 @@ void RbUtilQt::updateInfo() QUrl RbUtilQt::proxy() { - if(userSettings->value("defaults/proxytype") == "manual") - return QUrl(userSettings->value("defaults/proxy").toString()); + if(userSettings->value("proxytype") == "manual") + return QUrl(userSettings->value("proxy").toString()); #ifdef __linux - else if(userSettings->value("defaults/proxytype") == "system") + else if(userSettings->value("proxytype") == "system") return QUrl(getenv("http_proxy")); #endif return QUrl(""); diff --git a/rbutil/rbutilqt/uninstallwindow.cpp b/rbutil/rbutilqt/uninstallwindow.cpp index 6a712d7..5dcfbb8 100644 --- a/rbutil/rbutilqt/uninstallwindow.cpp +++ b/rbutil/rbutilqt/uninstallwindow.cpp @@ -78,7 +78,7 @@ void UninstallWindow::setUserSettings(QSettings *user) { userSettings = user; - QString mountpoint =userSettings->value("defaults/mountpoint").toString(); + QString mountpoint =userSettings->value("mountpoint").toString(); uninstaller = new Uninstaller(this,mountpoint); // disable smart uninstall, if not possible |