libktorrent  2.2.0
uploader.h
1 /***************************************************************************
2  * Copyright (C) 2005 by Joris Guisson *
3  * joris.guisson@gmail.com *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 #ifndef BTUPLOADER_H
21 #define BTUPLOADER_H
22 
23 #include <peer/peermanager.h>
24 #include "globals.h"
25 
26 namespace bt
27 {
28  class Peer;
29  class ChunkManager;
30 
31 
38  class Uploader : public QObject, public PeerManager::PeerVisitor
39  {
40  Q_OBJECT
41  public:
46  Uploader(ChunkManager & cman,PeerManager & pman);
47  ~Uploader() override;
48 
50  Uint64 bytesUploaded() const {return uploaded;}
51 
53  Uint32 uploadRate() const;
54 
56  void setBytesUploaded(Uint64 b) {uploaded = b;}
57 
58  public Q_SLOTS:
62  void update();
63 
64  private:
65  void visit(const bt::Peer::Ptr p) override;
66 
67  private:
68  ChunkManager & cman;
69  PeerManager & pman;
70  Uint64 uploaded;
71  };
72 
73 }
74 
75 #endif
bt::ChunkManager
Definition: chunkmanager.h:61
bt::PeerManager
Manages all the Peers.
Definition: peermanager.h:67
bt::Uploader::Uploader
Uploader(ChunkManager &cman, PeerManager &pman)
bt::Uploader::setBytesUploaded
void setBytesUploaded(Uint64 b)
Set the number of bytes which have been uploaded.
Definition: uploader.h:74
bt::Uploader::bytesUploaded
Uint64 bytesUploaded() const
Get the number of bytes uploaded.
Definition: uploader.h:68
bt::Uploader::uploadRate
Uint32 uploadRate() const
Get the upload rate of all Peers combined.
bt::Uploader::update
void update()