1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-22 20:44:15 +00:00

Add all torrents passed via the command line

PR #18296.
Closes #18289.
This commit is contained in:
Vladimir Golovnev 2023-01-16 06:54:02 +03:00 committed by GitHub
parent 8db2d04dbb
commit 5dbccf3473
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View File

@ -658,8 +658,7 @@ Application::AddTorrentParams Application::parseParams(const QStringList &params
continue; continue;
} }
parsedParams.torrentSource = param; parsedParams.torrentSources.append(param);
break;
} }
return parsedParams; return parsedParams;
@ -675,10 +674,16 @@ void Application::processParams(const AddTorrentParams &params)
// should be overridden. // should be overridden.
const bool showDialogForThisTorrent = !params.skipTorrentDialog.value_or(!AddNewTorrentDialog::isEnabled()); const bool showDialogForThisTorrent = !params.skipTorrentDialog.value_or(!AddNewTorrentDialog::isEnabled());
if (showDialogForThisTorrent) if (showDialogForThisTorrent)
AddNewTorrentDialog::show(params.torrentSource, params.torrentParams, m_window); {
for (const QString &torrentSource : params.torrentSources)
AddNewTorrentDialog::show(torrentSource, params.torrentParams, m_window);
}
else else
#endif #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 &params) int Application::exec(const QStringList &params)

View File

@ -148,7 +148,7 @@ private slots:
private: private:
struct AddTorrentParams struct AddTorrentParams
{ {
QString torrentSource; QStringList torrentSources;
BitTorrent::AddTorrentParams torrentParams; BitTorrent::AddTorrentParams torrentParams;
std::optional<bool> skipTorrentDialog; std::optional<bool> skipTorrentDialog;
}; };