Changeset 6274


Ignore:
Timestamp:
Jul 1, 2008, 1:28:19 AM (13 years ago)
Author:
livings124
Message:

groups are now stored as objects instead of dictionaries

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Transmission.xcodeproj/project.pbxproj

    r6273 r6274  
    145145                A2725D5D0DE7507C003445E7 /* TrackerTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = A2725D5C0DE7507C003445E7 /* TrackerTableView.m */; };
    146146                A277DA0B0C693D9C00DA2CD4 /* ActionOn.png in Resources */ = {isa = PBXBuildFile; fileRef = A277DA090C693D9C00DA2CD4 /* ActionOn.png */; };
     147                A27F0F330E19AD9800B2DB97 /* TorrentGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = A27F0F320E19AD9800B2DB97 /* TorrentGroup.m */; };
    147148                A28F4F770E085BDC003A3882 /* ColorTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = A28F4F760E085BDC003A3882 /* ColorTextField.m */; };
    148149                A292A6E80DFB45FC004B9C0A /* webseed.c in Sources */ = {isa = PBXBuildFile; fileRef = A292A6E50DFB45EC004B9C0A /* webseed.c */; };
     
    578579                A27477010CC38EE6003CC76D /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = macosx/es.lproj/Localizable.strings; sourceTree = "<group>"; };
    579580                A277DA090C693D9C00DA2CD4 /* ActionOn.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ActionOn.png; path = macosx/Images/ActionOn.png; sourceTree = "<group>"; };
     581                A27F0F310E19AD9800B2DB97 /* TorrentGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TorrentGroup.h; path = macosx/TorrentGroup.h; sourceTree = "<group>"; };
     582                A27F0F320E19AD9800B2DB97 /* TorrentGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TorrentGroup.m; path = macosx/TorrentGroup.m; sourceTree = "<group>"; };
    580583                A28AFE050DA1C47A00673957 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = zh_TW; path = macosx/zh_TW.lproj/AddWindow.xib; sourceTree = "<group>"; };
    581584                A28AFE060DA1C47A00673957 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = zh_TW; path = macosx/zh_TW.lproj/Creator.xib; sourceTree = "<group>"; };
     
    890893                                4DFBC2DD09C0970D00D5C571 /* Torrent.h */,
    891894                                4DFBC2DE09C0970D00D5C571 /* Torrent.m */,
     895                                A27F0F310E19AD9800B2DB97 /* TorrentGroup.h */,
     896                                A27F0F320E19AD9800B2DB97 /* TorrentGroup.m */,
    892897                                4D364D9E091FBB2C00377D12 /* TorrentTableView.h */,
    893898                                4D364D9F091FBB2C00377D12 /* TorrentTableView.m */,
     
    19771982                                A2725D5D0DE7507C003445E7 /* TrackerTableView.m in Sources */,
    19781983                                A28F4F770E085BDC003A3882 /* ColorTextField.m in Sources */,
     1984                                A27F0F330E19AD9800B2DB97 /* TorrentGroup.m in Sources */,
    19791985                        );
    19801986                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/macosx/BlocklistDownloader.h

    r6273 r6274  
    4343}
    4444
    45 + (void) downloadWithPrefsController: (PrefsController *) prefsController; //only use when no other blocklist downloads
     45+ (void) downloadWithPrefsController: (PrefsController *) prefsController; //only use when no other blocklist is downloading
    4646
    4747- (void) cancelDownload: (id) sender;
  • trunk/macosx/Controller.m

    r6260 r6274  
    2727#import "Controller.h"
    2828#import "Torrent.h"
     29#import "TorrentGroup.h"
    2930#import "TorrentCell.h"
    3031#import "TorrentTableView.h"
     
    18891890    {
    18901891        NSEnumerator * enumerator = [fDisplayedTorrents objectEnumerator];
    1891         NSDictionary * dict;
    1892         while ((dict = [enumerator nextObject]))
    1893             [[dict objectForKey: @"Torrents"] sortUsingDescriptors: descriptors];
     1892        TorrentGroup * group;
     1893        while ((group = [enumerator nextObject]))
     1894            [[group torrents] sortUsingDescriptors: descriptors];
    18941895    }
    18951896    else
     
    19101911       
    19111912        NSEnumerator * enumerator = [fDisplayedTorrents objectEnumerator];
    1912         NSDictionary * dict;
    1913         while ((dict = [enumerator nextObject]))
    1914             [previousTorrents addObjectsFromArray: [dict objectForKey: @"Torrents"]];
     1913        TorrentGroup * group;
     1914        while ((group = [enumerator nextObject]))
     1915            [previousTorrents addObjectsFromArray: [group torrents]];
    19151916    }
    19161917    else
     
    20482049            if (groupValue != oldGroupValue)
    20492050            {
    2050                 groupTorrents = [NSMutableArray array];
    2051                 NSDictionary * dict = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: groupValue], @"Group",
    2052                                         groupTorrents, @"Torrents", nil];
    2053                 [fDisplayedTorrents addObject: dict];
     2051                TorrentGroup * group = [TorrentGroup groupForIndex: groupValue];
     2052                [fDisplayedTorrents addObject: group];
     2053                groupTorrents = [group torrents];
    20542054               
    20552055                oldGroupValue = groupValue;
     
    20712071    {
    20722072        enumerator = [fDisplayedTorrents objectEnumerator];
    2073         NSDictionary * dict;
    2074         while ((dict = [enumerator nextObject]))
    2075         {
    2076             if ([fTableView isGroupCollapsed: [[dict objectForKey: @"Group"] intValue]])
    2077                 [fTableView collapseItem: dict];
     2073        TorrentGroup * group;
     2074        while ((group = [enumerator nextObject]))
     2075        {
     2076            if ([fTableView isGroupCollapsed: [group groupIndex]])
     2077                [fTableView collapseItem: group];
    20782078            else
    2079                 [fTableView expandItem: dict];
     2079                [fTableView expandItem: group];
    20802080        }
    20812081    }
     
    25772577{
    25782578    if (item)
    2579         return [[item objectForKey: @"Torrents"] count];
     2579        return [[item torrents] count];
    25802580    else
    25812581        return [fDisplayedTorrents count];
     
    25852585{
    25862586    if (item)
    2587         return [[item objectForKey: @"Torrents"] objectAtIndex: index];
     2587        return [[item torrents] objectAtIndex: index];
    25882588    else
    25892589        return [fDisplayedTorrents objectAtIndex: index];
     
    26042604        if ([ident isEqualToString: @"Group"])
    26052605        {
    2606             int group = [[item objectForKey: @"Group"] intValue];
     2606            int group = [item groupIndex];
    26072607            return group != -1 ? [[GroupsController groups] nameForIndex: group]
    26082608                                : NSLocalizedString(@"No Group", "Group table row");
     
    26102610        else if ([ident isEqualToString: @"Color"])
    26112611        {
    2612             int group = [[item objectForKey: @"Group"] intValue];
     2612            int group = [item groupIndex];
    26132613            return [[GroupsController groups] imageForIndex: group];
    26142614        }
     
    26232623            {
    26242624                uint64_t uploaded = 0, downloaded = 0;
    2625                 NSEnumerator * enumerator = [[item objectForKey: @"Torrents"] objectEnumerator];
     2625                NSEnumerator * enumerator = [[item torrents] objectEnumerator];
    26262626                Torrent * torrent;
    26272627                while ((torrent = [enumerator nextObject]))
     
    26382638               
    26392639                float rate = 0.0;
    2640                 NSEnumerator * enumerator = [[item objectForKey: @"Torrents"] objectEnumerator];
     2640                NSEnumerator * enumerator = [[item torrents] objectEnumerator];
    26412641                Torrent * torrent;
    26422642                while ((torrent = [enumerator nextObject]))
     
    26882688                if ([item isKindOfClass: [Torrent class]])
    26892689                {
    2690                     NSDictionary * group = [fTableView parentForItem: item];
    2691                     index = [[group objectForKey: @"Torrents"] indexOfObject: item] + 1;
     2690                    TorrentGroup * group = [fTableView parentForItem: item];
     2691                    index = [[group torrents] indexOfObject: item] + 1;
    26922692                    item = group;
    26932693                }
     
    27372737        {
    27382738            //change groups
    2739             int groupValue = [[item objectForKey: @"Group"] intValue];
     2739            int groupValue = [item groupIndex];
    27402740            NSEnumerator * enumerator = [movingTorrents objectEnumerator];
    27412741            Torrent * torrent;
     
    27432743            {
    27442744                //have to reset objects here to avoid weird crash
    2745                 [[[fTableView parentForItem: torrent] objectForKey: @"Torrent"] removeObject: torrent];
    2746                 [[item objectForKey: @"Torrent"] addObject: torrent];
     2745                [[[fTableView parentForItem: torrent] torrents] removeObject: torrent];
     2746                [[item torrents] addObject: torrent];
    27472747               
    27482748                [torrent setGroupValue: groupValue];
     
    27562756        {
    27572757            //find torrent to place under
    2758             NSArray * groupTorrents = item ? [item objectForKey: @"Torrents"] : fDisplayedTorrents;
     2758            NSArray * groupTorrents = item ? [item torrents] : fDisplayedTorrents;
    27592759            Torrent * topTorrent = nil;
    27602760            for (i = newRow-1; i >= 0; i--)
  • trunk/macosx/TorrentTableView.m

    r6265 r6274  
    2626#import "TorrentCell.h"
    2727#import "Torrent.h"
     28#import "TorrentGroup.h"
    2829#import "FileListNode.h"
    2930#import "QuickLookController.h"
     
    235236    else if (ident)
    236237    {
    237         int count = [[item objectForKey: @"Torrents"] count];
     238        int count = [[item torrents] count];
    238239        if (count == 1)
    239240            return NSLocalizedString(@"1 transfer", "Torrent table -> group row -> tooltip");
     
    355356- (void) outlineViewItemDidExpand: (NSNotification *) notification
    356357{
    357     int value = [[[[notification userInfo] objectForKey: @"NSObject"] objectForKey: @"Group"] intValue];
     358    int value = [[[notification userInfo] objectForKey: @"NSObject"] groupIndex];
    358359    if (value < 0)
    359360        value = MAX_GROUP;
     
    368369- (void) outlineViewItemDidCollapse: (NSNotification *) notification
    369370{
    370     int value = [[[[notification userInfo] objectForKey: @"NSObject"] objectForKey: @"Group"] intValue];
     371    int value = [[[notification userInfo] objectForKey: @"NSObject"] groupIndex];
    371372    if (value < 0)
    372373        value = MAX_GROUP;
     
    449450        else
    450451        {
    451             NSNumber * group = [item objectForKey: @"Group"];
    452             int i;
     452            int i, group = [item groupIndex];
    453453            for (i = 0; i < [self numberOfRows]; i++)
    454454            {
     
    457457               
    458458                id tableItem = [self itemAtRow: i];
    459                 if (![tableItem isKindOfClass: [Torrent class]] && [group isEqualToNumber: [tableItem objectForKey: @"Group"]])
     459                if (![tableItem isKindOfClass: [Torrent class]] && group == [tableItem groupIndex])
    460460                {
    461461                    [indexSet addIndex: i];
     
    494494        else
    495495        {
    496             NSArray * groupTorrents = [item objectForKey: @"Torrents"];
     496            NSArray * groupTorrents = [item torrents];
    497497            [torrents addObjectsFromArray: groupTorrents];
    498498            i += [groupTorrents count];
Note: See TracChangeset for help on using the changeset viewer.