Ignore:
Timestamp:
May 12, 2008, 9:38:24 PM (14 years ago)
Author:
livings124
Message:

moving torrents between groups will change their groups - this took forever to get not to crash, so enjoy

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r5816 r5823  
    19911991    if (groupRows)
    19921992    {
     1993        [fDisplayedTorrents removeAllObjects];
     1994       
    19931995        NSSortDescriptor * groupDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"groupOrderValue" ascending: YES] autorelease];
    19941996        allTorrents = [allTorrents sortedArrayUsingDescriptors: [NSArray arrayWithObject: groupDescriptor]];
    19951997       
    1996         NSMutableArray * groups = [NSMutableArray array], * groupTorrents;
     1998        NSMutableArray * groupTorrents;
    19971999        int oldGroupValue = -2;
    19982000        for (i = 0; i < [allTorrents count]; i++)
     
    20052007                NSDictionary * dict = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: groupValue], @"Group",
    20062008                                        groupTorrents, @"Torrents", nil];
    2007                 [groups addObject: dict];
     2009                [fDisplayedTorrents addObject: dict];
    20082010               
    20092011                oldGroupValue = groupValue;
     
    20122014            [groupTorrents addObject: torrent];
    20132015        }
    2014        
    2015         [fDisplayedTorrents setArray: groups];
    20162016    }
    20172017    else
     
    20372037   
    20382038    [self setBottomCountText: groupRows || filterStatus || filterGroup || filterText];
    2039 
     2039   
    20402040    [self setWindowSizeToFit];
    20412041}
     
    26632663        }
    26642664       
    2665         #warning get working
    26662665        //reset groups
    2667         /*if (item)
    2668         {
    2669            
     2666        if (item)
     2667        {
    26702668            //change groups
    26712669            int groupValue = [[item objectForKey: @"Group"] intValue];
     
    26732671            Torrent * torrent;
    26742672            while ((torrent = [enumerator nextObject]))
     2673            {
     2674                //have to reset objects here to avoid weird crash
     2675                [[[fTableView parentForItem: torrent] objectForKey: @"Torrent"] removeObject: torrent];
     2676                [[item objectForKey: @"Torrent"] addObject: torrent];
     2677               
    26752678                [torrent setGroupValue: groupValue];
    2676         }*/
     2679            }
     2680            //part 1 of avoiding weird crash
     2681            [fTableView reloadItem: nil reloadChildren: YES];
     2682        }
     2683       
     2684        //remove objects to reinsert
     2685        [fTorrents removeObjectsInArray: movingTorrents];
    26772686       
    26782687        //get all torrents to reorder
    26792688        NSSortDescriptor * orderDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"orderValue" ascending: YES] autorelease];
    26802689        [fTorrents sortUsingDescriptors: [NSArray arrayWithObject: orderDescriptor]];
    2681        
    2682         //remove objects to reinsert
    2683         [fTorrents removeObjectsInArray: movingTorrents];
    26842690       
    26852691        //insert objects at new location
Note: See TracChangeset for help on using the changeset viewer.