Calculate torrent pieces asynchronously

So the GUI won't hang when the calculation took a long time.
Note that it is not possible to cancel the calculation so it will always run until finish in the background.

Supersedes #23497.
PR #23584.
This commit is contained in:
Chocobo1
2025-12-13 14:22:20 +08:00
committed by GitHub
parent 7451552e6a
commit 5abf458e69
2 changed files with 80 additions and 17 deletions

View File

@@ -33,10 +33,15 @@
#include <QDialog>
#include <QThreadPool>
#include "base/bittorrent/torrentcreator.h"
#include "base/path.h"
#include "base/settingvalue.h"
namespace BitTorrent
{
enum class TorrentFormat;
struct TorrentCreatorResult;
}
namespace Ui
{
class TorrentCreatorDialog;
@@ -54,7 +59,7 @@ public:
private slots:
void updateProgressBar(int progress);
void updatePiecesCount();
void onCalculatePiecesButtonClicked();
void onCreateButtonClicked();
void onAddFileButtonClicked();
void onAddFolderButtonClicked();