From 33fbb119b679b54696235e3c96e1908c64267e39 Mon Sep 17 00:00:00 2001 From: bluebrother Date: Fri, 3 Aug 2007 16:55:27 +0000 Subject: [PATCH] - 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 --- rbutil/rbutilqt/configure.cpp | 28 ++++++++++++++++------------ rbutil/rbutilqt/configure.h | 1 - rbutil/rbutilqt/rbutilqt.cpp | 2 ++ 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp index 20ffe4ce9..53d1acfe0 100644 --- a/rbutil/rbutilqt/configure.cpp +++ b/rbutil/rbutilqt/configure.cpp @@ -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()); } diff --git a/rbutil/rbutilqt/configure.h b/rbutil/rbutilqt/configure.h index dee1e0659..54e76d024 100644 --- a/rbutil/rbutilqt/configure.h +++ b/rbutil/rbutilqt/configure.h @@ -54,7 +54,6 @@ class Config : public QDialog void setSystemProxy(bool); void updateLanguage(void); void browseFolder(void); - void updatePlatform(void); }; #endif diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index da469efde..5fcfc39d1 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp @@ -207,6 +207,8 @@ void RbUtilQt::updateDevice() QString brand = devices->value("brand").toString(); QString name = devices->value("name").toString(); devices->endGroup(); + if(name.isEmpty()) name = "<none>"; + if(mountpoint.isEmpty()) mountpoint = "<invalid>"; ui.labelDevice->setText(tr("%1 %2 at %3") .arg(brand, name, mountpoint)); } -- 2.11.4.GIT