diff options
Diffstat (limited to 'rbutil/rbutilqt')
-rw-r--r-- | rbutil/rbutilqt/browsedirtree.cpp | 17 | ||||
-rw-r--r-- | rbutil/rbutilqt/browsedirtree.h | 11 | ||||
-rw-r--r-- | rbutil/rbutilqt/browseof.cpp | 3 | ||||
-rw-r--r-- | rbutil/rbutilqt/configure.cpp | 15 | ||||
-rw-r--r-- | rbutil/rbutilqt/installtalkwindow.cpp | 6 |
5 files changed, 26 insertions, 26 deletions
diff --git a/rbutil/rbutilqt/browsedirtree.cpp b/rbutil/rbutilqt/browsedirtree.cpp index 2eabe75564..59c4cef9f4 100644 --- a/rbutil/rbutilqt/browsedirtree.cpp +++ b/rbutil/rbutilqt/browsedirtree.cpp @@ -30,7 +30,7 @@ BrowseDirtree::BrowseDirtree(QWidget *parent) : QDialog(parent) ui.tree->setModel(&model); model.setReadOnly(true); model.setSorting(QDir::Name | QDir::DirsFirst | QDir::IgnoreCase); - + // disable size / date / type columns ui.tree->setColumnHidden(1, true); ui.tree->setColumnHidden(2, true); @@ -39,7 +39,7 @@ BrowseDirtree::BrowseDirtree(QWidget *parent) : QDialog(parent) } -void BrowseDirtree::setDir(QDir &dir) +void BrowseDirtree::setDir(const QDir &dir) { qDebug() << "BrowseDirtree::setDir()" << model.index(dir.absolutePath()); @@ -49,17 +49,24 @@ void BrowseDirtree::setDir(QDir &dir) if(model.index(dir.absolutePath()).isValid()) { QModelIndex p = model.index(dir.absolutePath()); ui.tree->setCurrentIndex(p); + ui.tree->expand(p); ui.tree->scrollTo(p); ui.tree->resizeColumnToContents(0); } } -void BrowseDirtree::setRoot(QString dir) +void BrowseDirtree::setDir(const QString &dir) +{ + QDir d(dir); + setDir(d); +} + +void BrowseDirtree::setRoot(const QString &dir) { ui.tree->setRootIndex(model.index(dir)); } -void BrowseDirtree::setFilter(QDir::Filters filters) +void BrowseDirtree::setFilter(const QDir::Filters &filters) { model.setFilter(filters); } @@ -72,7 +79,7 @@ void BrowseDirtree::accept() this->close(); emit itemChanged(QDir::toNativeSeparators(path)); - setResult(QDialog::Accepted); + setResult(QDialog::Accepted); } QString BrowseDirtree::getSelected() diff --git a/rbutil/rbutilqt/browsedirtree.h b/rbutil/rbutilqt/browsedirtree.h index 4b9ae90a19..2c349398a8 100644 --- a/rbutil/rbutilqt/browsedirtree.h +++ b/rbutil/rbutilqt/browsedirtree.h @@ -29,18 +29,19 @@ class BrowseDirtree : public QDialog public: BrowseDirtree(QWidget *parent = 0); - void setFilter(QDir::Filters); - void setDir(QDir&); + void setFilter(const QDir::Filters&); + void setDir(const QDir&); + void setDir(const QString&); QString getSelected(); - void setRoot(QString dir); - + void setRoot(const QString&); + signals: void itemChanged(QString); private: Ui::BrowseDirtreeFrm ui; QDirModel model; - + private slots: void accept(void); }; diff --git a/rbutil/rbutilqt/browseof.cpp b/rbutil/rbutilqt/browseof.cpp index e9fdc982f4..93b768c263 100644 --- a/rbutil/rbutilqt/browseof.cpp +++ b/rbutil/rbutilqt/browseof.cpp @@ -43,8 +43,7 @@ void BrowseOF::onBrowse() if(QFileInfo(ui.OFlineEdit->text()).exists()) { - QDir d(ui.OFlineEdit->text()); - browser.setDir(d); + browser.setDir(ui.OFlineEdit->text()); } if(browser.exec() == QDialog::Accepted) diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp index 4001bc6347..c88b9857d8 100644 --- a/rbutil/rbutilqt/configure.cpp +++ b/rbutil/rbutilqt/configure.cpp @@ -495,13 +495,11 @@ void Config::browseFolder() #if defined(Q_OS_MACX) browser->setRoot("/Volumes"); #elif defined(Q_OS_LINUX) - QDir a("/media"); - browser->setDir(a); + browser->setDir("/media"); #endif if( ui.mountPoint->text() != "" ) { - QDir d(ui.mountPoint->text()); - browser->setDir(d); + browser->setDir(ui.mountPoint->text()); } browser->show(); connect(browser, SIGNAL(itemChanged(QString)), this, SLOT(setMountpoint(QString))); @@ -516,8 +514,7 @@ void Config::browseCache() #elif defined(Q_OS_WIN32) cbrowser->setFilter(QDir::Drives); #endif - QDir d(ui.cachePath->text()); - cbrowser->setDir(d); + cbrowser->setDir(ui.cachePath->text()); cbrowser->show(); connect(cbrowser, SIGNAL(itemChanged(QString)), this, SLOT(setCache(QString))); } @@ -625,8 +622,7 @@ void Config::browseTts() if(QFileInfo(ui.ttsExecutable->text()).isDir()) { - QDir d(ui.ttsExecutable->text()); - browser.setDir(d); + browser.setDir(ui.ttsExecutable->text()); } if(browser.exec() == QDialog::Accepted) { @@ -647,8 +643,7 @@ void Config::browseEnc() if(QFileInfo(ui.encoderExecutable->text()).isDir()) { - QDir d(ui.encoderExecutable->text()); - browser.setDir(d); + browser.setDir(ui.encoderExecutable->text()); } if(browser.exec() == QDialog::Accepted) { diff --git a/rbutil/rbutilqt/installtalkwindow.cpp b/rbutil/rbutilqt/installtalkwindow.cpp index 324fe442b1..f273721437 100644 --- a/rbutil/rbutilqt/installtalkwindow.cpp +++ b/rbutil/rbutilqt/installtalkwindow.cpp @@ -43,13 +43,11 @@ void InstallTalkWindow::browseFolder() if(QFileInfo(ui.lineTalkFolder->text()).isDir()) { - QDir d(ui.lineTalkFolder->text()); - browser.setDir(d); + browser.setDir(ui.lineTalkFolder->text()); } else { - QDir d("/media"); - browser.setDir(d); + browser.setDir("/media"); // FIXME: This looks Linux specific } if(browser.exec() == QDialog::Accepted) { |