summaryrefslogtreecommitdiffstats
path: root/rbutil
diff options
context:
space:
mode:
authorDominik Wenger <domonoky@googlemail.com>2007-08-07 17:49:35 +0000
committerDominik Wenger <domonoky@googlemail.com>2007-08-07 17:49:35 +0000
commit2ee205ae0de2c8dc6db150465175e737cfa79784 (patch)
tree3c7da4b2fca32b6d37a19ec95ea919bacd14dae5 /rbutil
parent3a4e540c3db4309990965455b0686230345be002 (diff)
downloadrockbox-2ee205ae0de2c8dc6db150465175e737cfa79784.tar.gz
rockbox-2ee205ae0de2c8dc6db150465175e737cfa79784.tar.bz2
rockbox-2ee205ae0de2c8dc6db150465175e737cfa79784.zip
rbutilqt: use the new dirbrowser in the talkfile generation. Also little changes to the dirbrowser to run it statically and without signals.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14234 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil')
-rw-r--r--rbutil/rbutilqt/browsedirtree.cpp8
-rw-r--r--rbutil/rbutilqt/browsedirtree.h3
-rw-r--r--rbutil/rbutilqt/installtalkwindow.cpp78
3 files changed, 58 insertions, 31 deletions
diff --git a/rbutil/rbutilqt/browsedirtree.cpp b/rbutil/rbutilqt/browsedirtree.cpp
index 0899ab103f..e100dfa41f 100644
--- a/rbutil/rbutilqt/browsedirtree.cpp
+++ b/rbutil/rbutilqt/browsedirtree.cpp
@@ -65,6 +65,14 @@ void BrowseDirtree::accept()
this->close();
emit itemChanged(path);
+ setResult(QDialog::Accepted);
+}
+
+QString BrowseDirtree::getSelected()
+{
+ QString path;
+ path = model.filePath(ui.tree->currentIndex());
+ return path;
}
diff --git a/rbutil/rbutilqt/browsedirtree.h b/rbutil/rbutilqt/browsedirtree.h
index 3b6846c211..4213400138 100644
--- a/rbutil/rbutilqt/browsedirtree.h
+++ b/rbutil/rbutilqt/browsedirtree.h
@@ -31,7 +31,8 @@ class BrowseDirtree : public QDialog
BrowseDirtree(QWidget *parent = 0);
void setFilter(QDir::Filters);
void setDir(QDir&);
-
+ QString getSelected();
+
signals:
void itemChanged(QString);
diff --git a/rbutil/rbutilqt/installtalkwindow.cpp b/rbutil/rbutilqt/installtalkwindow.cpp
index 4d1cdb1491..82efa20a88 100644
--- a/rbutil/rbutilqt/installtalkwindow.cpp
+++ b/rbutil/rbutilqt/installtalkwindow.cpp
@@ -20,6 +20,8 @@
#include "installtalkwindow.h"
#include "ui_installtalkfrm.h"
+#include "browsedirtree.h"
+
InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent)
{
ui.setupUi(this);
@@ -43,18 +45,23 @@ InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent)
void InstallTalkWindow::browseFolder()
{
- QFileDialog browser(this);
+ BrowseDirtree browser(this);
+ browser.setFilter(QDir::AllDirs | QDir::NoDotAndDotDot | QDir::NoSymLinks);
+
if(QFileInfo(ui.lineTalkFolder->text()).isDir())
- browser.setDirectory(ui.lineTalkFolder->text());
+ {
+ QDir d(ui.lineTalkFolder->text());
+ browser.setDir(d);
+ }
else
- browser.setDirectory("/media");
- browser.setReadOnly(true);
- browser.setFileMode(QFileDialog::DirectoryOnly);
- browser.setAcceptMode(QFileDialog::AcceptOpen);
- if(browser.exec()) {
- qDebug() << browser.directory();
- QStringList files = browser.selectedFiles();
- setTalkFolder(files.at(0));
+ {
+ QDir d("/media");
+ browser.setDir(d);
+ }
+ if(browser.exec() == QDialog::Accepted)
+ {
+ qDebug() << browser.getSelected();
+ setTalkFolder(browser.getSelected());
}
}
@@ -66,19 +73,25 @@ void InstallTalkWindow::setTalkFolder(QString folder)
void InstallTalkWindow::browseTTS()
{
- QFileDialog browser(this);
+ BrowseDirtree browser(this);
+ browser.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
+
if(QFileInfo(ui.TTSpath->text()).isDir())
- browser.setDirectory(ui.TTSpath->text());
+ {
+ QDir d(ui.TTSpath->text());
+ browser.setDir(d);
+ }
else
- browser.setDirectory("/media");
- browser.setReadOnly(true);
- browser.setFileMode(QFileDialog::ExistingFile);
- browser.setAcceptMode(QFileDialog::AcceptOpen);
- if(browser.exec()) {
- qDebug() << browser.directory();
- QStringList files = browser.selectedFiles();
- setTTSExec(files.at(0));
+ {
+ QDir d("/media");
+ browser.setDir(d);
+ }
+ if(browser.exec() == QDialog::Accepted)
+ {
+ qDebug() << browser.getSelected();
+ setTTSExec(browser.getSelected());
}
+
}
void InstallTalkWindow::setTTSExec(QString path)
@@ -89,18 +102,23 @@ void InstallTalkWindow::setTTSExec(QString path)
void InstallTalkWindow::browseEncoder()
{
- QFileDialog browser(this);
+ BrowseDirtree browser(this);
+ browser.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
+
if(QFileInfo(ui.Encoderpath->text()).isDir())
- browser.setDirectory(ui.Encoderpath->text());
+ {
+ QDir d(ui.Encoderpath->text());
+ browser.setDir(d);
+ }
else
- browser.setDirectory("/media");
- browser.setReadOnly(true);
- browser.setFileMode(QFileDialog::ExistingFile);
- browser.setAcceptMode(QFileDialog::AcceptOpen);
- if(browser.exec()) {
- qDebug() << browser.directory();
- QStringList files = browser.selectedFiles();
- setEncoderExec(files.at(0));
+ {
+ QDir d("/media");
+ browser.setDir(d);
+ }
+ if(browser.exec() == QDialog::Accepted)
+ {
+ qDebug() << browser.getSelected();
+ setEncoderExec(browser.getSelected());
}
}