libktorrent
2.2.0
|
Manages the downloading. More...
#include <downloader.h>
Public Slots | |
void | dataChecked (const BitSet &ok_chunks, bt::Uint32 from, bt::Uint32 to) |
void | recalcDownloaded () |
void | setMonitor (MonitorInterface *tmo) |
void | update () |
Signals | |
void | chunkDownloaded (Uint32 chunk) |
void | ioError (const QString &msg) |
Public Member Functions | |
Downloader (Torrent &tor, PeerManager &pman, ChunkManager &cman) | |
void | addPieceDownloader (PieceDownloader *peer) |
WebSeed * | addWebSeed (const QUrl &url) |
Add a webseed. | |
CurChunkCItr | beginDownloads () const |
Uint64 | bytesDownloaded () const |
Get the number of bytes we have downloaded. | |
bool | canDownloadFromWebSeed (Uint32 chunk) const |
void | clearDownloads () |
void | corrupted (Uint32 chunk) |
ChunkDownload * | download (Uint32 chunk) |
const ChunkDownload * | download (Uint32 chunk) const |
bool | downloading (Uint32 chunk) const |
Uint32 | downloadRate () const |
Get the current dowload rate. | |
CurChunkCItr | endDownloads () const |
bool | endgameMode () const |
Are we in endgame mode. | |
Uint32 | getDownloadedBytesOfCurrentChunksFile (const QString &file) |
Uint32 | getNumWebSeeds () const |
Get the number of webseeds. | |
WebSeed * | getWebSeed (Uint32 i) |
Get a webseed. | |
const WebSeed * | getWebSeed (Uint32 i) const |
Get a webseed. | |
bool | isFinished () const |
See if the download is finished. | |
void | loadDownloads (const QString &file) |
void | loadWebSeeds (const QString &file) |
Add the user created webseeds. | |
Uint32 | numActiveDownloads () const |
Get the number of chunks we are dowloading. | |
Uint32 | numDownloadersForChunk (Uint32 chunk) const |
void | pause () |
void | removeAllWebSeeds () |
Remove all webseeds. | |
void | removePieceDownloader (PieceDownloader *peer) |
bool | removeWebSeed (const QUrl &url) |
Remove a webseed. | |
void | saveDownloads (const QString &file) |
void | saveWebSeeds (const QString &file) |
Save the user created webseeds. | |
void | setChunkSelector (ChunkSelectorInterface *csel) |
Set the ChunkSelector, 0 means KT will reset to the default selector. | |
void | setGroupIDs (Uint32 up, Uint32 down) |
![]() | |
virtual void | pieceReceived (const Piece &p)=0 |
Static Public Member Functions | |
static void | setUseWebSeeds (bool on) |
Enable or disable the use of webseeds. | |
This class manages the downloading of the file. It should regurarly be updated.
Definition at line 67 of file downloader.h.
bt::Downloader::Downloader | ( | Torrent & | tor, |
PeerManager & | pman, | ||
ChunkManager & | cman | ||
) |
Constructor.
tor | The Torrent |
pman | The PeerManager |
cman | The ChunkManager |
void bt::Downloader::addPieceDownloader | ( | PieceDownloader * | peer | ) |
We got a new connection.
peer | The PieceDownloader |
bool bt::Downloader::canDownloadFromWebSeed | ( | Uint32 | chunk | ) | const |
|
signal |
Emitted when a chunk has been downloaded.
chunk | The chunk |
void bt::Downloader::clearDownloads | ( | ) |
Clear all downloads. Deletes all active downloads.
void bt::Downloader::corrupted | ( | Uint32 | chunk | ) |
A corrupted chunk has been detected, make sure we redownload it.
chunk | The chunk |
|
slot |
Data has been checked, and these chunks are OK.
ok_chunks | The ok_chunks |
from | First chunk of the check |
to | Last chunk of the check |
ChunkDownload* bt::Downloader::download | ( | Uint32 | chunk | ) |
Get a download for a chunk
chunk | The chunk |
const ChunkDownload* bt::Downloader::download | ( | Uint32 | chunk | ) | const |
Get a download for a chunk (const version)
chunk | The chunk |
bool bt::Downloader::downloading | ( | Uint32 | chunk | ) | const |
Uint32 bt::Downloader::getDownloadedBytesOfCurrentChunksFile | ( | const QString & | file | ) |
Get the number of bytes already downloaded in the current_chunks file.
file | The path of the current_chunks file |
|
signal |
An error occurred while we we're writing or reading from disk.
msg | Message |
void bt::Downloader::loadDownloads | ( | const QString & | file | ) |
Load the current downloads.
file | The file to load from |
Uint32 bt::Downloader::numDownloadersForChunk | ( | Uint32 | chunk | ) | const |
Get the number of downloaders assigned to a chunk
chunk | ID of Chunk |
void bt::Downloader::pause | ( | ) |
Pause the download
|
slot |
Recalculate the number of bytes downloaded.
void bt::Downloader::removePieceDownloader | ( | PieceDownloader * | peer | ) |
Remove a piece downloader.
peer | The PieceDownloader |
void bt::Downloader::saveDownloads | ( | const QString & | file | ) |
Save the current downloads.
file | The file to save to |
void bt::Downloader::setGroupIDs | ( | Uint32 | up, |
Uint32 | down | ||
) |
Set the group ID's of the webseed (for speed limits)
up | Upload group id |
down | Download group id |
|
slot |
Set the TorrentMonitor.
tmo |
|
slot |
Update the downloader.