mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-05 15:12:32 -06:00
[TorrentCreator] Show number of pieces. Closes #6774.
This commit is contained in:
@@ -160,3 +160,13 @@ void TorrentCreatorThread::run()
|
||||
emit creationFailure(QString::fromStdString(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
int TorrentCreatorThread::calculateTotalPieces(const QString &inputPath, const int pieceSize)
|
||||
{
|
||||
if (inputPath.isEmpty())
|
||||
return 0;
|
||||
|
||||
libt::file_storage fs;
|
||||
libt::add_files(fs, Utils::Fs::toNativePath(inputPath).toStdString(), fileFilter);
|
||||
return libt::create_torrent(fs, pieceSize).num_pieces();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user