Revert the last commit, it wasn't supposed to go on the trunk.
This commit is contained in:
parent
41525beaa3
commit
9a865c00b9
|
@ -96,13 +96,17 @@
|
|||
- (void) stopTorrentWithIndex: (NSIndexSet *) indexSet;
|
||||
|
||||
- (void) removeTorrent: (id) sender;
|
||||
- (void) removeTorrentDeleteTorrent: (id) sender;
|
||||
- (void) removeTorrentDeleteData: (id) sender;
|
||||
- (void) removeTorrentDeleteBoth: (id) sender;
|
||||
- (void) removeTorrentWithIndex: (NSIndexSet *) indexSet
|
||||
deleteTorrent: (BOOL) deleteTorrent
|
||||
deleteData: (BOOL) deleteData;
|
||||
|
||||
- (void) removeSheetDidEnd: (NSWindow *) sheet returnCode: (int) returnCode
|
||||
contextInfo: (NSDictionary *) dict;
|
||||
- (void) confirmRemoveTorrents: (NSArray *) torrents
|
||||
deleteTorrent: (BOOL) deleteTorrent
|
||||
deleteData: (BOOL) deleteData;
|
||||
|
||||
- (void) revealFile: (id) sender;
|
||||
|
|
|
@ -524,6 +524,7 @@ static void sleepCallBack( void * controller, io_service_t y,
|
|||
}
|
||||
|
||||
- (void) removeTorrentWithIndex: (NSIndexSet *) indexSet
|
||||
deleteTorrent: (BOOL) deleteTorrent
|
||||
deleteData: (BOOL) deleteData
|
||||
{
|
||||
NSArray * torrents = [[self torrentsAtIndexes: indexSet] retain];
|
||||
|
@ -539,6 +540,7 @@ static void sleepCallBack( void * controller, io_service_t y,
|
|||
{
|
||||
NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
torrents, @"Torrents",
|
||||
[NSNumber numberWithBool: deleteTorrent], @"DeleteTorrent",
|
||||
[NSNumber numberWithBool: deleteData], @"DeleteData",
|
||||
nil];
|
||||
|
||||
|
@ -570,6 +572,7 @@ static void sleepCallBack( void * controller, io_service_t y,
|
|||
else
|
||||
{
|
||||
[self confirmRemoveTorrents: torrents
|
||||
deleteTorrent: deleteTorrent
|
||||
deleteData: deleteData];
|
||||
}
|
||||
}
|
||||
|
@ -580,12 +583,14 @@ static void sleepCallBack( void * controller, io_service_t y,
|
|||
[NSApp stopModal];
|
||||
|
||||
NSArray * torrents = [dict objectForKey: @"Torrents"];
|
||||
BOOL deleteTorrent = [[dict objectForKey: @"DeleteTorrent"] boolValue];
|
||||
BOOL deleteData = [[dict objectForKey: @"DeleteData"] boolValue];
|
||||
[dict release];
|
||||
|
||||
if (returnCode == NSAlertDefaultReturn)
|
||||
{
|
||||
[self confirmRemoveTorrents: torrents
|
||||
deleteTorrent: deleteTorrent
|
||||
deleteData: deleteData];
|
||||
}
|
||||
else
|
||||
|
@ -593,6 +598,7 @@ static void sleepCallBack( void * controller, io_service_t y,
|
|||
}
|
||||
|
||||
- (void) confirmRemoveTorrents: (NSArray *) torrents
|
||||
deleteTorrent: (BOOL) deleteTorrent
|
||||
deleteData: (BOOL) deleteData
|
||||
{
|
||||
Torrent * torrent;
|
||||
|
@ -603,8 +609,10 @@ static void sleepCallBack( void * controller, io_service_t y,
|
|||
|
||||
if( deleteData )
|
||||
[torrent trashData];
|
||||
|
||||
if( deleteTorrent )
|
||||
[torrent trashTorrent];
|
||||
|
||||
[torrent removeForever];
|
||||
[fTorrents removeObject: torrent];
|
||||
}
|
||||
[torrents release];
|
||||
|
@ -617,12 +625,22 @@ static void sleepCallBack( void * controller, io_service_t y,
|
|||
|
||||
- (void) removeTorrent: (id) sender
|
||||
{
|
||||
[self removeTorrentWithIndex: [fTableView selectedRowIndexes] deleteData: NO];
|
||||
[self removeTorrentWithIndex: [fTableView selectedRowIndexes] deleteTorrent: NO deleteData: NO];
|
||||
}
|
||||
|
||||
- (void) removeTorrentDeleteTorrent: (id) sender
|
||||
{
|
||||
[self removeTorrentWithIndex: [fTableView selectedRowIndexes] deleteTorrent: YES deleteData: NO];
|
||||
}
|
||||
|
||||
- (void) removeTorrentDeleteData: (id) sender
|
||||
{
|
||||
[self removeTorrentWithIndex: [fTableView selectedRowIndexes] deleteData: YES];
|
||||
[self removeTorrentWithIndex: [fTableView selectedRowIndexes] deleteTorrent: NO deleteData: YES];
|
||||
}
|
||||
|
||||
- (void) removeTorrentDeleteBoth: (id) sender
|
||||
{
|
||||
[self removeTorrentWithIndex: [fTableView selectedRowIndexes] deleteTorrent: YES deleteData: YES];
|
||||
}
|
||||
|
||||
- (void) revealFile: (id) sender
|
||||
|
@ -1191,7 +1209,10 @@ static void sleepCallBack( void * controller, io_service_t y,
|
|||
}
|
||||
|
||||
//enable remove items
|
||||
if (action == @selector(removeTorrent:) || action == @selector(removeTorrentDeleteData:))
|
||||
if (action == @selector(removeTorrent:)
|
||||
|| action == @selector(removeTorrentDeleteTorrent:)
|
||||
|| action == @selector(removeTorrentDeleteData:)
|
||||
|| action == @selector(removeTorrentDeleteBoth:))
|
||||
{
|
||||
BOOL active = NO;
|
||||
Torrent * torrent;
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
<true/>
|
||||
<key>CheckUpload</key>
|
||||
<true/>
|
||||
<key>DeleteOriginalTorrent</key>
|
||||
<false/>
|
||||
<key>DownloadChoice</key>
|
||||
<string>Constant</string>
|
||||
<key>DownloadFolder</key>
|
||||
|
@ -42,8 +40,6 @@
|
|||
<integer>2</integer>
|
||||
<key>SUScheduledCheckInterval</key>
|
||||
<integer>86400</integer>
|
||||
<key>SavePrivateTorrent</key>
|
||||
<true/>
|
||||
<key>ShowInspector</key>
|
||||
<false/>
|
||||
<key>Sort</key>
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
linkHomepage = id;
|
||||
openShowSheet = id;
|
||||
removeTorrent = id;
|
||||
removeTorrentDeleteBoth = id;
|
||||
removeTorrentDeleteData = id;
|
||||
removeTorrentDeleteTorrent = id;
|
||||
resumeAllTorrents = id;
|
||||
resumeTorrent = id;
|
||||
revealFile = id;
|
||||
|
|
|
@ -29,9 +29,8 @@
|
|||
<integer>3</integer>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>29</integer>
|
||||
<integer>1480</integer>
|
||||
<integer>21</integer>
|
||||
<integer>1480</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>8I127</string>
|
||||
|
|
Binary file not shown.
|
@ -10,7 +10,6 @@
|
|||
setDownloadLocation = id;
|
||||
setLimit = id;
|
||||
setLimitCheck = id;
|
||||
setMoveTorrent = id;
|
||||
setPort = id;
|
||||
setRatio = id;
|
||||
setRatioCheck = id;
|
||||
|
@ -23,8 +22,6 @@
|
|||
fAutoStartCheck = NSButton;
|
||||
fBadgeDownloadRateCheck = NSButton;
|
||||
fBadgeUploadRateCheck = NSButton;
|
||||
fCopyTorrentCheck = NSButton;
|
||||
fDeleteOriginalTorrentCheck = NSButton;
|
||||
fDownloadCheck = NSButton;
|
||||
fDownloadField = NSTextField;
|
||||
fFolderPopUp = NSPopUpButton;
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>28</key>
|
||||
<string>345 472 462 212 0 0 1152 842 </string>
|
||||
<string>347 472 462 212 0 0 1152 842 </string>
|
||||
<key>41</key>
|
||||
<string>262 506 462 274 0 0 1152 842 </string>
|
||||
<string>345 461 462 234 0 0 1152 842 </string>
|
||||
<key>66</key>
|
||||
<string>347 526 462 104 0 0 1152 842 </string>
|
||||
</dict>
|
||||
|
|
Binary file not shown.
|
@ -36,7 +36,7 @@
|
|||
IBOutlet NSPopUpButton * fFolderPopUp;
|
||||
IBOutlet NSButton * fQuitCheck, * fRemoveCheck,
|
||||
* fBadgeDownloadRateCheck, * fBadgeUploadRateCheck,
|
||||
* fAutoStartCheck, * fCopyTorrentCheck, * fDeleteOriginalTorrentCheck;
|
||||
* fAutoStartCheck;
|
||||
IBOutlet NSPopUpButton * fUpdatePopUp;
|
||||
|
||||
IBOutlet NSTextField * fPortField, * fUploadField, * fDownloadField;
|
||||
|
@ -58,7 +58,6 @@
|
|||
- (void) setUpdate: (id) sender;
|
||||
- (void) checkUpdate;
|
||||
- (void) setAutoStart: (id) sender;
|
||||
- (void) setMoveTorrent: (id) sender;
|
||||
- (void) setDownloadLocation: (id) sender;
|
||||
- (void) folderSheetShow: (id) sender;
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@
|
|||
BOOL checkUpload = [fDefaults boolForKey: @"CheckUpload"];
|
||||
int uploadLimit = [fDefaults integerForKey: @"UploadLimit"];
|
||||
|
||||
[fUploadCheck setState: checkUpload];
|
||||
[fUploadCheck setState: checkUpload ? NSOnState : NSOffState];
|
||||
[fUploadField setIntValue: uploadLimit];
|
||||
[fUploadField setEnabled: checkUpload];
|
||||
|
||||
|
@ -126,7 +126,7 @@
|
|||
BOOL checkDownload = [fDefaults boolForKey: @"CheckDownload"];
|
||||
int downloadLimit = [fDefaults integerForKey: @"DownloadLimit"];
|
||||
|
||||
[fDownloadCheck setState: checkDownload];
|
||||
[fDownloadCheck setState: checkDownload ? NSOnState : NSOffState];
|
||||
[fDownloadField setIntValue: downloadLimit];
|
||||
[fDownloadField setEnabled: checkDownload];
|
||||
|
||||
|
@ -134,13 +134,15 @@
|
|||
|
||||
//set ratio limit
|
||||
BOOL ratioCheck = [fDefaults boolForKey: @"RatioCheck"];
|
||||
[fRatioCheck setState: ratioCheck];
|
||||
[fRatioCheck setState: ratioCheck ? NSOnState : NSOffState];
|
||||
[fRatioField setEnabled: ratioCheck];
|
||||
[fRatioField setFloatValue: [fDefaults floatForKey: @"RatioLimit"]];
|
||||
|
||||
//set remove and quit prompts
|
||||
[fQuitCheck setState: [fDefaults boolForKey: @"CheckQuit"]];
|
||||
[fRemoveCheck setState: [fDefaults boolForKey: @"CheckRemove"]];
|
||||
[fQuitCheck setState: [fDefaults boolForKey: @"CheckQuit"] ?
|
||||
NSOnState : NSOffState];
|
||||
[fRemoveCheck setState: [fDefaults boolForKey: @"CheckRemove"] ?
|
||||
NSOnState : NSOffState];
|
||||
|
||||
//set dock badging
|
||||
[fBadgeDownloadRateCheck setState: [fDefaults boolForKey: @"BadgeDownloadRate"]];
|
||||
|
@ -148,13 +150,6 @@
|
|||
|
||||
//set auto start
|
||||
[fAutoStartCheck setState: [fDefaults boolForKey: @"AutoStartDownload"]];
|
||||
|
||||
//set private torrents
|
||||
BOOL copyTorrents = [fDefaults boolForKey: @"SavePrivateTorrent"];
|
||||
[fCopyTorrentCheck setState: copyTorrents];
|
||||
|
||||
[fDeleteOriginalTorrentCheck setEnabled: copyTorrents];
|
||||
[fDeleteOriginalTorrentCheck setState: [fDefaults boolForKey: @"DeleteOriginalTorrent"]];
|
||||
|
||||
//set update check
|
||||
NSString * updateCheck = [fDefaults stringForKey: @"UpdateCheck"];
|
||||
|
@ -424,24 +419,6 @@
|
|||
[fDefaults setBool: [sender state] forKey: @"AutoStartDownload"];
|
||||
}
|
||||
|
||||
- (void) setMoveTorrent: (id) sender
|
||||
{
|
||||
int state = [sender state];
|
||||
if (sender == fCopyTorrentCheck)
|
||||
{
|
||||
[fDefaults setBool: state forKey: @"SavePrivateTorrent"];
|
||||
|
||||
[fDeleteOriginalTorrentCheck setEnabled: state];
|
||||
if (state == NSOffState)
|
||||
{
|
||||
[fDeleteOriginalTorrentCheck setState: NSOffState];
|
||||
[fDefaults setBool: NO forKey: @"DeleteOriginalTorrent"];
|
||||
}
|
||||
}
|
||||
else
|
||||
[fDefaults setBool: state forKey: @"DeleteOriginalTorrent"];
|
||||
}
|
||||
|
||||
- (void) setDownloadLocation: (id) sender
|
||||
{
|
||||
//Download folder
|
||||
|
|
|
@ -35,11 +35,8 @@
|
|||
tr_torrent_t * fHandle;
|
||||
tr_info_t * fInfo;
|
||||
tr_stat_t * fStat;
|
||||
|
||||
BOOL fResumeOnWake;
|
||||
NSDate * fDate;
|
||||
|
||||
BOOL fPrivateSaved;
|
||||
|
||||
NSUserDefaults * fDefaults;
|
||||
|
||||
|
@ -58,12 +55,11 @@
|
|||
- (NSString *) downloadFolder;
|
||||
- (void) getAvailability: (int8_t *) tab size: (int) size;
|
||||
|
||||
- (void) update;
|
||||
- (void) start;
|
||||
- (void) stop;
|
||||
- (void) removeForever;
|
||||
- (void) sleep;
|
||||
- (void) wakeUp;
|
||||
- (void) update;
|
||||
- (void) start;
|
||||
- (void) stop;
|
||||
- (void) sleep;
|
||||
- (void) wakeUp;
|
||||
|
||||
- (float) ratio;
|
||||
- (int) stopRatioSetting;
|
||||
|
@ -72,6 +68,7 @@
|
|||
- (void) setRatioLimit: (float) limit;
|
||||
|
||||
- (void) reveal;
|
||||
- (void) trashTorrent;
|
||||
- (void) trashData;
|
||||
|
||||
- (NSImage *) icon;
|
||||
|
|
102
macosx/Torrent.m
102
macosx/Torrent.m
|
@ -28,14 +28,9 @@
|
|||
|
||||
@interface Torrent (Private)
|
||||
|
||||
- (void) trashPath: (NSString *) path;
|
||||
- (id) initWithPath: (NSString *) path lib: (tr_handle_t *) lib date: (NSDate *) date
|
||||
stopRatioSetting: (NSNumber *) stopRatioSetting ratioLimit: (NSNumber *) ratioLimit;
|
||||
- (id) initWithHash: (NSString *) hashString lib: (tr_handle_t *) lib date: (NSDate *) date
|
||||
stopRatioSetting: (NSNumber *) stopRatioSetting ratioLimit: (NSNumber *) ratioLimit;
|
||||
- (id) initForSuccessWithDate: (NSDate *) date stopRatioSetting: (NSNumber *)
|
||||
stopRatioSetting ratioLimit: (NSNumber *) ratioLimit;
|
||||
|
||||
- (void) trashPath: (NSString *) path;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -44,26 +39,14 @@
|
|||
|
||||
- (id) initWithPath: (NSString *) path lib: (tr_handle_t *) lib
|
||||
{
|
||||
id torrent = [self initWithPath: path lib: lib
|
||||
date: nil stopRatioSetting: nil
|
||||
ratioLimit: nil];
|
||||
NSLog(path);
|
||||
if (fPrivateSaved && [fDefaults boolForKey: @"DeleteOriginalTorrent"])
|
||||
[self trashPath: path];
|
||||
|
||||
return torrent;
|
||||
return [self initWithPath: path lib: lib
|
||||
date: nil stopRatioSetting: nil
|
||||
ratioLimit: nil];
|
||||
}
|
||||
|
||||
- (id) initWithHistory: (NSDictionary *) history lib: (tr_handle_t *) lib
|
||||
{
|
||||
NSNumber * privateCopy;
|
||||
if ((privateCopy = [history objectForKey: @"PrivateCopy"]) && [privateCopy boolValue])
|
||||
self = [self initWithHash: [history objectForKey: @"TorrentHash"]
|
||||
lib: lib date: [history objectForKey: @"Date"]
|
||||
stopRatioSetting: [history objectForKey: @"StopRatioSetting"]
|
||||
ratioLimit: [history objectForKey: @"RatioLimit"]];
|
||||
else
|
||||
self = [self initWithPath: [history objectForKey: @"TorrentPath"]
|
||||
self = [self initWithPath: [history objectForKey: @"TorrentPath"]
|
||||
lib: lib date: [history objectForKey: @"Date"]
|
||||
stopRatioSetting: [history objectForKey: @"StopRatioSetting"]
|
||||
ratioLimit: [history objectForKey: @"RatioLimit"]];
|
||||
|
@ -85,20 +68,13 @@
|
|||
|
||||
- (NSDictionary *) history
|
||||
{
|
||||
NSMutableDictionary * history = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithBool: fPrivateSaved], @"PrivateCopy",
|
||||
[self downloadFolder], @"DownloadFolder",
|
||||
[self isActive] ? @"NO" : @"YES", @"Paused",
|
||||
[self date], @"Date",
|
||||
[NSNumber numberWithInt: fStopRatioSetting], @"StopRatioSetting",
|
||||
[NSNumber numberWithFloat: fRatioLimit], @"RatioLimit", nil];
|
||||
|
||||
if (fPrivateSaved)
|
||||
[history setObject: [self torrentLocation] forKey: @"TorrentPath"];
|
||||
else
|
||||
[history setObject: [self hashString] forKey: @"TorrentHash"];
|
||||
|
||||
return history;
|
||||
return [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[self torrentLocation], @"TorrentPath",
|
||||
[self downloadFolder], @"DownloadFolder",
|
||||
[self isActive] ? @"NO" : @"YES", @"Paused",
|
||||
[self date], @"Date",
|
||||
[NSNumber numberWithInt: fStopRatioSetting], @"StopRatioSetting",
|
||||
[NSNumber numberWithFloat: fRatioLimit], @"RatioLimit", nil];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
|
@ -236,11 +212,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void) removeForever
|
||||
{
|
||||
tr_torrentRemoveSaved(fHandle);
|
||||
}
|
||||
|
||||
- (void) sleep
|
||||
{
|
||||
if( ( fResumeOnWake = ( fStat->status & TR_STATUS_ACTIVE ) ) )
|
||||
|
@ -290,6 +261,11 @@
|
|||
inFileViewerRootedAtPath: nil];
|
||||
}
|
||||
|
||||
- (void) trashTorrent
|
||||
{
|
||||
[self trashPath: [self torrentLocation]];
|
||||
}
|
||||
|
||||
- (void) trashData
|
||||
{
|
||||
[self trashPath: [self dataLocation]];
|
||||
|
@ -338,21 +314,19 @@
|
|||
|
||||
- (NSString *) hashString
|
||||
{
|
||||
/*NSMutableString * string = [NSMutableString
|
||||
NSMutableString * string = [NSMutableString
|
||||
stringWithCapacity: SHA_DIGEST_LENGTH];
|
||||
int i;
|
||||
for( i = 0; i < SHA_DIGEST_LENGTH; i++ )
|
||||
{
|
||||
[string appendFormat: @"%02x", fInfo->hash[i]];
|
||||
}
|
||||
return string;*/
|
||||
|
||||
return [NSString stringWithUTF8String: fInfo->hashString];
|
||||
return string;
|
||||
}
|
||||
|
||||
- (NSString *) torrentLocation
|
||||
{
|
||||
return [NSString stringWithUTF8String: fInfo->torrent];
|
||||
return [NSString stringWithUTF8String: fInfo->torrent];;
|
||||
}
|
||||
|
||||
- (NSString *) dataLocation
|
||||
|
@ -513,46 +487,17 @@
|
|||
return nil;
|
||||
|
||||
fLib = lib;
|
||||
fDefaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
fPrivateSaved = [fDefaults boolForKey: @"SavePrivateTorrent"];
|
||||
|
||||
int error;
|
||||
if (!path || !(fHandle = tr_torrentInit(fLib, [path UTF8String],
|
||||
fPrivateSaved ? TR_FSAVEPRIVATE : 0, &error)))
|
||||
if (!path || !(fHandle = tr_torrentInit(fLib, [path UTF8String], &error)))
|
||||
{
|
||||
[self release];
|
||||
return nil;
|
||||
}
|
||||
|
||||
return [self initForSuccessWithDate: date stopRatioSetting: stopRatioSetting ratioLimit: ratioLimit];
|
||||
}
|
||||
|
||||
- (id) initWithHash: (NSString *) hashString lib: (tr_handle_t *) lib date: (NSDate *) date
|
||||
stopRatioSetting: (NSNumber *) stopRatioSetting ratioLimit: (NSNumber *) ratioLimit
|
||||
{
|
||||
if (!(self = [super init]))
|
||||
return nil;
|
||||
|
||||
fLib = lib;
|
||||
fDefaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
fPrivateSaved = YES;
|
||||
|
||||
int error;
|
||||
if (!hashString || !(fHandle = tr_torrentInitSaved(fLib, [hashString UTF8String], TR_FSAVEPRIVATE, &error)))
|
||||
{
|
||||
[self release];
|
||||
return nil;
|
||||
}
|
||||
|
||||
return [self initForSuccessWithDate: date stopRatioSetting: stopRatioSetting ratioLimit: ratioLimit];
|
||||
}
|
||||
|
||||
- (id) initForSuccessWithDate: (NSDate *) date stopRatioSetting: (NSNumber *)
|
||||
stopRatioSetting ratioLimit: (NSNumber *) ratioLimit
|
||||
{
|
||||
fInfo = tr_torrentInfo( fHandle );
|
||||
|
||||
fDefaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
fDate = date ? [date retain] : [[NSDate alloc] init];
|
||||
fStopRatioSetting = stopRatioSetting ? [stopRatioSetting intValue] : -1;
|
||||
|
@ -573,7 +518,6 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (void) trashPath: (NSString *) path
|
||||
{
|
||||
if( ![[NSWorkspace sharedWorkspace] performFileOperation:
|
||||
|
|
Loading…
Reference in New Issue