~ubuntu-branches/ubuntu/lucid/ktorrent/lucid

« back to all changes in this revision

Viewing changes to libbtcore/interfaces/trackerslist.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-12-08 19:17:41 UTC
  • mfrom: (1.2.1 upstream) (0.7.12 sid)
  • Revision ID: james.westby@ubuntu.com-20091208191741-lqlq0xvnlv8ki19u
Tags: 3.3.1+dfsg.1-1ubuntu1
* Merge with Debian Testing remaining changes:
  - Build-depend directly on libboost-serialization1.40-dev since
    libboost-serialization-dev from boost-defaults is not in Main
  - Add in rules: include /usr/lib/kubuntu-desktop-i18n/debhelper/kubuntu.mk
  - Don't use dpkg-source 3.0 format
  - Add quilt to build-depends

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
namespace bt
27
27
{
28
28
        struct TrackerTier;
 
29
        class TrackerInterface;
29
30
 
30
31
        /**
31
32
         * @author Ivan Vasić <ivasic@gmail.com>
34
35
        */
35
36
        class BTCORE_EXPORT TrackersList
36
37
        {
37
 
                public:
38
 
                        TrackersList();
39
 
                        virtual ~TrackersList();
40
 
                        
41
 
                        /**
42
 
                         * Get the current tracker URL.
43
 
                         */
44
 
                        virtual KUrl getTrackerURL() const = 0;
45
 
                        
46
 
                        /**
47
 
                         * Gets a list of available trackers.
48
 
                         */
49
 
                        virtual KUrl::List getTrackerURLs() = 0;
50
 
                
51
 
                        /**
52
 
                         * Adds a tracker URL to the list.
53
 
                         * @param url The URL
54
 
                         * @param custom Is it a custom tracker
55
 
                         * @param tier Which tier (or priority) the tracker has, tier 1 are 
56
 
                         * the main trackers, tier 2 are backups ...
57
 
                         */
58
 
                        virtual void addTracker(const KUrl &url, bool custom = true,int tier = 1) = 0;
59
 
                
60
 
                        /**
61
 
                         * Removes the tracker from the list.
62
 
                         * @param url - Tracker url.
63
 
                         */
64
 
                        virtual bool removeTracker(const KUrl &url) = 0;
65
 
                
66
 
                        /**
67
 
                         * Sets the current tracker and does the announce.
68
 
                         * @param url - Tracker url.
69
 
                         */
70
 
                        virtual void setTracker(const KUrl &url) = 0;
71
 
                        
72
 
                        /**
73
 
                         * Restores the default tracker and does the announce.
74
 
                         */
75
 
                        virtual void restoreDefault() = 0;
76
 
                        
77
 
                        /**
78
 
                         * Enable or disable a tracker
79
 
                         * @param url The url 
80
 
                         * @param enabled True to enable, false to disable
81
 
                         */
82
 
                        virtual void setTrackerEnabled(const KUrl & url,bool enabled) = 0;
83
 
                        
84
 
                        /**
85
 
                         * See if a tracker is enabled
86
 
                         * @param url The tracker url
87
 
                         * @return true if it is, false if it isn't
88
 
                         */
89
 
                        virtual bool isTrackerEnabled(const KUrl & url) const = 0;
90
 
                        
91
 
                        /**
92
 
                         * Merge an other tracker list.
93
 
                         * @param first The first TrackerTier
94
 
                         */
95
 
                        void merge(const bt::TrackerTier* first);
 
38
        public:
 
39
                TrackersList();
 
40
                virtual ~TrackersList();
 
41
                
 
42
                /**
 
43
                 * Get the current tracker (for non private torrents this returns 0, seeing that
 
44
                 * all trackers are used at the same time)
 
45
                 */
 
46
                virtual TrackerInterface* getCurrentTracker() const = 0;
 
47
                
 
48
                /**
 
49
                * Sets the current tracker and does the announce. For non private torrents, this
 
50
                * does nothing.
 
51
                * @param t The Tracker
 
52
                */
 
53
                virtual void setCurrentTracker(TrackerInterface* t) = 0;
 
54
                
 
55
                /**
 
56
                * Sets the current tracker and does the announce. For non private torrents, this
 
57
                * does nothing.
 
58
                * @param url Url of the tracker
 
59
                */
 
60
                virtual void setCurrentTracker(const KUrl & url) = 0;
 
61
                
 
62
                /**
 
63
                 * Gets a list of all available trackers. 
 
64
                 */
 
65
                virtual QList<TrackerInterface*> getTrackers() = 0;
 
66
        
 
67
                /**
 
68
                 * Adds a tracker URL to the list.
 
69
                 * @param url The URL
 
70
                 * @param custom Is it a custom tracker
 
71
                 * @param tier Which tier (or priority) the tracker has, tier 1 are 
 
72
                 * the main trackers, tier 2 are backups ...
 
73
                 * @return The Tracker
 
74
                 */
 
75
                virtual TrackerInterface* addTracker(const KUrl &url, bool custom = true,int tier = 1) = 0;
 
76
        
 
77
                /**
 
78
                 * Removes the tracker from the list.
 
79
                 * @param t The Tracker
 
80
                 */
 
81
                virtual bool removeTracker(TrackerInterface* t) = 0;
 
82
                
 
83
                /**
 
84
                 * Removes the tracker from the list.
 
85
                 * @param url The tracker url
 
86
                 */
 
87
                virtual bool removeTracker(const KUrl & url) = 0;
 
88
                
 
89
                /**
 
90
                 * Return true if a tracker can be removed
 
91
                 * @param t The tracker
 
92
                 */
 
93
                virtual bool canRemoveTracker(TrackerInterface* t) = 0;
 
94
                
 
95
                /**
 
96
                 * Restores the default tracker and does the announce.
 
97
                 */
 
98
                virtual void restoreDefault() = 0;
 
99
                
 
100
                /**
 
101
                 * Set a tracker enabled or not
 
102
                 */
 
103
                virtual void setTrackerEnabled(const KUrl & url,bool on) = 0;
 
104
                
 
105
                /**
 
106
                 * Merge an other tracker list.
 
107
                 * @param first The first TrackerTier
 
108
                 */
 
109
                void merge(const bt::TrackerTier* first);
96
110
 
97
111
        };
98
112