Use native file dialogs

This commit is contained in:
Christophe Dumez
2011-01-27 17:33:19 +00:00
parent a8a42fb8f3
commit a42d4afeb7
3 changed files with 5 additions and 18 deletions

View File

@@ -1,6 +1,7 @@
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.6.5 * Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.6.5
- BUGFIX: Make sure the progress is not 100% unless the file is complete - BUGFIX: Make sure the progress is not 100% unless the file is complete
- BUGFIX: Fix memory leak in HTTP torrent downloader - BUGFIX: Fix memory leak in HTTP torrent downloader
- BUGFIX: Use native file dialogs (by Vladimir Golovnev)
- BUGFIX: Performance improvement on ARM - BUGFIX: Performance improvement on ARM
* Sun Jan 23 2011 - Christophe Dumez <chris@qbittorrent.org> - v2.6.4 * Sun Jan 23 2011 - Christophe Dumez <chris@qbittorrent.org> - v2.6.4

View File

@@ -702,15 +702,8 @@ void PropertiesWidget::on_changeSavePathButton_clicked() {
new_path = QFileDialog::getSaveFileName(this, tr("Choose save path"), h.firstFileSavePath()); new_path = QFileDialog::getSaveFileName(this, tr("Choose save path"), h.firstFileSavePath());
} else { } else {
const QDir saveDir(TorrentPersistentData::getSavePath(h.hash())); const QDir saveDir(TorrentPersistentData::getSavePath(h.hash()));
QFileDialog dlg(this, tr("Choose save path"), saveDir.absolutePath()); new_path = QFileDialog::getExistingDirectory(this, tr("Choose save path"), saveDir.absolutePath(),
dlg.setConfirmOverwrite(false); QFileDialog::DontConfirmOverwrite|QFileDialog::ShowDirsOnly|QFileDialog::HideNameFilterDetails);
dlg.setFileMode(QFileDialog::Directory);
dlg.setOption(QFileDialog::ShowDirsOnly, true);
dlg.setFilter(QDir::AllDirs);
dlg.setAcceptMode(QFileDialog::AcceptSave);
dlg.setNameFilterDetailsVisible(false);
if(dlg.exec())
new_path = dlg.selectedFiles().first();
} }
if(!new_path.isEmpty()){ if(!new_path.isEmpty()){
// Check if savePath exists // Check if savePath exists

View File

@@ -218,15 +218,8 @@ void TransferListWidget::setSelectedTorrentsLocation() {
QString dir; QString dir;
const QDir saveDir(TorrentPersistentData::getSavePath(hashes.first())); const QDir saveDir(TorrentPersistentData::getSavePath(hashes.first()));
qDebug("Old save path is %s", qPrintable(saveDir.absolutePath())); qDebug("Old save path is %s", qPrintable(saveDir.absolutePath()));
QFileDialog dlg(this, tr("Choose save path"), saveDir.absolutePath()); dir = QFileDialog::getExistingDirectory(this, tr("Choose save path"), saveDir.absolutePath(),
dlg.setConfirmOverwrite(false); QFileDialog::DontConfirmOverwrite|QFileDialog::ShowDirsOnly|QFileDialog::HideNameFilterDetails);
dlg.setFileMode(QFileDialog::Directory);
dlg.setOption(QFileDialog::ShowDirsOnly, true);
dlg.setFilter(QDir::AllDirs);
dlg.setAcceptMode(QFileDialog::AcceptSave);
dlg.setNameFilterDetailsVisible(false);
if(dlg.exec())
dir = dlg.selectedFiles().first();
if(!dir.isNull()) { if(!dir.isNull()) {
qDebug("New path is %s", qPrintable(dir)); qDebug("New path is %s", qPrintable(dir));
// Check if savePath exists // Check if savePath exists