libktorrent
2.2.0
|
Interface for an object which controls one torrent. More...
#include <torrentinterface.h>
Public Types | |
enum | ChangeOutputFlags { MOVE_FILES = 1, FULL_PATH = 2 } |
typedef QSharedPointer< TorrentInterface > | Ptr |
typedef QPointer< TorrentInterface > | WPtr |
Signals | |
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 | |
virtual void | addPeerSource (PeerSource *ps)=0 |
virtual bool | addWebSeed (const QUrl &url)=0 |
Add a webseed (return false, if there is already a webseed with the same url) | |
virtual bool | announceAllowed ()=0 |
Is manual announce allowed? | |
virtual const bt::BitSet & | availableChunksBitSet () const =0 |
virtual bool | changeOutputDir (const QString &new_dir, int flags)=0 |
virtual void | changeTextCodec (QTextCodec *tc)=0 |
Set the text codec. | |
virtual bool | changeTorDir (const QString &new_dir)=0 |
virtual bool | checkDiskSpace (bool emit_sig=true)=0 |
Check if there is enough diskspace available for this torrent. | |
virtual TorrentFileStream::Ptr | createTorrentFileStream (bt::Uint32 index, bool streaming_mode, QObject *parent)=0 |
virtual void | deleteDataFiles ()=0 |
virtual void | dndMissingFiles ()=0 |
virtual const bt::BitSet & | downloadedChunksBitSet () const =0 |
virtual const bt::BitSet & | excludedChunksBitSet () const =0 |
virtual void | getAssuredSpeeds (Uint32 &up, Uint32 &down)=0 |
Get the assured speeds. | |
virtual QString | getComments () const =0 |
Get the comments. | |
virtual QString | getDataDir () const =0 |
Get the data directory of this torrent. | |
virtual const DHTNode & | getDHTNode (Uint32 i) const =0 |
Get a DHT node. | |
QString | getDisplayName () const |
Gets the displayed name. | |
virtual int | getETA ()=0 |
virtual const bt::SHA1Hash & | getInfoHash () const =0 |
Get the info_hash. | |
virtual const JobQueue * | getJobQueue () const =0 |
Get the JobQueue of the torrent. | |
virtual float | getMaxSeedTime () const =0 |
Get the max seed time. | |
virtual float | getMaxShareRatio () const =0 |
Get the max share ratio. | |
virtual QString | getMoveWhenCompletedDir () const =0 |
virtual Uint32 | getNumDHTNodes () const =0 |
Get the number of initial DHT nodes. | |
virtual Uint32 | getNumFiles () const =0 |
Get the number of files in a multifile torrent (0 if we do not have a multifile torrent) | |
virtual Uint32 | getNumWebSeeds () const =0 |
Get the number of webseeds. | |
virtual const bt::PeerID & | getOwnPeerID () const =0 |
Get our PeerID. | |
virtual int | getPriority () const =0 |
Get the torrent queue number. Zero if not in queue. | |
virtual Uint32 | getRunningTimeDL () const =0 |
virtual Uint32 | getRunningTimeUL () const =0 |
const TorrentStats & | getStats () const |
Get the torrent's statistics. | |
virtual const QTextCodec * | getTextCodec () const =0 |
Get the text codec used in the torrent. | |
virtual QString | getTorDir () const =0 |
virtual const TorrentFileInterface & | getTorrentFile (Uint32 index) const =0 |
virtual TorrentFileInterface & | getTorrentFile (Uint32 index)=0 |
virtual const TrackersList * | getTrackersList () const =0 |
Get a pointer to TrackersList object. | |
virtual TrackersList * | getTrackersList ()=0 |
Get a pointer to TrackersList object. | |
virtual void | getTrafficLimits (Uint32 &up, Uint32 &down)=0 |
Get the traffic limits. | |
QString | getUserModifiedFileName () const |
Gets the user modified file or toplevel directory name. | |
virtual const WebSeedInterface * | getWebSeed (Uint32 i) const =0 |
Get a webseed (returns 0 if index is invalid) | |
virtual WebSeedInterface * | getWebSeed (Uint32 i)=0 |
Get a webseed (returns 0 if index is invalid) | |
virtual void | handleError (const QString &err)=0 |
Handle an error. | |
virtual bool | hasMissingFiles (QStringList &sl)=0 |
bool | isAllowedToStart () const |
virtual bool | isFeatureEnabled (TorrentFeature tf)=0 |
Is a feature enabled. | |
virtual bool | isMultimedia () const =0 |
See if this is a single file torrent and a multimedia files. | |
virtual bool | isStorageMounted (QStringList &missing)=0 |
QUrl | loadUrl () const |
Get the URL which the torrent was loaded from. | |
virtual void | markExistingFilesAsDownloaded ()=0 |
Mark all existing files as downloaded (. | |
virtual bool | moveTorrentFiles (const QMap< TorrentFileInterface *, QString > &files)=0 |
virtual void | networkUp ()=0 |
After some network down time, the network is back up. | |
virtual const bt::BitSet & | onlySeedChunksBitSet () const =0 |
virtual bool | overMaxRatio ()=0 |
Checks if a seeding torrent has reached its maximum share ratio. | |
virtual bool | overMaxSeedTime ()=0 |
Checks if a seeding torrent has reached it's max seed timery / will be ret. | |
virtual void | pause ()=0 |
virtual bool | readyForPreview () const =0 |
virtual void | recreateMissingFiles ()=0 |
virtual void | removePeerSource (PeerSource *ps)=0 |
virtual bool | removeWebSeed (const QUrl &url)=0 |
Remove a webseed (only user created ones can be removed) | |
virtual void | rollback ()=0 |
virtual void | scrapeTracker ()=0 |
virtual void | setAllowedToStart (bool on)=0 |
Set whether the QM can start a torrent. | |
virtual void | setAssuredSpeeds (Uint32 up, Uint32 down)=0 |
Set the assured speeds. | |
virtual void | setChunkSelector (ChunkSelectorInterface *csel)=0 |
Set the ChunkSelector to use (0 resets to the default ChunkSelector) | |
virtual void | setDisplayName (const QString &n)=0 |
Set the displayed name. | |
virtual void | setFeatureEnabled (TorrentFeature tf, bool on)=0 |
Disable or enable a feature. | |
void | setLoadUrl (const QUrl &u) |
Set the URL which the torrent was loaded from. | |
virtual void | setMaxSeedTime (float hours)=0 |
Set the max seed time in hours (0 is no limit) | |
virtual void | setMaxShareRatio (float ratio)=0 |
Set the max share ratio. | |
virtual void | setMonitor (MonitorInterface *tmo)=0 |
Set the monitor. | |
virtual void | setMoveWhenCompletedDir (const QString &dir)=0 |
virtual void | setPriority (int p)=0 |
Set the torrent queue number. | |
virtual void | setQueued (bool queued)=0 |
virtual void | setSuperSeeding (bool on)=0 |
virtual void | setTrafficLimits (Uint32 up, Uint32 down)=0 |
Set the traffic limits for this torrent. | |
virtual void | setUserModifiedFileName (const QString &n) |
Set the user modified file or toplevel directory name. | |
virtual void | start ()=0 |
virtual Job * | startDataCheck (bool auto_import, bt::Uint32 from, bt::Uint32 to)=0 |
virtual void | stop (bt::WaitJob *wjob=0)=0 |
virtual void | unpause ()=0 |
virtual void | update ()=0 |
virtual void | updateStatus ()=0 |
Update the status. | |
virtual void | updateTracker ()=0 |
Protected Attributes | |
QString | display_name |
TorrentStats | stats |
QUrl | url |
QString | user_modified_name |
This class is the interface for an object which controls the up- and download of one torrent.
Definition at line 89 of file torrentinterface.h.
|
signal |
Emitted just before the torrent is started, this should be used to do some checks on the files in the cache.
me | The torrent which emitted the signal |
ret | The return value |
|
pure virtual |
|
pure virtual |
Get a BitSet of the availability of all Chunks
Implemented in bt::TorrentControl.
|
pure virtual |
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 |
Implemented in bt::TorrentControl.
|
pure virtual |
Change to a new torX dir. If this fails we will fall back on the old directory.
new_dir | The new directory |
Implemented in bt::TorrentControl.
|
signal |
Emitted when a chunk is downloaded.
me | The torrent |
chunk | The chunk |
|
signal |
A corrupted chunk has been found during upload.
me | The torrent which emitted the signal |
|
pure virtual |
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 |
Implemented in bt::TorrentControl.
|
pure virtual |
Delete the data files of the torrent, they will be lost permanently
Implemented in bt::TorrentControl.
|
signal |
Disk is running out of space.
me | The torrent which emitted the signal |
toStop | should this torrent be stopped or not |
|
pure virtual |
Mark missing files as do not download.
Implemented in bt::TorrentControl.
|
pure virtual |
Get a BitSet of the status of all Chunks
Implemented in bt::TorrentControl.
|
pure virtual |
Get a BitSet of the excluded Chunks
Implemented in bt::TorrentControl.
|
signal |
Emitted when we have finished downloading.
me | The object who emitted the signal |
|
pure virtual |
Returns estimated time left for finishing download. Returned value is in seconds. Uses TimeEstimator class to calculate this value.
Implemented in bt::TorrentControl.
|
pure virtual |
Get the move upon completion directory.
Implemented in bt::TorrentControl.
|
pure virtual |
Get the download running time of this torrent in seconds
Implemented in bt::TorrentControl.
|
pure virtual |
Get the upload running time of this torrent in seconds
Implemented in bt::TorrentControl.
|
pure virtual |
Get the torX directory of this torrent. Temporary stuff like the index file get stored there.
Implemented in bt::TorrentControl.
|
pure virtual |
Const version of the previous one.
index | The index of the file |
Implemented in bt::TorrentControl.
|
pure virtual |
Get the index'th file of a multifile torrent
index | The index |
Implemented in bt::TorrentControl.
|
pure virtual |
Test all files and see if they are not missing. If so put them in a list
Implemented in bt::TorrentControl.
|
inline |
Can the torrent be started by the QM.
Definition at line 435 of file torrentinterface.h.
|
pure virtual |
Is storage mounted for this torrent
missing | Filled with missing mount points (if any) |
Implemented in bt::TorrentControl.
|
signal |
Emitted when maximum share ratio for this torrent is changed
me | The object which emitted the signal. |
|
signal |
Emitted when missing files have been marked as dnd. The intention of this signal is to update the GUI.
me | The torrent which emitted the signal |
|
pure virtual |
Move a torrent file to a new location.
files | Map of files and their new location |
Implemented in bt::TorrentControl.
|
signal |
Signal emitted when the torrent needs a data check
me | The torrent |
|
pure virtual |
Get a bitset of only seed chunks
Implemented in bt::TorrentControl.
|
pure virtual |
Pause the torrent.
|
pure virtual |
Checks if torrent is multimedial and chunks needed for preview are downloaded This only works for single file torrents
Implemented in bt::TorrentControl.
|
pure virtual |
Recreate missing files.
Implemented in bt::TorrentControl.
|
pure virtual |
|
pure virtual |
Roll back the previous changeDataDir call. Does nothing if there was no previous changeDataDir call.
Implemented in bt::TorrentControl.
|
signal |
Emitted when all running jobs are done.
me | the torrent |
|
pure virtual |
Scrape all or one tracker (private torrents)
|
signal |
Emitted then torrent is stopped from seeding by KTorrent. Happens when torrent has reached maximum share ratio and maybe we'll add something more...
me | The object which emitted the signal. |
reason | The reason why it was aut stopped |
|
pure virtual |
Get the move upon completion directory.
dir | the directory an empty url disables this feature |
Implemented in bt::TorrentControl.
|
pure virtual |
Set whether the torrent is queued or not
Implemented in bt::TorrentControl.
|
pure virtual |
Enable or disable superseeding mode, does nothing if the torrent is not finished.
Implemented in bt::TorrentControl.
|
pure virtual |
Start the download of the torrent.
|
pure virtual |
Verify the correctness of all data. If from and to are not a valid range, the entire torrent will be checked.
Implemented in bt::TorrentControl.
|
signal |
Emitted whenever the status of the torrent changes.
me | the torrent |
|
pure virtual |
Stop the download, closes all connections.
wjob | WaitJob, used when KT is shutting down, so that we can wait for all stopped events to reach the tracker |
|
signal |
|
signal |
Torrent has been stopped
me | The torrent which emitted the signal |
|
pure virtual |
Unpause the torrent.
|
pure virtual |
Update the object, should be called periodically.
|
signal |
Emitted when the torrent thinks the QM should update the queue
|
pure virtual |
Update the tracker, this should normally handled internally. We leave it public so that the user can do a manual announce.