Changeset 3644


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

0.9x: fix a warning introduced in [3639]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/0.9x/macosx/InfoWindowController.m

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