File indexing completed on 2025-01-05 04:37:18
0001 /* 0002 SPDX-FileCopyrightText: 2008 Joris Guisson <joris.guisson@gmail.com> 0003 SPDX-FileCopyrightText: 2008 Ivan Vasic <ivasic@gmail.com> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 #ifndef BTWEBSEEDINTERFACE_H 0008 #define BTWEBSEEDINTERFACE_H 0009 0010 #include <QUrl> 0011 #include <ktorrent_export.h> 0012 #include <util/constants.h> 0013 0014 namespace bt 0015 { 0016 /** 0017 Interface for WebSeeds 0018 */ 0019 class KTORRENT_EXPORT WebSeedInterface 0020 { 0021 public: 0022 WebSeedInterface(const QUrl &url, bool user); 0023 virtual ~WebSeedInterface(); 0024 0025 /// Disable or enable the webseed 0026 virtual void setEnabled(bool on); 0027 0028 /// Whether or not the webseed is enabled 0029 bool isEnabled() const 0030 { 0031 return enabled; 0032 } 0033 0034 /// Get the URL of the webseed 0035 const QUrl &getUrl() const 0036 { 0037 return url; 0038 } 0039 0040 /// Get how much data was downloaded 0041 Uint64 getTotalDownloaded() const 0042 { 0043 return total_downloaded; 0044 } 0045 0046 /// Get the present status in string form 0047 QString getStatus() const 0048 { 0049 return status; 0050 } 0051 0052 /// Get the current download rate in bytes per sec 0053 virtual Uint32 getDownloadRate() const = 0; 0054 0055 /// Whether or not this webseed was user created 0056 bool isUserCreated() const 0057 { 0058 return user; 0059 } 0060 0061 protected: 0062 QUrl url; 0063 Uint64 total_downloaded; 0064 QString status; 0065 bool user; 0066 bool enabled; 0067 }; 0068 0069 } 0070 0071 #endif