kget
bt::TorrentControl Class Reference
#include <torrentcontrol.h>

Detailed Description
Controls just about everything
This is the interface which any user gets to deal with. This class controls the uploading, downloading, choking, updating the tracker and chunk management.
Definition at line 67 of file torrentcontrol.h.
Constructor & Destructor Documentation
| bt::TorrentControl::TorrentControl | ( | ) |
Definition at line 79 of file torrentcontrol.cpp.
| bt::TorrentControl::~TorrentControl | ( | ) | [virtual] |
Definition at line 130 of file torrentcontrol.cpp.
Member Function Documentation
| void bt::TorrentControl::addPeerSource | ( | PeerSource * | ps | ) | [virtual] |
Add a new PeerSource.
- Parameters:
-
ps
Implements bt::TorrentInterface.
Definition at line 1652 of file torrentcontrol.cpp.
| bool bt::TorrentControl::addWebSeed | ( | const KUrl & | url | ) | [virtual] |
Add a webseed (return false, if there is already a webseed with the same url).
Implements bt::TorrentInterface.
Definition at line 1947 of file torrentcontrol.cpp.
| bool bt::TorrentControl::announceAllowed | ( | ) | [virtual] |
Checks if tracker announce is allowed (minimum interval 60 seconds).
Implements bt::TorrentInterface.
Definition at line 728 of file torrentcontrol.cpp.
| const BitSet & bt::TorrentControl::availableChunksBitSet | ( | ) | const [virtual] |
Get a BitSet of the availability of all Chunks.
Implements bt::TorrentInterface.
Definition at line 1019 of file torrentcontrol.cpp.
| bool bt::TorrentControl::changeOutputDir | ( | const QString & | new_dir, | |
| int | flags | |||
| ) | [virtual] |
Change torrents output directory.
If this fails we will fall back on the old directory.
- Parameters:
-
new_dir The new directory flags
- Returns:
- true upon success.
Implements bt::TorrentInterface.
Definition at line 837 of file torrentcontrol.cpp.
| void bt::TorrentControl::changeTextCodec | ( | QTextCodec * | tc | ) | [virtual] |
Set the text codec.
Implements bt::TorrentInterface.
Definition at line 1918 of file torrentcontrol.cpp.
| bool bt::TorrentControl::changeTorDir | ( | const QString & | new_dir | ) | [virtual] |
Change to a new data dir.
If this fails we will fall back on the old directory.
- Parameters:
-
new_dir The new directory
- Returns:
- true upon succes
Implements bt::TorrentInterface.
Definition at line 809 of file torrentcontrol.cpp.
| bool bt::TorrentControl::checkDiskSpace | ( | bool | emit_sig = true |
) | [virtual] |
Checks if diskspace is low.
Implements bt::TorrentInterface.
Definition at line 1745 of file torrentcontrol.cpp.
| void bt::TorrentControl::createFiles | ( | ) |
| void bt::TorrentControl::deleteDataFiles | ( | ) | [virtual] |
Delete the data files of the torrent, they will be lost permanently.
Implements bt::TorrentInterface.
Definition at line 1629 of file torrentcontrol.cpp.
| void bt::TorrentControl::dndMissingFiles | ( | ) | [virtual] |
Mark missing files as do not download.
Implements bt::TorrentInterface.
Definition at line 1598 of file torrentcontrol.cpp.
| const BitSet & bt::TorrentControl::downloadedChunksBitSet | ( | ) | const [virtual] |
Get a BitSet of the status of all Chunks.
Implements bt::TorrentInterface.
Definition at line 1011 of file torrentcontrol.cpp.
| const BitSet & bt::TorrentControl::excludedChunksBitSet | ( | ) | const [virtual] |
Get a BitSet of the excluded Chunks.
Implements bt::TorrentInterface.
Definition at line 1027 of file torrentcontrol.cpp.
Definition at line 1875 of file torrentcontrol.cpp.
| QString bt::TorrentControl::getDataDir | ( | ) | const [inline, virtual] |
Get the data directory of this torrent.
Implements bt::TorrentInterface.
Definition at line 156 of file torrentcontrol.h.
Definition at line 1624 of file torrentcontrol.cpp.
| int bt::TorrentControl::getETA | ( | ) | [virtual] |
Returns estimated time left for finishing download.
Returned value is in seconds. Uses TimeEstimator class to calculate this value.
Implements bt::TorrentInterface.
Definition at line 1676 of file torrentcontrol.cpp.
| const bt::SHA1Hash & bt::TorrentControl::getInfoHash | ( | ) | const [virtual] |
Get the info_hash.
Implements bt::TorrentInterface.
Definition at line 1634 of file torrentcontrol.cpp.
| virtual float bt::TorrentControl::getMaxSeedTime | ( | ) | const [inline, virtual] |
Get the max seed time.
Implements bt::TorrentInterface.
Definition at line 212 of file torrentcontrol.h.
| virtual float bt::TorrentControl::getMaxShareRatio | ( | ) | const [inline, virtual] |
Get the max share ratio.
Implements bt::TorrentInterface.
Definition at line 208 of file torrentcontrol.h.
| Uint32 bt::TorrentControl::getNumDHTNodes | ( | ) | const [virtual] |
Get the number of initial DHT nodes.
Implements bt::TorrentInterface.
Definition at line 1619 of file torrentcontrol.cpp.
| Uint32 bt::TorrentControl::getNumFiles | ( | ) | const [virtual] |
Get the number of files in a multifile torrent (0 if we do not have a multifile torrent).
Implements bt::TorrentInterface.
Definition at line 1300 of file torrentcontrol.cpp.
| Uint32 bt::TorrentControl::getNumWebSeeds | ( | ) | const [virtual] |
Get the number of webseeds.
Implements bt::TorrentInterface.
Definition at line 1937 of file torrentcontrol.cpp.
| const bt::PeerID & bt::TorrentControl::getOwnPeerID | ( | ) | const [virtual] |
Get our PeerID.
Implements bt::TorrentInterface.
Definition at line 1683 of file torrentcontrol.cpp.
| const PeerManager * bt::TorrentControl::getPeerMgr | ( | ) | const |
| int bt::TorrentControl::getPriority | ( | ) | const [inline, virtual] |
Get the torrent queue number. Zero if not in queue.
Implements bt::TorrentInterface.
Definition at line 203 of file torrentcontrol.h.
| Uint32 bt::TorrentControl::getRunningTimeDL | ( | ) | const [virtual] |
Get the download running time of this torrent in seconds.
- Returns:
- Uint32 - time in seconds
Implements bt::TorrentInterface.
Definition at line 1284 of file torrentcontrol.cpp.
| Uint32 bt::TorrentControl::getRunningTimeUL | ( | ) | const [virtual] |
Get the upload running time of this torrent in seconds.
- Returns:
- Uint32 - time in seconds
Implements bt::TorrentInterface.
Definition at line 1292 of file torrentcontrol.cpp.
| QString bt::TorrentControl::getShortErrorMessage | ( | ) | const [inline, virtual] |
Get a short error message.
Implements bt::TorrentInterface.
Definition at line 183 of file torrentcontrol.h.
| const QTextCodec * bt::TorrentControl::getTextCodec | ( | ) | const [virtual] |
Get the text codec used in the torrent.
Implements bt::TorrentInterface.
Definition at line 1910 of file torrentcontrol.cpp.
| Uint32 bt::TorrentControl::getTimeToNextTrackerUpdate | ( | ) | const [virtual] |
Get the time to the next tracker update in seconds.
Implements bt::TorrentInterface.
Definition at line 1188 of file torrentcontrol.cpp.
| QString bt::TorrentControl::getTorDir | ( | ) | const [inline, virtual] |
| const Torrent& bt::TorrentControl::getTorrent | ( | ) | const [inline] |
| const TorrentFileInterface & bt::TorrentControl::getTorrentFile | ( | Uint32 | index | ) | const [virtual] |
Definition at line 1316 of file torrentcontrol.cpp.
| TorrentFileInterface & bt::TorrentControl::getTorrentFile | ( | Uint32 | index | ) | [virtual] |
Definition at line 1308 of file torrentcontrol.cpp.
| const TrackersList * bt::TorrentControl::getTrackersList | ( | ) | const [virtual] |
Gets the TrackersList interface.
Implements bt::TorrentInterface.
Definition at line 1470 of file torrentcontrol.cpp.
| TrackersList * bt::TorrentControl::getTrackersList | ( | ) | [virtual] |
Gets the TrackersList interface.
Implements bt::TorrentInterface.
Definition at line 1465 of file torrentcontrol.cpp.
Definition at line 1860 of file torrentcontrol.cpp.
| const WebSeedInterface * bt::TorrentControl::getWebSeed | ( | Uint32 | i | ) | const [virtual] |
Definition at line 1942 of file torrentcontrol.cpp.
| bool bt::TorrentControl::hasExistingFiles | ( | ) | const |
Test if the torrent has existing files, only works the first time a torrent is loaded.
Definition at line 1573 of file torrentcontrol.cpp.
| bool bt::TorrentControl::hasMissingFiles | ( | QStringList & | sl | ) | [virtual] |
Test all files and see if they are not missing.
If so put them in a list
Implements bt::TorrentInterface.
Definition at line 1578 of file torrentcontrol.cpp.
| void bt::TorrentControl::init | ( | QueueManagerInterface * | qman, | |
| const QByteArray & | data, | |||
| const QString & | tmpdir, | |||
| const QString & | datadir, | |||
| const QString & | default_save_dir | |||
| ) |
Initialize the TorrentControl.
- Parameters:
-
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) default_save_dir Default save directory (null if not set)
- Exceptions:
-
Error when something goes wrong
Definition at line 548 of file torrentcontrol.cpp.
| void bt::TorrentControl::init | ( | QueueManagerInterface * | qman, | |
| const QString & | torrent, | |||
| const QString & | tmpdir, | |||
| const QString & | datadir, | |||
| const QString & | default_save_dir | |||
| ) |
Initialize the TorrentControl.
- Parameters:
-
qman The QueueManager torrent The filename of the torrent file 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) default_save_dir Default save directory (null if not set)
- Exceptions:
-
Error when something goes wrong
Definition at line 516 of file torrentcontrol.cpp.
| bool bt::TorrentControl::isFeatureEnabled | ( | TorrentFeature | tf | ) | [virtual] |
Is a feature enabled.
Implements bt::TorrentInterface.
Definition at line 1689 of file torrentcontrol.cpp.
| bool bt::TorrentControl::isMovingFiles | ( | ) | const [inline, virtual] |
Are we in the process of moving files.
Implements bt::TorrentInterface.
Definition at line 274 of file torrentcontrol.h.
| bool bt::TorrentControl::isMultimedia | ( | ) | const [virtual] |
See if this is a single file torrent and a multimedia files.
Implements bt::TorrentInterface.
Definition at line 1183 of file torrentcontrol.cpp.
| void bt::TorrentControl::markExistingFilesAsDownloaded | ( | ) | [virtual] |
Mark all existing files as downloaded (.
Implements bt::TorrentInterface.
Definition at line 1562 of file torrentcontrol.cpp.
| bool bt::TorrentControl::moveTorrentFiles | ( | const QMap< TorrentFileInterface *, QString > & | files | ) | [virtual] |
Move a torrent file to a new location.
- Parameters:
-
files Map of files and their new location
- Returns:
- true upon success
Implements bt::TorrentInterface.
Definition at line 939 of file torrentcontrol.cpp.
| const BitSet & bt::TorrentControl::onlySeedChunksBitSet | ( | ) | const [virtual] |
Get a BitSet of the only seed chunks.
Implements bt::TorrentInterface.
Definition at line 1035 of file torrentcontrol.cpp.
| bool bt::TorrentControl::overMaxRatio | ( | ) | [virtual] |
Checks if a seeding torrent has reached its maximum share ratio.
Implements bt::TorrentInterface.
Definition at line 1409 of file torrentcontrol.cpp.
| bool bt::TorrentControl::overMaxSeedTime | ( | ) | [virtual] |
Checks if a seeding torrent has reached it's max seed timery / will be ret.
Implements bt::TorrentInterface.
Definition at line 1420 of file torrentcontrol.cpp.
| bool bt::TorrentControl::readyForPreview | ( | ) | const [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
Implements bt::TorrentInterface.
Definition at line 1167 of file torrentcontrol.cpp.
| void bt::TorrentControl::recreateMissingFiles | ( | ) | [virtual] |
Recreate missing files.
Implements bt::TorrentInterface.
Definition at line 1583 of file torrentcontrol.cpp.
| void bt::TorrentControl::removePeerSource | ( | PeerSource * | ps | ) | [virtual] |
Remove a nPeerSource.
- Parameters:
-
ps
Implements bt::TorrentInterface.
Definition at line 1658 of file torrentcontrol.cpp.
| bool bt::TorrentControl::removeWebSeed | ( | const KUrl & | url | ) | [virtual] |
Remove a webseed (only user created ones can be removed).
Implements bt::TorrentInterface.
Definition at line 1958 of file torrentcontrol.cpp.
| void bt::TorrentControl::resetTrackerStats | ( | ) |
Called by the PeerSourceManager when it is going to start a new tracker.
Definition at line 1639 of file torrentcontrol.cpp.
| void bt::TorrentControl::rollback | ( | ) | [virtual] |
Roll back the previous changeDataDir call.
Does nothing if there was no previous changeDataDir call.
Implements bt::TorrentInterface.
Definition at line 971 of file torrentcontrol.cpp.
| void bt::TorrentControl::scrapeTracker | ( | ) | [virtual, slot] |
Scrape the tracker.
Implements bt::TorrentInterface.
Definition at line 748 of file torrentcontrol.cpp.
Definition at line 1866 of file torrentcontrol.cpp.
| static void bt::TorrentControl::setAutoRecheck | ( | bool | on | ) | [inline, static, slot] |
Enable or disable automatic datachecking when to many corrupted chunks have been found on disk.
- Parameters:
-
on
Definition at line 344 of file torrentcontrol.h.
| void bt::TorrentControl::setCacheFactory | ( | CacheFactory * | cf | ) |
| void bt::TorrentControl::setChunkSelectorFactory | ( | ChunkSelectorFactoryInterface * | csfi | ) |
Set a custom chunk selector factory (needs to be done for init is called).
Definition at line 1927 of file torrentcontrol.cpp.
| static void bt::TorrentControl::setDataCheckWhenCompleted | ( | bool | on | ) | [inline, static, slot] |
Enable or disable data check upon completion.
- Parameters:
-
on
Definition at line 332 of file torrentcontrol.h.
| void bt::TorrentControl::setFeatureEnabled | ( | TorrentFeature | tf, | |
| bool | on | |||
| ) | [virtual] |
Disable or enable a feature.
Implements bt::TorrentInterface.
Definition at line 1702 of file torrentcontrol.cpp.
| void bt::TorrentControl::setMaxSeedTime | ( | float | hours | ) | [virtual] |
Set the max seed time in hours (0 is no limit).
Implements bt::TorrentInterface.
Definition at line 1403 of file torrentcontrol.cpp.
| void bt::TorrentControl::setMaxShareRatio | ( | float | ratio | ) | [virtual] |
Set the max share ratio.
Implements bt::TorrentInterface.
Definition at line 1386 of file torrentcontrol.cpp.
| static void bt::TorrentControl::setMinimumDiskSpace | ( | Uint32 | m | ) | [inline, static, slot] |
Set the minimum amount of diskspace in MB.
When there is less then this free, torrents will be stopped.
- Parameters:
-
m
Definition at line 338 of file torrentcontrol.h.
| void bt::TorrentControl::setMonitor | ( | MonitorInterface * | tmo | ) | [virtual] |
Set the monitor.
Implements bt::TorrentInterface.
Definition at line 504 of file torrentcontrol.cpp.
| static void bt::TorrentControl::setMoveWhenCompletedDir | ( | const KUrl & | dir | ) | [inline, static, slot] |
Set the move upon completion directory.
- Parameters:
-
dir The directory an empty url disables this feature
Definition at line 326 of file torrentcontrol.h.
| static void bt::TorrentControl::setNumCorruptedForRecheck | ( | Uint32 | m | ) | [inline, static, slot] |
Set the number of corrupted chunks for a before we start an automatic recheck.
- Parameters:
-
m
Definition at line 350 of file torrentcontrol.h.
| void bt::TorrentControl::setPreallocateDiskSpace | ( | bool | pa | ) | [inline] |
Tell the TorrentControl obj to preallocate diskspace in the next update.
Definition at line 215 of file torrentcontrol.h.
| void bt::TorrentControl::setPriority | ( | int | p | ) | [virtual] |
Set the torrent queue number.
Implements bt::TorrentInterface.
Definition at line 1371 of file torrentcontrol.cpp.
Definition at line 1851 of file torrentcontrol.cpp.
| void bt::TorrentControl::start | ( | ) | [virtual, slot] |
Start the download of the torrent.
Implements bt::TorrentInterface.
Definition at line 341 of file torrentcontrol.cpp.
| void bt::TorrentControl::startDataCheck | ( | bt::DataCheckerListener * | lst | ) | [virtual] |
Verify the correctness of all data.
- Parameters:
-
lst The listener
Implements bt::TorrentInterface.
Definition at line 1481 of file torrentcontrol.cpp.
| QString bt::TorrentControl::statusToString | ( | ) | const [virtual] |
Make a string out of the status message.
Implements bt::TorrentInterface.
Definition at line 1433 of file torrentcontrol.cpp.
| void bt::TorrentControl::stop | ( | bool | user, | |
| WaitJob * | wjob = 0 | |||
| ) | [virtual, slot] |
Stop the download, closes all connections.
- Parameters:
-
user whether or not the user did this explicitly wjob WaitJob to wait at exit for the completion of stopped requests
Implements bt::TorrentInterface.
Definition at line 431 of file torrentcontrol.cpp.
| void bt::TorrentControl::trackerScrapeDone | ( | ) | [slot] |
| void bt::TorrentControl::trackerStatusChanged | ( | const QString & | ns | ) | [slot] |
The tracker status has changed.
- Parameters:
-
ns New status
Definition at line 1647 of file torrentcontrol.cpp.
| void bt::TorrentControl::update | ( | ) | [virtual, slot] |
Update the object, should be called periodically.
Implements bt::TorrentInterface.
Definition at line 154 of file torrentcontrol.cpp.
| bool bt::TorrentControl::updateNeeded | ( | ) | const [virtual] |
Do we need to update this torrent ?
Implements bt::TorrentInterface.
Definition at line 149 of file torrentcontrol.cpp.
| void bt::TorrentControl::updateTracker | ( | ) | [virtual, slot] |
Update the tracker, this should normally handled internally.
We leave it public so that the user can do a manual announce.
Implements bt::TorrentInterface.
Definition at line 739 of file torrentcontrol.cpp.
The documentation for this class was generated from the following files:
KDE 4.2 API Reference