#1575 Auto-select a group for new torrents according to criteria for each group

This commit is contained in:
Mitchell Livingston
2008-12-08 03:26:28 +00:00
parent e3b039cd21
commit 678a3f7c3e
10 changed files with 1649 additions and 1153 deletions
+20 -15
View File
@@ -37,6 +37,8 @@
- (void) confirmAdd;
- (void) setDestinationPath: (NSString *) destination;
- (void) folderChoiceClosed: (NSOpenPanel *) openPanel returnCode: (NSInteger) code contextInfo: (void *) contextInfo;
- (void) setGroupsMenu;
@@ -64,7 +66,13 @@
&& [[NSUserDefaults standardUserDefaults] boolForKey: @"DeleteOriginalTorrent"]);
fDeleteEnable = deleteTorrent == TORRENT_FILE_DEFAULT;
fGroupValue = -1;
fGroupValue = [torrent groupValue];
#warning factor in if there already is a destination
// set the groups download location if there is one
if ([[GroupsController groups] usesCustomDownloadLocationForIndex: fGroupValue] &&
[[GroupsController groups] customDownloadLocationForIndex: fGroupValue])
[self setDestinationPath: [[GroupsController groups] customDownloadLocationForIndex: fGroupValue]];
}
return self;
}
@@ -91,7 +99,7 @@
[self updateStatusField: nil];
[self setGroupsMenu];
[fGroupPopUp selectItemWithTag: -1];
[fGroupPopUp selectItemWithTag: fGroupValue];
[fStartCheck setState: [[NSUserDefaults standardUserDefaults] boolForKey: @"AutoStartDownload"] ? NSOnState : NSOffState];
@@ -99,14 +107,7 @@
[fDeleteCheck setEnabled: fDeleteEnable];
if (fDestination)
{
[fLocationField setStringValue: [fDestination stringByAbbreviatingWithTildeInPath]];
[fLocationField setToolTip: fDestination];
ExpandedPathToIconTransformer * iconTransformer = [[ExpandedPathToIconTransformer alloc] init];
[fLocationImageView setImage: [iconTransformer transformedValue: fDestination]];
[iconTransformer release];
}
[self setDestinationPath: fDestination];
else
{
[fLocationField setStringValue: @""];
@@ -247,7 +248,7 @@
fTimer = nil;
[fTorrent setWaitToStart: [fStartCheck state] == NSOnState];
[fTorrent setGroupValue: [[fGroupPopUp selectedItem] tag]];
[fTorrent setGroupValue: fGroupValue];
if ([fDeleteCheck state] == NSOnState)
[fTorrent trashTorrent];
@@ -260,8 +261,14 @@
- (void) setDestinationPath: (NSString *) destination
{
[fDestination release];
fDestination = [destination retain];
destination = [destination stringByExpandingTildeInPath];
if (!fDestination || ![fDestination isEqualToString: destination])
{
[fDestination release];
fDestination = [destination retain];
[fTorrent changeDownloadFolder: fDestination];
}
[fLocationField setStringValue: [fDestination stringByAbbreviatingWithTildeInPath]];
[fLocationField setToolTip: fDestination];
@@ -269,8 +276,6 @@
ExpandedPathToIconTransformer * iconTransformer = [[ExpandedPathToIconTransformer alloc] init];
[fLocationImageView setImage: [iconTransformer transformedValue: fDestination]];
[iconTransformer release];
[fTorrent changeDownloadFolder: fDestination];
}
- (void) folderChoiceClosed: (NSOpenPanel *) openPanel returnCode: (NSInteger) code contextInfo: (void *) contextInfo