- display better values if no user configuration is found

- make it possible to cancel device selection
- accept new device path also if it's not selected from the browser and ignore it if it's not a path.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14162 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2007-08-03 16:55:27 +00:00
parent a31b410868
commit 7aceb93589
3 changed files with 18 additions and 13 deletions

View file

@ -98,6 +98,16 @@ void Config::accept()
tr("You need to restart the application for the changed language to take effect."));
userSettings->setValue("defaults/lang", language);
// mountpoint
QString mp = ui.mountPoint->text();
if(QFileInfo(mp).isDir())
userSettings->setValue("defaults/mountpoint", mp);
// platform
QString nplat;
nplat = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString();
userSettings->setValue("defaults/platform", nplat);
// sync settings
userSettings->sync();
this->close();
@ -118,7 +128,9 @@ void Config::setUserSettings(QSettings *user)
// set proxy
QUrl proxy = userSettings->value("defaults/proxy").toString();
ui.proxyPort->setText(QString("%1").arg(proxy.port()));
if(proxy.port() > 0)
ui.proxyPort->setText(QString("%1").arg(proxy.port()));
else ui.proxyPort->setText("");
ui.proxyHost->setText(proxy.host());
ui.proxyUser->setText(proxy.userName());
ui.proxyPass->setText(proxy.password());
@ -225,16 +237,6 @@ void Config::setDevices(QSettings *dev)
ui.treeDevices->insertTopLevelItems(0, items);
if(w3 != 0)
ui.treeDevices->setCurrentItem(w3); // hilight old selection
connect(ui.treeDevices, SIGNAL(itemSelectionChanged()), this, SLOT(updatePlatform()));
}
void Config::updatePlatform()
{
qDebug() << "updatePlatform()";
QString nplat;
nplat = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString();
userSettings->setValue("defaults/platform", nplat);
}
@ -273,7 +275,9 @@ void Config::setSystemProxy(bool checked)
}
else {
ui.proxyHost->setText(proxy.host());
ui.proxyPort->setText(QString("%1").arg(proxy.port()));
if(proxy.port() > 0)
ui.proxyPort->setText(QString("%1").arg(proxy.port()));
else ui.proxyPort->setText("");
ui.proxyUser->setText(proxy.userName());
ui.proxyPass->setText(proxy.password());
}