mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-02 13:48:05 -06:00
Use upstream defined namespace
`lt` namespace is defined since libtorrent 1.1.6 and our master branch requires >= 1.1.10, so there is no need to add #if condition for it.
This commit is contained in:
@@ -62,7 +62,6 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
namespace libt = libtorrent;
|
||||
using namespace BitTorrent;
|
||||
|
||||
TorrentCreatorThread::TorrentCreatorThread(QObject *parent)
|
||||
@@ -97,9 +96,9 @@ void TorrentCreatorThread::run()
|
||||
const QString parentPath = Utils::Fs::branchPath(m_params.inputPath) + '/';
|
||||
|
||||
// Adding files to the torrent
|
||||
libt::file_storage fs;
|
||||
lt::file_storage fs;
|
||||
if (QFileInfo(m_params.inputPath).isFile()) {
|
||||
libt::add_files(fs, Utils::Fs::toNativePath(m_params.inputPath).toStdString(), fileFilter);
|
||||
lt::add_files(fs, Utils::Fs::toNativePath(m_params.inputPath).toStdString(), fileFilter);
|
||||
}
|
||||
else {
|
||||
// need to sort the file names by natural sort order
|
||||
@@ -137,8 +136,8 @@ void TorrentCreatorThread::run()
|
||||
|
||||
if (isInterruptionRequested()) return;
|
||||
|
||||
libt::create_torrent newTorrent(fs, m_params.pieceSize, -1
|
||||
, (m_params.isAlignmentOptimized ? libt::create_torrent::optimize_alignment : CreateFlags {}));
|
||||
lt::create_torrent newTorrent(fs, m_params.pieceSize, -1
|
||||
, (m_params.isAlignmentOptimized ? lt::create_torrent::optimize_alignment : CreateFlags {}));
|
||||
|
||||
// Add url seeds
|
||||
for (QString seed : asConst(m_params.urlSeeds)) {
|
||||
@@ -158,7 +157,7 @@ void TorrentCreatorThread::run()
|
||||
if (isInterruptionRequested()) return;
|
||||
|
||||
// calculate the hash for all pieces
|
||||
libt::set_piece_hashes(newTorrent, Utils::Fs::toNativePath(parentPath).toStdString()
|
||||
lt::set_piece_hashes(newTorrent, Utils::Fs::toNativePath(parentPath).toStdString()
|
||||
, [this, &newTorrent](const int n) { sendProgressSignal(n, newTorrent.num_pieces()); });
|
||||
// Set qBittorrent as creator and add user comment to
|
||||
// torrent_info structure
|
||||
@@ -169,7 +168,7 @@ void TorrentCreatorThread::run()
|
||||
|
||||
if (isInterruptionRequested()) return;
|
||||
|
||||
libt::entry entry = newTorrent.generate();
|
||||
lt::entry entry = newTorrent.generate();
|
||||
|
||||
// add source field
|
||||
if (!m_params.source.isEmpty())
|
||||
@@ -190,7 +189,7 @@ void TorrentCreatorThread::run()
|
||||
|
||||
if (isInterruptionRequested()) return;
|
||||
|
||||
libt::bencode(std::ostream_iterator<char>(outfile), entry);
|
||||
lt::bencode(std::ostream_iterator<char>(outfile), entry);
|
||||
outfile.close();
|
||||
|
||||
emit updateProgress(100);
|
||||
@@ -206,9 +205,9 @@ int TorrentCreatorThread::calculateTotalPieces(const QString &inputPath, const i
|
||||
if (inputPath.isEmpty())
|
||||
return 0;
|
||||
|
||||
libt::file_storage fs;
|
||||
libt::add_files(fs, Utils::Fs::toNativePath(inputPath).toStdString(), fileFilter);
|
||||
lt::file_storage fs;
|
||||
lt::add_files(fs, Utils::Fs::toNativePath(inputPath).toStdString(), fileFilter);
|
||||
|
||||
return libt::create_torrent(fs, pieceSize, -1
|
||||
, (isAlignmentOptimized ? libt::create_torrent::optimize_alignment : CreateFlags {})).num_pieces();
|
||||
return lt::create_torrent(fs, pieceSize, -1
|
||||
, (isAlignmentOptimized ? lt::create_torrent::optimize_alignment : CreateFlags {})).num_pieces();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user