remove option to save a private torrent copy...just do it automatically

This commit is contained in:
Mitchell Livingston
2006-11-05 19:08:38 +00:00
parent ed16a15356
commit b11b48e804
12 changed files with 41 additions and 57 deletions
-2
View File
@@ -74,8 +74,6 @@
<integer>2</integer>
<key>SUScheduledCheckInterval</key>
<integer>86400</integer>
<key>SavePrivateTorrent</key>
<true/>
<key>SeedingSound</key>
<string>Submarine</string>
<key>ShowInspector</key>
+1 -1
View File
@@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>58 51 356 240 0 0 1024 746 </string>
<string>69 61 356 240 0 0 1152 842 </string>
<key>IBEditorPositions</key>
<dict>
<key>549</key>
Binary file not shown.
+1 -1
View File
@@ -241,7 +241,7 @@
/* Status bar transfer count */
"%d Transfers" = "%d Transfers";
/* Torrent -> location */
/* Torrent -> location when deleting original */
"Transmission Support Folder" = "Transmission Support Folder";
/* Torrent -> progress string */
-1
View File
@@ -14,7 +14,6 @@
setAutoSize = id;
setAutoSpeedLimit = id;
setBadge = id;
setCopyTorrents = id;
setDownloadLocation = id;
setNat = id;
setPort = id;
+3 -2
View File
@@ -7,11 +7,11 @@
<key>IBEditorPositions</key>
<dict>
<key>153</key>
<string>294 445 563 267 0 0 1152 842 </string>
<string>286 248 563 267 0 0 1152 842 </string>
<key>28</key>
<string>294 434 563 290 0 0 1152 842 </string>
<key>41</key>
<string>294 408 563 342 0 0 1152 842 </string>
<string>128 481 563 305 0 0 1152 842 </string>
<key>66</key>
<string>294 507 563 144 0 0 1152 842 </string>
</dict>
@@ -24,6 +24,7 @@
<key>IBOpenObjects</key>
<array>
<integer>41</integer>
<integer>153</integer>
</array>
<key>IBSystem Version</key>
<string>8L127</string>
Binary file not shown.
+25 -10
View File
@@ -122,7 +122,8 @@
{
if (numberSelected > 0)
{
[fNameField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%d Torrents Selected", "Inspector -> above tabs -> selected torrents"), numberSelected]];
[fNameField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%d Torrents Selected",
"Inspector -> above tabs -> selected torrents"), numberSelected]];
uint64_t size = 0;
NSEnumerator * enumerator = [torrents objectEnumerator];
@@ -130,11 +131,13 @@
while ((torrent = [enumerator nextObject]))
size += [torrent size];
[fSizeField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%@ Total", "Inspector -> above tabs -> total size (several torrents selected)"), [NSString stringForFileSize: size]]];
[fSizeField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%@ Total",
"Inspector -> above tabs -> total size (several torrents selected)"), [NSString stringForFileSize: size]]];
}
else
{
[fNameField setStringValue: NSLocalizedString(@"No Torrents Selected", "Inspector -> above tabs -> selected torrents")];
[fNameField setStringValue: NSLocalizedString(@"No Torrents Selected",
"Inspector -> above tabs -> selected torrents")];
[fSizeField setStringValue: @""];
[fDownloadedValidField setStringValue: @""];
@@ -209,8 +212,15 @@
[fHashField setStringValue: hashString];
[fHashField setToolTip: hashString];
[fTorrentLocationField setStringValue: [torrent torrentLocationString]];
[fTorrentLocationField setToolTip: [torrent torrentLocation]];
BOOL publicTorrent = [torrent publicTorrent];
[fTorrentLocationField setStringValue: publicTorrent
? [[torrent publicTorrentLocation] stringByAbbreviatingWithTildeInPath]
: NSLocalizedString(@"Transmission Support Folder", "Torrent -> location when deleting original")];
if (publicTorrent)
[fTorrentLocationField setToolTip: [NSString stringWithFormat: @"%@\n\n%@",
[torrent publicTorrentLocation], [torrent torrentLocation]]];
else
[fTorrentLocationField setToolTip: [torrent torrentLocation]];
[fDateStartedField setObjectValue: [torrent date]];
@@ -242,12 +252,15 @@
[fFiles addObjectsFromArray: [torrent fileList]];
if ([fFiles count] > 1)
[fFileTableStatusField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%d files", "Inspector -> Files tab -> bottom text (number of files)"), [fFiles count]]];
[fFileTableStatusField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%d files",
"Inspector -> Files tab -> bottom text (number of files)"), [fFiles count]]];
else
[fFileTableStatusField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%d file", "Inspector -> Files tab -> bottom text (number of files)"), [fFiles count]]];
[fFileTableStatusField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%d file",
"Inspector -> Files tab -> bottom text (number of files)"), [fFiles count]]];
}
else
[fFileTableStatusField setStringValue: NSLocalizedString(@"info not available", "Inspector -> Files tab -> bottom text (number of files)")];
[fFileTableStatusField setStringValue: NSLocalizedString(@"info not available",
"Inspector -> Files tab -> bottom text (number of files)")];
[fFileTable deselectAll: nil];
[fFileTable reloadData];
@@ -312,7 +325,8 @@
[fLeechersField setStringValue: leechers < 0 ? @"" : [NSString stringWithInt: leechers]];
BOOL active = [torrent isActive];
[fConnectedPeersField setStringValue: active ? [NSString stringWithFormat: NSLocalizedString(@"%d (%d incoming)", "Inspector -> Peers tab -> connected"),
[fConnectedPeersField setStringValue: active ? [NSString stringWithFormat: NSLocalizedString(@"%d (%d incoming)",
"Inspector -> Peers tab -> connected"),
[torrent totalPeers], [torrent totalPeersIncoming]]: @""];
[fDownloadingFromField setStringValue: active ? [NSString stringWithInt: [torrent peersUploading]] : @""];
[fUploadingToField setStringValue: active ? [NSString stringWithInt: [torrent peersDownloading]] : @""];
@@ -534,7 +548,8 @@
{
NSDictionary * file = [fFiles objectAtIndex: row];
if ([[column identifier] isEqualToString: @"Size"])
return [[[file objectForKey: @"Size"] stringValue] stringByAppendingString: NSLocalizedString(@" bytes", "Inspector -> Files tab -> table row tooltip")];
return [[[file objectForKey: @"Size"] stringValue] stringByAppendingString: NSLocalizedString(@" bytes",
"Inspector -> Files tab -> table row tooltip")];
else
return [file objectForKey: @"Name"];
}
-2
View File
@@ -66,8 +66,6 @@
- (void) setQueueNumber: (id) sender;
- (void) setCopyTorrents: (id) sender;
- (void) setDownloadLocation: (id) sender;
- (void) folderSheetShow: (id) sender;
- (void) incompleteFolderSheetShow: (id) sender;
-6
View File
@@ -359,12 +359,6 @@
[[NSNotificationCenter defaultCenter] postNotificationName: @"GlobalStartSettingChange" object: self];
}
- (void) setCopyTorrents: (id) sender
{
if (![fDefaults boolForKey: @"SavePrivateTorrent"])
[fDefaults setBool: NO forKey: @"DeleteOriginalTorrent"];
}
- (void) setDownloadLocation: (id) sender
{
//download folder
+1 -3
View File
@@ -42,7 +42,7 @@
BOOL fUseIncompleteFolder;
NSString * fDownloadFolder, * fIncompleteFolder;
BOOL fPrivateTorrent, fPublicTorrent;
BOOL fPublicTorrent;
NSString * fPublicTorrentLocation;
NSUserDefaults * fDefaults;
@@ -111,11 +111,9 @@
- (NSString *) torrentLocation;
- (NSString *) publicTorrentLocation;
- (NSString *) torrentLocationString;
- (NSString *) dataLocation;
- (BOOL) publicTorrent;
- (BOOL) privateTorrent;
- (NSString *) stateString;
+10 -29
View File
@@ -33,7 +33,7 @@
@interface Torrent (Private)
- (id) initWithHash: (NSString *) hashString path: (NSString *) path lib: (tr_handle_t *) lib
privateTorrent: (NSNumber *) privateTorrent publicTorrent: (NSNumber *) publicTorrent
publicTorrent: (NSNumber *) publicTorrent
date: (NSDate *) date stopRatioSetting: (NSNumber *) stopRatioSetting
ratioLimit: (NSNumber *) ratioLimit waitToStart: (NSNumber *) waitToStart
orderValue: (NSNumber *) orderValue;
@@ -60,7 +60,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
- (id) initWithPath: (NSString *) path lib: (tr_handle_t *) lib
{
self = [self initWithHash: nil path: path lib: lib privateTorrent: nil publicTorrent: nil
self = [self initWithHash: nil path: path lib: lib publicTorrent: nil
date: nil stopRatioSetting: nil ratioLimit: nil waitToStart: nil orderValue: nil];
if (self)
@@ -78,7 +78,6 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
{
self = [self initWithHash: [history objectForKey: @"TorrentHash"]
path: [history objectForKey: @"TorrentPath"] lib: lib
privateTorrent: [history objectForKey: @"PrivateCopy"]
publicTorrent: [history objectForKey: @"PublicCopy"]
date: [history objectForKey: @"Date"]
stopRatioSetting: [history objectForKey: @"StopRatioSetting"]
@@ -124,8 +123,8 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
- (NSDictionary *) history
{
NSMutableDictionary * history = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool: fPrivateTorrent], @"PrivateCopy",
[NSNumber numberWithBool: fPublicTorrent], @"PublicCopy",
[self hashString], @"TorrentHash",
fDownloadFolder, @"DownloadFolder",
[NSNumber numberWithBool: fUseIncompleteFolder], @"UseIncompleteFolder",
[self isActive] ? @"NO" : @"YES", @"Paused",
@@ -137,9 +136,6 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
if (fUseIncompleteFolder)
[history setObject: fIncompleteFolder forKey: @"IncompleteFolder"];
if (fPrivateTorrent)
[history setObject: [self hashString] forKey: @"TorrentHash"];
if (fPublicTorrent)
[history setObject: [self publicTorrentLocation] forKey: @"TorrentPath"];
@@ -442,8 +438,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
- (void) removeForever
{
if (fPrivateTorrent)
tr_torrentRemoveSaved(fHandle);
tr_torrentRemoveSaved(fHandle);
}
- (void) sleep
@@ -615,12 +610,6 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
return fPublicTorrentLocation;
}
- (NSString *) torrentLocationString
{
return fPrivateTorrent ? NSLocalizedString(@"Transmission Support Folder", "Torrent -> location")
: [fPublicTorrentLocation stringByAbbreviatingWithTildeInPath];
}
- (NSString *) dataLocation
{
return [[self downloadFolder] stringByAppendingPathComponent: [self name]];
@@ -631,11 +620,6 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
return fPublicTorrent;
}
- (BOOL) privateTorrent
{
return fPrivateTorrent;
}
- (NSString *) stateString
{
switch( fStat->status )
@@ -868,7 +852,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
//if a hash is given, attempt to load that; otherwise, attempt to open file at path
- (id) initWithHash: (NSString *) hashString path: (NSString *) path lib: (tr_handle_t *) lib
privateTorrent: (NSNumber *) privateTorrent publicTorrent: (NSNumber *) publicTorrent
publicTorrent: (NSNumber *) publicTorrent
date: (NSDate *) date stopRatioSetting: (NSNumber *) stopRatioSetting
ratioLimit: (NSNumber *) ratioLimit waitToStart: (NSNumber *) waitToStart
orderValue: (NSNumber *) orderValue
@@ -879,16 +863,16 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
fLib = lib;
fDefaults = [NSUserDefaults standardUserDefaults];
fPrivateTorrent = privateTorrent ? [privateTorrent boolValue] : [fDefaults boolForKey: @"SavePrivateTorrent"];
fPublicTorrent = !fPrivateTorrent || (publicTorrent ? [publicTorrent boolValue]
: ![fDefaults boolForKey: @"DeleteOriginalTorrent"]);
fPublicTorrent = path && (publicTorrent ? [publicTorrent boolValue] : ![fDefaults boolForKey: @"DeleteOriginalTorrent"]);
if (fPublicTorrent)
fPublicTorrentLocation = [path retain];
int error;
if (fPrivateTorrent && hashString)
if (hashString)
fHandle = tr_torrentInitSaved(fLib, [hashString UTF8String], TR_FSAVEPRIVATE, & error);
if (!fHandle && path)
fHandle = tr_torrentInit(fLib, [path UTF8String], fPrivateTorrent ? TR_FSAVEPRIVATE : 0, & error);
fHandle = tr_torrentInit(fLib, [path UTF8String], TR_FSAVEPRIVATE, & error);
if (!fHandle)
{
@@ -898,9 +882,6 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
fInfo = tr_torrentInfo( fHandle );
if (fPublicTorrent)
fPublicTorrentLocation = [path retain];
fDate = date ? [date retain] : [[NSDate alloc] init];
fStopRatioSetting = stopRatioSetting ? [stopRatioSetting intValue] : -1;