~ubuntu-branches/ubuntu/precise/transmission/precise

« back to all changes in this revision

Viewing changes to macosx/Torrent.h

  • Committer: Bazaar Package Importer
  • Author(s): Leo Costela
  • Date: 2009-05-17 19:39:51 UTC
  • mto: (1.3.4 upstream) (2.2.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 36.
  • Revision ID: james.westby@ubuntu.com-20090517193951-k8x15sqoxzf7cuyx
ImportĀ upstreamĀ versionĀ 1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/******************************************************************************
2
 
 * $Id: Torrent.h 5678 2008-04-24 06:35:21Z livings124 $
 
2
 * $Id: Torrent.h 8260 2009-04-20 02:45:27Z livings124 $
3
3
 *
4
 
 * Copyright (c) 2006-2008 Transmission authors and contributors
 
4
 * Copyright (c) 2006-2009 Transmission authors and contributors
5
5
 *
6
6
 * Permission is hereby granted, free of charge, to any person obtaining a
7
7
 * copy of this software and associated documentation files (the "Software"),
25
25
#import <Cocoa/Cocoa.h>
26
26
#import <transmission.h>
27
27
 
28
 
#define INVALID -99
 
28
@class FileListNode;
29
29
 
30
30
typedef enum
31
31
{
34
34
    TORRENT_FILE_DEFAULT
35
35
} torrentFileState;
36
36
 
 
37
#define STAT_TIME_NONE -1
 
38
#define STAT_TIME_NOW -2
 
39
 
37
40
@interface Torrent : NSObject
38
41
{
39
42
    tr_torrent * fHandle;
40
43
    const tr_info * fInfo;
41
44
    const tr_stat * fStat;
42
45
    
43
 
    int fID;
44
 
    
45
46
    BOOL fResumeOnWake;
46
 
    NSDate * fDateAdded, * fDateCompleted, * fDateActivity;
47
47
    
48
48
    BOOL fUseIncompleteFolder;
49
49
    NSString * fDownloadFolder, * fIncompleteFolder;
58
58
    NSString * fNameString, * fHashString;
59
59
    
60
60
    tr_file_stat * fFileStat;
61
 
    NSArray * fFileList;
62
 
    
63
 
    float * fPreviousFinishedPieces;
64
 
    NSDate * fFinishedPiecesDate;
65
 
    
66
 
    float fRatioLimit;
67
 
    int fRatioSetting;
 
61
    NSArray * fFileList, * fFlatFileList;
 
62
    
 
63
    NSIndexSet * fPreviousFinishedIndexes;
 
64
    NSDate * fPreviousFinishedIndexesDate;
 
65
    
68
66
    BOOL fFinishedSeeding, fWaitToStart, fStalled;
69
67
    
70
 
    int fOrderValue, fGroupValue;
 
68
    NSInteger fGroupValue;
 
69
    
 
70
    BOOL fAddedTrackers;
71
71
    
72
72
    NSDictionary * fQuickPauseDict;
73
73
}
74
74
 
75
75
- (id) initWithPath: (NSString *) path location: (NSString *) location deleteTorrentFile: (torrentFileState) torrentDelete
76
 
        lib: (tr_handle *) lib;
77
 
- (id) initWithData: (NSData *) data location: (NSString *) location lib: (tr_handle *) lib;
78
 
- (id) initWithHistory: (NSDictionary *) history lib: (tr_handle *) lib;
 
76
        lib: (tr_session *) lib;
 
77
- (id) initWithTorrentStruct: (tr_torrent *) torrentStruct location: (NSString *) location lib: (tr_session *) lib;
 
78
- (id) initWithHistory: (NSDictionary *) history lib: (tr_session *) lib;
79
79
 
80
80
- (NSDictionary *) history;
81
81
 
85
85
- (void) changeDownloadFolder: (NSString *) folder;
86
86
- (NSString *) downloadFolder;
87
87
 
88
 
- (void) getAvailability: (int8_t *) tab size: (int) size;
89
 
- (void) getAmountFinished: (float *) tab size: (int) size;
90
 
- (float *) getPreviousAmountFinished;
91
 
-(void) setPreviousAmountFinished: (float *) tab;
 
88
- (void) getAvailability: (int8_t *) tab size: (NSInteger) size;
 
89
- (void) getAmountFinished: (float *) tab size: (NSInteger) size;
 
90
- (NSIndexSet *) previousFinishedPieces;
 
91
-(void) setPreviousFinishedPieces: (NSIndexSet *) indexes;
92
92
 
93
93
- (void) update;
94
94
 
102
102
 
103
103
- (void) resetCache;
104
104
 
105
 
- (float) ratio;
106
 
- (int) ratioSetting;
107
 
- (void) setRatioSetting: (int) setting;
108
 
- (float) ratioLimit;
109
 
- (void) setRatioLimit: (float) limit;
110
 
- (float) actualStopRatio; //returns INVALID if will not stop
111
 
- (float) progressStopRatio;
 
105
- (CGFloat) ratio;
 
106
- (tr_ratiolimit) ratioSetting;
 
107
- (void) setRatioSetting: (tr_ratiolimit) setting;
 
108
- (CGFloat) ratioLimit;
 
109
- (void) setRatioLimit: (CGFloat) limit;
 
110
- (BOOL) seedRatioSet;
 
111
- (CGFloat) progressStopRatio;
112
112
 
113
 
- (tr_speedlimit) speedMode: (BOOL) upload;
114
 
- (void) setSpeedMode: (tr_speedlimit) mode upload: (BOOL) upload;
115
 
- (int) speedLimit: (BOOL) upload;
116
 
- (void) setSpeedLimit: (int) limit upload: (BOOL) upload;
 
113
- (BOOL) usesSpeedLimit: (BOOL) upload;
 
114
- (void) setUseSpeedLimit: (BOOL) use upload: (BOOL) upload;
 
115
- (NSInteger) speedLimit: (BOOL) upload;
 
116
- (void) setSpeedLimit: (NSInteger) limit upload: (BOOL) upload;
 
117
- (BOOL) usesGlobalSpeedLimit;
 
118
- (void) setUseGlobalSpeedLimit: (BOOL) use;
117
119
 
118
120
- (void) setMaxPeerConnect: (uint16_t) count;
119
121
- (uint16_t) maxPeerConnect;
121
123
- (void) setWaitToStart: (BOOL) wait;
122
124
- (BOOL) waitingToStart;
123
125
 
 
126
- (tr_priority_t) priority;
 
127
- (void) setPriority: (tr_priority_t) priority;
 
128
 
124
129
- (void) revealData;
125
130
- (void) revealPublicTorrent;
126
131
- (void) trashData;
135
140
- (NSImage *) icon;
136
141
 
137
142
- (NSString *) name;
138
 
- (BOOL) folder;
 
143
- (BOOL) isFolder;
139
144
- (uint64_t) size;
140
145
- (uint64_t) sizeLeft;
141
146
 
142
147
- (NSString *) trackerAddressAnnounce;
143
148
- (NSDate *) lastAnnounceTime;
144
 
- (int) nextAnnounceTime;
 
149
- (NSInteger) nextAnnounceTime;
145
150
- (NSString *) announceResponse;
146
151
 
147
152
- (NSString *) trackerAddressScrape;
148
153
- (NSDate *) lastScrapeTime;
149
 
- (int) nextScrapeTime;
 
154
- (NSInteger) nextScrapeTime;
150
155
- (NSString *) scrapeResponse;
151
156
 
152
 
- (NSArray *) allTrackers: (BOOL) separators;
 
157
- (NSMutableArray *) allTrackers: (BOOL) separators;
 
158
- (NSArray *) allTrackersFlat;
 
159
- (BOOL) updateAllTrackersForAdd: (NSMutableArray *) trackers;
 
160
- (void) updateAllTrackersForRemove: (NSMutableArray *) trackers;
 
161
- (BOOL) hasAddedTrackers;
153
162
 
154
163
- (NSString *) comment;
155
164
- (NSString *) creator;
156
165
- (NSDate *) dateCreated;
157
166
 
158
 
- (int) pieceSize;
159
 
- (int) pieceCount;
 
167
- (NSInteger) pieceSize;
 
168
- (NSInteger) pieceCount;
160
169
- (NSString *) hashString;
161
170
- (BOOL) privateTorrent;
162
171
 
166
175
 
167
176
- (BOOL) publicTorrent;
168
177
 
169
 
- (float) progress;
170
 
- (float) progressDone;
171
 
- (float) progressLeft;
172
 
- (float) checkingProgress;
173
 
 
174
 
- (int) eta;
175
 
- (int) etaRatio;
176
 
 
177
 
- (float) notAvailableDesired;
 
178
- (CGFloat) progress;
 
179
- (CGFloat) progressDone;
 
180
- (CGFloat) progressLeft;
 
181
- (CGFloat) checkingProgress;
 
182
 
 
183
- (NSInteger) eta;
 
184
 
 
185
- (CGFloat) notAvailableDesired;
178
186
 
179
187
- (BOOL) isActive;
180
188
- (BOOL) isSeeding;
187
195
 
188
196
- (NSArray *) peers;
189
197
 
 
198
- (NSUInteger) webSeedCount;
 
199
- (NSArray *) webSeeds;
 
200
 
190
201
- (NSString *) progressString;
191
202
- (NSString *) statusString;
192
203
- (NSString *) shortStatusString;
194
205
 
195
206
- (NSString *) stateString;
196
207
 
197
 
- (int) seeders;
198
 
- (int) leechers;
199
 
- (int) completedFromTracker;
200
 
 
201
 
- (int) totalPeersConnected;
202
 
- (int) totalPeersTracker;
203
 
- (int) totalPeersIncoming;
204
 
- (int) totalPeersCache;
205
 
- (int) totalPeersPex;
206
 
- (int) totalPeersKnown;
207
 
 
208
 
- (int) peersSendingToUs;
209
 
- (int) peersGettingFromUs;
210
 
 
211
 
- (float) downloadRate;
212
 
- (float) uploadRate;
213
 
- (float) totalRate;
 
208
- (NSInteger) seeders;
 
209
- (NSInteger) leechers;
 
210
- (NSInteger) completedFromTracker;
 
211
 
 
212
- (NSInteger) totalPeersConnected;
 
213
- (NSInteger) totalPeersTracker;
 
214
- (NSInteger) totalPeersIncoming;
 
215
- (NSInteger) totalPeersCache;
 
216
- (NSInteger) totalPeersPex;
 
217
- (NSInteger) totalPeersKnown;
 
218
 
 
219
- (NSInteger) peersSendingToUs;
 
220
- (NSInteger) peersGettingFromUs;
 
221
 
 
222
- (CGFloat) downloadRate;
 
223
- (CGFloat) uploadRate;
 
224
- (CGFloat) totalRate;
214
225
- (uint64_t) haveVerified;
215
226
- (uint64_t) haveTotal;
216
227
- (uint64_t) totalSizeSelected;
217
228
- (uint64_t) downloadedTotal;
218
229
- (uint64_t) uploadedTotal;
219
230
- (uint64_t) failedHash;
220
 
- (float) swarmSpeed;
221
 
 
222
 
- (int) orderValue;
223
 
- (void) setOrderValue: (int) orderValue;
224
 
 
225
 
- (int) groupValue;
226
 
- (void) setGroupValue: (int) groupValue;
227
 
- (int) groupOrderValue;
 
231
- (CGFloat) swarmSpeed;
 
232
 
 
233
- (NSInteger) groupValue;
 
234
- (void) setGroupValue: (NSInteger) groupValue;
 
235
- (NSInteger) groupOrderValue;
228
236
- (void) checkGroupValueForRemoval: (NSNotification *) notification;
229
237
 
230
238
- (NSArray *) fileList;
231
 
- (int) fileCount;
 
239
- (NSInteger) fileCount;
232
240
- (void) updateFileStat;
 
241
- (NSArray *) flatFileList;
233
242
 
234
243
//methods require fileStats to have been updated recently to be accurate
235
 
- (float) fileProgress: (int) index;
236
 
- (BOOL) canChangeDownloadCheckForFile: (int) index;
 
244
- (CGFloat) fileProgress: (FileListNode *) node;
 
245
- (BOOL) canChangeDownloadCheckForFile: (NSInteger) index;
237
246
- (BOOL) canChangeDownloadCheckForFiles: (NSIndexSet *) indexSet;
238
 
- (int) checkForFiles: (NSIndexSet *) indexSet;
239
 
- (void) setFileCheckState: (int) state forIndexes: (NSIndexSet *) indexSet;
240
 
- (void) setFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet;
241
 
- (BOOL) hasFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet;
 
247
- (NSInteger) checkForFiles: (NSIndexSet *) indexSet;
 
248
- (void) setFileCheckState: (NSInteger) state forIndexes: (NSIndexSet *) indexSet;
 
249
- (void) setFilePriority: (tr_priority_t) priority forIndexes: (NSIndexSet *) indexSet;
 
250
- (BOOL) hasFilePriority: (tr_priority_t) priority forIndexes: (NSIndexSet *) indexSet;
242
251
- (NSSet *) filePrioritiesForIndexes: (NSIndexSet *) indexSet;
243
252
 
244
253
- (NSDate *) dateAdded;
246
255
- (NSDate *) dateActivity;
247
256
- (NSDate *) dateActivityOrAdd;
248
257
 
249
 
- (int) stalledMinutes;
 
258
- (NSInteger) stalledMinutes;
250
259
- (BOOL) isStalled;
251
260
 
252
 
- (NSNumber *) stateSortKey;
 
261
- (NSInteger) stateSortKey;
253
262
 
254
 
- (int) torrentID;
255
263
- (tr_torrent *) torrentStruct;
256
264
 
257
265
@end