Changeset 10335


Ignore:
Timestamp:
Mar 9, 2010, 2:26:52 AM (12 years ago)
Author:
livings124
Message:

avoid setting views in the inspector until necessary

Location:
trunk/macosx
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/InfoActivityViewController.h

    r10309 r10335  
    3232    NSArray * fTorrents;
    3333   
     34    BOOL fSet;
     35   
    3436    IBOutlet NSTextField * fDateAddedField, * fDateCompletedField, * fDateActivityField,
    3537                        * fStateField, * fProgressField,
  • trunk/macosx/InfoActivityViewController.m

    r10317 r10335  
    3232#define PIECES_CONTROL_AVAILABLE 1
    3333
     34@interface InfoActivityViewController (Private)
     35
     36- (void) setupInfo;
     37
     38@end
     39
    3440@implementation InfoActivityViewController
    3541
     
    5561    fTorrents = [torrents retain];
    5662   
     63    fSet = NO;
     64}
     65
     66- (void) updateInfo
     67{
     68    if (!fSet)
     69        [self setupInfo];
     70   
     71    const NSInteger numberSelected = [fTorrents count];
     72    if (numberSelected == 0)
     73        return;
     74   
     75    uint64_t have = 0, haveVerified = 0, downloadedTotal = 0, uploadedTotal = 0, failedHash = 0;
     76    NSDate * lastActivity = nil;
     77    for (Torrent * torrent in fTorrents)
     78    {
     79        have += [torrent haveTotal];
     80        haveVerified += [torrent haveVerified];
     81        downloadedTotal += [torrent downloadedTotal];
     82        uploadedTotal += [torrent uploadedTotal];
     83        failedHash += [torrent failedHash];
     84       
     85        NSDate * nextLastActivity;
     86        if ((nextLastActivity = [torrent dateActivity]))
     87            lastActivity = lastActivity ? [lastActivity laterDate: nextLastActivity] : nextLastActivity;
     88    }
     89   
     90    if (have == 0)
     91        [fHaveField setStringValue: [NSString stringForFileSize: 0]];
     92    else
     93    {
     94        NSString * verifiedString = [NSString stringWithFormat: NSLocalizedString(@"%@ verified", "Inspector -> Activity tab -> have"),
     95                                        [NSString stringForFileSize: haveVerified]];
     96        if (have == haveVerified)
     97            [fHaveField setStringValue: verifiedString];
     98        else
     99            [fHaveField setStringValue: [NSString stringWithFormat: @"%@ (%@)", [NSString stringForFileSize: have], verifiedString]];
     100    }
     101   
     102    [fDownloadedTotalField setStringValue: [NSString stringForFileSize: downloadedTotal]];
     103    [fUploadedTotalField setStringValue: [NSString stringForFileSize: uploadedTotal]];
     104    [fFailedHashField setStringValue: [NSString stringForFileSize: failedHash]];
     105   
     106    [fDateActivityField setObjectValue: lastActivity];
     107   
     108    if (numberSelected == 1)
     109    {
     110        Torrent * torrent = [fTorrents objectAtIndex: 0];
     111       
     112        [fStateField setStringValue: [torrent stateString]];
     113       
     114        if ([torrent isFolder])
     115            [fProgressField setStringValue: [NSString localizedStringWithFormat: NSLocalizedString(@"%.2f%% (%.2f%% selected)",
     116                "Inspector -> Activity tab -> progress"), 100.0 * [torrent progress], 100.0 * [torrent progressDone]]];
     117        else
     118            [fProgressField setStringValue: [NSString localizedStringWithFormat: @"%.2f%%", 100.0 * [torrent progress]]];
     119           
     120        [fRatioField setStringValue: [NSString stringForRatio: [torrent ratio]]];
     121       
     122        NSString * errorMessage = [torrent errorMessage];
     123        if (![errorMessage isEqualToString: [fErrorMessageView string]])
     124            [fErrorMessageView setString: errorMessage];
     125       
     126        [fDateCompletedField setObjectValue: [torrent dateCompleted]];
     127       
     128        [fPiecesView updateView];
     129    }
     130    else if (numberSelected > 1)
     131    {
     132        [fRatioField setStringValue: [NSString stringForRatio: tr_getRatio(uploadedTotal, downloadedTotal)]];
     133    }
     134    else;
     135}
     136
     137- (void) setPiecesView: (id) sender
     138{
     139    [self setPiecesViewForAvailable: [sender selectedSegment] == PIECES_CONTROL_AVAILABLE];
     140}
     141
     142- (void) setPiecesViewForAvailable: (BOOL) available
     143{
     144    [fPiecesControl setSelected: available forSegment: PIECES_CONTROL_AVAILABLE];
     145    [fPiecesControl setSelected: !available forSegment: PIECES_CONTROL_PROGRESS];
     146   
     147    [[NSUserDefaults standardUserDefaults] setBool: available forKey: @"PiecesViewShowAvailability"];
     148    [fPiecesView updateView];
     149}
     150
     151- (void) clearPiecesView
     152{
     153    [fPiecesView clearView];
     154}
     155
     156@end
     157
     158@implementation InfoActivityViewController (Private)
     159
     160- (void) setupInfo
     161{
    57162    const NSUInteger count = [fTorrents count];
    58163    if (count != 1)
     
    93198        [fPiecesView setTorrent: torrent];
    94199    }
    95 }
    96 
    97 - (void) updateInfo
    98 {
    99     const NSInteger numberSelected = [fTorrents count];
    100     if (numberSelected == 0)
    101         return;
    102    
    103     uint64_t have = 0, haveVerified = 0, downloadedTotal = 0, uploadedTotal = 0, failedHash = 0;
    104     NSDate * lastActivity = nil;
    105     for (Torrent * torrent in fTorrents)
    106     {
    107         have += [torrent haveTotal];
    108         haveVerified += [torrent haveVerified];
    109         downloadedTotal += [torrent downloadedTotal];
    110         uploadedTotal += [torrent uploadedTotal];
    111         failedHash += [torrent failedHash];
    112        
    113         NSDate * nextLastActivity;
    114         if ((nextLastActivity = [torrent dateActivity]))
    115             lastActivity = lastActivity ? [lastActivity laterDate: nextLastActivity] : nextLastActivity;
    116     }
    117    
    118     if (have == 0)
    119         [fHaveField setStringValue: [NSString stringForFileSize: 0]];
    120     else
    121     {
    122         NSString * verifiedString = [NSString stringWithFormat: NSLocalizedString(@"%@ verified", "Inspector -> Activity tab -> have"),
    123                                         [NSString stringForFileSize: haveVerified]];
    124         if (have == haveVerified)
    125             [fHaveField setStringValue: verifiedString];
    126         else
    127             [fHaveField setStringValue: [NSString stringWithFormat: @"%@ (%@)", [NSString stringForFileSize: have], verifiedString]];
    128     }
    129    
    130     [fDownloadedTotalField setStringValue: [NSString stringForFileSize: downloadedTotal]];
    131     [fUploadedTotalField setStringValue: [NSString stringForFileSize: uploadedTotal]];
    132     [fFailedHashField setStringValue: [NSString stringForFileSize: failedHash]];
    133    
    134     [fDateActivityField setObjectValue: lastActivity];
    135    
    136     if (numberSelected == 1)
    137     {
    138         Torrent * torrent = [fTorrents objectAtIndex: 0];
    139        
    140         [fStateField setStringValue: [torrent stateString]];
    141        
    142         if ([torrent isFolder])
    143             [fProgressField setStringValue: [NSString localizedStringWithFormat: NSLocalizedString(@"%.2f%% (%.2f%% selected)",
    144                 "Inspector -> Activity tab -> progress"), 100.0 * [torrent progress], 100.0 * [torrent progressDone]]];
    145         else
    146             [fProgressField setStringValue: [NSString localizedStringWithFormat: @"%.2f%%", 100.0 * [torrent progress]]];
    147            
    148         [fRatioField setStringValue: [NSString stringForRatio: [torrent ratio]]];
    149        
    150         NSString * errorMessage = [torrent errorMessage];
    151         if (![errorMessage isEqualToString: [fErrorMessageView string]])
    152             [fErrorMessageView setString: errorMessage];
    153        
    154         [fDateCompletedField setObjectValue: [torrent dateCompleted]];
    155        
    156         [fPiecesView updateView];
    157     }
    158     else if (numberSelected > 1)
    159     {
    160         [fRatioField setStringValue: [NSString stringForRatio: tr_getRatio(uploadedTotal, downloadedTotal)]];
    161     }
    162     else;
    163 }
    164 
    165 - (void) setPiecesView: (id) sender
    166 {
    167     [self setPiecesViewForAvailable: [sender selectedSegment] == PIECES_CONTROL_AVAILABLE];
    168 }
    169 
    170 - (void) setPiecesViewForAvailable: (BOOL) available
    171 {
    172     [fPiecesControl setSelected: available forSegment: PIECES_CONTROL_AVAILABLE];
    173     [fPiecesControl setSelected: !available forSegment: PIECES_CONTROL_PROGRESS];
    174    
    175     [[NSUserDefaults standardUserDefaults] setBool: available forKey: @"PiecesViewShowAvailability"];
    176     [fPiecesView updateView];
    177 }
    178 
    179 - (void) clearPiecesView
    180 {
    181     [fPiecesView clearView];
     200   
     201    fSet = YES;
    182202}
    183203
  • trunk/macosx/InfoFileViewController.h

    r10309 r10335  
    3131    NSArray * fTorrents;
    3232   
     33    BOOL fSet;
     34   
    3335    IBOutlet FileOutlineController * fFileController;
    3436   
  • trunk/macosx/InfoFileViewController.m

    r10314 r10335  
    3030
    3131@interface InfoFileViewController (Private)
     32
     33- (void) setupInfo;
    3234
    3335- (BOOL) canQuickLookFile: (FileListNode *) item;
     
    6365    fTorrents = [torrents retain];
    6466   
    65     [fFileFilterField setStringValue: @""];
    66    
    67     if ([fTorrents count] == 1)
    68     {
    69         Torrent * torrent = [fTorrents objectAtIndex: 0];
    70        
    71         [fFileController setTorrent: torrent];
    72         [fFileFilterField setEnabled: [torrent isFolder]];
    73     }
    74     else
    75     {
    76         [fFileController setTorrent: nil];
    77         [fFileFilterField setEnabled: NO];
    78     }
     67    fSet = NO;
    7968}
    8069
    8170- (void) updateInfo
    8271{
     72    if (!fSet)
     73        [self setupInfo];
     74   
    8375    if ([fTorrents count] == 1)
    8476        [fFileController reloadData];
     
    159151@implementation InfoFileViewController (Private)
    160152
     153- (void) setupInfo
     154{
     155    [fFileFilterField setStringValue: @""];
     156   
     157    if ([fTorrents count] == 1)
     158    {
     159        Torrent * torrent = [fTorrents objectAtIndex: 0];
     160       
     161        [fFileController setTorrent: torrent];
     162        [fFileFilterField setEnabled: [torrent isFolder]];
     163    }
     164    else
     165    {
     166        [fFileController setTorrent: nil];
     167        [fFileFilterField setEnabled: NO];
     168    }
     169   
     170    fSet = YES;
     171}
     172
    161173- (BOOL) canQuickLookFile: (FileListNode *) item
    162174{
  • trunk/macosx/InfoGeneralViewController.h

    r10309 r10335  
    2929    NSArray * fTorrents;
    3030   
     31    BOOL fSet;
     32   
    3133    IBOutlet NSTextField * fPiecesField, * fHashField, * fSecureField,
    3234                        * fDataLocationField,
  • trunk/macosx/InfoGeneralViewController.m

    r10314 r10335  
    2727#import "NSStringAdditions.h"
    2828#import "Torrent.h"
     29
     30@interface InfoGeneralViewController (Private)
     31
     32- (void) setupInfo;
     33
     34@end
    2935
    3036@implementation InfoGeneralViewController
     
    6975    fTorrents = [torrents retain];
    7076   
     77    fSet = NO;
     78}
     79
     80- (void) updateInfo
     81{
     82    if (!fSet)
     83        [self setupInfo];
     84   
     85    if ([fTorrents count] != 1)
     86        return;
     87   
     88    Torrent * torrent = [fTorrents objectAtIndex: 0];
     89   
     90    NSString * location = [torrent dataLocation];
     91    [fDataLocationField setStringValue: location ? [location stringByAbbreviatingWithTildeInPath] : @""];
     92    [fDataLocationField setToolTip: location ? location : @""];
     93   
     94    [fRevealDataButton setHidden: !location];
     95}
     96
     97- (void) revealDataFile: (id) sender
     98{
     99    Torrent * torrent = [fTorrents objectAtIndex: 0];
     100    NSString * location = [torrent dataLocation];
     101    if (!location)
     102        return;
     103   
     104    if ([NSApp isOnSnowLeopardOrBetter])
     105    {
     106        NSURL * file = [NSURL fileURLWithPath: location];
     107        [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs: [NSArray arrayWithObject: file]];
     108    }
     109    else
     110        [[NSWorkspace sharedWorkspace] selectFile: location inFileViewerRootedAtPath: nil];
     111}
     112
     113@end
     114
     115@implementation InfoGeneralViewController (Private)
     116
     117- (void) setupInfo
     118{
    71119    if ([fTorrents count] == 1)
    72120    {
     
    107155        [fRevealDataButton setHidden: YES];
    108156    }
    109 }
    110 
    111 - (void) updateInfo
    112 {   
    113     if ([fTorrents count] != 1)
    114         return;
    115157   
    116     Torrent * torrent = [fTorrents objectAtIndex: 0];
    117    
    118     NSString * location = [torrent dataLocation];
    119     [fDataLocationField setStringValue: location ? [location stringByAbbreviatingWithTildeInPath] : @""];
    120     [fDataLocationField setToolTip: location ? location : @""];
    121    
    122     [fRevealDataButton setHidden: !location];
    123 }
    124 
    125 - (void) revealDataFile: (id) sender
    126 {
    127     Torrent * torrent = [fTorrents objectAtIndex: 0];
    128     NSString * location = [torrent dataLocation];
    129     if (!location)
    130         return;
    131    
    132     if ([NSApp isOnSnowLeopardOrBetter])
    133     {
    134         NSURL * file = [NSURL fileURLWithPath: location];
    135         [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs: [NSArray arrayWithObject: file]];
    136     }
    137     else
    138         [[NSWorkspace sharedWorkspace] selectFile: location inFileViewerRootedAtPath: nil];
     158    fSet = YES;
    139159}
    140160
    141161@end
     162
  • trunk/macosx/InfoOptionsViewController.h

    r10309 r10335  
    2929    NSArray * fTorrents;
    3030   
     31    BOOL fSet;
     32   
    3133    IBOutlet NSPopUpButton * fPriorityPopUp, * fRatioPopUp;
    3234    IBOutlet NSButton * fUploadLimitCheck, * fDownloadLimitCheck, * fGlobalLimitCheck;
     
    3941
    4042- (void) setInfoForTorrents: (NSArray *) torrents;
     43- (void) updateInfo;
    4144- (void) updateOptions;
    4245
  • trunk/macosx/InfoOptionsViewController.m

    r10314 r10335  
    3636#define INVALID -99
    3737
     38@interface InfoOptionsViewController (Private)
     39
     40- (void) setupInfo;
     41
     42@end
     43
    3844@implementation InfoOptionsViewController
    3945
     
    5965    fTorrents = [torrents retain];
    6066   
    61     if ([fTorrents count] == 0)
    62     {
    63         [fUploadLimitCheck setEnabled: NO];
    64         [fUploadLimitCheck setState: NSOffState];
    65         [fUploadLimitField setEnabled: NO];
    66         [fUploadLimitLabel setEnabled: NO];
    67         [fUploadLimitField setStringValue: @""];
    68        
    69         [fDownloadLimitCheck setEnabled: NO];
    70         [fDownloadLimitCheck setState: NSOffState];
    71         [fDownloadLimitField setEnabled: NO];
    72         [fDownloadLimitLabel setEnabled: NO];
    73         [fDownloadLimitField setStringValue: @""];
    74        
    75         [fGlobalLimitCheck setEnabled: NO];
    76         [fGlobalLimitCheck setState: NSOffState];
    77        
    78         [fPriorityPopUp setEnabled: NO];
    79         [fPriorityPopUp selectItemAtIndex: -1];
    80        
    81         [fRatioPopUp setEnabled: NO];
    82         [fRatioPopUp selectItemAtIndex: -1];
    83         [fRatioLimitField setHidden: YES];
    84         [fRatioLimitField setStringValue: @""];
    85        
    86         [fPeersConnectField setEnabled: NO];
    87         [fPeersConnectField setStringValue: @""];
    88         [fPeersConnectLabel setEnabled: NO];
    89     }
    90     else
    91         [self updateOptions];
     67    fSet = NO;
     68}
     69
     70- (void) updateInfo
     71{
     72    if (!fSet)
     73        [self setupInfo];
     74   
     75    fSet = YES;
    9276}
    9377
     
    376360@implementation InfoOptionsViewController (Private)
    377361
     362- (void) setupInfo
     363{
     364    if ([fTorrents count] == 0)
     365    {
     366        [fUploadLimitCheck setEnabled: NO];
     367        [fUploadLimitCheck setState: NSOffState];
     368        [fUploadLimitField setEnabled: NO];
     369        [fUploadLimitLabel setEnabled: NO];
     370        [fUploadLimitField setStringValue: @""];
     371       
     372        [fDownloadLimitCheck setEnabled: NO];
     373        [fDownloadLimitCheck setState: NSOffState];
     374        [fDownloadLimitField setEnabled: NO];
     375        [fDownloadLimitLabel setEnabled: NO];
     376        [fDownloadLimitField setStringValue: @""];
     377       
     378        [fGlobalLimitCheck setEnabled: NO];
     379        [fGlobalLimitCheck setState: NSOffState];
     380       
     381        [fPriorityPopUp setEnabled: NO];
     382        [fPriorityPopUp selectItemAtIndex: -1];
     383       
     384        [fRatioPopUp setEnabled: NO];
     385        [fRatioPopUp selectItemAtIndex: -1];
     386        [fRatioLimitField setHidden: YES];
     387        [fRatioLimitField setStringValue: @""];
     388       
     389        [fPeersConnectField setEnabled: NO];
     390        [fPeersConnectField setStringValue: @""];
     391        [fPeersConnectLabel setEnabled: NO];
     392    }
     393    else
     394        [self updateOptions];
     395}
     396
    378397@end
  • trunk/macosx/InfoPeersViewController.h

    r10316 r10335  
    2929    NSArray * fTorrents;
    3030   
     31    BOOL fSet;
     32   
    3133    NSMutableArray * fPeers, * fWebSeeds;
    3234   
  • trunk/macosx/InfoPeersViewController.m

    r10322 r10335  
    3131@interface InfoPeersViewController (Private)
    3232
    33 - (void) resetInfo;
     33- (void) setupInfo;
    3434
    3535- (void) setWebSeedTableHidden: (BOOL) hide animate: (BOOL) animate;
     
    105105    fTorrents = [torrents retain];
    106106   
    107     [self resetInfo];
     107    fSet = NO;
    108108}
    109109
    110110- (void) updateInfo
    111111{
     112    if (!fSet)
     113        [self setupInfo];
     114   
    112115    if ([fTorrents count] == 0)
    113116        return;
     
    442445@implementation InfoPeersViewController (Private)
    443446
    444 - (void) resetInfo
     447- (void) setupInfo
    445448{
    446449    BOOL hasWebSeeds = NO;
     
    471474    }
    472475    [self setWebSeedTableHidden: !hasWebSeeds animate: YES];
     476   
     477    fSet = YES;
    473478}
    474479
  • trunk/macosx/InfoTrackersViewController.h

    r10309 r10335  
    3333    NSArray * fTorrents;
    3434   
     35    BOOL fSet;
     36   
    3537    NSMutableArray * fTrackers;
    3638   
  • trunk/macosx/InfoTrackersViewController.m

    r10314 r10335  
    3737@interface InfoTrackersViewController (Private)
    3838
     39- (void) setupInfo;
     40
    3941- (void) addTrackers;
    4042- (void) removeTrackers;
     
    7173    fTorrents = [torrents retain];
    7274   
    73     const NSUInteger numberSelected = [fTorrents count];
    74     if (numberSelected != 1)
    75     {
    76         if (numberSelected == 0)
    77         {
    78             [fTrackers release];
    79             fTrackers = nil;
    80            
    81             [fTrackerTable setTrackers: nil];
    82             [fTrackerTable reloadData];
    83         }
    84        
    85         [fTrackerTable setTorrent: nil];
    86        
    87         [fTrackerAddRemoveControl setEnabled: NO forSegment: TRACKER_ADD_TAG];
    88         [fTrackerAddRemoveControl setEnabled: NO forSegment: TRACKER_REMOVE_TAG];
    89     }
    90     else
    91     {
    92         [fTrackerTable setTorrent: [fTorrents objectAtIndex: 0]];
    93        
    94         [fTrackerAddRemoveControl setEnabled: YES forSegment: TRACKER_ADD_TAG];
    95         [fTrackerAddRemoveControl setEnabled: NO forSegment: TRACKER_REMOVE_TAG];
    96     }
    97    
    98     [fTrackerTable deselectAll: self];
     75    fSet = NO;
    9976}
    10077
    10178- (void) updateInfo
    10279{
     80    if (!fSet)
     81        [self setupInfo];
     82   
    10383    if ([fTorrents count] == 0)
    10484        return;
     
    246226
    247227@implementation InfoTrackersViewController (Private)
     228
     229- (void) setupInfo
     230{
     231    const NSUInteger numberSelected = [fTorrents count];
     232    if (numberSelected != 1)
     233    {
     234        if (numberSelected == 0)
     235        {
     236            [fTrackers release];
     237            fTrackers = nil;
     238           
     239            [fTrackerTable setTrackers: nil];
     240            [fTrackerTable reloadData];
     241        }
     242       
     243        [fTrackerTable setTorrent: nil];
     244       
     245        [fTrackerAddRemoveControl setEnabled: NO forSegment: TRACKER_ADD_TAG];
     246        [fTrackerAddRemoveControl setEnabled: NO forSegment: TRACKER_REMOVE_TAG];
     247    }
     248    else
     249    {
     250        [fTrackerTable setTorrent: [fTorrents objectAtIndex: 0]];
     251       
     252        [fTrackerAddRemoveControl setEnabled: YES forSegment: TRACKER_ADD_TAG];
     253        [fTrackerAddRemoveControl setEnabled: NO forSegment: TRACKER_REMOVE_TAG];
     254    }
     255   
     256    [fTrackerTable deselectAll: self];
     257   
     258    fSet = YES;
     259}
    248260
    249261#warning doesn't like blank addresses
  • trunk/macosx/InfoWindowController.m

    r10316 r10335  
    7878    NSPanel * window = (NSPanel *)[self window];
    7979   
    80     CGFloat windowHeight = [window frame].size.height;
    81    
     80    const CGFloat windowHeight = NSHeight([window frame]);
     81   
     82    #warning check if this is still needed
    8283    [window setFrameAutosaveName: @"InspectorWindow"];
    8384    [window setFrameUsingName: @"InspectorWindow"];
    8485   
    8586    NSRect windowRect = [window frame];
    86     windowRect.origin.y -= windowHeight - windowRect.size.height;
     87    windowRect.origin.y -= windowHeight - NSHeight(windowRect);
    8788    windowRect.size.height = windowHeight;
    8889    [window setFrame: windowRect display: NO];
     
    197198            [fFileViewController updateInfo];
    198199            break;
     200        case TAB_OPTIONS_TAG:
     201            [fOptionsViewController updateInfo];
     202            break;
    199203    }
    200204}
     
    278282        case TAB_GENERAL_TAG:
    279283            if (!fGeneralViewController)
     284            {
    280285                fGeneralViewController = [[InfoGeneralViewController alloc] init];
     286                [fGeneralViewController setInfoForTorrents: fTorrents];
     287            }
    281288           
    282289            identifier = TAB_INFO_IDENT;
     
    285292        case TAB_ACTIVITY_TAG:
    286293            if (!fActivityViewController)
     294            {
    287295                fActivityViewController = [[InfoActivityViewController alloc] init];
     296                [fActivityViewController setInfoForTorrents: fTorrents];
     297            }
    288298           
    289299            identifier = TAB_ACTIVITY_IDENT;
     
    292302        case TAB_TRACKERS_TAG:
    293303            if (!fTrackersViewController)
     304            {
    294305                fTrackersViewController = [[InfoTrackersViewController alloc] init];
     306                [fTrackersViewController setInfoForTorrents: fTorrents];
     307            }
    295308           
    296309            identifier = TAB_TRACKER_IDENT;
     
    300313        case TAB_PEERS_TAG:
    301314            if (!fPeersViewController)
     315            {
    302316                fPeersViewController = [[InfoPeersViewController alloc] init];
     317                [fPeersViewController setInfoForTorrents: fTorrents];
     318            }
    303319           
    304320            identifier = TAB_PEERS_IDENT;
     
    308324        case TAB_FILE_TAG:
    309325            if (!fFileViewController)
     326            {
    310327                fFileViewController = [[InfoFileViewController alloc] init];
     328                [fFileViewController setInfoForTorrents: fTorrents];
     329            }
    311330           
    312331            identifier = TAB_FILES_IDENT;
     
    316335        case TAB_OPTIONS_TAG:
    317336            if (!fOptionsViewController)
     337            {
    318338                fOptionsViewController = [[InfoOptionsViewController alloc] init];
     339                [fOptionsViewController setInfoForTorrents: fTorrents];
     340            }
    319341           
    320342            identifier = TAB_OPTIONS_IDENT;
     
    336358   
    337359    NSView * view = [self tabViewForTag: fCurrentTabTag];
    338    
    339     //if view was just loaded - has to be a better way
    340     [fGeneralViewController setInfoForTorrents: fTorrents];
    341     [fActivityViewController setInfoForTorrents: fTorrents];
    342     [fTrackersViewController setInfoForTorrents: fTorrents];
    343     [fPeersViewController setInfoForTorrents: fTorrents];
    344     [fFileViewController setInfoForTorrents: fTorrents];
    345     [fOptionsViewController setInfoForTorrents: fTorrents];
    346360   
    347361    [self updateInfoStats];
Note: See TracChangeset for help on using the changeset viewer.