allow selecting a group row to apply settings to all torrents in the group

This commit is contained in:
Mitchell Livingston 2008-01-23 03:12:06 +00:00
parent 07761591c9
commit 327f278976
2 changed files with 17 additions and 9 deletions

View File

@ -1686,18 +1686,22 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
int total = [fDisplayedTorrents count];
if (group && total > 0 && [NSApp isOnLeopardOrBetter])
{
int i, groupValue = [[fDisplayedTorrents objectAtIndex: total-1] groupValue], newGroupValue;
int i, groupValue = [[fDisplayedTorrents objectAtIndex: total-1] groupValue], newGroupValue, count = 1;
for (i = total-1; i >= 0; i--)
{
if (i > 0)
newGroupValue = [[fDisplayedTorrents objectAtIndex: i-1] groupValue];
if (groupValue != newGroupValue || i == 0)
{
NSDictionary * dict = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: groupValue], @"Group", nil];
NSDictionary * dict = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: groupValue], @"Group",
[NSNumber numberWithInt: count], @"Count", nil];
[fDisplayedTorrents insertObject: dict atIndex: i];
groupValue = newGroupValue;
count = 1;
}
else
count++;
}
}

View File

@ -295,13 +295,10 @@
for (i = 0; i < [fTorrents count]; i++)
{
id currentObject = [fTorrents objectAtIndex: i];
if ((![currentObject isKindOfClass: [Torrent class]]))
if (![currentObject isKindOfClass: [Torrent class]] && value == [[currentObject objectForKey: @"Group"] intValue])
{
if (value == [[currentObject objectForKey: @"Group"] intValue])
{
index = i;
break;
}
index = i;
break;
}
}
}
@ -327,8 +324,15 @@
NSUInteger i;
for (i = [selectedIndexes firstIndex]; i != NSNotFound; i = [selectedIndexes indexGreaterThanIndex: i])
{
if ([[fTorrents objectAtIndex: i] isKindOfClass: [Torrent class]])
id object = [fTorrents objectAtIndex: i];
if ([object isKindOfClass: [Torrent class]])
[indexSet addIndex: i];
else
{
int count = [[object objectForKey: @"Count"] intValue];
[indexSet addIndexesInRange: NSMakeRange(i+1, count)];
i += count;
}
}
[fTorrents objectsAtIndexes: indexSet];