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

kget

bt::Downloader

bt::Downloader Class Reference

#include <downloader.h>

Inheritance diagram for bt::Downloader:

Inheritance graph
[legend]

List of all members.


Detailed Description

Author:
Joris Guisson

Manages the downloading

This class manages the downloading of the file. It should regurarly be updated.

Definition at line 67 of file downloader.h.


Public Slots

void dataChecked (const BitSet &ok_chunks)
void onNewPeer (Peer *peer)
void onPeerKilled (Peer *peer)
void recalcDownloaded ()
static void setMemoryUsage (Uint32 m)
void setMonitor (MonitorInterface *tmo)
void update ()

Signals

void ioError (const QString &msg)

Public Member Functions

WebSeed * addWebSeed (const KUrl &url)
bool areWeDownloading (Uint32 chunk) const
CurChunkCItr beginDownloads () const
Uint64 bytesDownloaded () const
bool canDownloadFromWebSeed (Uint32 chunk) const
void clearDownloads ()
void corrupted (Uint32 chunk)
 Downloader (Torrent &tor, PeerManager &pman, ChunkManager &cman, ChunkSelectorFactoryInterface *fac)
Uint32 downloadRate () const
CurChunkCItr endDownloads () const
Uint32 getDownloadedBytesOfCurrentChunksFile (const QString &file)
Uint32 getNumWebSeeds () const
const WebSeed * getWebSeed (Uint32 i) const
bool isFinished () const
void loadDownloads (const QString &file)
void loadWebSeeds (const QString &file)
Uint32 numActiveDownloads () const
Uint32 numDownloadersForChunk (Uint32 chunk) const
bool removeWebSeed (const KUrl &url)
void saveDownloads (const QString &file)
void saveWebSeeds (const QString &file)
void setGroupIDs (Uint32 up, Uint32 down)
virtual ~Downloader ()

Constructor & Destructor Documentation

bt::Downloader::Downloader ( Torrent &  tor,
PeerManager &  pman,
ChunkManager &  cman,
ChunkSelectorFactoryInterface *  fac 
)

Constructor.

Parameters:
tor The Torrent
pman The PeerManager
cman The ChunkManager
fac The ChunkSelectorFactory, if this is 0, a default one will be created (note: Downloader will take control of this and delete it when it gets deleted)

Definition at line 49 of file downloader.cpp.

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

Definition at line 84 of file downloader.cpp.


Member Function Documentation

WebSeed * bt::Downloader::addWebSeed ( const KUrl &  url  ) 

Add a webseed.

Definition at line 836 of file downloader.cpp.

bool bt::Downloader::areWeDownloading ( Uint32  chunk  )  const

See if we are downloading a Chunk.

Parameters:
chunk ID of Chunk
Returns:
true if we are, false if not

Definition at line 405 of file downloader.cpp.

CurChunkCItr bt::Downloader::beginDownloads (  )  const [inline]

Definition at line 125 of file downloader.h.

Uint64 bt::Downloader::bytesDownloaded (  )  const [inline]

Get the number of bytes we have downloaded.

Definition at line 109 of file downloader.h.

bool bt::Downloader::canDownloadFromWebSeed ( Uint32  chunk  )  const

Can we download a chunk from a webseed.

Parameters:
chunk ID of Chunk
Returns:
true if we can

Definition at line 410 of file downloader.cpp.

void bt::Downloader::clearDownloads (  ) 

Clear all downloads.

Deletes all active downloads.

Definition at line 508 of file downloader.cpp.

void bt::Downloader::corrupted ( Uint32  chunk  ) 

A corrupted chunk has been detected, make sure we redownload it.

Parameters:
chunk The chunk

Definition at line 737 of file downloader.cpp.

void bt::Downloader::dataChecked ( const BitSet &  ok_chunks  )  [slot]

Data has been checked, and these chunks are OK.

Parameters:
ok_chunks The ok_chunks

Definition at line 749 of file downloader.cpp.

Uint32 bt::Downloader::downloadRate (  )  const

Get the current dowload rate.

Definition at line 526 of file downloader.cpp.

CurChunkCItr bt::Downloader::endDownloads (  )  const [inline]

Definition at line 126 of file downloader.h.

Uint32 bt::Downloader::getDownloadedBytesOfCurrentChunksFile ( const QString &  file  ) 

Get the number of bytes already downloaded in the current_chunks file.

Parameters:
file The path of the current_chunks file
Returns:
The bytes already downloading

Definition at line 654 of file downloader.cpp.

Uint32 bt::Downloader::getNumWebSeeds (  )  const [inline]

Get the number of webseeds.

Definition at line 91 of file downloader.h.

const WebSeed* bt::Downloader::getWebSeed ( Uint32  i  )  const [inline]

Get a webseed.

Definition at line 94 of file downloader.h.

void bt::Downloader::ioError ( const QString &  msg  )  [signal]

An error occurred while we we're writing or reading from disk.

Parameters:
msg Message

bool bt::Downloader::isFinished (  )  const

See if the download is finished.

Definition at line 704 of file downloader.cpp.

void bt::Downloader::loadDownloads ( const QString &  file  ) 

Load the current downloads.

Parameters:
file The file to load from

Definition at line 581 of file downloader.cpp.

void bt::Downloader::loadWebSeeds ( const QString &  file  ) 

Add the user created webseeds.

Definition at line 894 of file downloader.cpp.

Uint32 bt::Downloader::numActiveDownloads (  )  const [inline]

Get the number of chunks we are dowloading.

Definition at line 115 of file downloader.h.

Uint32 bt::Downloader::numDownloadersForChunk ( Uint32  chunk  )  const

Get the number of downloaders assigned to a chunk.

Parameters:
chunk ID of Chunk
Returns:
the number of downloaders for that chunk

Definition at line 418 of file downloader.cpp.

void bt::Downloader::onNewPeer ( Peer *  peer  )  [slot]

We got a new connection.

Parameters:
peer The Peer

Definition at line 427 of file downloader.cpp.

void bt::Downloader::onPeerKilled ( Peer *  peer  )  [slot]

A Peer has disconnected.

Parameters:
peer The Peer

Definition at line 435 of file downloader.cpp.

void bt::Downloader::recalcDownloaded (  )  [slot]

Recalculate the number of bytes downloaded.

Definition at line 767 of file downloader.cpp.

bool bt::Downloader::removeWebSeed ( const KUrl &  url  ) 

Remove a webseed.

Definition at line 855 of file downloader.cpp.

void bt::Downloader::saveDownloads ( const QString &  file  ) 

Save the current downloads.

Parameters:
file The file to save to

Definition at line 558 of file downloader.cpp.

void bt::Downloader::saveWebSeeds ( const QString &  file  ) 

Save the user created webseeds.

Definition at line 877 of file downloader.cpp.

void bt::Downloader::setGroupIDs ( Uint32  up,
Uint32  down 
)

Set the group ID's of the webseed (for speed limits).

Parameters:
up Upload group id
down Download group id

Definition at line 920 of file downloader.cpp.

void bt::Downloader::setMemoryUsage ( Uint32  m  )  [static, slot]

Definition at line 744 of file downloader.cpp.

void bt::Downloader::setMonitor ( MonitorInterface *  tmo  )  [slot]

Set the TorrentMonitor.

Parameters:
tmo 

Definition at line 543 of file downloader.cpp.

void bt::Downloader::update (  )  [slot]

Update the downloader.

Definition at line 161 of file downloader.cpp.


The documentation for this class was generated from the following files:
  • downloader.h
  • downloader.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