• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdenetwork
  • Sitemap
  • Contact Us
 

kget

bt::TorrentInterface

bt::TorrentInterface Class Reference

#include <torrentinterface.h>

Inheritance diagram for bt::TorrentInterface:

Inheritance graph
[legend]

List of all members.


Detailed Description

Author:
Joris Guisson

Interface for an object which controls one torrent

This class is the interface for an object which controls the up- and download of one torrent.

Definition at line 187 of file torrentinterface.h.


Public Types

enum  ChangeOutputFlags { MOVE_FILES = 1, FULL_PATH = 2 }

Signals

void aboutToBeStarted (bt::TorrentInterface *me, bool &ret)
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 seedingAutoStopped (bt::TorrentInterface *me, bt::AutoStopReason reason)
void statusChanged (bt::TorrentInterface *me)
void stoppedByError (bt::TorrentInterface *me, QString msg)
void torrentStopped (bt::TorrentInterface *me)

Public Member Functions

virtual void addPeerSource (PeerSource *ps)=0
virtual bool addWebSeed (const KUrl &url)=0
virtual bool announceAllowed ()=0
virtual const bt::BitSet & availableChunksBitSet () const =0
virtual bool changeOutputDir (const QString &new_dir, int flags)=0
virtual void changeTextCodec (QTextCodec *tc)=0
virtual bool changeTorDir (const QString &new_dir)=0
virtual bool checkDiskSpace (bool emit_sig=true)=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
virtual QString getDataDir () const =0
virtual const DHTNode & getDHTNode (Uint32 i) const =0
virtual int getETA ()=0
virtual const bt::SHA1Hash & getInfoHash () const =0
virtual float getMaxSeedTime () const =0
virtual float getMaxShareRatio () const =0
virtual Uint32 getNumDHTNodes () const =0
virtual Uint32 getNumFiles () const =0
virtual Uint32 getNumWebSeeds () const =0
virtual const bt::PeerID & getOwnPeerID () const =0
virtual int getPriority () const =0
virtual Uint32 getRunningTimeDL () const =0
virtual Uint32 getRunningTimeUL () const =0
virtual QString getShortErrorMessage () const =0
const TorrentStats & getStats () const
virtual const QTextCodec * getTextCodec () const =0
virtual Uint32 getTimeToNextTrackerUpdate () const =0
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
virtual TrackersList * getTrackersList ()=0
virtual void getTrafficLimits (Uint32 &up, Uint32 &down)=0
virtual const WebSeedInterface * getWebSeed (Uint32 i) const =0
virtual void handleError (const QString &err)=0
virtual bool hasMissingFiles (QStringList &sl)=0
virtual bool isCheckingData (bool &finished) const =0
virtual bool isFeatureEnabled (TorrentFeature tf)=0
virtual bool isMovingFiles () const =0
virtual bool isMultimedia () const =0
virtual void markExistingFilesAsDownloaded ()=0
virtual bool moveTorrentFiles (const QMap< TorrentFileInterface *, QString > &files)=0
virtual const bt::BitSet & onlySeedChunksBitSet () const =0
virtual bool overMaxRatio ()=0
virtual bool overMaxSeedTime ()=0
virtual bool readyForPreview () const =0
virtual void recreateMissingFiles ()=0
virtual void removePeerSource (PeerSource *ps)=0
virtual bool removeWebSeed (const KUrl &url)=0
virtual void rollback ()=0
virtual void scrapeTracker ()=0
virtual void setAssuredSpeeds (Uint32 up, Uint32 down)=0
virtual void setFeatureEnabled (TorrentFeature tf, bool on)=0
virtual void setMaxSeedTime (float hours)=0
virtual void setMaxShareRatio (float ratio)=0
virtual void setMonitor (MonitorInterface *tmo)=0
virtual void setPriority (int p)=0
virtual void setTrafficLimits (Uint32 up, Uint32 down)=0
virtual void start ()=0
virtual void startDataCheck (bt::DataCheckerListener *lst)=0
virtual QString statusToString () const =0
virtual void stop (bool user, bt::WaitJob *wjob=0)=0
 TorrentInterface ()
