summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2010-02-16 21:34:39 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2010-02-16 21:34:39 +0000
commit7e91332e398db9f344e44df3b2ea29adc94ad56e (patch)
tree5f35421351efa7b816c4745c3d673c53f740ff76
parentb1908e95e130b766af113a264b145da06bbeeb31 (diff)
downloadrockbox-7e91332e398db9f344e44df3b2ea29adc94ad56e.tar.gz
rockbox-7e91332e398db9f344e44df3b2ea29adc94ad56e.tar.bz2
rockbox-7e91332e398db9f344e44df3b2ea29adc94ad56e.zip
Use QFileDialog::getExistingDirectory() for path selection.
This makes it possible for native dialogs to get used on Windows and OS X. The mountpoint selection dialog needs special handling and still uses the BrowseDirtree class for now. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24703 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--rbutil/rbutilqt/configure.cpp27
-rw-r--r--rbutil/rbutilqt/configure.h1
-rw-r--r--rbutil/rbutilqt/installtalkwindow.cpp23
-rw-r--r--rbutil/rbutilqt/installtalkwindow.h1
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp8
5 files changed, 24 insertions, 36 deletions
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp
index 1f433d8903..2e2f2e3531 100644
--- a/rbutil/rbutilqt/configure.cpp
+++ b/rbutil/rbutilqt/configure.cpp
@@ -549,16 +549,16 @@ void Config::browseFolder()
void Config::browseCache()
{
- cbrowser = new BrowseDirtree(this);
-#if defined(Q_OS_LINUX) || defined(Q_OS_MACX)
- cbrowser->setFilter(QDir::AllDirs | QDir::NoDotAndDotDot | QDir::NoSymLinks);
-#elif defined(Q_OS_WIN32)
- cbrowser->setFilter(QDir::Drives | QDir::AllDirs | QDir::NoDotAndDotDot);
-#endif
- cbrowser->setDir(ui.cachePath->text());
- connect(cbrowser, SIGNAL(itemChanged(QString)), this, SLOT(setCache(QString)));
- cbrowser->show();
-
+ QString old = ui.cachePath->text();
+ if(!QFileInfo(old).isDir())
+ old = QDir::tempPath();
+ QString c = QFileDialog::getExistingDirectory(this, tr("Set Cache Path"), old);
+ if(c.isEmpty())
+ c = old;
+ else if(!QFileInfo(c).isDir())
+ c = QDir::tempPath();
+ ui.cachePath->setText(QDir::toNativeSeparators(c));
+ updateCacheInfo(c);
}
@@ -568,13 +568,6 @@ void Config::setMountpoint(QString m)
}
-void Config::setCache(QString c)
-{
- ui.cachePath->setText(c);
- updateCacheInfo(c);
-}
-
-
void Config::autodetect()
{
Autodetection detector(this);
diff --git a/rbutil/rbutilqt/configure.h b/rbutil/rbutilqt/configure.h
index d2654907c1..3884d0d750 100644
--- a/rbutil/rbutilqt/configure.h
+++ b/rbutil/rbutilqt/configure.h
@@ -64,7 +64,6 @@ class Config : public QDialog
void browseCache(void);
void autodetect(void);
void setMountpoint(QString);
- void setCache(QString);
void cacheClear(void);
void configTts(void);
void configEnc(void);
diff --git a/rbutil/rbutilqt/installtalkwindow.cpp b/rbutil/rbutilqt/installtalkwindow.cpp
index fb604e71e2..8c09d684c8 100644
--- a/rbutil/rbutilqt/installtalkwindow.cpp
+++ b/rbutil/rbutilqt/installtalkwindow.cpp
@@ -42,28 +42,24 @@ InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent)
void InstallTalkWindow::browseFolder()
{
- BrowseDirtree browser(this);
- browser.setFilter(QDir::AllDirs | QDir::NoDotAndDotDot | QDir::NoSymLinks);
-
+ QString selected;
+ QString startfolder;
if(QFileInfo(ui.lineTalkFolder->text()).isDir())
{
- browser.setDir(ui.lineTalkFolder->text());
+ startfolder = ui.lineTalkFolder->text();
}
else
{
- browser.setDir("/media"); // FIXME: This looks Linux specific
+ startfolder = "/media"; // FIXME: This looks Linux specific
}
- if(browser.exec() == QDialog::Accepted)
+ selected = QFileDialog::getExistingDirectory(this,
+ tr("Select folder to create talk files"), startfolder);
+ if(!selected.isEmpty())
{
- qDebug() << browser.getSelected();
- setTalkFolder(browser.getSelected());
+ ui.lineTalkFolder->setText(selected);
}
}
-void InstallTalkWindow::setTalkFolder(QString folder)
-{
- ui.lineTalkFolder->setText(folder);
-}
void InstallTalkWindow::change()
{
@@ -145,7 +141,8 @@ void InstallTalkWindow::updateSettings(void)
ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>")
.arg("Invalid encoder configuration!"));
- setTalkFolder(RbSettings::value(RbSettings::LastTalkedFolder).toString());
+ ui.lineTalkFolder->setText(
+ RbSettings::value(RbSettings::LastTalkedFolder).toString());
emit settingsUpdated();
}
diff --git a/rbutil/rbutilqt/installtalkwindow.h b/rbutil/rbutilqt/installtalkwindow.h
index e7cc85aac7..e723f29af8 100644
--- a/rbutil/rbutilqt/installtalkwindow.h
+++ b/rbutil/rbutilqt/installtalkwindow.h
@@ -40,7 +40,6 @@ class InstallTalkWindow : public QDialog
private slots:
void browseFolder(void);
- void setTalkFolder(QString folder);
void updateSettings(void);
signals:
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index 4698b3fc58..f5ff47d539 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -735,11 +735,11 @@ void RbUtilQt::installBootloader()
"in a new folder \"%1\" created below the selected folder.\n"
"Press \"No\" to skip this step.").arg(targetFolder),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
- BrowseDirtree tree(this, tr("Browse backup folder"));
- tree.setDir(QDir::home());
- tree.exec();
+ backupDestination = QFileDialog::getExistingDirectory(this,
+ tr("Browse backup folder"), QDir::homePath());
+ if(!backupDestination.isEmpty())
+ backupDestination += "/" + targetFolder;
- backupDestination = tree.getSelected() + "/" + targetFolder;
qDebug() << "[RbUtil] backing up to" << backupDestination;
// backup needs to be done after the logger has been set up.
}