1
0
Fork 0
forked from len0rd/rockbox

- 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
This commit is contained in:
Dominik Riebeling 2007-09-03 14:37:00 +00:00
parent a449a3a7a3
commit b9dbd4ee9c
7 changed files with 114 additions and 101 deletions

View file

@ -26,7 +26,7 @@
#include <stdio.h> #include <stdio.h>
#define DEFAULT_LANG "English (builtin)" #define DEFAULT_LANG "English (C)"
Config::Config(QWidget *parent) : QDialog(parent) Config::Config(QWidget *parent) : QDialog(parent)
{ {
@ -43,7 +43,7 @@ Config::Config(QWidget *parent) : QDialog(parent)
// build language list and sort alphabetically // build language list and sort alphabetically
QStringList langs = findLanguageFiles(); QStringList langs = findLanguageFiles();
for(int i = 0; i < langs.size(); ++i) 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, ""); lang.insert(DEFAULT_LANG, "");
QMap<QString, QString>::const_iterator i = lang.constBegin(); QMap<QString, QString>::const_iterator i = lang.constBegin();
while (i != lang.constEnd()) { while (i != lang.constEnd()) {
@ -85,40 +85,40 @@ void Config::accept()
proxy.setHost(ui.proxyHost->text()); proxy.setHost(ui.proxyHost->text());
proxy.setPort(ui.proxyPort->text().toInt()); proxy.setPort(ui.proxyPort->text().toInt());
} }
userSettings->setValue("defaults/proxy", proxy.toString()); userSettings->setValue("proxy", proxy.toString());
qDebug() << "new proxy:" << proxy; qDebug() << "new proxy:" << proxy;
// proxy type // proxy type
QString proxyType; QString proxyType;
if(ui.radioNoProxy->isChecked()) proxyType = "none"; if(ui.radioNoProxy->isChecked()) proxyType = "none";
else if(ui.radioSystemProxy->isChecked()) proxyType = "system"; else if(ui.radioSystemProxy->isChecked()) proxyType = "system";
else proxyType = "manual"; else proxyType = "manual";
userSettings->setValue("defaults/proxytype", proxyType); userSettings->setValue("proxytype", proxyType);
// language // language
if(userSettings->value("defaults/lang").toString() != language) if(userSettings->value("lang").toString() != language)
QMessageBox::information(this, tr("Language changed"), QMessageBox::information(this, tr("Language changed"),
tr("You need to restart the application for the changed language to take effect.")); tr("You need to restart the application for the changed language to take effect."));
userSettings->setValue("defaults/lang", language); userSettings->setValue("lang", language);
// mountpoint // mountpoint
QString mp = ui.mountPoint->text(); QString mp = ui.mountPoint->text();
if(QFileInfo(mp).isDir()) if(QFileInfo(mp).isDir())
userSettings->setValue("defaults/mountpoint", mp); userSettings->setValue("mountpoint", mp);
// platform // platform
QString nplat; QString nplat;
if(ui.treeDevices->selectedItems().size() != 0) { if(ui.treeDevices->selectedItems().size() != 0) {
nplat = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); nplat = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString();
userSettings->setValue("defaults/platform", nplat); userSettings->setValue("platform", nplat);
} }
// cache settings // cache settings
if(QFileInfo(ui.cachePath->text()).isDir()) 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 else // default to system temp path
userSettings->setValue("defaults/cachepath", QDir::tempPath()); userSettings->setValue("cachepath", QDir::tempPath());
userSettings->setValue("defaults/cachedisable", ui.cacheDisable->isChecked()); userSettings->setValue("cachedisable", ui.cacheDisable->isChecked());
userSettings->setValue("defaults/offline", ui.cacheOfflineMode->isChecked()); userSettings->setValue("offline", ui.cacheOfflineMode->isChecked());
// tts settings // tts settings
if(QFileInfo(ui.ttsExecutable->text()).isExecutable()) if(QFileInfo(ui.ttsExecutable->text()).isExecutable())
@ -151,7 +151,7 @@ void Config::setUserSettings(QSettings *user)
{ {
userSettings = user; userSettings = user;
// set proxy // set proxy
proxy = userSettings->value("defaults/proxy").toString(); proxy = userSettings->value("proxy").toString();
if(proxy.port() > 0) if(proxy.port() > 0)
ui.proxyPort->setText(QString("%1").arg(proxy.port())); ui.proxyPort->setText(QString("%1").arg(proxy.port()));
@ -160,7 +160,7 @@ void Config::setUserSettings(QSettings *user)
ui.proxyUser->setText(proxy.userName()); ui.proxyUser->setText(proxy.userName());
ui.proxyPass->setText(proxy.password()); 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); if(proxyType == "manual") ui.radioManualProxy->setChecked(true);
else if(proxyType == "system") ui.radioSystemProxy->setChecked(true); else if(proxyType == "system") ui.radioSystemProxy->setChecked(true);
else ui.radioNoProxy->setChecked(true); else ui.radioNoProxy->setChecked(true);
@ -171,7 +171,7 @@ void Config::setUserSettings(QSettings *user)
// find key for lang value // find key for lang value
QMap<QString, QString>::const_iterator i = lang.constBegin(); QMap<QString, QString>::const_iterator i = lang.constBegin();
while (i != lang.constEnd()) { while (i != lang.constEnd()) {
if(i.value() == userSettings->value("defaults/lang").toString() + ".qm") { if(i.value() == userSettings->value("lang").toString()) {
b = i.key(); b = i.key();
break; break;
} }
@ -184,15 +184,15 @@ void Config::setUserSettings(QSettings *user)
ui.listLanguages->setCurrentItem(a.at(0)); ui.listLanguages->setCurrentItem(a.at(0));
// devices tab // devices tab
ui.mountPoint->setText(userSettings->value("defaults/mountpoint").toString()); ui.mountPoint->setText(userSettings->value("mountpoint").toString());
// cache tab // cache tab
if(!QFileInfo(userSettings->value("defaults/cachepath").toString()).isDir()) if(!QFileInfo(userSettings->value("cachepath").toString()).isDir())
userSettings->setValue("defaults/cachepath", QDir::tempPath()); userSettings->setValue("cachepath", QDir::tempPath());
ui.cachePath->setText(userSettings->value("defaults/cachepath").toString()); ui.cachePath->setText(userSettings->value("cachepath").toString());
ui.cacheDisable->setChecked(userSettings->value("defaults/cachedisable", true).toBool()); ui.cacheDisable->setChecked(userSettings->value("cachedisable", true).toBool());
ui.cacheOfflineMode->setChecked(userSettings->value("defaults/offline").toBool()); ui.cacheOfflineMode->setChecked(userSettings->value("offline").toBool());
QList<QFileInfo> fs = QDir(userSettings->value("defaults/cachepath").toString() + "/rbutil-cache/").entryInfoList(QDir::Files | QDir::NoDotAndDotDot); QList<QFileInfo> fs = QDir(userSettings->value("cachepath").toString() + "/rbutil-cache/").entryInfoList(QDir::Files | QDir::NoDotAndDotDot);
qint64 sz = 0; qint64 sz = 0;
for(int i = 0; i < fs.size(); i++) { for(int i = 0; i < fs.size(); i++) {
sz += fs.at(i).size(); sz += fs.at(i).size();
@ -230,7 +230,7 @@ void Config::setDevices(QSettings *dev)
} }
QString platform; QString platform;
platform = devcs.value(userSettings->value("defaults/platform").toString()); platform = devcs.value(userSettings->value("platform").toString());
// set up devices table // set up devices table
ui.treeDevices->header()->hide(); ui.treeDevices->header()->hide();
@ -248,7 +248,6 @@ void Config::setDevices(QSettings *dev)
w = new QTreeWidgetItem(); w = new QTreeWidgetItem();
w->setFlags(Qt::ItemIsEnabled); w->setFlags(Qt::ItemIsEnabled);
w->setText(0, brands.at(c)); w->setText(0, brands.at(c));
// w->setData(0, Qt::DecorationRole, <icon>);
items.append(w); items.append(w);
// go through platforms again for sake of order // go through platforms again for sake of order
@ -261,11 +260,16 @@ void Config::setDevices(QSettings *dev)
devices->beginGroup(curdev); devices->beginGroup(curdev);
curname = devices->value("name", "null").toString(); curname = devices->value("name", "null").toString();
QString curbrand = devices->value("brand", "").toString(); QString curbrand = devices->value("brand", "").toString();
QString curicon = devices->value("icon", "").toString();
devices->endGroup(); devices->endGroup();
if(curbrand != brands.at(c)) continue; if(curbrand != brands.at(c)) continue;
qDebug() << "adding:" << brands.at(c) << curname << curdev; qDebug() << "adding:" << brands.at(c) << curname << curdev;
w2 = new QTreeWidgetItem(w, QStringList(curname)); w2 = new QTreeWidgetItem(w, QStringList(curname));
w2->setData(0, Qt::UserRole, curdev); 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)) { if(platform.contains(curname)) {
w2->setSelected(true); w2->setSelected(true);
w->setExpanded(true); w->setExpanded(true);
@ -439,15 +443,22 @@ QStringList Config::findLanguageFiles()
{ {
QDir dir(programPath); QDir dir(programPath);
QStringList fileNames; QStringList fileNames;
QStringList langs;
fileNames = dir.entryList(QStringList("*.qm"), QDir::Files, QDir::Name); fileNames = dir.entryList(QStringList("*.qm"), QDir::Files, QDir::Name);
QDir resDir(":/lang"); QDir resDir(":/lang");
fileNames += resDir.entryList(QStringList("*.qm"), QDir::Files, QDir::Name); fileNames += resDir.entryList(QStringList("*.qm"), QDir::Files, QDir::Name);
fileNames.sort(); QRegExp exp("^rbutil_(.*)\\.qm");
qDebug() << "Config::findLanguageFiles()" << fileNames; 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; QTranslator translator;
if(!translator.load(qmFile, programPath)) QString file = "rbutil_" + qmFile;
translator.load(qmFile, ":/lang"); if(!translator.load(file, programPath))
translator.load(file, ":/lang");
return translator.translate("Configure", "English"); return translator.translate("Configure", "English");
} }
@ -467,7 +479,8 @@ void Config::updateLanguage()
qDebug() << "updateLanguage()"; qDebug() << "updateLanguage()";
QList<QListWidgetItem*> a = ui.listLanguages->selectedItems(); QList<QListWidgetItem*> a = ui.listLanguages->selectedItems();
if(a.size() > 0) 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)->child(j)->setSelected(true); //select the item
itmList.at(i)->setExpanded(true); //expand the platform item itmList.at(i)->setExpanded(true); //expand the platform item
//ui.treeDevices->indexOfTopLevelItem(itmList.at(i)->child(j));
break; break;
} }
} }

