Changeset 13163


Ignore:
Timestamp:
Jan 14, 2012, 7:53:08 PM (10 years ago)
Author:
livings124
Message:

On Lion with group rows shown, when moving torrents to a group row that did not previously exist, do sliding instead of fading and keep selected torrents selected.

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.h

    r13162 r13163  
    193193
    194194- (void) sortTorrents: (BOOL) includeQueueOrder;
    195 - (void) sortTorrentsIgnoreSelectedCallUpdates: (BOOL) callUpdates includeQueueOrder: (BOOL) includeQueueOrder;
     195- (void) sortTorrentsCallUpdates: (BOOL) callUpdates includeQueueOrder: (BOOL) includeQueueOrder;
    196196- (void) rearrangeTorrentTableArray: (NSMutableArray *) rearrangeArray forParent: (id) parent withSortDescriptors: (NSArray *) descriptors beganTableUpdate: (BOOL *) beganTableUpdate;
    197197- (void) setSort: (id) sender;
  • trunk/macosx/Controller.m

    r13162 r13163  
    19071907   
    19081908    //actually sort
    1909     [self sortTorrentsIgnoreSelectedCallUpdates: YES includeQueueOrder: includeQueueOrder];
     1909    [self sortTorrentsCallUpdates: YES includeQueueOrder: includeQueueOrder];
    19101910   
    19111911    if (!onLion)
     
    19181918}
    19191919
    1920 #warning rename
    1921 - (void) sortTorrentsIgnoreSelectedCallUpdates: (BOOL) callUpdates includeQueueOrder: (BOOL) includeQueueOrder
     1920- (void) sortTorrentsCallUpdates: (BOOL) callUpdates includeQueueOrder: (BOOL) includeQueueOrder
    19221921{
    19231922    //don't do anything else if we don't have to
     
    20532052    const BOOL onLion = [NSApp isOnLionOrBetter];
    20542053   
    2055     NSArray * selectedValues = nil;
     2054    NSArray * selectedValuesSL = nil;
    20562055    if (!onLion)
    2057         selectedValues = [fTableView selectedValues];
     2056        selectedValuesSL = [fTableView selectedValues];
    20582057   
    20592058    __block NSUInteger active = 0, downloading = 0, seeding = 0, paused = 0;
     
    22542253        NSAssert(groupRows && wasGroupRows, @"Should have had group rows and should remain with group rows");
    22552254       
    2256         #warning not remembering selected when changing to a new group
    2257        
    22582255        #warning don't always do?
    22592256        beganUpdates = YES;
     
    22982295                           
    22992296                            if (onLion)
     2297                            {
    23002298                                [fTableView insertItemsAtIndexes: [NSIndexSet indexSetWithIndex: [fDisplayedTorrents count]-1] inParent: nil withAnimation: NSTableViewAnimationEffectFade];
     2299                                [fTableView isGroupCollapsed: groupValue] ? [fTableView collapseItem: newGroup] : [fTableView expandItem: newGroup];
     2300                            }
    23012301                        }
    23022302                        else //if we haven't processed the other group yet, we have to make sure we don't flag it for removal the next time
     
    23412341               
    23422342                if (onLion)
     2343                {
    23432344                    [fTableView insertItemsAtIndexes: [NSIndexSet indexSetWithIndex: [fDisplayedTorrents count]-1] inParent: nil withAnimation: NSTableViewAnimationEffectFade];
     2345                    [fTableView isGroupCollapsed: groupValue] ? [fTableView collapseItem: group] : [fTableView expandItem: group];
     2346                }
    23442347            }
    23452348           
     
    23732376       
    23742377        //since we're not doing this the right way (boo buggy animation), we need to remember selected values
    2375         selectedValues = [fTableView selectedValues];
     2378        #warning when Lion-only and using views instead of cells, this likely won't be needed
     2379        NSArray * selectedValues = [fTableView selectedValues];
    23762380       
    23772381        beganUpdates = YES;
     
    24102414        if (onLion)
    24112415            [fTableView insertItemsAtIndexes: [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [fDisplayedTorrents count])] inParent: nil withAnimation: NSTableViewAnimationEffectFade];
     2416       
     2417        //reset expanded/collapsed rows
     2418        if (groupRows)
     2419        {
     2420            for (TorrentGroup * group in fDisplayedTorrents)
     2421            {
     2422                if ([fTableView isGroupCollapsed: [group groupIndex]])
     2423                    [fTableView collapseItem: group];
     2424                else
     2425                    [fTableView expandItem: group];
     2426            }
     2427        }
     2428       
     2429        if (selectedValues)
     2430            [fTableView selectValues: selectedValues];
    24122431    }
    24132432   
    24142433    //sort the torrents (won't sort the groups, though)
    2415     [self sortTorrentsIgnoreSelectedCallUpdates: !beganUpdates includeQueueOrder: YES];
     2434    [self sortTorrentsCallUpdates: !beganUpdates includeQueueOrder: YES];
    24162435   
    24172436    if (onLion)
     
    24262445        [fTableView reloadData];
    24272446   
    2428     //reset expanded/collapsed rows
    2429     if (groupRows)
    2430     {
    2431         for (TorrentGroup * group in fDisplayedTorrents)
    2432         {
    2433             if ([fTableView isGroupCollapsed: [group groupIndex]])
    2434                 [fTableView collapseItem: group];
    2435             else
    2436                 [fTableView expandItem: group];
    2437         }
    2438     }
    2439    
    2440     if (selectedValues)
    2441         [fTableView selectValues: selectedValues];
     2447    if (!onLion)
     2448        [fTableView selectValues: selectedValuesSL];
    24422449   
    24432450    [self resetInfo]; //if group is already selected, but the torrents in it change
Note: See TracChangeset for help on using the changeset viewer.