libktorrent
2.1.1
|
Controls just about everything. More...
#include <torrentcontrol.h>
Public Slots | |
void | pause () override |
void | scrapeTracker () override |
static void | setDataCheckWhenCompleted (bool on) |
static void | setMinimumDiskSpace (Uint32 m) |
void | start () override |
void | stop (WaitJob *wjob=0) override |
void | trackerScrapeDone () |
void | unpause () override |
void | update () override |
void | updateTracker () override |
Signals | |
void | dataCheckFinished () |
![]() | |
void | aboutToBeStarted (bt::TorrentInterface *me, bool &ret) |
void | chunkDownloaded (bt::TorrentInterface *me, bt::Uint32 chunk) |
void | corruptedDataFound (bt::TorrentInterface *me) |
void | diskSpaceLow (bt::TorrentInterface *me, bool toStop) |
void | finished (bt::TorrentInterface *me) |
void | maxRatioChanged (bt::TorrentInterface *me) |
void | missingFilesMarkedDND (bt::TorrentInterface *me) |
void | needDataCheck (bt::TorrentInterface *me) |
void | runningJobsDone (bt::TorrentInterface *me) |
void | seedingAutoStopped (bt::TorrentInterface *me, bt::AutoStopReason reason) |
void | statusChanged (bt::TorrentInterface *me) |
void | stoppedByError (bt::TorrentInterface *me, QString msg) |
void | torrentStopped (bt::TorrentInterface *me) |
void | updateQueue () |
Public Member Functions | |
void | addPeerSource (PeerSource *ps) override |
bool | addWebSeed (const QUrl &url) override |
Add a webseed (return false, if there is already a webseed with the same url) | |
bool | announceAllowed () override |
Is manual announce allowed? | |
const BitSet & | availableChunksBitSet () const override |
bool | changeOutputDir (const QString &new_dir, int flags) override |
void | changeTextCodec (QTextCodec *tc) override |
Set the text codec. | |
bool | changeTorDir (const QString &new_dir) override |
bool | checkDiskSpace (bool emit_sig=true) override |
Check if there is enough diskspace available for this torrent. | |
void | createFiles () |
Create all the necessary files. | |
TorrentFileStream::Ptr | createTorrentFileStream (bt::Uint32 index, bool streaming_mode, QObject *parent) override |
void | deleteDataFiles () override |
void | dndMissingFiles () override |
const BitSet & | downloadedChunksBitSet () const override |
const BitSet & | excludedChunksBitSet () const override |
void | getAssuredSpeeds (Uint32 &up, Uint32 &down) override |
Get the assured speeds. | |
QString | getComments () const override |
Get the comments. | |
QString | getDataDir () const override |
Get the data directory of this torrent. | |
const DHTNode & | getDHTNode (Uint32 i) const override |
Get a DHT node. | |
int | getETA () override |
const SHA1Hash & | getInfoHash () const override |
Get the info_hash. | |
const JobQueue * | getJobQueue () const override |
Get the JobQueue of the torrent. | |
float | getMaxSeedTime () const override |
Get the max seed time. | |
float | getMaxShareRatio () const override |
Get the max share ratio. | |
QString | getMoveWhenCompletedDir () const override |
Uint32 | getNumDHTNodes () const override |
Get the number of initial DHT nodes. | |
Uint32 | getNumFiles () const override |
Get the number of files in a multifile torrent (0 if we do not have a multifile torrent) | |
Uint32 | getNumWebSeeds () const override |
Get the number of webseeds. | |
const bt::PeerID & | getOwnPeerID () const override |
Get our PeerID. | |
const PeerManager * | getPeerMgr () const |
Get the PeerManager. | |
int | getPriority () const override |
Get the torrent queue number. Zero if not in queue. | |
Uint32 | getRunningTimeDL () const override |
Uint32 | getRunningTimeUL () const override |
const QTextCodec * | getTextCodec () const override |
Get the text codec used in the torrent. | |
QString | getTorDir () const override |
const Torrent & | getTorrent () const |
Get the Torrent. | |
const TorrentFileInterface & | getTorrentFile (Uint32 index) const override |
TorrentFileInterface & | getTorrentFile (Uint32 index) override |
const TrackersList * | getTrackersList () const override |
Get a pointer to TrackersList object. | |
TrackersList * | getTrackersList () override |
Get a pointer to TrackersList object. | |
void | getTrafficLimits (Uint32 &up, Uint32 &down) override |
Get the traffic limits. | |
const WebSeedInterface * | getWebSeed (Uint32 i) const override |
Get a webseed (returns 0 if index is invalid) | |
WebSeedInterface * | getWebSeed (Uint32 i) override |
Get a webseed (returns 0 if index is invalid) | |
bool | hasExistingFiles () const |
Test if the torrent has existing files, only works the first time a torrent is loaded. | |
bool | hasMissingFiles (QStringList &sl) override |
void | init (QueueManagerInterface *qman, const QByteArray &data, const QString &tmpdir, const QString &datadir) |
bool | isFeatureEnabled (TorrentFeature tf) override |
Is a feature enabled. | |
bool | isMultimedia () const override |
See if this is a single file torrent and a multimedia files. | |
bool | isStorageMounted (QStringList &missing) override |
void | markExistingFilesAsDownloaded () override |
Mark all existing files as downloaded (. | |
bool | moveTorrentFiles (const QMap< TorrentFileInterface *, QString > &files) override |
void | networkUp () override |
After some network down time, the network is back up. | |
const BitSet & | onlySeedChunksBitSet () const override |
bool | overMaxRatio () override |
Checks if a seeding torrent has reached its maximum share ratio. | |
bool | overMaxSeedTime () override |
Checks if a seeding torrent has reached it's max seed timery / will be ret. | |
bool | readyForPreview () const override |
void | recreateMissingFiles () override |
void | removePeerSource (PeerSource *ps) override |
bool | removeWebSeed (const QUrl &url) override |
Remove a webseed (only user created ones can be removed) | |
void | rollback () override |
void | setAllowedToStart (bool on) override |
Set whether the QM can start a torrent. | |
void | setAssuredSpeeds (Uint32 up, Uint32 down) override |
Set the assured speeds. | |
void | setCacheFactory (CacheFactory *cf) |
Set a custom Cache factory. | |
void | setChunkSelector (ChunkSelectorInterface *csel) override |
Set the ChunkSelector to use (0 resets to the default ChunkSelector) | |
void | setChunkSelectorFactory (ChunkSelectorFactoryInterface *csfi) |
void | setDisplayName (const QString &n) override |
Set the displayed name. | |
void | setFeatureEnabled (TorrentFeature tf, bool on) override |
Disable or enable a feature. | |
void | setMaxSeedTime (float hours) override |
Set the max seed time in hours (0 is no limit) | |
void | setMaxShareRatio (float ratio) override |
Set the max share ratio. | |
void | setMonitor (MonitorInterface *tmo) override |
Set the monitor. | |
void | setMoveWhenCompletedDir (const QString &dir) override |
void | setPreallocateDiskSpace (bool pa) |
Tell the TorrentControl obj to preallocate diskspace in the next update. | |
void | setPriority (int p) override |
Set the torrent queue number. | |
void | setQueued (bool queued) override |
void | setSuperSeeding (bool on) override |
void | setTrafficLimits (Uint32 up, Uint32 down) override |
Set the traffic limits for this torrent. | |
void | setUserModifiedFileName (const QString &n) override |
Set the user modified file or toplevel directory name. | |
Job * | startDataCheck (bool auto_import, bt::Uint32 from, bt::Uint32 to) override |
![]() | |
QString | getDisplayName () const |
Gets the displayed name. | |
const TorrentStats & | getStats () const |
Get the torrent's statistics. | |
QString | getUserModifiedFileName () const |
Gets the user modified file or toplevel directory name. | |
bool | isAllowedToStart () const |
QUrl | loadUrl () const |
Get the URL which the torrent was loaded from. | |
virtual void | pause ()=0 |
virtual void | scrapeTracker ()=0 |
void | setLoadUrl (const QUrl &u) |
Set the URL which the torrent was loaded from. | |
virtual void | start ()=0 |
virtual void | stop (bt::WaitJob *wjob=0)=0 |
virtual void | unpause ()=0 |
virtual void | update ()=0 |
virtual void | updateTracker ()=0 |
Protected Member Functions | |
void | afterDataCheck (DataCheckerJob *job, const BitSet &result) |
Called when a data check is finished by DataCheckerJob. | |
void | allJobsDone () |
void | beforeDataCheck () |
bool | preallocate () |
void | preallocFinished (const QString &error, bool completed) |
Friends | |
class | DataCheckerJob |
class | JobQueue |
class | PreallocationJob |
Additional Inherited Members | |
![]() | |
enum | ChangeOutputFlags { MOVE_FILES = 1, FULL_PATH = 2 } |
typedef QSharedPointer< TorrentInterface > | Ptr |
typedef QPointer< TorrentInterface > | WPtr |
![]() | |
QString | display_name |
TorrentStats | stats |
QUrl | url |
QString | user_modified_name |
Definition at line 68 of file torrentcontrol.h.
|
overridevirtual |
|
overridevirtual |
Get a BitSet of the availability of all Chunks
Implements bt::TorrentInterface.
|
overridevirtual |
Change to a new data dir. If this fails we will fall back on the old directory.
new_dir | The new directory |
flags | The OR of ChangeOutputFlags |
Implements bt::TorrentInterface.
|
overridevirtual |
Change to a new torX dir. If this fails we will fall back on the old directory.
new_dir | The new directory |
Implements bt::TorrentInterface.
|
overridevirtual |
Create a TorrentFileStream object. If the torrent is destroyed this object must also be destroyed.
index | Index of the file (in case of a single file torrent, this does not matter) |
streaming_mode | Set to true if this needs to be streamed (note that only one streaming_mode per torrent is allowed) |
parent | Parent of the TorrentFileStream |
Implements bt::TorrentInterface.
|
overridevirtual |
Delete the data files of the torrent, they will be lost permanently
Implements bt::TorrentInterface.
|
overridevirtual |
Mark missing files as do not download.
Implements bt::TorrentInterface.
|
overridevirtual |
Get a BitSet of the status of all Chunks
Implements bt::TorrentInterface.
|
overridevirtual |
Get a BitSet of the excluded Chunks
Implements bt::TorrentInterface.
|
overridevirtual |
Returns estimated time left for finishing download. Returned value is in seconds. Uses TimeEstimator class to calculate this value.
Implements bt::TorrentInterface.
|
inlineoverridevirtual |
Get the move upon completion directory.
Implements bt::TorrentInterface.
Definition at line 166 of file torrentcontrol.h.
|
overridevirtual |
Get the download running time of this torrent in seconds
Implements bt::TorrentInterface.
|
overridevirtual |
Get the upload running time of this torrent in seconds
Implements bt::TorrentInterface.
|
inlineoverridevirtual |
Get the torX directory of this torrent. Temporary stuff like the index file get stored there.
Implements bt::TorrentInterface.
Definition at line 110 of file torrentcontrol.h.
|
overridevirtual |
Const version of the previous one.
index | The index of the file |
Implements bt::TorrentInterface.
|
overridevirtual |
Get the index'th file of a multifile torrent
index | The index |
Implements bt::TorrentInterface.
|
overridevirtual |
Test all files and see if they are not missing. If so put them in a list
Implements bt::TorrentInterface.
void bt::TorrentControl::init | ( | QueueManagerInterface * | qman, |
const QByteArray & | data, | ||
const QString & | tmpdir, | ||
const QString & | datadir | ||
) |
Initialize the TorrentControl.
qman | The QueueManager |
data | The data of the torrent |
tmpdir | The directory to store temporary data |
datadir | The directory to store the actual file(s) (only used the first time we load a torrent) |
Error | when something goes wrong |
|
overridevirtual |
Is storage mounted for this torrent
missing | Filled with missing mount points (if any) |
Implements bt::TorrentInterface.
|
overridevirtual |
Move a torrent file to a new location.
files | Map of files and their new location |
Implements bt::TorrentInterface.
|
overridevirtual |
Get a bitset of only seed chunks
Implements bt::TorrentInterface.
|
overrideslot |
Pause the torrent.
|
overridevirtual |
Checks if torrent is multimedial and chunks needed for preview are downloaded This only works for single file torrents
Implements bt::TorrentInterface.
|
overridevirtual |
Recreate missing files.
Implements bt::TorrentInterface.
|
overridevirtual |
|
overridevirtual |
Roll back the previous changeDataDir call. Does nothing if there was no previous changeDataDir call.
Implements bt::TorrentInterface.
|
overrideslot |
Scrape the tracker.
void bt::TorrentControl::setChunkSelectorFactory | ( | ChunkSelectorFactoryInterface * | csfi | ) |
Set a custom chunk selector factory (needs to be done for init is called) Note: TorrentControl does not take ownership
|
inlinestaticslot |
Enable or disable data check upon completion
on |
Definition at line 231 of file torrentcontrol.h.
|
inlinestaticslot |
Set the minimum amount of diskspace in MB. When there is less then this free, torrents will be stopped.
m |
Definition at line 237 of file torrentcontrol.h.
|
inlineoverridevirtual |
Get the move upon completion directory.
dir | the directory an empty url disables this feature |
Implements bt::TorrentInterface.
Definition at line 165 of file torrentcontrol.h.
|
overridevirtual |
Set whether the torrent is queued or not
Implements bt::TorrentInterface.
|
overridevirtual |
Enable or disable superseeding mode, does nothing if the torrent is not finished.
Implements bt::TorrentInterface.
|
overrideslot |
Start the download of the torrent.
|
overridevirtual |
Verify the correctness of all data. If from and to are not a valid range, the entire torrent will be checked.
Implements bt::TorrentInterface.
|
overrideslot |
Stop the download, closes all connections.
wjob | WaitJob to wait at exit for the completion of stopped requests |
|
slot |
A scrape has finished on the tracker.
|
overrideslot |
Unpause the torrent.
|
overrideslot |
Update the object, should be called periodically.
|
overrideslot |
Update the tracker, this should normally handled internally. We leave it public so that the user can do a manual announce.