20 #ifndef BTTORRENTINTERFACE_H
21 #define BTTORRENTINTERFACE_H
23 #include <QSharedPointer>
27 #include <ktorrent_export.h>
28 #include <util/constants.h>
29 #include <interfaces/trackerslist.h>
30 #include <torrent/torrentstats.h>
31 #include <torrent/torrentfilestream.h>
43 class MonitorInterface;
44 class TorrentFileInterface;
47 class WebSeedInterface;
49 class ChunkSelectorInterface;
52 enum TorrentStartResponse
57 MAX_SHARE_RATIO_REACHED,
182 enum ChangeOutputFlags
184 MOVE_FILES = 1,FULL_PATH = 2
426 QString
getDisplayName()
const {
return display_name.isEmpty() ? stats.torrent_name : display_name;}
467 typedef QSharedPointer<TorrentInterface> Ptr;
468 typedef QPointer<TorrentInterface> WPtr;
564 QString user_modified_name;
565 QString display_name;
QString getUserModifiedFileName() const
Gets the user modified file or toplevel directory name.
virtual void networkUp()=0
After some network down time, the network is back up.
void stoppedByError(bt::TorrentInterface *me, QString msg)
virtual float getMaxShareRatio() const =0
Get the max share ratio.
virtual QString getComments() const =0
Get the comments.
virtual void setMoveWhenCompletedDir(const QString &dir)=0
Simple implementation of a BitSet.
virtual const bt::BitSet & onlySeedChunksBitSet() const =0
virtual TorrentFileStream::Ptr createTorrentFileStream(bt::Uint32 index, bool streaming_mode, QObject *parent)=0
virtual Job * startDataCheck(bool auto_import, bt::Uint32 from, bt::Uint32 to)=0
void needDataCheck(bt::TorrentInterface *me)
virtual QString getMoveWhenCompletedDir() const =0
virtual bool changeOutputDir(const QString &new_dir, int flags)=0
virtual void dndMissingFiles()=0
virtual Uint32 getNumDHTNodes() const =0
Get the number of initial DHT nodes.
const TorrentStats & getStats() const
Get the torrent's statistics.
virtual void markExistingFilesAsDownloaded()=0
Mark all existing files as downloaded (.
virtual void removePeerSource(PeerSource *ps)=0
void setLoadUrl(const QUrl &u)
Set the URL which the torrent was loaded from.
void chunkDownloaded(bt::TorrentInterface *me, bt::Uint32 chunk)
Interface for a file in a multifile torrent.
void seedingAutoStopped(bt::TorrentInterface *me, bt::AutoStopReason reason)
virtual QString getDataDir() const =0
Get the data directory of this torrent.
virtual bool removeWebSeed(const QUrl &url)=0
Remove a webseed (only user created ones can be removed)
virtual void addPeerSource(PeerSource *ps)=0
virtual TorrentFileInterface & getTorrentFile(Uint32 index)=0
virtual const bt::BitSet & excludedChunksBitSet() const =0
virtual const bt::SHA1Hash & getInfoHash() const =0
Get the info_hash.
virtual void setQueued(bool queued)=0
virtual TrackersList * getTrackersList()=0
Get a pointer to TrackersList object.
virtual void setAssuredSpeeds(Uint32 up, Uint32 down)=0
Set the assured speeds.
virtual void setMaxSeedTime(float hours)=0
Set the max seed time in hours (0 is no limit)
virtual void changeTextCodec(QTextCodec *tc)=0
Set the text codec.
virtual bool hasMissingFiles(QStringList &sl)=0
virtual const bt::BitSet & downloadedChunksBitSet() const =0
virtual bool overMaxRatio()=0
Checks if a seeding torrent has reached its maximum share ratio.
QUrl loadUrl() const
Get the URL which the torrent was loaded from.
virtual bool isFeatureEnabled(TorrentFeature tf)=0
Is a feature enabled.
virtual const QTextCodec * getTextCodec() const =0
Get the text codec used in the torrent.
virtual const bt::PeerID & getOwnPeerID() const =0
Get our PeerID.
void finished(bt::TorrentInterface *me)
virtual bool checkDiskSpace(bool emit_sig=true)=0
Check if there is enough diskspace available for this torrent.
virtual void deleteDataFiles()=0
virtual void setSuperSeeding(bool on)=0
virtual WebSeedInterface * getWebSeed(Uint32 i)=0
Get a webseed (returns 0 if index is invalid)
void aboutToBeStarted(bt::TorrentInterface *me, bool &ret)
virtual void setTrafficLimits(Uint32 up, Uint32 down)=0
Set the traffic limits for this torrent.
virtual void setFeatureEnabled(TorrentFeature tf, bool on)=0
Disable or enable a feature.
virtual QString getTorDir() const =0
Interface for classes who want to monitor a TorrentInterface.
QString getDisplayName() const
Gets the displayed name.
virtual const WebSeedInterface * getWebSeed(Uint32 i) const =0
Get a webseed (returns 0 if index is invalid)
void corruptedDataFound(bt::TorrentInterface *me)
virtual void rollback()=0
virtual void setPriority(int p)=0
Set the torrent queue number.
virtual const TrackersList * getTrackersList() const =0
Get a pointer to TrackersList object.
virtual Uint32 getNumWebSeeds() const =0
Get the number of webseeds.
virtual bool overMaxSeedTime()=0
Checks if a seeding torrent has reached it's max seed timery / will be ret.
void statusChanged(bt::TorrentInterface *me)
void maxRatioChanged(bt::TorrentInterface *me)
virtual Uint32 getNumFiles() const =0
Get the number of files in a multifile torrent (0 if we do not have a multifile torrent)
virtual const DHTNode & getDHTNode(Uint32 i) const =0
Get a DHT node.
virtual bool isStorageMounted(QStringList &missing)=0
virtual bool addWebSeed(const QUrl &url)=0
Add a webseed (return false, if there is already a webseed with the same url)
virtual void setMaxShareRatio(float ratio)=0
Set the max share ratio.
virtual const JobQueue * getJobQueue() const =0
Get the JobQueue of the torrent.
virtual void updateStatus()=0
Update the status.
void diskSpaceLow(bt::TorrentInterface *me, bool toStop)
virtual Uint32 getRunningTimeDL() const =0
void torrentStopped(bt::TorrentInterface *me)
virtual bool moveTorrentFiles(const QMap< TorrentFileInterface *, QString > &files)=0
virtual float getMaxSeedTime() const =0
Get the max seed time.
virtual void setAllowedToStart(bool on)=0
Set whether the QM can start a torrent.
virtual void stop(bt::WaitJob *wjob=0)=0
bool isAllowedToStart() const
virtual void setChunkSelector(ChunkSelectorInterface *csel)=0
Set the ChunkSelector to use (0 resets to the default ChunkSelector)
virtual bool readyForPreview() const =0
virtual void getAssuredSpeeds(Uint32 &up, Uint32 &down)=0
Get the assured speeds.
void missingFilesMarkedDND(bt::TorrentInterface *me)
virtual void updateTracker()=0
virtual const TorrentFileInterface & getTorrentFile(Uint32 index) const =0
virtual void getTrafficLimits(Uint32 &up, Uint32 &down)=0
Get the traffic limits.
virtual bool isMultimedia() const =0
See if this is a single file torrent and a multimedia files.
virtual bool announceAllowed()=0
Is manual announce allowed?
virtual int getPriority() const =0
Get the torrent queue number. Zero if not in queue.
virtual void scrapeTracker()=0
virtual void setUserModifiedFileName(const QString &n)
Set the user modified file or toplevel directory name.
virtual const bt::BitSet & availableChunksBitSet() const =0
virtual void setDisplayName(const QString &n)=0
Set the displayed name.
virtual Uint32 getRunningTimeUL() const =0
virtual void handleError(const QString &err)=0
Handle an error.
virtual void recreateMissingFiles()=0
virtual bool changeTorDir(const QString &new_dir)=0
Interface for an object which controls one torrent.
void runningJobsDone(bt::TorrentInterface *me)
virtual void setMonitor(MonitorInterface *tmo)=0
Set the monitor.