mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-14 09:13:08 -07:00
Cleanup code
Also remove redundant code, it is already handled correctly in subsequent function calls.
This commit is contained in:
parent
19d6de795c
commit
6759446639
5 changed files with 27 additions and 31 deletions
|
@ -2090,12 +2090,9 @@ TorrentStatusReport Session::torrentStatusReport() const
|
|||
return m_torrentStatusReport;
|
||||
}
|
||||
|
||||
// source - .torrent file path/url or magnet uri
|
||||
bool Session::addTorrent(QString source, const AddTorrentParams ¶ms)
|
||||
bool Session::addTorrent(const QString &source, const AddTorrentParams ¶ms)
|
||||
{
|
||||
MagnetUri magnetUri(source);
|
||||
if (magnetUri.isValid())
|
||||
return addTorrent_impl(CreateTorrentParams(params), magnetUri);
|
||||
// `source`: .torrent file path/url or magnet uri
|
||||
|
||||
if (Utils::Misc::isUrl(source)) {
|
||||
LogMsg(tr("Downloading '%1', please wait...", "e.g: Downloading 'xxx.torrent', please wait...").arg(source));
|
||||
|
@ -2110,6 +2107,10 @@ bool Session::addTorrent(QString source, const AddTorrentParams ¶ms)
|
|||
return true;
|
||||
}
|
||||
|
||||
const MagnetUri magnetUri {source};
|
||||
if (magnetUri.isValid())
|
||||
return addTorrent_impl(CreateTorrentParams(params), magnetUri);
|
||||
|
||||
TorrentFileGuard guard(source);
|
||||
if (addTorrent_impl(CreateTorrentParams(params)
|
||||
, MagnetUri(), TorrentInfo::loadFromFile(source))) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue