mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 05:08:05 -06:00
Merge pull request #6842 from Chocobo1/countPieces
[TorrentCreator] Show total 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();
|
||||
}
|
||||
|
||||
@@ -47,6 +47,8 @@ namespace BitTorrent
|
||||
void create(const QString &inputPath, const QString &savePath, const QStringList &trackers,
|
||||
const QStringList &urlSeeds, const QString &comment, bool isPrivate, int pieceSize);
|
||||
|
||||
static int calculateTotalPieces(const QString &inputPath, const int pieceSize);
|
||||
|
||||
protected:
|
||||
void run();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user