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

kget

  • sources
  • kde-4.12
  • kdenetwork
  • kget
  • transfer-plugins
  • bittorrent
  • advanceddetails
monitor.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2007 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 #include "monitor.h"
21 
22 #include <interfaces/peerinterface.h>
23 #include <interfaces/torrentinterface.h>
24 #include <interfaces/torrentfileinterface.h>
25 #include <interfaces/chunkdownloadinterface.h>
26 #include "peerview.h"
27 #include "chunkdownloadview.h"
28 #include "fileview.h"
29 
30 using namespace bt;
31 
32 namespace kt
33 {
34 
35  Monitor::Monitor(bt::TorrentInterface* tc,PeerView* pv,ChunkDownloadView* cdv,FileView* fv)
36  : tc(tc),pv(pv),cdv(cdv),fv(fv)
37  {
38  if (tc)
39  tc->setMonitor(this);
40  }
41 
42 
43  Monitor::~Monitor()
44  {
45  if (tc)
46  tc->setMonitor(0);
47  }
48 
49 
50  void Monitor::downloadRemoved(bt::ChunkDownloadInterface* cd)
51  {
52  if (cdv)
53  cdv->downloadRemoved(cd);
54  }
55 
56  void Monitor::downloadStarted(bt::ChunkDownloadInterface* cd)
57  {
58  if (cdv)
59  cdv->downloadAdded(cd);
60  }
61 
62  void Monitor::peerAdded(bt::PeerInterface* peer)
63  {
64  if (pv)
65  pv->peerAdded(peer);
66  }
67 
68  void Monitor::peerRemoved(bt::PeerInterface* peer)
69  {
70  if (pv)
71  pv->peerRemoved(peer);
72  }
73 
74  void Monitor::stopped()
75  {
76  if (pv)
77  pv->removeAll();
78  if (cdv)
79  cdv->removeAll();
80  }
81 
82  void Monitor::destroyed()
83  {
84  if (pv)
85  pv->removeAll();
86  if (cdv)
87  cdv->removeAll();
88  tc = 0;
89  }
90 
91  void Monitor::filePercentageChanged(bt::TorrentFileInterface* file,float percentage)
92  {
93  if (fv)
94  fv->filePercentageChanged(file,percentage);
95  }
96 
97  void Monitor::filePreviewChanged(bt::TorrentFileInterface* file,bool preview)
98  {
99  if (fv)
100  fv->filePreviewChanged(file,preview);
101  }
102 }
kt::PeerView
View which shows a list of peers, of a torrent.
Definition: peerview.h:38
chunkdownloadview.h
kt::FileView::filePercentageChanged
void filePercentageChanged(bt::TorrentFileInterface *file, float percentage)
Definition: fileview.cpp:448
kt::Monitor::~Monitor
virtual ~Monitor()
Definition: monitor.cpp:43
fileview.h
kt::Monitor::destroyed
virtual void destroyed()
Definition: monitor.cpp:82
kt::ChunkDownloadView::downloadRemoved
void downloadRemoved(bt::ChunkDownloadInterface *cd)
A download has been removed.
Definition: chunkdownloadview.cpp:59
kt::FileView
Definition: fileview.h:43
kt::PeerView::removeAll
void removeAll()
Remove all items.
Definition: peerview.cpp:112
kt::ChunkDownloadView::downloadAdded
void downloadAdded(bt::ChunkDownloadInterface *cd)
A peer has been added.
Definition: chunkdownloadview.cpp:54
kt::FileView::filePreviewChanged
void filePreviewChanged(bt::TorrentFileInterface *file, bool preview)
Definition: fileview.cpp:454
kt::PeerView::peerRemoved
void peerRemoved(bt::PeerInterface *peer)
A peer has been removed.
Definition: peerview.cpp:102
kt::Monitor::filePercentageChanged
virtual void filePercentageChanged(bt::TorrentFileInterface *file, float percentage)
Definition: monitor.cpp:91
kt::Monitor::stopped
virtual void stopped()
Definition: monitor.cpp:74
kt::ChunkDownloadView::removeAll
void removeAll()
Remove all items.
Definition: chunkdownloadview.cpp:94
kt::Monitor::peerAdded
virtual void peerAdded(bt::PeerInterface *peer)
Definition: monitor.cpp:62
kt::ChunkDownloadView
View which shows a list of downloading chunks, of a torrent.
Definition: chunkdownloadview.h:43
kt::Monitor::downloadStarted
virtual void downloadStarted(bt::ChunkDownloadInterface *cd)
Definition: monitor.cpp:56
peerview.h
kt::PeerView::peerAdded
void peerAdded(bt::PeerInterface *peer)
A peer has been added.
Definition: peerview.cpp:97
monitor.h
kt::Monitor::peerRemoved
virtual void peerRemoved(bt::PeerInterface *peer)
Definition: monitor.cpp:68
kt::Monitor::filePreviewChanged
virtual void filePreviewChanged(bt::TorrentFileInterface *file, bool preview)
Definition: monitor.cpp:97
kt::Monitor::downloadRemoved
virtual void downloadRemoved(bt::ChunkDownloadInterface *cd)
Definition: monitor.cpp:50
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:17 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kget

Skip menu "kget"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal