1 /* This file is part of the KDE project
3 Copyright (C) 2007 Lukas Appelhans <l.appelhans@gmx.de>
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
16 #include "core/transfer.h"
17 #include "torrent/torrentcontrol.h"
19 class BTTransfer
: public QObject
, public Transfer
25 * Here we define the Bittorrent specific flags.
29 Tc_ChunksTotal
= 0x00010000,
30 Tc_ChunksDownloaded
= 0x00020000,
31 Tc_ChunksExcluded
= 0x00040000,
32 Tc_ChunksLeft
= 0x00080000,
33 Tc_SeedsConnected
= 0x00160000,
34 Tc_SeedsDisconnected
= 0x00320000,
35 Tc_LeechesConnected
= 0x00640000,
36 Tc_LeechesDisconnected
= 0x01280000,
37 Tc_DlRate
= 0x02560000,
38 Tc_UlRate
= 0x05120000,
39 Tc_UlLimit
= 0x07860000,
40 Tc_DlLimit
= 0x09840000,
41 Tc_SessionBytesDownloaded
= 0x10240000,
42 Tc_SessionBytesUploaded
= 0x20480000,
43 Tc_TrackersList
= 0x40960000
46 BTTransfer(TransferGroup
* parent
, TransferFactory
* factory
,
47 Scheduler
* scheduler
, const KUrl
& src
, const KUrl
& dest
,
48 const QDomElement
* e
= 0);
51 //Job virtual functions
54 int elapsedTime() const;
55 int remainingTime() const;
56 bool isResumable() const;
58 //Bittorrent specific functions (connected with TransferFlags
59 int chunksTotal() const;
60 int chunksDownloaded() const;
61 int chunksExcluded() const;
62 int chunksLeft() const;
63 int seedsConnected() const;
64 int seedsDisconnected() const;
65 int leechesConnected() const;
66 int leechesDisconnected() const;
69 int totalSize() const;
70 int sessionBytesDownloaded() const;
71 int sessionBytesUploaded() const;
72 KUrl::List
trackersList() const;
73 bt::TorrentControl
* torrentControl();
78 //More Bittorrent-Functions
79 void setPort(int port
);
80 void setTrafficLimits(int ulLimit
, int dlLimit
);
81 void addTracker(QString url
);
82 void save(const QDomElement
&element
);
87 void load(const QDomElement
&e
);
90 void init(KUrl src
= KUrl());
92 void slotStoppedByError(bt::TorrentInterface
* error
, QString errormsg
);
93 void slotDownloadFinished(bt::TorrentInterface
* ti
);
96 bt::TorrentControl
*torrent
;