View file

@ -48,8 +48,8 @@ void Install::accept()
{ {
logger = new ProgressLoggerGui(this); logger = new ProgressLoggerGui(this);
logger->show(); logger->show();
QString mountPoint = userSettings->value("defaults/mountpoint").toString(); QString mountPoint = userSettings->value("mountpoint").toString();
qDebug() << "mountpoint:" << userSettings->value("defaults/mountpoint").toString(); qDebug() << "mountpoint:" << userSettings->value("mountpoint").toString();
// show dialog with error if mount point is wrong // show dialog with error if mount point is wrong
if(!QFileInfo(mountPoint).isDir()) { if(!QFileInfo(mountPoint).isDir()) {
logger->addItem(tr("Mount point is wrong!"),LOGERROR); logger->addItem(tr("Mount point is wrong!"),LOGERROR);
@ -59,7 +59,7 @@ void Install::accept()
QString myversion; QString myversion;
QString buildname; QString buildname;
devices->beginGroup(userSettings->value("defaults/platform").toString()); devices->beginGroup(userSettings->value("platform").toString());
buildname = devices->value("platform").toString(); buildname = devices->value("platform").toString();
devices->endGroup(); devices->endGroup();
if(ui.radioStable->isChecked()) { if(ui.radioStable->isChecked()) {
@ -68,7 +68,7 @@ void Install::accept()
devices->value("last_release").toString(), buildname); devices->value("last_release").toString(), buildname);
fileName = QString("rockbox-%1-%2.zip") fileName = QString("rockbox-%1-%2.zip")
.arg(devices->value("last_release").toString(), buildname); .arg(devices->value("last_release").toString(), buildname);
userSettings->setValue("defaults/build", "stable"); userSettings->setValue("build", "stable");
myversion = version.value("rel_rev"); myversion = version.value("rel_rev");
} }
else if(ui.radioArchived->isChecked()) { else if(ui.radioArchived->isChecked()) {
@ -77,14 +77,14 @@ void Install::accept()
buildname, buildname, version.value("arch_date")); buildname, buildname, version.value("arch_date"));
fileName = QString("rockbox-%1-%2.zip") fileName = QString("rockbox-%1-%2.zip")
.arg(buildname, version.value("arch_date")); .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"); myversion = "r" + version.value("arch_rev") + "-" + version.value("arch_date");
} }
else if(ui.radioCurrent->isChecked()) { else if(ui.radioCurrent->isChecked()) {
file = QString("%1%2/rockbox.zip") file = QString("%1%2/rockbox.zip")
.arg(devices->value("bleeding_url").toString(), buildname); .arg(devices->value("bleeding_url").toString(), buildname);
fileName = QString("rockbox.zip"); fileName = QString("rockbox.zip");
userSettings->setValue("defaults/build", "current"); userSettings->setValue("build", "current");
myversion = "r" + version.value("bleed_rev"); myversion = "r" + version.value("bleed_rev");
} }
else { else {
@ -97,10 +97,10 @@ void Install::accept()
installer->setUrl(file); installer->setUrl(file);
installer->setProxy(proxy); installer->setProxy(proxy);
installer->setLogSection("Rockbox (Base)"); installer->setLogSection("Rockbox (Base)");
if(!userSettings->value("defaults/cachedisable").toBool() if(!userSettings->value("cachedisable").toBool()
&& !ui.radioCurrent->isChecked() && !ui.radioCurrent->isChecked()
&& !ui.checkBoxCache->isChecked()) && !ui.checkBoxCache->isChecked())
installer->setCache(userSettings->value("defaults/cachepath", installer->setCache(userSettings->value("cachepath",
QDir::tempPath()).toString()); QDir::tempPath()).toString());
installer->setLogVersion(myversion); installer->setLogVersion(myversion);
@ -125,9 +125,9 @@ void Install::done(bool error)
// no error, close the window, when the logger is closed // no error, close the window, when the logger is closed
connect(logger,SIGNAL(closed()),this,SLOT(close())); connect(logger,SIGNAL(closed()),this,SLOT(close()));
// add platform info to log file for later detection // 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); + "/.rockbox/rbutil.log", QSettings::IniFormat, 0);
installlog.setValue("platform", userSettings->value("defaults/platform").toString()); installlog.setValue("platform", userSettings->value("platform").toString());
installlog.sync(); installlog.sync();
} }

