mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 01:33:07 -07:00
Refactor code
Make the code slightly easier to read.
This commit is contained in:
parent
9bd8587c68
commit
a68cdc5225
2 changed files with 5 additions and 12 deletions
|
@ -2122,17 +2122,12 @@ bool Session::addTorrent_impl(CreateTorrentParams params, const MagnetUri &magne
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If empty then Automatic mode, otherwise Manual mode
|
||||||
|
QString savePath = params.savePath.isEmpty() ? categorySavePath(params.category) : params.savePath;
|
||||||
libt::add_torrent_params p;
|
libt::add_torrent_params p;
|
||||||
InfoHash hash;
|
InfoHash hash;
|
||||||
std::vector<boost::uint8_t> filePriorities;
|
const bool fromMagnetUri = magnetUri.isValid();
|
||||||
|
|
||||||
QString savePath;
|
|
||||||
if (params.savePath.isEmpty()) // using Automatic mode
|
|
||||||
savePath = categorySavePath(params.category);
|
|
||||||
else // using Manual mode
|
|
||||||
savePath = params.savePath;
|
|
||||||
|
|
||||||
bool fromMagnetUri = magnetUri.isValid();
|
|
||||||
if (fromMagnetUri) {
|
if (fromMagnetUri) {
|
||||||
hash = magnetUri.hash();
|
hash = magnetUri.hash();
|
||||||
|
|
||||||
|
@ -2195,9 +2190,7 @@ bool Session::addTorrent_impl(CreateTorrentParams params, const MagnetUri &magne
|
||||||
p.flags |= libt::add_torrent_params::flag_use_resume_save_path;
|
p.flags |= libt::add_torrent_params::flag_use_resume_save_path;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
foreach (int prio, params.filePriorities)
|
p.file_priorities = {params.filePriorities.begin(), params.filePriorities.end()};
|
||||||
filePriorities.push_back(prio);
|
|
||||||
p.file_priorities = filePriorities;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We should not add torrent if it already
|
// We should not add torrent if it already
|
||||||
|
|
|
@ -1991,7 +1991,7 @@ void TorrentHandle::prioritizeFiles(const QVector<int> &priorities)
|
||||||
if (priorities.size() != filesCount()) return;
|
if (priorities.size() != filesCount()) return;
|
||||||
|
|
||||||
// Save first/last piece first option state
|
// Save first/last piece first option state
|
||||||
bool firstLastPieceFirst = hasFirstLastPiecePriority();
|
const bool firstLastPieceFirst = hasFirstLastPiecePriority();
|
||||||
|
|
||||||
// Reset 'm_hasSeedStatus' if needed in order to react again to
|
// Reset 'm_hasSeedStatus' if needed in order to react again to
|
||||||
// 'torrent_finished_alert' and eg show tray notifications
|
// 'torrent_finished_alert' and eg show tray notifications
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue