mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-03 14:12:30 -06:00
Cleanup code
Also remove redundant code, it is already handled correctly in subsequent function calls.
This commit is contained in:
@@ -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))) {
|
||||
|
||||
@@ -469,7 +469,7 @@ namespace BitTorrent
|
||||
void banIP(const QString &ip);
|
||||
|
||||
bool isKnownTorrent(const InfoHash &hash) const;
|
||||
bool addTorrent(QString source, const AddTorrentParams ¶ms = AddTorrentParams());
|
||||
bool addTorrent(const QString &source, const AddTorrentParams ¶ms = AddTorrentParams());
|
||||
bool addTorrent(const TorrentInfo &torrentInfo, const AddTorrentParams ¶ms = AddTorrentParams());
|
||||
bool deleteTorrent(const QString &hash, bool deleteLocalFiles = false);
|
||||
bool loadMetadata(const MagnetUri &magnetUri);
|
||||
|
||||
Reference in New Issue
Block a user