View file

@ -154,7 +154,7 @@ void InstallTalkWindow::setUserSettings(QSettings *user)
{ {
userSettings = user; userSettings = user;
talkcreator->setMountPoint(userSettings->value("defaults/mountpoint").toString()); talkcreator->setMountPoint(userSettings->value("mountpoint").toString());
setTalkFolder(userSettings->value("last_talked_folder").toString()); setTalkFolder(userSettings->value("last_talked_folder").toString());

View file

@ -41,7 +41,7 @@ ThemesInstallWindow::ThemesInstallWindow(QWidget *parent) : QDialog(parent)
QString ThemesInstallWindow::resolution() QString ThemesInstallWindow::resolution()
{ {
QString resolution; QString resolution;
devices->beginGroup(userSettings->value("defaults/platform").toString()); devices->beginGroup(userSettings->value("platform").toString());
resolution = devices->value("resolution").toString(); resolution = devices->value("resolution").toString();
devices->endGroup(); devices->endGroup();
return resolution; return resolution;
@ -77,8 +77,8 @@ void ThemesInstallWindow::downloadInfo()
qDebug() << "downloadInfo()" << url; qDebug() << "downloadInfo()" << url;
qDebug() << url.queryItems(); qDebug() << url.queryItems();
getter->setProxy(proxy); getter->setProxy(proxy);
if(userSettings->value("defaults/offline").toBool()) if(userSettings->value("offline").toBool())
getter->setCache(userSettings->value("defaults/cachepath", QDir::tempPath()).toString()); getter->setCache(userSettings->value("cachepath", QDir::tempPath()).toString());
getter->setFile(&themesInfo); getter->setFile(&themesInfo);
getter->getFile(url); getter->getFile(url);
} }
@ -184,8 +184,8 @@ void ThemesInstallWindow::updateDetails(int row)
igetter.abort(); igetter.abort();
igetter.setProxy(proxy); igetter.setProxy(proxy);
if(!userSettings->value("defaults/cachedisable").toBool()) if(!userSettings->value("cachedisable").toBool())
igetter.setCache(userSettings->value("defaults/cachepath", QDir::tempPath()).toString()); igetter.setCache(userSettings->value("cachepath", QDir::tempPath()).toString());
igetter.getFile(img); igetter.getFile(img);
connect(&igetter, SIGNAL(done(bool)), this, SLOT(updateImage(bool))); connect(&igetter, SIGNAL(done(bool)), this, SLOT(updateImage(bool)));
} }
@ -283,8 +283,8 @@ void ThemesInstallWindow::accept()
logger = new ProgressLoggerGui(this); logger = new ProgressLoggerGui(this);
logger->show(); logger->show();
QString mountPoint = userSettings->value("defaults/mountpoint").toString(); QString mountPoint = userSettings->value("mountpoint").toString();
qDebug() << "mountpoint:" << userSettings->value("defaults/mountpoint").toString(); qDebug() << "mountpoint:" << userSettings->value("mountpoint").toString();
// show dialog with error if mount point is wrong // show dialog with error if mount point is wrong
if(!QFileInfo(mountPoint).isDir()) { if(!QFileInfo(mountPoint).isDir()) {
logger->addItem(tr("Mount point is wrong!"),LOGERROR); logger->addItem(tr("Mount point is wrong!"),LOGERROR);
@ -298,8 +298,8 @@ void ThemesInstallWindow::accept()
installer->setLogSection(names); installer->setLogSection(names);
installer->setLogVersion(version); installer->setLogVersion(version);
installer->setMountPoint(mountPoint); installer->setMountPoint(mountPoint);
if(!userSettings->value("defaults/cachedisable").toBool()) if(!userSettings->value("cachedisable").toBool())
installer->setCache(userSettings->value("defaults/cachepath", QDir::tempPath()).toString()); installer->setCache(userSettings->value("cachepath", QDir::tempPath()).toString());
installer->install(logger); installer->install(logger);
connect(logger, SIGNAL(closed()), this, SLOT(close())); connect(logger, SIGNAL(closed()), this, SLOT(close()));
} }

