2007-09-16 01:02:06 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* $Id$
|
|
|
|
*
|
2010-01-01 21:12:04 +00:00
|
|
|
* Copyright (c) 2006-2010 Transmission authors and contributors
|
2007-09-16 01:02:06 +00:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
#import <transmission.h>
|
2009-09-05 01:58:13 +00:00
|
|
|
#import <Quartz/Quartz.h>
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2008-10-12 13:22:13 +00:00
|
|
|
@class FileListNode;
|
|
|
|
|
2009-10-10 14:30:54 +00:00
|
|
|
#warning uncomment
|
2010-02-13 04:30:47 +00:00
|
|
|
@interface Torrent : NSObject <NSCopying>//, QLPreviewItem>
|
2007-09-16 01:02:06 +00:00
|
|
|
{
|
2007-09-20 20:24:33 +00:00
|
|
|
tr_torrent * fHandle;
|
|
|
|
const tr_info * fInfo;
|
|
|
|
const tr_stat * fStat;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
|
|
|
NSUserDefaults * fDefaults;
|
|
|
|
|
|
|
|
NSImage * fIcon;
|
|
|
|
|
2009-11-26 02:11:00 +00:00
|
|
|
NSString * fHashString;
|
2008-02-06 23:45:44 +00:00
|
|
|
|
2008-03-17 19:59:26 +00:00
|
|
|
tr_file_stat * fFileStat;
|
2008-12-07 02:36:26 +00:00
|
|
|
NSArray * fFileList, * fFlatFileList;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2008-06-11 16:28:33 +00:00
|
|
|
NSIndexSet * fPreviousFinishedIndexes;
|
|
|
|
NSDate * fPreviousFinishedIndexesDate;
|
2007-12-28 21:37:06 +00:00
|
|
|
|
2010-04-02 17:57:25 +00:00
|
|
|
BOOL fWaitToStart, fStalled;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2009-01-24 19:07:25 +00:00
|
|
|
NSInteger fGroupValue;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2009-10-21 13:01:14 +00:00
|
|
|
BOOL fResumeOnWake;
|
|
|
|
|
|
|
|
NSString * fTimeMachineExclude;
|
2007-09-16 01:02:06 +00:00
|
|
|
}
|
|
|
|
|
2009-07-20 00:40:01 +00:00
|
|
|
- (id) initWithPath: (NSString *) path location: (NSString *) location deleteTorrentFile: (BOOL) torrentDelete
|
2008-12-22 19:14:43 +00:00
|
|
|
lib: (tr_session *) lib;
|
|
|
|
- (id) initWithTorrentStruct: (tr_torrent *) torrentStruct location: (NSString *) location lib: (tr_session *) lib;
|
2009-11-25 04:11:52 +00:00
|
|
|
- (id) initWithMagnetAddress: (NSString *) address location: (NSString *) location lib: (tr_session *) lib;
|
2009-05-12 00:58:22 +00:00
|
|
|
- (id) initWithHistory: (NSDictionary *) history lib: (tr_session *) lib forcePause: (BOOL) pause;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
|
|
|
- (NSDictionary *) history;
|
|
|
|
|
|
|
|
- (void) closeRemoveTorrent;
|
|
|
|
|
2009-10-21 13:01:14 +00:00
|
|
|
- (void) changeDownloadFolderBeforeUsing: (NSString *) folder;
|
|
|
|
|
|
|
|
- (NSString *) currentDirectory;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2008-11-02 01:07:01 +00:00
|
|
|
- (void) getAvailability: (int8_t *) tab size: (NSInteger) size;
|
|
|
|
- (void) getAmountFinished: (float *) tab size: (NSInteger) size;
|
2008-06-11 16:28:33 +00:00
|
|
|
- (NSIndexSet *) previousFinishedPieces;
|
|
|
|
-(void) setPreviousFinishedPieces: (NSIndexSet *) indexes;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
|
|
|
- (void) update;
|
|
|
|
|
|
|
|
- (void) startTransfer;
|
|
|
|
- (void) stopTransfer;
|
|
|
|
- (void) sleep;
|
|
|
|
- (void) wakeUp;
|
|
|
|
|
|
|
|
- (void) manualAnnounce;
|
|
|
|
- (BOOL) canManualAnnounce;
|
|
|
|
|
|
|
|
- (void) resetCache;
|
|
|
|
|
2009-11-25 05:04:19 +00:00
|
|
|
- (BOOL) isMagnet;
|
2009-12-04 13:35:15 +00:00
|
|
|
- (NSString *) magnetLink;
|
2009-11-25 05:04:19 +00:00
|
|
|
|
2008-11-02 01:07:01 +00:00
|
|
|
- (CGFloat) ratio;
|
2009-02-14 21:15:57 +00:00
|
|
|
- (tr_ratiolimit) ratioSetting;
|
|
|
|
- (void) setRatioSetting: (tr_ratiolimit) setting;
|
2008-11-02 01:07:01 +00:00
|
|
|
- (CGFloat) ratioLimit;
|
|
|
|
- (void) setRatioLimit: (CGFloat) limit;
|
|
|
|
- (CGFloat) progressStopRatio;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2010-07-24 03:19:41 +00:00
|
|
|
- (tr_idlelimit) idleSetting;
|
|
|
|
- (void) setIdleSetting: (tr_idlelimit) setting;
|
|
|
|
- (NSUInteger) idleLimitMinutes;
|
|
|
|
- (void) setIdleLimitMinutes: (NSUInteger) limit;
|
2010-07-16 03:12:57 +00:00
|
|
|
|
2009-03-05 01:10:09 +00:00
|
|
|
- (BOOL) usesSpeedLimit: (BOOL) upload;
|
|
|
|
- (void) setUseSpeedLimit: (BOOL) use upload: (BOOL) upload;
|
2008-11-02 01:07:01 +00:00
|
|
|
- (NSInteger) speedLimit: (BOOL) upload;
|
|
|
|
- (void) setSpeedLimit: (NSInteger) limit upload: (BOOL) upload;
|
2009-03-05 01:10:09 +00:00
|
|
|
- (BOOL) usesGlobalSpeedLimit;
|
|
|
|
- (void) setUseGlobalSpeedLimit: (BOOL) use;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2007-12-22 05:21:25 +00:00
|
|
|
- (void) setMaxPeerConnect: (uint16_t) count;
|
|
|
|
- (uint16_t) maxPeerConnect;
|
|
|
|
|
2007-09-16 01:02:06 +00:00
|
|
|
- (void) setWaitToStart: (BOOL) wait;
|
|
|
|
- (BOOL) waitingToStart;
|
|
|
|
|
2009-04-20 02:45:27 +00:00
|
|
|
- (tr_priority_t) priority;
|
|
|
|
- (void) setPriority: (tr_priority_t) priority;
|
|
|
|
|
2009-07-20 00:40:01 +00:00
|
|
|
+ (void) trashFile: (NSString *) path;
|
2007-09-16 01:02:06 +00:00
|
|
|
- (void) trashData;
|
|
|
|
- (void) moveTorrentDataFileTo: (NSString *) folder;
|
|
|
|
- (void) copyTorrentFileTo: (NSString *) path;
|
|
|
|
|
|
|
|
- (BOOL) alertForRemainingDiskSpace;
|
|
|
|
|
|
|
|
- (NSImage *) icon;
|
|
|
|
|
|
|
|
- (NSString *) name;
|
2008-05-29 22:16:03 +00:00
|
|
|
- (BOOL) isFolder;
|
2007-09-16 01:02:06 +00:00
|
|
|
- (uint64_t) size;
|
2007-10-07 03:28:06 +00:00
|
|
|
- (uint64_t) sizeLeft;
|
2008-02-22 01:36:30 +00:00
|
|
|
|
2010-02-06 02:35:27 +00:00
|
|
|
- (NSMutableArray *) allTrackerStats;
|
2009-10-11 17:17:29 +00:00
|
|
|
- (NSArray *) allTrackersFlat; //used by GroupRules
|
2009-09-29 03:02:44 +00:00
|
|
|
- (BOOL) addTrackerToNewTier: (NSString *) tracker;
|
2010-01-10 02:34:00 +00:00
|
|
|
- (void) removeTrackersWithIdentifiers: (NSIndexSet *) removeIdentifiers;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
|
|
|
- (NSString *) comment;
|
|
|
|
- (NSString *) creator;
|
|
|
|
- (NSDate *) dateCreated;
|
|
|
|
|
2008-11-02 01:07:01 +00:00
|
|
|
- (NSInteger) pieceSize;
|
|
|
|
- (NSInteger) pieceCount;
|
2007-09-16 01:02:06 +00:00
|
|
|
- (NSString *) hashString;
|
|
|
|
- (BOOL) privateTorrent;
|
|
|
|
|
|
|
|
- (NSString *) torrentLocation;
|
|
|
|
- (NSString *) dataLocation;
|
2009-10-21 13:01:14 +00:00
|
|
|
- (NSString *) fileLocation: (FileListNode *) node;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2008-11-02 01:07:01 +00:00
|
|
|
- (CGFloat) progress;
|
|
|
|
- (CGFloat) progressDone;
|
2009-11-07 02:22:57 +00:00
|
|
|
- (CGFloat) progressLeft;
|
2008-11-02 01:07:01 +00:00
|
|
|
- (CGFloat) checkingProgress;
|
2007-11-23 17:42:49 +00:00
|
|
|
|
2009-09-06 21:09:33 +00:00
|
|
|
- (CGFloat) availableDesired;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
|
|
|
- (BOOL) isActive;
|
|
|
|
- (BOOL) isSeeding;
|
|
|
|
- (BOOL) isChecking;
|
2008-03-19 18:03:02 +00:00
|
|
|
- (BOOL) isCheckingWaiting;
|
2007-09-16 01:02:06 +00:00
|
|
|
- (BOOL) allDownloaded;
|
|
|
|
- (BOOL) isComplete;
|
2010-04-02 17:57:25 +00:00
|
|
|
- (BOOL) isFinishedSeeding;
|
2007-09-16 01:02:06 +00:00
|
|
|
- (BOOL) isError;
|
2009-10-17 17:15:37 +00:00
|
|
|
- (BOOL) isAnyErrorOrWarning;
|
2007-09-16 01:02:06 +00:00
|
|
|
- (NSString *) errorMessage;
|
|
|
|
|
|
|
|
- (NSArray *) peers;
|
2008-06-08 16:38:15 +00:00
|
|
|
|
|
|
|
- (NSUInteger) webSeedCount;
|
2008-06-08 18:02:16 +00:00
|
|
|
- (NSArray *) webSeeds;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
|
|
|
- (NSString *) progressString;
|
|
|
|
- (NSString *) statusString;
|
|
|
|
- (NSString *) shortStatusString;
|
|
|
|
- (NSString *) remainingTimeString;
|
|
|
|
|
2007-09-28 02:58:25 +00:00
|
|
|
- (NSString *) stateString;
|
2008-11-02 01:07:01 +00:00
|
|
|
- (NSInteger) totalPeersConnected;
|
|
|
|
- (NSInteger) totalPeersTracker;
|
|
|
|
- (NSInteger) totalPeersIncoming;
|
|
|
|
- (NSInteger) totalPeersCache;
|
|
|
|
- (NSInteger) totalPeersPex;
|
2009-05-19 22:51:37 +00:00
|
|
|
- (NSInteger) totalPeersDHT;
|
2010-05-01 16:19:40 +00:00
|
|
|
- (NSInteger) totalPeersLocal;
|
2009-11-26 06:15:29 +00:00
|
|
|
- (NSInteger) totalPeersLTEP;
|
2008-11-02 01:07:01 +00:00
|
|
|
- (NSInteger) totalPeersKnown;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2008-11-02 01:07:01 +00:00
|
|
|
- (NSInteger) peersSendingToUs;
|
|
|
|
- (NSInteger) peersGettingFromUs;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2008-11-02 01:07:01 +00:00
|
|
|
- (CGFloat) downloadRate;
|
|
|
|
- (CGFloat) uploadRate;
|
|
|
|
- (CGFloat) totalRate;
|
2007-09-26 03:27:00 +00:00
|
|
|
- (uint64_t) haveVerified;
|
|
|
|
- (uint64_t) haveTotal;
|
2008-02-27 19:34:55 +00:00
|
|
|
- (uint64_t) totalSizeSelected;
|
2007-09-26 18:32:32 +00:00
|
|
|
- (uint64_t) downloadedTotal;
|
2007-09-26 18:43:32 +00:00
|
|
|
- (uint64_t) uploadedTotal;
|
2007-09-26 18:32:32 +00:00
|
|
|
- (uint64_t) failedHash;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2008-11-02 01:07:01 +00:00
|
|
|
- (NSInteger) groupValue;
|
|
|
|
- (void) setGroupValue: (NSInteger) groupValue;
|
|
|
|
- (NSInteger) groupOrderValue;
|
2007-12-19 21:11:49 +00:00
|
|
|
- (void) checkGroupValueForRemoval: (NSNotification *) notification;
|
2007-12-17 16:06:20 +00:00
|
|
|
|
2007-09-16 01:02:06 +00:00
|
|
|
- (NSArray *) fileList;
|
2010-01-02 02:50:22 +00:00
|
|
|
- (NSArray *) flatFileList;
|
2008-11-02 01:07:01 +00:00
|
|
|
- (NSInteger) fileCount;
|
2007-09-16 01:02:06 +00:00
|
|
|
- (void) updateFileStat;
|
|
|
|
|
|
|
|
//methods require fileStats to have been updated recently to be accurate
|
2008-11-02 01:07:01 +00:00
|
|
|
- (CGFloat) fileProgress: (FileListNode *) node;
|
2009-12-26 00:02:20 +00:00
|
|
|
- (BOOL) canChangeDownloadCheckForFile: (NSUInteger) index;
|
2007-09-16 01:02:06 +00:00
|
|
|
- (BOOL) canChangeDownloadCheckForFiles: (NSIndexSet *) indexSet;
|
2008-11-02 01:07:01 +00:00
|
|
|
- (NSInteger) checkForFiles: (NSIndexSet *) indexSet;
|
|
|
|
- (void) setFileCheckState: (NSInteger) state forIndexes: (NSIndexSet *) indexSet;
|
2009-04-20 02:45:27 +00:00
|
|
|
- (void) setFilePriority: (tr_priority_t) priority forIndexes: (NSIndexSet *) indexSet;
|
|
|
|
- (BOOL) hasFilePriority: (tr_priority_t) priority forIndexes: (NSIndexSet *) indexSet;
|
2007-09-16 01:02:06 +00:00
|
|
|
- (NSSet *) filePrioritiesForIndexes: (NSIndexSet *) indexSet;
|
|
|
|
|
|
|
|
- (NSDate *) dateAdded;
|
|
|
|
- (NSDate *) dateCompleted;
|
|
|
|
- (NSDate *) dateActivity;
|
2007-11-23 02:46:29 +00:00
|
|
|
- (NSDate *) dateActivityOrAdd;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2008-11-02 01:07:01 +00:00
|
|
|
- (NSInteger) stalledMinutes;
|
2007-09-16 01:02:06 +00:00
|
|
|
- (BOOL) isStalled;
|
|
|
|
|
2009-10-21 22:20:43 +00:00
|
|
|
- (void) updateTimeMachineExclude;
|
|
|
|
|
2008-06-30 02:22:29 +00:00
|
|
|
- (NSInteger) stateSortKey;
|
2009-10-11 13:42:10 +00:00
|
|
|
- (NSString *) trackerSortKey;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2008-04-07 13:14:31 +00:00
|
|
|
- (tr_torrent *) torrentStruct;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
|
|
|
@end
|