From 5dbccf34737bde897cd18ff83b39c1b43b3fcda3 Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Mon, 16 Jan 2023 06:54:02 +0300 Subject: [PATCH] Add all torrents passed via the command line PR #18296. Closes #18289. --- src/app/application.cpp | 13 +++++++++---- src/app/application.h | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/app/application.cpp b/src/app/application.cpp index 4e4e1fc7a..5b3124a45 100644 --- a/src/app/application.cpp +++ b/src/app/application.cpp @@ -658,8 +658,7 @@ Application::AddTorrentParams Application::parseParams(const QStringList ¶ms continue; } - parsedParams.torrentSource = param; - break; + parsedParams.torrentSources.append(param); } return parsedParams; @@ -675,10 +674,16 @@ void Application::processParams(const AddTorrentParams ¶ms) // should be overridden. const bool showDialogForThisTorrent = !params.skipTorrentDialog.value_or(!AddNewTorrentDialog::isEnabled()); if (showDialogForThisTorrent) - AddNewTorrentDialog::show(params.torrentSource, params.torrentParams, m_window); + { + for (const QString &torrentSource : params.torrentSources) + AddNewTorrentDialog::show(torrentSource, params.torrentParams, m_window); + } else #endif - BitTorrent::Session::instance()->addTorrent(params.torrentSource, params.torrentParams); + { + for (const QString &torrentSource : params.torrentSources) + BitTorrent::Session::instance()->addTorrent(torrentSource, params.torrentParams); + } } int Application::exec(const QStringList ¶ms) diff --git a/src/app/application.h b/src/app/application.h index d8801face..21f1dc132 100644 --- a/src/app/application.h +++ b/src/app/application.h @@ -148,7 +148,7 @@ private slots: private: struct AddTorrentParams { - QString torrentSource; + QStringList torrentSources; BitTorrent::AddTorrentParams torrentParams; std::optional skipTorrentDialog; };