virtual void update ()=0
virtual bool updateNeeded () const =0
virtual void updateTracker ()=0
virtual ~TorrentInterface ()

Protected Attributes

TorrentStats stats

Member Enumeration Documentation

enum bt::TorrentInterface::ChangeOutputFlags

Enumerator:
MOVE_FILES 
FULL_PATH 

Definition at line 268 of file torrentinterface.h.


Constructor & Destructor Documentation

bt::TorrentInterface::TorrentInterface (  ) 

Definition at line 34 of file torrentinterface.cpp.

bt::TorrentInterface::~TorrentInterface (  )  [virtual]

Definition at line 38 of file torrentinterface.cpp.


Member Function Documentation

void bt::TorrentInterface::aboutToBeStarted ( bt::TorrentInterface *  me,
bool &  ret 
) [signal]

Emitted just before the torrent is started, this should be used to do some checks on the files in the cache.

Parameters:
me The torrent which emitted the signal
ret The return value

virtual void bt::TorrentInterface::addPeerSource ( PeerSource *  ps  )  [pure virtual]

Add a new PeerSource.

Parameters:
ps 

Implemented in bt::TorrentControl.

virtual bool bt::TorrentInterface::addWebSeed ( const KUrl &  url  )  [pure virtual]

Add a webseed (return false, if there is already a webseed with the same url).

Implemented in bt::TorrentControl.

virtual bool bt::TorrentInterface::announceAllowed (  )  [pure virtual]

Is manual announce allowed?

Implemented in bt::TorrentControl.

virtual const bt::BitSet& bt::TorrentInterface::availableChunksBitSet (  )  const [pure virtual]

Get a BitSet of the availability of all Chunks.

Implemented in bt::TorrentControl.

virtual bool bt::TorrentInterface::changeOutputDir ( const QString &  new_dir,
int  flags 
) [pure virtual]

Change to a new data dir.

If this fails we will fall back on the old directory.

Parameters:
new_dir The new directory
flags The OR of ChangeOutputFlags
Returns:
true upon succes

Implemented in bt::TorrentControl.

virtual void bt::TorrentInterface::changeTextCodec ( QTextCodec *  tc  )  [pure virtual]

Set the text codec.

Implemented in bt::TorrentControl.

virtual bool bt::TorrentInterface::changeTorDir ( const QString &  new_dir  )  [pure virtual]

Change to a new torX dir.

If this fails we will fall back on the old directory.

Parameters:
new_dir The new directory
Returns:
true upon succes

Implemented in bt::TorrentControl.

virtual bool bt::TorrentInterface::checkDiskSpace ( bool  emit_sig = true  )  [pure virtual]

Check if there is enough diskspace available for this torrent.

Implemented in bt::TorrentControl.

void bt::TorrentInterface::corruptedDataFound ( bt::TorrentInterface *  me  )  [signal]

A corrupted chunk has been found during upload.

Parameters:
me The torrent which emitted the signal

virtual void bt::TorrentInterface::deleteDataFiles (  )  [pure virtual]

Delete the data files of the torrent, they will be lost permanently.

Implemented in bt::TorrentControl.

void bt::TorrentInterface::diskSpaceLow ( bt::TorrentInterface *  me,
bool  toStop 
) [signal]

Disk is running out of space.

Parameters:
me The torrent which emitted the signal
toStop should this torrent be stopped or not

virtual void bt::TorrentInterface::dndMissingFiles (  )  [pure virtual]

Mark missing files as do not download.

Implemented in bt::TorrentControl.

virtual const bt::BitSet& bt::TorrentInterface::downloadedChunksBitSet (  )  const [pure virtual]

Get a BitSet of the status of all Chunks.

Implemented in bt::TorrentControl.

virtual const bt::BitSet& bt::TorrentInterface::excludedChunksBitSet (  )  const [pure virtual]

Get a BitSet of the excluded Chunks.

Implemented in bt::TorrentControl.

void bt::TorrentInterface::finished ( bt::TorrentInterface *  me  )  [signal]

Emitted when we have finished downloading.

Parameters:
me The object who emitted the signal

