Changeset 3182


Ignore:
Timestamp:
Sep 26, 2007, 4:12:57 AM (14 years ago)
Author:
livings124
Message:

attempt to decrease memory usage a bit when window/application is hidden

Location:
trunk/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r3150 r3182  
    177177    {
    178178        fLib = tr_init("macosx");
     179       
     180        [NSApp setDelegate: self];
    179181       
    180182        fTorrents = [[NSMutableArray alloc] init];
     
    14511453{
    14521454    [fTorrents makeObjectsPerformSelector: @selector(update)];
    1453 
    1454     //resort if necessary or just update the table
    1455     NSString * sortType = [fDefaults stringForKey: @"Sort"];
    1456     if ([sortType isEqualToString: SORT_PROGRESS] || [sortType isEqualToString: SORT_STATE]
    1457             || [sortType isEqualToString: SORT_TRACKER])
    1458         [self sortTorrents];
    1459     else
    1460         [fTableView reloadData];
    1461    
    1462     //update the global DL/UL rates
    1463     if (![fStatusBar isHidden])
    1464     {
    1465         float downloadRate, uploadRate;
    1466         tr_torrentRates(fLib, & downloadRate, & uploadRate);
    1467        
    1468         [fTotalDLField setStringValue: [NSLocalizedString(@"Total DL: ", "Status bar -> total download")
    1469                                         stringByAppendingString: [NSString stringForSpeed: downloadRate]]];
    1470         [fTotalULField setStringValue: [NSLocalizedString(@"Total UL: ", "Status bar -> total upload")
    1471                                         stringByAppendingString: [NSString stringForSpeed: uploadRate]]];
    1472     }
    1473 
    1474     //update non-constant parts of info window
    1475     if ([[fInfoController window] isVisible])
    1476         [fInfoController updateInfoStats];
     1455   
     1456    if (![NSApp isHidden])
     1457    {
     1458        if ([fWindow isVisible])
     1459        {
     1460            //resort if necessary or just update the table
     1461            NSString * sortType = [fDefaults stringForKey: @"Sort"];
     1462            if ([sortType isEqualToString: SORT_PROGRESS] || [sortType isEqualToString: SORT_STATE]
     1463                    || [sortType isEqualToString: SORT_TRACKER])
     1464                [self sortTorrents];
     1465            else
     1466                [fTableView reloadData];
     1467           
     1468            //update the global DL/UL rates
     1469            if (![fStatusBar isHidden])
     1470            {
     1471                float downloadRate, uploadRate;
     1472                tr_torrentRates(fLib, & downloadRate, & uploadRate);
     1473               
     1474                [fTotalDLField setStringValue: [NSLocalizedString(@"Total DL: ", "Status bar -> total download")
     1475                                                stringByAppendingString: [NSString stringForSpeed: downloadRate]]];
     1476                [fTotalULField setStringValue: [NSLocalizedString(@"Total UL: ", "Status bar -> total upload")
     1477                                                stringByAppendingString: [NSString stringForSpeed: uploadRate]]];
     1478            }
     1479        }
     1480
     1481        //update non-constant parts of info window
     1482        if ([[fInfoController window] isVisible])
     1483            [fInfoController updateInfoStats];
     1484    }
    14771485
    14781486    //badge dock
     
    32203228   
    32213229    [fBadger clearCompleted];
     3230    [self updateUI];
    32223231}
    32233232
     
    32573266    //hide search filter if it overlaps filter buttons
    32583267    [fSearchFilterField setHidden: !show];
     3268}
     3269
     3270- (void) applicationWillUnhide: (NSNotification *) notification
     3271{
     3272    [self updateUI];
    32593273}
    32603274
  • trunk/macosx/InfoWindowController.m

    r3180 r3182  
    389389        [fHaveField setStringValue: [NSString stringForFileSize: 0]];
    390390    else if (have == haveVerified)
    391         [fHaveField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%@ verified", "Inspector -> Activity tab -> have"),
    392                                     [NSString stringForFileSize: haveVerified]]];
    393     else
    394         [fHaveField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%@ (%@ verified)", "Inspector -> Activity tab -> have"),
    395                                     [NSString stringForFileSize: have], [NSString stringForFileSize: haveVerified]]];
     391        [fHaveField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%@ verified",
     392                "Inspector -> Activity tab -> have"), [NSString stringForFileSize: haveVerified]]];
     393    else
     394        [fHaveField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%@ (%@ verified)",
     395                "Inspector -> Activity tab -> have"), [NSString stringForFileSize: have], [NSString stringForFileSize: haveVerified]]];
    396396   
    397397    [fDownloadedTotalField setStringValue: [NSString stringForFileSize: downloadedTotal]];
  • trunk/macosx/TorrentCell.m

    r3145 r3182  
    174174    NSRect result = bounds;
    175175    result.size.height = BAR_HEIGHT;
    176     result.origin.x = PADDING_HORIZONAL + (minimal ? IMAGE_SIZE_MIN : IMAGE_SIZE_REG)
    177                         + PADDING_BETWEEN_IMAGE_AND_BAR;
     176    result.origin.x = PADDING_HORIZONAL + (minimal ? IMAGE_SIZE_MIN : IMAGE_SIZE_REG) + PADDING_BETWEEN_IMAGE_AND_BAR;
    178177   
    179178    result.origin.y += PADDING_ABOVE_TITLE + HEIGHT_TITLE;
Note: See TracChangeset for help on using the changeset viewer.