File indexing completed on 2025-01-05 04:37:17
0001 /* 0002 SPDX-FileCopyrightText: 2007 Joris Guisson <joris.guisson@gmail.com> 0003 SPDX-FileCopyrightText: 2007 Ivan Vasic <ivasic@gmail.com> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 #ifndef BTQUEUEMANAGERINTERFACE_H 0008 #define BTQUEUEMANAGERINTERFACE_H 0009 0010 #include <ktorrent_export.h> 0011 0012 namespace bt 0013 { 0014 class SHA1Hash; 0015 class TorrentControl; 0016 struct TrackerTier; 0017 0018 /** 0019 @author 0020 */ 0021 class KTORRENT_EXPORT QueueManagerInterface 0022 { 0023 static bool qm_enabled; 0024 0025 public: 0026 QueueManagerInterface(); 0027 virtual ~QueueManagerInterface(); 0028 0029 /** 0030 * See if we already loaded a torrent. 0031 * @param ih The info hash of a torrent 0032 * @return true if we do, false if we don't 0033 */ 0034 virtual bool alreadyLoaded(const SHA1Hash &ih) const = 0; 0035 0036 /** 0037 * Merge announce lists to a torrent 0038 * @param ih The info_hash of the torrent to merge to 0039 * @param trk First tier of trackers 0040 */ 0041 virtual void mergeAnnounceList(const SHA1Hash &ih, const TrackerTier *trk) = 0; 0042 0043 /** 0044 * Disable or enable the QM 0045 * @param on 0046 */ 0047 static void setQueueManagerEnabled(bool on); 0048 0049 /** 0050 * Requested by each TorrentControl during its update to 0051 * get permission on saving Stats file to disk. May be 0052 * overriden to balance I/O operations. 0053 * @param tc Pointer to TorrentControl instance 0054 * @return true if file save is permitted, false otherwise 0055 */ 0056 0057 virtual bool permitStatsSync(TorrentControl *tc); 0058 0059 static bool enabled() 0060 { 0061 return qm_enabled; 0062 } 0063 }; 0064 0065 } 0066 0067 #endif