Use QThreadPool for torrent creation

The change is in preparation for adding the possibility to create
torrent files via the API.

Rework TorrentCreatorThread to be a more lightweight QRunnable class.
The parameters are now defined on construction time and are fixed
throughout the lifecycle of the TorrentCreator. The lifecycle of the
object is not bound to the one of QDialog anymore; it is now handled
by the QThreadPool. This will enable easier queueing of multiple torrent
creation jobs without risk of spawning many threads.

PR #19500.
This commit is contained in:
rcarpa
2023-08-26 18:27:11 +02:00
committed by GitHub
parent 9ab8203c8a
commit bbac94cc95
5 changed files with 50 additions and 40 deletions

View File

@@ -35,7 +35,7 @@ add_library(qbt_base STATIC
bittorrent/torrent.h
bittorrent/torrentcontenthandler.h
bittorrent/torrentcontentlayout.h
bittorrent/torrentcreatorthread.h
bittorrent/torrentcreator.h
bittorrent/torrentdescriptor.h
bittorrent/torrentimpl.h
bittorrent/torrentinfo.h
@@ -132,7 +132,7 @@ add_library(qbt_base STATIC
bittorrent/speedmonitor.cpp
bittorrent/torrent.cpp
bittorrent/torrentcontenthandler.cpp
bittorrent/torrentcreatorthread.cpp
bittorrent/torrentcreator.cpp
bittorrent/torrentdescriptor.cpp
bittorrent/torrentimpl.cpp
bittorrent/torrentinfo.cpp