1
0
Fork 0
forked from len0rd/rockbox

- 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.")); tr("You need to restart the application for the changed language to take effect."));
userSettings->setValue("defaults/lang", language); 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 // sync settings
userSettings->sync(); userSettings->sync();
this->close(); this->close();
@ -118,7 +128,9 @@ void Config::setUserSettings(QSettings *user)
// set proxy // set proxy
QUrl proxy = userSettings->value("defaults/proxy").toString(); 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.proxyHost->setText(proxy.host());
ui.proxyUser->setText(proxy.userName()); ui.proxyUser->setText(proxy.userName());
ui.proxyPass->setText(proxy.password()); ui.proxyPass->setText(proxy.password());
@ -225,16 +237,6 @@ void Config::setDevices(QSettings *dev)
ui.treeDevices->insertTopLevelItems(0, items); ui.treeDevices->insertTopLevelItems(0, items);
if(w3 != 0) if(w3 != 0)
ui.treeDevices->setCurrentItem(w3); // hilight old selection 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 { else {
ui.proxyHost->setText(proxy.host()); 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.proxyUser->setText(proxy.userName());
ui.proxyPass->setText(proxy.password()); ui.proxyPass->setText(proxy.password());
} }

View file

@ -54,7 +54,6 @@ class Config : public QDialog
void setSystemProxy(bool); void setSystemProxy(bool);
void updateLanguage(void); void updateLanguage(void);
void browseFolder(void); void browseFolder(void);
void updatePlatform(void);
}; };
#endif #endif

View file

@ -207,6 +207,8 @@ void RbUtilQt::updateDevice()
QString brand = devices->value("brand").toString(); QString brand = devices->value("brand").toString();
QString name = devices->value("name").toString(); QString name = devices->value("name").toString();
devices->endGroup(); devices->endGroup();
if(name.isEmpty()) name = "&lt;none&gt;";
if(mountpoint.isEmpty()) mountpoint = "&lt;invalid&gt;";
ui.labelDevice->setText(tr("<b>%1 %2</b> at <b>%3</b>") ui.labelDevice->setText(tr("<b>%1 %2</b> at <b>%3</b>")
.arg(brand, name, mountpoint)); .arg(brand, name, mountpoint));
} }