File indexing completed on 2025-01-05 04:37:17

0001 /*
0002     SPDX-FileCopyrightText: 2005 Joris Guisson <joris.guisson@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 #ifndef BTMONITORINTERFACE_H
0007 #define BTMONITORINTERFACE_H
0008 
0009 #include <ktorrent_export.h>
0010 
0011 namespace bt
0012 {
0013 class ChunkDownloadInterface;
0014 class PeerInterface;
0015 class TorrentFileInterface;
0016 
0017 /**
0018  * @author Joris Guisson
0019  * @brief Interface for classes who want to monitor a TorrentInterface
0020  *
0021  * Classes who want to keep track of all peers currently connected for a given
0022  * torrent and all chunks who are currently downloading can implement this interface.
0023  */
0024 class KTORRENT_EXPORT MonitorInterface
0025 {
0026 public:
0027     MonitorInterface();
0028     virtual ~MonitorInterface();
0029 
0030     /**
0031      * A peer has been added.
0032      * @param peer The peer
0033      */
0034     virtual void peerAdded(PeerInterface *peer) = 0;
0035 
0036     /**
0037      * A peer has been removed.
0038      * @param peer The peer
0039      */
0040     virtual void peerRemoved(PeerInterface *peer) = 0;
0041 
0042     /**
0043      * The download of a chunk has been started.
0044      * @param cd The ChunkDownload
0045      */
0046     virtual void downloadStarted(ChunkDownloadInterface *cd) = 0;
0047 
0048     /**
0049      * The download of a chunk has been stopped.
0050      * @param cd The ChunkDownload
0051      */
0052     virtual void downloadRemoved(ChunkDownloadInterface *cd) = 0;
0053 
0054     /**
0055      * The download has been stopped.
0056      */
0057     virtual void stopped() = 0;
0058 
0059     /**
0060      * The download has been deleted.
0061      */
0062     virtual void destroyed() = 0;
0063 
0064     /**
0065      * The download percentage of a file has changed.
0066      * @param file The file
0067      * @param percentage The percentage
0068      */
0069     virtual void filePercentageChanged(TorrentFileInterface *file, float percentage) = 0;
0070 
0071     /**
0072      * Preview status of a file has changed.
0073      * @param file The file
0074      * @param preview Whether or not it is available
0075      */
0076     virtual void filePreviewChanged(TorrentFileInterface *file, bool preview) = 0;
0077 };
0078 
0079 }
0080 
0081 #endif