Changeset 2275


Ignore:
Timestamp:
Jul 2, 2007, 10:39:16 PM (15 years ago)
Author:
livings124
Message:

have the badger not set up all of the badge images and other data at launch...instead wait until it's needed

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEWS

    r2273 r2275  
    1010 - Many miscellaneous bugfixes and small improvements
    1111 - OS X:
    12    + Overlay when dragging torrent files onto window
     12   + Overlay when dragging torrent files, URLs, and data files onto window
    1313   + Ability to set an amount of time to consider a transfer stalled
    14    + Various smaller interface changes and improvements
     14   + Various smaller interface improvements
    1515 - GTK:
    1616   + Interface significantly reworked to closer match the Mac version
  • trunk/macosx/Badger.m

    r1917 r2275  
    4040        fLib = lib;
    4141       
    42         fDockIcon = [[NSImage imageNamed: @"NSApplicationIcon"] copy];
    43         fBadge = [NSImage imageNamed: @"Badge"];
    44         fUploadBadge = [NSImage imageNamed: @"UploadBadge"];
    45         fDownloadBadge = [NSImage imageNamed: @"DownloadBadge"];
    46        
    47         NSShadow * stringShadow = [[NSShadow alloc] init];
    48         [stringShadow setShadowOffset: NSMakeSize(2.0, -2.0)];
    49         [stringShadow setShadowBlurRadius: 4.0];
    50        
    51         NSFont * boldFont = [[NSFontManager sharedFontManager] convertFont:
    52                                 [NSFont fontWithName: @"Helvetica" size: 28.0] toHaveTrait: NSBoldFontMask];
    53        
    54         fAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
    55             [NSColor whiteColor], NSForegroundColorAttributeName,
    56             boldFont, NSFontAttributeName, stringShadow, NSShadowAttributeName, nil];
    57        
    58         [stringShadow release];
    59        
    6042        fCompleted = 0;
    6143        fCompletedBadged = 0;
     
    7052    [fDockIcon release];
    7153    [fAttributes release];
     54   
    7255    [super dealloc];
    7356}
     
    8265       
    8366        //force image to reload - copy does not work
    84         NSSize iconSize = [fDockIcon size];
    85         [fDockIcon release];
     67        NSImage * icon = [NSImage imageNamed: @"NSApplicationIcon"];
     68        NSSize iconSize = [icon size];
     69       
     70        if (fDockIcon)
     71            [fDockIcon release];
    8672        fDockIcon = [[NSImage alloc] initWithSize: iconSize];
    87         [fDockIcon addRepresentation: [[NSImage imageNamed: @"NSApplicationIcon"] bestRepresentationForDevice: nil]];
     73        [fDockIcon addRepresentation: [icon bestRepresentationForDevice: nil]];
    8874       
    8975        if (fCompleted > 0)
    9076        {
     77            if (!fBadge)
     78                fBadge = [NSImage imageNamed: @"Badge"];
     79           
    9180            NSRect badgeRect;
    9281            NSSize iconSize = [fDockIcon size];
     
    132121    if (speedChange = (uploadRateString || downloadRateString))
    133122    {
     123        if (!fDockIcon)
     124            fDockIcon = [[NSImage imageNamed: @"NSApplicationIcon"] copy];
    134125        dockIcon = [fDockIcon copy];
     126       
     127        if (!fUploadBadge)
     128            fUploadBadge = [NSImage imageNamed: @"UploadBadge"];
     129        if (!fDownloadBadge)
     130            fDownloadBadge = [NSImage imageNamed: @"DownloadBadge"];
    135131       
    136132        NSRect badgeRect;
     
    216212- (void) badgeString: (NSString *) string forRect: (NSRect) rect
    217213{
     214    if (!fAttributes)
     215    {
     216        NSShadow * stringShadow = [[NSShadow alloc] init];
     217        [stringShadow setShadowOffset: NSMakeSize(2.0, -2.0)];
     218        [stringShadow setShadowBlurRadius: 4.0];
     219       
     220        NSFont * boldFont = [[NSFontManager sharedFontManager] convertFont:
     221                                [NSFont fontWithName: @"Helvetica" size: 28.0] toHaveTrait: NSBoldFontMask];
     222       
     223        fAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
     224            [NSColor whiteColor], NSForegroundColorAttributeName,
     225            boldFont, NSFontAttributeName, stringShadow, NSShadowAttributeName, nil];
     226       
     227        [stringShadow release];
     228    }
     229   
    218230    NSSize stringSize = [string sizeWithAttributes: fAttributes];
    219231   
  • trunk/macosx/Controller.m

    r2273 r2275  
    524524{
    525525    //remove all torrent downloads
    526     NSEnumerator * enumerator;
    527526    if (fPendingTorrentDownloads)
    528527    {
    529         enumerator = [[fPendingTorrentDownloads allValues] objectEnumerator];
     528        NSEnumerator * downloadEnumerator = [[fPendingTorrentDownloads allValues] objectEnumerator];
    530529        NSDictionary * downloadDict;
    531530        NSURLDownload * download;
    532         while ((downloadDict = [enumerator nextObject]))
     531        while ((downloadDict = [downloadEnumerator nextObject]))
    533532        {
    534533            download = [downloadDict objectForKey: @"Download"];
     
    553552   
    554553    //make sure torrents are closed
    555     enumerator = [fTorrents objectEnumerator];
     554    NSEnumerator * enumerator = [fTorrents objectEnumerator];
    556555    Torrent * torrent;
    557556    while ((torrent = [enumerator nextObject]))
     
    11891188    [self updateUI];
    11901189    [self applyFilter: nil];
    1191    
    11921190    [self updateTorrentHistory];
    11931191}
     
    13341332    while ((torrent = [enumerator nextObject]))
    13351333        [torrent resetCache];
    1336    
    1337     #warning reset queue?
    13381334}
    13391335
  • trunk/macosx/Torrent.m

    r2270 r2275  
    607607{
    608608    tr_torrentRecheck(fHandle);
     609    [self update];
    609610}
    610611
Note: See TracChangeset for help on using the changeset viewer.