Changeset 3643


Ignore:
Timestamp:
Oct 29, 2007, 7:11:21 PM (14 years ago)
Author:
livings124
Message:

trunk: fix a warning introduced in [3638]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/InfoWindowController.m

    r3638 r3643  
    417417}
    418418
     419- (void) updateOptions
     420{
     421    if ([fTorrents count] == 0)
     422        return;
     423   
     424    [self updateInfoOptions];
     425   
     426    //get bandwidth info
     427    NSEnumerator * enumerator = [fTorrents objectEnumerator];
     428    Torrent * torrent = [enumerator nextObject]; //first torrent
     429   
     430    int uploadSpeedMode = [torrent speedMode: YES],
     431        uploadSpeedLimit = [torrent speedLimit: YES],
     432        downloadSpeedMode = [torrent speedMode: NO],
     433        downloadSpeedLimit = [torrent speedLimit: NO];
     434   
     435    while ((torrent = [enumerator nextObject])
     436            && (uploadSpeedMode != INVALID || uploadSpeedLimit != INVALID
     437                || downloadSpeedMode != INVALID || downloadSpeedLimit != INVALID))
     438    {
     439        if (uploadSpeedMode != INVALID && uploadSpeedMode != [torrent speedMode: YES])
     440            uploadSpeedMode = INVALID;
     441       
     442        if (uploadSpeedLimit != INVALID && uploadSpeedLimit != [torrent speedLimit: YES])
     443            uploadSpeedLimit = INVALID;
     444       
     445        if (downloadSpeedMode != INVALID && downloadSpeedMode != [torrent speedMode: NO])
     446            downloadSpeedMode = INVALID;
     447       
     448        if (downloadSpeedLimit != INVALID && downloadSpeedLimit != [torrent speedLimit: NO])
     449            downloadSpeedLimit = INVALID;
     450    }
     451   
     452    //set upload view
     453    int index;
     454    if (uploadSpeedMode == TR_SPEEDLIMIT_SINGLE)
     455        index = OPTION_POPUP_LIMIT;
     456    else if (uploadSpeedMode == TR_SPEEDLIMIT_UNLIMITED)
     457        index = OPTION_POPUP_NO_LIMIT;
     458    else if (uploadSpeedMode == TR_SPEEDLIMIT_GLOBAL)
     459        index = OPTION_POPUP_GLOBAL;
     460    else
     461        index = -1;
     462    [fUploadLimitPopUp selectItemAtIndex: index];
     463    [fUploadLimitPopUp setEnabled: YES];
     464   
     465    [fUploadLimitLabel setHidden: uploadSpeedMode != TR_SPEEDLIMIT_SINGLE];
     466    [fUploadLimitField setHidden: uploadSpeedMode != TR_SPEEDLIMIT_SINGLE];
     467    if (uploadSpeedLimit != INVALID)
     468        [fUploadLimitField setIntValue: uploadSpeedLimit];
     469    else
     470        [fUploadLimitField setStringValue: @""];
     471   
     472    //set download view
     473    if (downloadSpeedMode == TR_SPEEDLIMIT_SINGLE)
     474        index = OPTION_POPUP_LIMIT;
     475    else if (downloadSpeedMode == TR_SPEEDLIMIT_UNLIMITED)
     476        index = OPTION_POPUP_NO_LIMIT;
     477    else if (downloadSpeedMode == TR_SPEEDLIMIT_GLOBAL)
     478        index = OPTION_POPUP_GLOBAL;
     479    else
     480        index = -1;
     481    [fDownloadLimitPopUp selectItemAtIndex: index];
     482    [fDownloadLimitPopUp setEnabled: YES];
     483   
     484    [fDownloadLimitLabel setHidden: downloadSpeedMode != TR_SPEEDLIMIT_SINGLE];
     485    [fDownloadLimitField setHidden: downloadSpeedMode != TR_SPEEDLIMIT_SINGLE];
     486    if (downloadSpeedLimit != INVALID)
     487        [fDownloadLimitField setIntValue: downloadSpeedLimit];
     488    else
     489        [fDownloadLimitField setStringValue: @""];
     490   
     491    //get ratio info
     492    enumerator = [fTorrents objectEnumerator];
     493    torrent = [enumerator nextObject]; //first torrent
     494   
     495    int checkRatio = [torrent ratioSetting];
     496    float ratioLimit = [torrent ratioLimit];
     497   
     498    while ((torrent = [enumerator nextObject]) && (checkRatio != INVALID || checkRatio != INVALID))
     499    {
     500        if (checkRatio != INVALID && checkRatio != [torrent ratioSetting])
     501            checkRatio = INVALID;
     502       
     503        if (ratioLimit != INVALID && ratioLimit != [torrent ratioLimit])
     504            ratioLimit = INVALID;
     505    }
     506   
     507    //set ratio view
     508    if (checkRatio == NSOnState)
     509        index = OPTION_POPUP_LIMIT;
     510    else if (checkRatio == NSOffState)
     511        index = OPTION_POPUP_NO_LIMIT;
     512    else if (checkRatio == NSMixedState)
     513        index = OPTION_POPUP_GLOBAL;
     514    else
     515        index = -1;
     516    [fRatioPopUp selectItemAtIndex: index];
     517    [fRatioPopUp setEnabled: YES];
     518   
     519    [fRatioLimitField setHidden: checkRatio != NSOnState];
     520    if (ratioLimit != INVALID)
     521        [fRatioLimitField setFloatValue: ratioLimit];
     522    else
     523        [fRatioLimitField setStringValue: @""];
     524}
     525
    419526- (BOOL) validateMenuItem: (NSMenuItem *) menuItem
    420527{
     
    12701377}
    12711378
    1272 - (void) updateOptions
    1273 {
    1274     if ([fTorrents count] == 0)
    1275         return;
    1276    
    1277     [self updateInfoOptions];
    1278    
    1279     //get bandwidth info
    1280     NSEnumerator * enumerator = [fTorrents objectEnumerator];
    1281     Torrent * torrent = [enumerator nextObject]; //first torrent
    1282    
    1283     int uploadSpeedMode = [torrent speedMode: YES],
    1284         uploadSpeedLimit = [torrent speedLimit: YES],
    1285         downloadSpeedMode = [torrent speedMode: NO],
    1286         downloadSpeedLimit = [torrent speedLimit: NO];
    1287    
    1288     while ((torrent = [enumerator nextObject])
    1289             && (uploadSpeedMode != INVALID || uploadSpeedLimit != INVALID
    1290                 || downloadSpeedMode != INVALID || downloadSpeedLimit != INVALID))
    1291     {
    1292         if (uploadSpeedMode != INVALID && uploadSpeedMode != [torrent speedMode: YES])
    1293             uploadSpeedMode = INVALID;
    1294        
    1295         if (uploadSpeedLimit != INVALID && uploadSpeedLimit != [torrent speedLimit: YES])
    1296             uploadSpeedLimit = INVALID;
    1297        
    1298         if (downloadSpeedMode != INVALID && downloadSpeedMode != [torrent speedMode: NO])
    1299             downloadSpeedMode = INVALID;
    1300        
    1301         if (downloadSpeedLimit != INVALID && downloadSpeedLimit != [torrent speedLimit: NO])
    1302             downloadSpeedLimit = INVALID;
    1303     }
    1304    
    1305     //set upload view
    1306     int index;
    1307     if (uploadSpeedMode == TR_SPEEDLIMIT_SINGLE)
    1308         index = OPTION_POPUP_LIMIT;
    1309     else if (uploadSpeedMode == TR_SPEEDLIMIT_UNLIMITED)
    1310         index = OPTION_POPUP_NO_LIMIT;
    1311     else if (uploadSpeedMode == TR_SPEEDLIMIT_GLOBAL)
    1312         index = OPTION_POPUP_GLOBAL;
    1313     else
    1314         index = -1;
    1315     [fUploadLimitPopUp selectItemAtIndex: index];
    1316     [fUploadLimitPopUp setEnabled: YES];
    1317    
    1318     [fUploadLimitLabel setHidden: uploadSpeedMode != TR_SPEEDLIMIT_SINGLE];
    1319     [fUploadLimitField setHidden: uploadSpeedMode != TR_SPEEDLIMIT_SINGLE];
    1320     if (uploadSpeedLimit != INVALID)
    1321         [fUploadLimitField setIntValue: uploadSpeedLimit];
    1322     else
    1323         [fUploadLimitField setStringValue: @""];
    1324    
    1325     //set download view
    1326     if (downloadSpeedMode == TR_SPEEDLIMIT_SINGLE)
    1327         index = OPTION_POPUP_LIMIT;
    1328     else if (downloadSpeedMode == TR_SPEEDLIMIT_UNLIMITED)
    1329         index = OPTION_POPUP_NO_LIMIT;
    1330     else if (downloadSpeedMode == TR_SPEEDLIMIT_GLOBAL)
    1331         index = OPTION_POPUP_GLOBAL;
    1332     else
    1333         index = -1;
    1334     [fDownloadLimitPopUp selectItemAtIndex: index];
    1335     [fDownloadLimitPopUp setEnabled: YES];
    1336    
    1337     [fDownloadLimitLabel setHidden: downloadSpeedMode != TR_SPEEDLIMIT_SINGLE];
    1338     [fDownloadLimitField setHidden: downloadSpeedMode != TR_SPEEDLIMIT_SINGLE];
    1339     if (downloadSpeedLimit != INVALID)
    1340         [fDownloadLimitField setIntValue: downloadSpeedLimit];
    1341     else
    1342         [fDownloadLimitField setStringValue: @""];
    1343    
    1344     //get ratio info
    1345     enumerator = [fTorrents objectEnumerator];
    1346     torrent = [enumerator nextObject]; //first torrent
    1347    
    1348     int checkRatio = [torrent ratioSetting];
    1349     float ratioLimit = [torrent ratioLimit];
    1350    
    1351     while ((torrent = [enumerator nextObject]) && (checkRatio != INVALID || checkRatio != INVALID))
    1352     {
    1353         if (checkRatio != INVALID && checkRatio != [torrent ratioSetting])
    1354             checkRatio = INVALID;
    1355        
    1356         if (ratioLimit != INVALID && ratioLimit != [torrent ratioLimit])
    1357             ratioLimit = INVALID;
    1358     }
    1359    
    1360     //set ratio view
    1361     if (checkRatio == NSOnState)
    1362         index = OPTION_POPUP_LIMIT;
    1363     else if (checkRatio == NSOffState)
    1364         index = OPTION_POPUP_NO_LIMIT;
    1365     else if (checkRatio == NSMixedState)
    1366         index = OPTION_POPUP_GLOBAL;
    1367     else
    1368         index = -1;
    1369     [fRatioPopUp selectItemAtIndex: index];
    1370     [fRatioPopUp setEnabled: YES];
    1371    
    1372     [fRatioLimitField setHidden: checkRatio != NSOnState];
    1373     if (ratioLimit != INVALID)
    1374         [fRatioLimitField setFloatValue: ratioLimit];
    1375     else
    1376         [fRatioLimitField setStringValue: @""];
    1377 }
    1378 
    13791379- (NSView *) tabViewForTag: (int) tag
    13801380{
Note: See TracChangeset for help on using the changeset viewer.