21 #ifndef BTPIECEDOWNLOADER_H
22 #define BTPIECEDOWNLOADER_H
25 #include <ktorrent_export.h>
26 #include <util/constants.h>
37 class KTORRENT_EXPORT PieceDownloader :
public QObject
42 ~PieceDownloader()
override;
58 int getNumGrabbed()
const {
return grabbed;}
75 virtual void cancelAll() = 0;
83 virtual QString getName()
const = 0;
89 virtual bt::Uint32 getDownloadRate()
const = 0;
95 virtual bool isChoked()
const {
return false;}
100 virtual bool canAddRequest()
const = 0;
105 virtual bool canDownloadChunk()
const = 0;
108 bool isNearlyDone()
const {
return getNumGrabbed() == 1 && nearly_done;}
111 void setNearlyDone(
bool nd) {nearly_done = nd;}
119 virtual bool hasChunk(bt::Uint32 )
const {
return true;}
124 virtual void checkTimeouts() = 0;