mirror of
https://github.com/transmission/transmission
synced 2025-03-10 14:13:23 +00:00
allow selecting a group row to apply settings to all torrents in the group
This commit is contained in:
parent
07761591c9
commit
327f278976
2 changed files with 17 additions and 9 deletions
|
@ -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++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -295,16 +295,13 @@
|
|||
for (i = 0; i < [fTorrents count]; i++)
|
||||
{
|
||||
id currentObject = [fTorrents objectAtIndex: i];
|
||||
if ((![currentObject isKindOfClass: [Torrent class]]))
|
||||
{
|
||||
if (value == [[currentObject objectForKey: @"Group"] intValue])
|
||||
if (![currentObject isKindOfClass: [Torrent class]] && value == [[currentObject objectForKey: @"Group"] intValue])
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (index != NSNotFound)
|
||||
[indexSet addIndex: index];
|
||||
|
@ -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];
|
||||
|
|
Loading…
Add table
Reference in a new issue