Changeset 4189


Ignore:
Timestamp:
Dec 17, 2007, 8:10:51 PM (15 years ago)
Author:
livings124
Message:

sort groups by their order in the table

Location:
trunk/macosx
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r4188 r4189  
    17421742    if (!sortByOrder && [fDefaults boolForKey: @"SortByGroup"])
    17431743    {
    1744         NSSortDescriptor * groupDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"groupValue" ascending: asc] autorelease];
     1744        NSSortDescriptor * groupDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"groupOrderValue" ascending: asc] autorelease];
    17451745       
    17461746        NSMutableArray * temp = [[NSMutableArray alloc] initWithCapacity: [descriptors count]+1];
  • trunk/macosx/GroupsWindowController.h

    r4187 r4189  
    4040- (CTGradient *) gradientForIndex: (int) index;
    4141
     42- (int) orderValueForIndex: (int) index;
     43
    4244- (void) addRemoveGroup: (id) sender;
    4345
  • trunk/macosx/GroupsWindowController.m

    r4188 r4189  
    139139}
    140140
     141- (int) orderValueForIndex: (int) index
     142{
     143    if (index != -1)
     144    {
     145        int i;
     146        for (i = 0; i < [fGroups count]; i++)
     147            if (index == [[[fGroups objectAtIndex: i] objectForKey: @"Index"] intValue])
     148                return i;
     149    }
     150    return -1;
     151}
     152
    141153- (NSInteger) numberOfRowsInTableView: (NSTableView *) tableview
    142154{
  • trunk/macosx/Torrent.h

    r4183 r4189  
    211211- (int) groupValue;
    212212- (void) setGroupValue: (int) groupValue;
     213- (int) groupOrderValue;
    213214- (void) checkGroupValue: (NSNotification *) notification;
    214215
  • trunk/macosx/Torrent.m

    r4183 r4189  
    2424
    2525#import "Torrent.h"
     26#import "GroupsWindowController.h"
    2627#import "NSApplicationAdditions.h"
    2728#import "NSStringAdditions.h"
     
    11951196{
    11961197    fGroupValue = goupValue;
     1198}
     1199
     1200- (int) groupOrderValue
     1201{
     1202    return [[GroupsWindowController groupsController] orderValueForIndex: fGroupValue];
    11971203}
    11981204
Note: See TracChangeset for help on using the changeset viewer.