2006-07-16 19:39:23 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* $Id$
|
|
|
|
*
|
2007-04-03 02:22:25 +00:00
|
|
|
* Copyright (c) 2006-2007 Transmission authors and contributors
|
2006-07-16 19:39:23 +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>
|
|
|
|
|
2007-03-22 04:30:08 +00:00
|
|
|
#define INVALID -99
|
|
|
|
|
2006-07-16 19:39:23 +00:00
|
|
|
@interface Torrent : NSObject
|
|
|
|
{
|
|
|
|
tr_handle_t * fLib;
|
|
|
|
tr_torrent_t * fHandle;
|
|
|
|
tr_info_t * fInfo;
|
|
|
|
tr_stat_t * fStat;
|
|
|
|
|
|
|
|
BOOL fResumeOnWake;
|
2007-03-31 01:00:51 +00:00
|
|
|
NSDate * fDateAdded, * fDateCompleted, * fAnnounceDate;
|
2006-07-16 19:39:23 +00:00
|
|
|
|
2006-11-03 16:01:45 +00:00
|
|
|
BOOL fUseIncompleteFolder;
|
|
|
|
NSString * fDownloadFolder, * fIncompleteFolder;
|
|
|
|
|
2006-11-05 19:08:38 +00:00
|
|
|
BOOL fPublicTorrent;
|
2006-07-16 19:39:23 +00:00
|
|
|
NSString * fPublicTorrentLocation;
|
2007-03-31 20:08:10 +00:00
|
|
|
|
|
|
|
BOOL fPex;
|
2006-07-16 19:39:23 +00:00
|
|
|
|
2007-01-17 20:50:42 +00:00
|
|
|
NSUserDefaults * fDefaults;
|
2006-07-16 19:39:23 +00:00
|
|
|
|
2007-01-17 20:50:42 +00:00
|
|
|
NSImage * fIcon, * fIconFlipped, * fIconSmall;
|
2006-07-25 00:59:14 +00:00
|
|
|
NSMutableString * fNameString, * fProgressString, * fStatusString, * fShortStatusString, * fRemainingTimeString;
|
2006-07-16 19:39:23 +00:00
|
|
|
|
2007-02-23 13:40:30 +00:00
|
|
|
NSArray * fFileList, * fFileFlatList;
|
2006-12-27 02:57:55 +00:00
|
|
|
|
2006-12-28 00:29:05 +00:00
|
|
|
int fUploadLimit, fDownloadLimit;
|
2006-07-16 19:39:23 +00:00
|
|
|
float fRatioLimit;
|
2007-02-02 17:54:24 +00:00
|
|
|
int fCheckUpload, fCheckDownload, fRatioSetting;
|
|
|
|
BOOL fFinishedSeeding, fWaitToStart, fError, fChecking;
|
2006-07-16 19:39:23 +00:00
|
|
|
|
|
|
|
int fOrderValue;
|
2006-10-05 21:21:30 +00:00
|
|
|
|
|
|
|
NSBitmapImageRep * fBitmap;
|
|
|
|
int8_t * fPieces;
|
2006-07-16 19:39:23 +00:00
|
|
|
}
|
|
|
|
|
2006-11-13 04:05:24 +00:00
|
|
|
- (id) initWithPath: (NSString *) path forceDeleteTorrent: (BOOL) delete lib: (tr_handle_t *) lib;
|
2006-07-16 19:39:23 +00:00
|
|
|
- (id) initWithHistory: (NSDictionary *) history lib: (tr_handle_t *) lib;
|
|
|
|
|
|
|
|
- (NSDictionary *) history;
|
|
|
|
|
|
|
|
- (void) setDownloadFolder: (NSString *) path;
|
|
|
|
- (NSString *) downloadFolder;
|
2006-10-12 23:34:20 +00:00
|
|
|
|
|
|
|
- (void) getAvailability: (int8_t *) tab size: (int) size;
|
2006-10-13 01:34:15 +00:00
|
|
|
- (void) getAmountFinished: (float *) tab size: (int) size;
|
2006-07-16 19:39:23 +00:00
|
|
|
|
2006-09-11 23:52:03 +00:00
|
|
|
- (void) update;
|
|
|
|
- (NSDictionary *) infoForCurrentView;
|
|
|
|
|
2006-07-16 19:39:23 +00:00
|
|
|
- (void) startTransfer;
|
|
|
|
- (void) stopTransfer;
|
|
|
|
- (void) stopTransferForQuit;
|
|
|
|
- (void) sleep;
|
|
|
|
- (void) wakeUp;
|
|
|
|
|
2006-12-26 21:02:00 +00:00
|
|
|
- (void) announce;
|
|
|
|
- (NSDate *) announceDate;
|
|
|
|
|
2007-01-15 04:09:56 +00:00
|
|
|
- (BOOL) allDownloaded;
|
|
|
|
|
2006-07-16 19:39:23 +00:00
|
|
|
- (float) ratio;
|
2007-02-02 17:54:24 +00:00
|
|
|
- (int) ratioSetting;
|
|
|
|
- (void) setRatioSetting: (int) setting;
|
2006-07-16 19:39:23 +00:00
|
|
|
- (float) ratioLimit;
|
|
|
|
- (void) setRatioLimit: (float) limit;
|
2007-03-22 04:30:08 +00:00
|
|
|
- (float) actualStopRatio; //returns INVALID if will not stop
|
2006-07-16 19:39:23 +00:00
|
|
|
|
2007-02-02 17:33:32 +00:00
|
|
|
- (int) checkUpload;
|
|
|
|
- (void) setCheckUpload: (int) setting;
|
2006-12-28 00:29:05 +00:00
|
|
|
- (int) uploadLimit;
|
|
|
|
- (void) setUploadLimit: (int) limit;
|
2007-02-02 17:33:32 +00:00
|
|
|
- (int) checkDownload;
|
|
|
|
- (void) setCheckDownload: (int) setting;
|
2006-12-28 00:29:05 +00:00
|
|
|
- (int) downloadLimit;
|
|
|
|
- (void) setDownloadLimit: (int) limit;
|
|
|
|
|
2007-01-08 15:11:15 +00:00
|
|
|
- (void) updateSpeedSetting;
|
2006-12-27 02:57:55 +00:00
|
|
|
|
2006-07-16 19:39:23 +00:00
|
|
|
- (void) setWaitToStart: (BOOL) wait;
|
|
|
|
- (BOOL) waitingToStart;
|
|
|
|
|
|
|
|
- (void) revealData;
|
2006-10-15 19:57:40 +00:00
|
|
|
- (void) revealPublicTorrent;
|
2006-07-16 19:39:23 +00:00
|
|
|
- (void) trashData;
|
|
|
|
- (void) trashTorrent;
|
|
|
|
|
2006-11-16 19:32:01 +00:00
|
|
|
- (BOOL) alertForRemainingDiskSpace;
|
2007-01-14 20:22:51 +00:00
|
|
|
- (BOOL) alertForFolderAvailable;
|
|
|
|
- (BOOL) alertForMoveFolderAvailable;
|
2006-09-28 00:32:26 +00:00
|
|
|
|
2006-07-16 19:39:23 +00:00
|
|
|
- (NSImage *) icon;
|
|
|
|
- (NSImage *) iconFlipped;
|
|
|
|
- (NSImage *) iconSmall;
|
|
|
|
|
|
|
|
- (NSString *) name;
|
|
|
|
- (uint64_t) size;
|
2006-12-26 21:02:00 +00:00
|
|
|
- (NSString *) trackerAddress;
|
|
|
|
- (NSString *) trackerAddressAnnounce;
|
2006-11-23 01:38:18 +00:00
|
|
|
|
|
|
|
- (NSString *) comment;
|
|
|
|
- (NSString *) creator;
|
|
|
|
- (NSDate *) dateCreated;
|
|
|
|
|
2006-07-16 19:39:23 +00:00
|
|
|
- (int) pieceSize;
|
|
|
|
- (int) pieceCount;
|
|
|
|
- (NSString *) hashString;
|
2006-12-17 16:36:27 +00:00
|
|
|
- (BOOL) privateTorrent;
|
2006-07-16 19:39:23 +00:00
|
|
|
|
|
|
|
- (NSString *) torrentLocation;
|
|
|
|
- (NSString *) publicTorrentLocation;
|
|
|
|
- (NSString *) dataLocation;
|
|
|
|
|
|
|
|
- (BOOL) publicTorrent;
|
|
|
|
|
|
|
|
- (NSString *) stateString;
|
|
|
|
|
|
|
|
- (float) progress;
|
|
|
|
- (int) eta;
|
|
|
|
|
2006-12-17 16:36:27 +00:00
|
|
|
- (BOOL) isActive;
|
|
|
|
- (BOOL) isSeeding;
|
|
|
|
- (BOOL) isPaused;
|
|
|
|
- (BOOL) isError;
|
|
|
|
- (NSString *) errorMessage;
|
|
|
|
- (BOOL) justFinished;
|
2006-07-16 19:39:23 +00:00
|
|
|
|
2006-08-13 15:46:02 +00:00
|
|
|
- (NSArray *) peers;
|
|
|
|
|
2006-07-25 00:59:14 +00:00
|
|
|
- (NSString *) progressString;
|
|
|
|
- (NSString *) statusString;
|
|
|
|
- (NSString *) shortStatusString;
|
|
|
|
- (NSString *) remainingTimeString;
|
2006-07-16 19:39:23 +00:00
|
|
|
|
|
|
|
- (int) seeders;
|
|
|
|
- (int) leechers;
|
2006-12-02 01:46:54 +00:00
|
|
|
- (int) completedFromTracker;
|
2007-03-23 08:28:01 +00:00
|
|
|
|
2006-07-16 19:39:23 +00:00
|
|
|
- (int) totalPeers;
|
2007-03-23 08:28:01 +00:00
|
|
|
- (int) totalPeersTracker;
|
2006-10-13 18:58:12 +00:00
|
|
|
- (int) totalPeersIncoming;
|
2007-03-23 08:28:01 +00:00
|
|
|
- (int) totalPeersCache;
|
|
|
|
- (int) totalPeersPex;
|
|
|
|
|
2006-07-16 19:39:23 +00:00
|
|
|
- (int) peersUploading;
|
|
|
|
- (int) peersDownloading;
|
|
|
|
|
|
|
|
- (float) downloadRate;
|
|
|
|
- (float) uploadRate;
|
2007-04-05 23:03:03 +00:00
|
|
|
- (uint64_t) downloadedValid;
|
2006-07-16 19:39:23 +00:00
|
|
|
- (uint64_t) downloadedTotal;
|
|
|
|
- (uint64_t) uploadedTotal;
|
2006-08-17 03:12:40 +00:00
|
|
|
- (float) swarmSpeed;
|
2006-07-16 19:39:23 +00:00
|
|
|
|
2007-03-31 20:08:10 +00:00
|
|
|
- (BOOL) pex;
|
2007-03-31 20:19:19 +00:00
|
|
|
- (void) setPex: (BOOL) setting;
|
2007-03-31 20:08:10 +00:00
|
|
|
|
2006-07-16 19:39:23 +00:00
|
|
|
- (NSNumber *) orderValue;
|
|
|
|
- (void) setOrderValue: (int) orderValue;
|
|
|
|
|
|
|
|
- (NSArray *) fileList;
|
2007-01-17 06:43:07 +00:00
|
|
|
- (int) fileCount;
|
2007-03-02 01:34:06 +00:00
|
|
|
- (BOOL) updateFileProgress;
|
|
|
|
- (void) setFileCheckState: (int) state forFileItem: (NSMutableDictionary *) item;
|
|
|
|
- (NSMutableDictionary *) resetFileCheckStateForItemParent: (NSMutableDictionary *) originalChild;
|
2006-07-16 19:39:23 +00:00
|
|
|
|
2007-03-30 18:58:18 +00:00
|
|
|
- (NSDate *) dateAdded;
|
2007-03-31 01:00:51 +00:00
|
|
|
- (NSDate *) dateCompleted;
|
|
|
|
|
2006-07-16 19:39:23 +00:00
|
|
|
- (NSNumber *) stateSortKey;
|
|
|
|
- (NSNumber *) progressSortKey;
|
2007-01-15 04:41:01 +00:00
|
|
|
- (NSNumber *) ratioSortKey;
|
2006-07-16 19:39:23 +00:00
|
|
|
|
|
|
|
@end
|