From 78dafc9cbe0bd01e06dfe4085af564edfac85db6 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Wed, 9 Aug 2017 15:12:56 +0800 Subject: [PATCH] Prefill torrent name when creating a new torrent. Closes #7229. --- src/gui/torrentcreatordlg.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/torrentcreatordlg.cpp b/src/gui/torrentcreatordlg.cpp index fb72e792b..5f26c1aeb 100644 --- a/src/gui/torrentcreatordlg.cpp +++ b/src/gui/torrentcreatordlg.cpp @@ -144,7 +144,7 @@ void TorrentCreatorDlg::onCreateButtonClicked() QString input = Utils::Fs::fromNativePath(m_ui->textInputPath->text()).trimmed(); // test if readable - QFileInfo fi(input); + const QFileInfo fi(input); if (!fi.isReadable()) { QMessageBox::critical(this, tr("Torrent creator failed"), tr("Reason: Path to file/folder is not readable.")); return; @@ -152,8 +152,8 @@ void TorrentCreatorDlg::onCreateButtonClicked() input = fi.canonicalFilePath(); // get save path - QString lastPath = m_storeLastSavePath; - QString destination = QFileDialog::getSaveFileName(this, tr("Select where to save the new torrent"), lastPath, tr("Torrent Files (*.torrent)")); + const QString savePath = QString(m_storeLastSavePath) + QLatin1Char('/') + fi.fileName() + QLatin1String(".torrent"); + QString destination = QFileDialog::getSaveFileName(this, tr("Select where to save the new torrent"), savePath, tr("Torrent Files (*.torrent)")); if (destination.isEmpty()) return; if (!destination.endsWith(C_TORRENT_FILE_EXTENSION, Qt::CaseInsensitive))