View file

@ -38,11 +38,10 @@ int main( int argc, char ** argv ) {
else user = new QSettings(QSettings::IniFormat, QSettings::UserScope, "rockbox.org", "RockboxUtility"); else user = new QSettings(QSettings::IniFormat, QSettings::UserScope, "rockbox.org", "RockboxUtility");
QTranslator translator; QTranslator translator;
if(user->value("defaults/lang").toString() != "")
// install translator // install translator
if(user->value("defaults/lang", "").toString() != "") { if(!user->value("lang", "").toString().isEmpty()) {
if(!translator.load(user->value("defaults/lang").toString(), absolutePath)) if(!translator.load("rbutil_" + user->value("lang").toString(), absolutePath))
translator.load(user->value("defaults/lang").toString(), ":/lang"); translator.load("rbutil_" + user->value("lang").toString(), ":/lang");
} }
delete user; delete user;
app.installTranslator(&translator); app.installTranslator(&translator);

View file

@ -130,8 +130,8 @@ void RbUtilQt::downloadInfo()
connect(daily, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool))); connect(daily, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool)));
connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort())); connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort()));
daily->setProxy(proxy()); daily->setProxy(proxy());
if(userSettings->value("defaults/offline").toBool()) if(userSettings->value("offline").toBool())
daily->setCache(userSettings->value("defaults/cachepath", QDir::tempPath()).toString()); daily->setCache(userSettings->value("cachepath", QDir::tempPath()).toString());
qDebug() << "downloading build info"; qDebug() << "downloading build info";
daily->setFile(&buildInfo); daily->setFile(&buildInfo);
daily->getFile(QUrl(devices->value("server_conf_url").toString())); 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(bleeding, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool)));
connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort())); connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort()));
bleeding->setProxy(proxy()); bleeding->setProxy(proxy());
if(userSettings->value("defaults/offline").toBool()) if(userSettings->value("offline").toBool())
bleeding->setCache(userSettings->value("defaults/cachepath", QDir::tempPath()).toString()); bleeding->setCache(userSettings->value("cachepath", QDir::tempPath()).toString());
bleeding->setFile(&bleedingInfo); bleeding->setFile(&bleedingInfo);
bleeding->getFile(QUrl(devices->value("bleeding_info").toString())); bleeding->getFile(QUrl(devices->value("bleeding_info").toString()));
} }
@ -245,7 +245,7 @@ void RbUtilQt::updateSettings()
void RbUtilQt::updateDevice() void RbUtilQt::updateDevice()
{ {
platform = userSettings->value("defaults/platform").toString(); platform = userSettings->value("platform").toString();
// buttons // buttons
devices->beginGroup(platform); devices->beginGroup(platform);
if(devices->value("needsbootloader", "") == "no") { if(devices->value("needsbootloader", "") == "no") {
@ -268,8 +268,8 @@ void RbUtilQt::updateDevice()
} }
devices->endGroup(); devices->endGroup();
// displayed device info // displayed device info
platform = userSettings->value("defaults/platform").toString(); platform = userSettings->value("platform").toString();
QString mountpoint = userSettings->value("defaults/mountpoint").toString(); QString mountpoint = userSettings->value("mountpoint").toString();
devices->beginGroup(platform); devices->beginGroup(platform);
QString brand = devices->value("brand").toString(); QString brand = devices->value("brand").toString();
QString name = devices->value("name").toString(); QString name = devices->value("name").toString();
@ -283,9 +283,9 @@ void RbUtilQt::updateDevice()
void RbUtilQt::updateManual() 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; QString manual;
manual = devices->value("manualname", "").toString(); manual = devices->value("manualname", "").toString();
@ -319,7 +319,7 @@ void RbUtilQt::completeInstall()
logger = new ProgressLoggerGui(this); logger = new ProgressLoggerGui(this);
logger->show(); logger->show();
QString mountpoint = userSettings->value("defaults/mountpoint").toString(); QString mountpoint = userSettings->value("mountpoint").toString();
// show dialog with error if mount point is wrong // show dialog with error if mount point is wrong
if(!QFileInfo(mountpoint).isDir()) { if(!QFileInfo(mountpoint).isDir()) {
logger->addItem(tr("Mount point is wrong!"),LOGERROR); logger->addItem(tr("Mount point is wrong!"),LOGERROR);
@ -400,7 +400,7 @@ void RbUtilQt::smallInstall()
logger = new ProgressLoggerGui(this); logger = new ProgressLoggerGui(this);
logger->show(); logger->show();
QString mountpoint = userSettings->value("defaults/mountpoint").toString(); QString mountpoint = userSettings->value("mountpoint").toString();
// show dialog with error if mount point is wrong // show dialog with error if mount point is wrong
if(!QFileInfo(mountpoint).isDir()) { if(!QFileInfo(mountpoint).isDir()) {
logger->addItem(tr("Mount point is wrong!"),LOGERROR); logger->addItem(tr("Mount point is wrong!"),LOGERROR);
@ -450,7 +450,7 @@ bool RbUtilQt::installAuto()
{ {
QString file = QString("%1%2/rockbox.zip") QString file = QString("%1%2/rockbox.zip")
.arg(devices->value("bleeding_url").toString(), .arg(devices->value("bleeding_url").toString(),
userSettings->value("defaults/platform").toString()); userSettings->value("platform").toString());
buildInfo.open(); buildInfo.open();
QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); QSettings info(buildInfo.fileName(), QSettings::IniFormat, this);
@ -473,9 +473,9 @@ bool RbUtilQt::installAuto()
installer->setProxy(proxy()); installer->setProxy(proxy());
installer->setLogSection("Rockbox (Base)"); installer->setLogSection("Rockbox (Base)");
installer->setLogVersion(myversion); installer->setLogVersion(myversion);
if(!userSettings->value("defaults/cachedisable").toBool()) if(!userSettings->value("cachedisable").toBool())
installer->setCache(userSettings->value("defaults/cachepath", QDir::tempPath()).toString()); installer->setCache(userSettings->value("cachepath", QDir::tempPath()).toString());
installer->setMountPoint(userSettings->value("defaults/mountpoint").toString()); installer->setMountPoint(userSettings->value("mountpoint").toString());
installer->install(logger); installer->install(logger);
connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool))); connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool)));
@ -530,12 +530,12 @@ void RbUtilQt::installBootloaderBtn()
void RbUtilQt::installBootloader() void RbUtilQt::installBootloader()
{ {
QString platform = userSettings->value("defaults/platform").toString(); QString platform = userSettings->value("platform").toString();
// create installer // create installer
blinstaller = new BootloaderInstaller(this); blinstaller = new BootloaderInstaller(this);
blinstaller->setMountPoint(userSettings->value("defaults/mountpoint").toString()); blinstaller->setMountPoint(userSettings->value("mountpoint").toString());
blinstaller->setProxy(proxy()); blinstaller->setProxy(proxy());
blinstaller->setDevice(platform); blinstaller->setDevice(platform);
@ -579,7 +579,7 @@ void RbUtilQt::installBootloader()
if(devices->value(platform + "/bootloadermethod").toString() == "fwpatcher") if(devices->value(platform + "/bootloadermethod").toString() == "fwpatcher")
{ {
BrowseOF ofbrowser(this); BrowseOF ofbrowser(this);
ofbrowser.setFile(userSettings->value("defaults/ofpath").toString()); ofbrowser.setFile(userSettings->value("ofpath").toString());
if(ofbrowser.exec() == QDialog::Accepted) if(ofbrowser.exec() == QDialog::Accepted)
{ {
offirmware = ofbrowser.getFile(); offirmware = ofbrowser.getFile();
@ -593,7 +593,7 @@ void RbUtilQt::installBootloader()
} }
else else
{ {
userSettings->setValue("defaults/ofpath",offirmware); userSettings->setValue("ofpath",offirmware);
userSettings->sync(); userSettings->sync();
} }
} }
@ -637,9 +637,9 @@ void RbUtilQt::installFonts()
installer->setProxy(proxy()); installer->setProxy(proxy());
installer->setLogSection("Fonts"); installer->setLogSection("Fonts");
installer->setLogVersion(versmap.value("arch_date")); installer->setLogVersion(versmap.value("arch_date"));
installer->setMountPoint(userSettings->value("defaults/mountpoint").toString()); installer->setMountPoint(userSettings->value("mountpoint").toString());
if(!userSettings->value("defaults/cachedisable").toBool()) if(!userSettings->value("cachedisable").toBool())
installer->setCache(userSettings->value("defaults/cachepath", QDir::tempPath()).toString()); installer->setCache(userSettings->value("cachepath", QDir::tempPath()).toString());
installer->install(logger); installer->install(logger);
} }
@ -658,7 +658,7 @@ void RbUtilQt::installVoice()
installer->setUnzip(false); installer->setUnzip(false);
QString voiceurl = devices->value("voice_url").toString() + "/" + QString voiceurl = devices->value("voice_url").toString() + "/" +
userSettings->value("defaults/platform").toString() + "-" + userSettings->value("platform").toString() + "-" +
versmap.value("arch_date") + "-english.voice"; versmap.value("arch_date") + "-english.voice";
qDebug() << voiceurl; qDebug() << voiceurl;
@ -666,10 +666,10 @@ void RbUtilQt::installVoice()
installer->setUrl(voiceurl); installer->setUrl(voiceurl);
installer->setLogSection("Voice"); installer->setLogSection("Voice");
installer->setLogVersion(versmap.value("arch_date")); 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"); installer->setTarget("/.rockbox/langs/english.voice");
if(!userSettings->value("defaults/cachedisable").toBool()) if(!userSettings->value("cachedisable").toBool())
installer->setCache(userSettings->value("defaults/cachepath", QDir::tempPath()).toString()); installer->setCache(userSettings->value("cachepath", QDir::tempPath()).toString());
installer->install(logger); installer->install(logger);
//connect(installer, SIGNAL(done(bool)), this, SLOT(done(bool))); //connect(installer, SIGNAL(done(bool)), this, SLOT(done(bool)));
@ -702,9 +702,9 @@ void RbUtilQt::installDoom()
installer->setProxy(proxy()); installer->setProxy(proxy());
installer->setLogSection("Game Addons"); installer->setLogSection("Game Addons");
installer->setLogVersion(versmap.value("arch_date")); installer->setLogVersion(versmap.value("arch_date"));
installer->setMountPoint(userSettings->value("defaults/mountpoint").toString()); installer->setMountPoint(userSettings->value("mountpoint").toString());
if(!userSettings->value("defaults/cachedisable").toBool()) if(!userSettings->value("cachedisable").toBool())
installer->setCache(userSettings->value("defaults/cachepath", QDir::tempPath()).toString()); installer->setCache(userSettings->value("cachepath", QDir::tempPath()).toString());
installer->install(logger); installer->install(logger);
} }
@ -747,10 +747,10 @@ void RbUtilQt::uninstallBootloader(void)
ProgressLoggerGui* logger = new ProgressLoggerGui(this); ProgressLoggerGui* logger = new ProgressLoggerGui(this);
logger->show(); logger->show();
QString plattform = userSettings->value("defaults/platform").toString(); QString plattform = userSettings->value("platform").toString();
BootloaderInstaller blinstaller(this); BootloaderInstaller blinstaller(this);
blinstaller.setMountPoint(userSettings->value("defaults/mountpoint").toString()); blinstaller.setMountPoint(userSettings->value("mountpoint").toString());
blinstaller.setDevice(userSettings->value("defaults/platform").toString()); blinstaller.setDevice(userSettings->value("platform").toString());
blinstaller.setBootloaderMethod(devices->value(plattform + "/bootloadermethod").toString()); blinstaller.setBootloaderMethod(devices->value(plattform + "/bootloadermethod").toString());
blinstaller.setBootloaderName(devices->value(plattform + "/bootloadername").toString()); blinstaller.setBootloaderName(devices->value(plattform + "/bootloadername").toString());
blinstaller.setBootloaderBaseUrl(devices->value("bootloader_url").toString()); blinstaller.setBootloaderBaseUrl(devices->value("bootloader_url").toString());
@ -779,7 +779,7 @@ void RbUtilQt::downloadManual(void)
QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); QSettings info(buildInfo.fileName(), QSettings::IniFormat, this);
buildInfo.close(); buildInfo.close();
devices->beginGroup(userSettings->value("defaults/platform").toString()); devices->beginGroup(userSettings->value("platform").toString());
QString manual; QString manual;
manual = devices->value("manualname", "rockbox-" + devices->value("platform").toString()).toString(); manual = devices->value("manualname", "rockbox-" + devices->value("platform").toString()).toString();
devices->endGroup(); devices->endGroup();
@ -803,9 +803,9 @@ void RbUtilQt::downloadManual(void)
ProgressLoggerGui* logger = new ProgressLoggerGui(this); ProgressLoggerGui* logger = new ProgressLoggerGui(this);
logger->show(); logger->show();
installer = new ZipInstaller(this); installer = new ZipInstaller(this);
installer->setMountPoint(userSettings->value("defaults/mountpoint").toString()); installer->setMountPoint(userSettings->value("mountpoint").toString());
if(!userSettings->value("defaults/cachedisable").toBool()) if(!userSettings->value("cachedisable").toBool())
installer->setCache(userSettings->value("defaults/cachepath", QDir::tempPath()).toString()); installer->setCache(userSettings->value("cachepath", QDir::tempPath()).toString());
installer->setProxy(proxy()); installer->setProxy(proxy());
installer->setLogSection(section); installer->setLogSection(section);
installer->setUrl(manualurl); installer->setUrl(manualurl);
@ -828,23 +828,23 @@ void RbUtilQt::installPortable(void)
logger->addItem(tr("Installing Rockbox Utility"), LOGINFO); logger->addItem(tr("Installing Rockbox Utility"), LOGINFO);
// check mountpoint // 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->addItem(tr("Mount point is wrong!"),LOGERROR);
logger->abort(); logger->abort();
return; return;
} }
// remove old files first. // remove old files first.
QFile::remove(userSettings->value("defaults/mountpoint").toString() + "/RockboxUtility.exe"); QFile::remove(userSettings->value("mountpoint").toString() + "/RockboxUtility.exe");
QFile::remove(userSettings->value("defaults/mountpoint").toString() + "/RockboxUtility.ini"); QFile::remove(userSettings->value("mountpoint").toString() + "/RockboxUtility.ini");
// copy currently running binary and currently used settings file // 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->addItem(tr("Error installing Rockbox Utility"), LOGERROR);
logger->abort(); logger->abort();
return; return;
} }
logger->addItem(tr("Installing user configuration"), LOGINFO); 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->addItem(tr("Error installing user configuration"), LOGERROR);
logger->abort(); logger->abort();
return; return;
@ -859,7 +859,7 @@ void RbUtilQt::updateInfo()
{ {
qDebug() << "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(); QStringList groups = log.childGroups();
QList<QTreeWidgetItem *> items; QList<QTreeWidgetItem *> items;
QTreeWidgetItem *w, *w2; QTreeWidgetItem *w, *w2;
@ -895,7 +895,7 @@ void RbUtilQt::updateInfo()
for(int b = 0; b < keys.size(); b++) { for(int b = 0; b < keys.size(); b++) {
QString file; QString file;
file = userSettings->value("defaults/mountpoint").toString() + "/" + keys.at(b); file = userSettings->value("mountpoint").toString() + "/" + keys.at(b);
if(QFileInfo(file).isDir()) if(QFileInfo(file).isDir())
continue; continue;
w2 = new QTreeWidgetItem(w, QStringList() << "/" w2 = new QTreeWidgetItem(w, QStringList() << "/"
@ -920,10 +920,10 @@ void RbUtilQt::updateInfo()
QUrl RbUtilQt::proxy() QUrl RbUtilQt::proxy()
{ {
if(userSettings->value("defaults/proxytype") == "manual") if(userSettings->value("proxytype") == "manual")
return QUrl(userSettings->value("defaults/proxy").toString()); return QUrl(userSettings->value("proxy").toString());
#ifdef __linux #ifdef __linux
else if(userSettings->value("defaults/proxytype") == "system") else if(userSettings->value("proxytype") == "system")
return QUrl(getenv("http_proxy")); return QUrl(getenv("http_proxy"));
#endif #endif
return QUrl(""); return QUrl("");

View file

@ -78,7 +78,7 @@ void UninstallWindow::setUserSettings(QSettings *user)
{ {
userSettings = user; userSettings = user;
QString mountpoint =userSettings->value("defaults/mountpoint").toString(); QString mountpoint =userSettings->value("mountpoint").toString();
uninstaller = new Uninstaller(this,mountpoint); uninstaller = new Uninstaller(this,mountpoint);
// disable smart uninstall, if not possible // disable smart uninstall, if not possible