virtual void bt::TorrentInterface::getAssuredSpeeds ( Uint32 &  up,
Uint32 &  down 
) [pure virtual]

Get the assured speeds.

virtual QString bt::TorrentInterface::getDataDir (  )  const [pure virtual]

Get the data directory of this torrent.

Implemented in bt::TorrentControl.

virtual const DHTNode& bt::TorrentInterface::getDHTNode ( Uint32  i  )  const [pure virtual]

Get a DHT node.

virtual int bt::TorrentInterface::getETA (  )  [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.

virtual const bt::SHA1Hash& bt::TorrentInterface::getInfoHash (  )  const [pure virtual]

Get the info_hash.

Implemented in bt::TorrentControl.

virtual float bt::TorrentInterface::getMaxSeedTime (  )  const [pure virtual]

Get the max seed time.

Implemented in bt::TorrentControl.

virtual float bt::TorrentInterface::getMaxShareRatio (  )  const [pure virtual]

Get the max share ratio.

Implemented in bt::TorrentControl.

virtual Uint32 bt::TorrentInterface::getNumDHTNodes (  )  const [pure virtual]

Get the number of initial DHT nodes.

Implemented in bt::TorrentControl.

virtual Uint32 bt::TorrentInterface::getNumFiles (  )  const [pure virtual]

Get the number of files in a multifile torrent (0 if we do not have a multifile torrent).

Implemented in bt::TorrentControl.

virtual Uint32 bt::TorrentInterface::getNumWebSeeds (  )  const [pure virtual]

Get the number of webseeds.

Implemented in bt::TorrentControl.

virtual const bt::PeerID& bt::TorrentInterface::getOwnPeerID (  )  const [pure virtual]

Get our PeerID.

Implemented in bt::TorrentControl.

virtual int bt::TorrentInterface::getPriority (  )  const [pure virtual]

Get the torrent queue number. Zero if not in queue.

Implemented in bt::TorrentControl.

virtual Uint32 bt::TorrentInterface::getRunningTimeDL (  )  const [pure virtual]

Get the download running time of this torrent in seconds.

Returns:
Uint32 - time in seconds

Implemented in bt::TorrentControl.

virtual Uint32 bt::TorrentInterface::getRunningTimeUL (  )  const [pure virtual]

Get the upload running time of this torrent in seconds.

Returns:
Uint32 - time in seconds

Implemented in bt::TorrentControl.

virtual QString bt::TorrentInterface::getShortErrorMessage (  )  const [pure virtual]

Get a short error message.

Implemented in bt::TorrentControl.

const TorrentStats& bt::TorrentInterface::getStats (  )  const [inline]

Get the torrent's statistics.

Definition at line 224 of file torrentinterface.h.

virtual const QTextCodec* bt::TorrentInterface::getTextCodec (  )  const [pure virtual]

Get the text codec used in the torrent.

Implemented in bt::TorrentControl.

virtual Uint32 bt::TorrentInterface::getTimeToNextTrackerUpdate (  )  const [pure virtual]

Get the time to the next tracker update in seconds.

Implemented in bt::TorrentControl.

virtual QString bt::TorrentInterface::getTorDir (  )  const [pure virtual]

Get the torX directory of this torrent.

Temporary stuff like the index file get stored there.

Implemented in bt::TorrentControl.

virtual const TorrentFileInterface& bt::TorrentInterface::getTorrentFile ( Uint32  index  )  const [pure virtual]

Const version of the previous one.

Parameters:
index The index of the file
Returns:
The TorrentFileInterface (isNull() will be true in case of error)

virtual TorrentFileInterface& bt::TorrentInterface::getTorrentFile ( Uint32  index  )  [pure virtual]

Get the index'th file of a multifile torrent.

Parameters:
index The index
Returns:
The TorrentFileInterface (isNull() will be true in case of error)

virtual const TrackersList* bt::TorrentInterface::getTrackersList (  )  const [pure virtual]

Get a pointer to TrackersList object.

Implemented in bt::TorrentControl.

virtual TrackersList* bt::TorrentInterface::getTrackersList (  )  [pure virtual]

Get a pointer to TrackersList object.

Implemented in bt::TorrentControl.

virtual void bt::TorrentInterface::getTrafficLimits ( Uint32 &  up,
Uint32 &  down 
) [pure virtual]

Get the traffic limits.

virtual const WebSeedInterface* bt::TorrentInterface::getWebSeed ( Uint32  i  )  const [pure virtual]

Get a webseed (returns 0 if index is invalid).

virtual void bt::TorrentInterface::handleError ( const QString &  err  )  [pure virtual]

Handle an error.

virtual bool bt::TorrentInterface::hasMissingFiles ( QStringList &  sl  )  [pure virtual]

Test all files and see if they are not missing.

If so put them in a list

Implemented in bt::TorrentControl.

virtual bool bt::TorrentInterface::isCheckingData ( bool &  finished  )  const [pure virtual]

Are we doing a data check on this torrent.

Parameters:
finished This will be set to true if the data check is finished

virtual bool bt::TorrentInterface::isFeatureEnabled ( TorrentFeature  tf  )  [pure virtual]

Is a feature enabled.

Implemented in bt::TorrentControl.

virtual bool bt::TorrentInterface::isMovingFiles (  )  const [pure virtual]

Are we in the process of moving files.

Implemented in bt::TorrentControl.

virtual bool bt::TorrentInterface::isMultimedia (  )  const [pure virtual]

See if this is a single file torrent and a multimedia files.

Implemented in bt::TorrentControl.

virtual void bt::TorrentInterface::markExistingFilesAsDownloaded (  )  [pure virtual]

Mark all existing files as downloaded (.

Implemented in bt::TorrentControl.

void bt::TorrentInterface::maxRatioChanged ( bt::TorrentInterface *  me  )  [signal]

Emitted when maximum share ratio for this torrent is changed.

Parameters:
me The object which emitted the signal.

void bt::TorrentInterface::missingFilesMarkedDND ( bt::TorrentInterface *  me  )  [signal]

Emitted when missing files have been marked as dnd.

The intention of this signal is to update the GUI.

Parameters:
me The torrent which emitted the signal

virtual bool bt::TorrentInterface::moveTorrentFiles ( const QMap< TorrentFileInterface *, QString > &  files  )  [pure virtual]

Move a torrent file to a new location.

Parameters:
files Map of files and their new location
Returns:
true upon success

Implemented in bt::TorrentControl.

void bt::TorrentInterface::needDataCheck ( bt::TorrentInterface *  me  )  [signal]

Signal emitted when the torrent needs a data check.

Parameters:
me The torrent

virtual const bt::BitSet& bt::TorrentInterface::onlySeedChunksBitSet (  )  const [pure virtual]

Get a bitset of only seed chunks.

Implemented in bt::TorrentControl.

virtual bool bt::TorrentInterface::overMaxRatio (  )  [pure virtual]

Checks if a seeding torrent has reached its maximum share ratio.

Implemented in bt::TorrentControl.

virtual bool bt::TorrentInterface::overMaxSeedTime (  )  [pure virtual]

Checks if a seeding torrent has reached it's max seed timery / will be ret.

Implemented in bt::TorrentControl.

virtual bool bt::TorrentInterface::readyForPreview (  )  const [pure virtual]

Checks if torrent is multimedial and chunks needed for preview are downloaded This only works for single file torrents.

Returns:
true if it is

Implemented in bt::TorrentControl.

virtual void bt::TorrentInterface::recreateMissingFiles (  )  [pure virtual]

Recreate missing files.

Implemented in bt::TorrentControl.

virtual void bt::TorrentInterface::removePeerSource ( PeerSource *  ps  )  [pure virtual]

Remove a nPeerSource.

Parameters:
ps 

Implemented in bt::TorrentControl.

virtual bool bt::TorrentInterface::removeWebSeed ( const KUrl &  url  )  [pure virtual]

Remove a webseed (only user created ones can be removed).

Implemented in bt::TorrentControl.

virtual void bt::TorrentInterface::rollback (  )  [pure virtual]

Roll back the previous changeDataDir call.

Does nothing if there was no previous changeDataDir call.

Implemented in bt::TorrentControl.

virtual void bt::TorrentInterface::scrapeTracker (  )  [pure virtual]

Scrape the tracker.

Implemented in bt::TorrentControl.

void bt::TorrentInterface::seedingAutoStopped ( bt::TorrentInterface *  me,
bt::AutoStopReason  reason 
) [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...

Parameters:
me The object which emitted the signal.
reason The reason why it was aut stopped

virtual void bt::TorrentInterface::setAssuredSpeeds ( Uint32  up,
Uint32  down 
) [pure virtual]

Set the assured speeds.

virtual void bt::TorrentInterface::setFeatureEnabled ( TorrentFeature  tf,
bool  on 
) [pure virtual]

Disable or enable a feature.

Implemented in bt::TorrentControl.

virtual void bt::TorrentInterface::setMaxSeedTime ( float  hours  )  [pure virtual]

Set the max seed time in hours (0 is no limit).

Implemented in bt::TorrentControl.

virtual void bt::TorrentInterface::setMaxShareRatio ( float  ratio  )  [pure virtual]

Set the max share ratio.

Implemented in bt::TorrentControl.

virtual void bt::TorrentInterface::setMonitor ( MonitorInterface *  tmo  )  [pure virtual]

Set the monitor.

Implemented in bt::TorrentControl.

virtual void bt::TorrentInterface::setPriority ( int  p  )  [pure virtual]

Set the torrent queue number.

Implemented in bt::TorrentControl.

virtual void bt::TorrentInterface::setTrafficLimits ( Uint32  up,
Uint32  down 
) [pure virtual]

Set the traffic limits for this torrent.

virtual void bt::TorrentInterface::start (  )  [pure virtual]

Start the download of the torrent.

Implemented in bt::TorrentControl.

virtual void bt::TorrentInterface::startDataCheck ( bt::DataCheckerListener *  lst  )  [pure virtual]

Verify the correctness of all data.

Parameters:
lst The listener

Implemented in bt::TorrentControl.

void bt::TorrentInterface::statusChanged ( bt::TorrentInterface *  me  )  [signal]

Emitted whenever the status of the torrent changes.

Parameters:
me the torrent

virtual QString bt::TorrentInterface::statusToString (  )  const [pure virtual]

Make a string of the current status.

Implemented in bt::TorrentControl.

virtual void bt::TorrentInterface::stop ( bool  user,
bt::WaitJob *  wjob = 0 
) [pure virtual]

Stop the download, closes all connections.

Parameters:
user whether or not the user did this explicitly
wjob WaitJob, used when KT is shutting down, so that we can wait for all stopped events to reach the tracker

Implemented in bt::TorrentControl.

void bt::TorrentInterface::stoppedByError ( bt::TorrentInterface *  me,
QString  msg 
) [signal]

Emitted when a Torrent download is stopped by error.

Parameters:
me The object who emitted the signal
msg Error message

void bt::TorrentInterface::torrentStopped ( bt::TorrentInterface *  me  )  [signal]

Torrent has been stopped.

Parameters:
me The torrent which emitted the signal

virtual void bt::TorrentInterface::update (  )  [pure virtual]

Update the object, should be called periodically.

Implemented in bt::TorrentControl.

virtual bool bt::TorrentInterface::updateNeeded (  )  const [pure virtual]

Do we need to update this torrent ?

Implemented in bt::TorrentControl.

virtual void bt::TorrentInterface::updateTracker (  )  [pure virtual]

Update the tracker, this should normally handled internally.

We leave it public so that the user can do a manual announce.

Implemented in bt::TorrentControl.


Member Data Documentation

TorrentStats bt::TorrentInterface::stats [protected]

Definition at line 565 of file torrentinterface.h.


The documentation for this class was generated from the following files:
  • torrentinterface.h
  • torrentinterface.cpp

kget

Skip menu "kget"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdenetwork

Skip menu "kdenetwork"
  • kget
  • kopete
  •   kopete
  •   libkopete
  •       libpapillon
  • krfb
Generated for kdenetwork by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal