Changeset 4063
- Timestamp:
- Dec 5, 2007, 1:26:30 AM (14 years ago)
- Location:
- trunk/macosx
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/Controller.h
r4062 r4063 183 183 - (void) switchFilter: (id) sender; 184 184 185 - (void) setStatusLabel: (id) sender; 186 185 187 - (void) toggleSpeedLimit: (id) sender; 186 188 - (void) autoSpeedLimitChange: (NSNotification *) notification; -
trunk/macosx/Controller.m
r4062 r4063 84 84 #define FILTER_TYPE_TAG_NAME 401 85 85 #define FILTER_TYPE_TAG_TRACKER 402 86 87 #define STATUS_RATIO_TOTAL @"RatioTotal" 88 #define STATUS_RATIO_SESSION @"RatioSession" 89 #define STATUS_TRANSFER_TOTAL @"TransferTotal" 90 #define STATUS_TRANSFER_SESSION @"TransferSession" 91 92 typedef enum 93 { 94 STATUS_RATIO_TOTAL_TAG = 0, 95 STATUS_RATIO_SESSION_TAG = 1, 96 STATUS_TRANSFER_TOTAL_TAG = 2, 97 STATUS_TRANSFER_SESSION_TAG = 3 98 } statusTag; 86 99 87 100 #define GROWL_DOWNLOAD_COMPLETE @"Download Complete" … … 1412 1425 1413 1426 //set status button text 1414 tr_session_stats stats; 1415 tr_getCumulativeSessionStats(fLib, &stats); 1416 1417 NSString * statusString = [NSLocalizedString(@"Total Ratio: ", "status bar -> status button text") 1418 stringByAppendingString: [NSString stringForRatio: stats.ratio]]; 1427 NSString * statusLabel = [fDefaults stringForKey: @"StatusLabel"], * statusString; 1428 if ([statusLabel isEqualToString: STATUS_RATIO_TOTAL]) 1429 { 1430 tr_session_stats stats; 1431 tr_getCumulativeSessionStats(fLib, &stats); 1432 1433 statusString = [NSLocalizedString(@"Total Ratio: ", "status bar -> status button text") 1434 stringByAppendingString: [NSString stringForRatio: stats.ratio]]; 1435 } 1436 else if ([statusLabel isEqualToString: STATUS_RATIO_SESSION]) 1437 { 1438 tr_session_stats stats; 1439 tr_getSessionStats(fLib, &stats); 1440 1441 statusString = [NSLocalizedString(@"Ratio: ", "status bar -> status button text") 1442 stringByAppendingString: [NSString stringForRatio: stats.ratio]]; 1443 } 1444 else if ([statusLabel isEqualToString: STATUS_TRANSFER_TOTAL]) 1445 { 1446 tr_session_stats stats; 1447 tr_getCumulativeSessionStats(fLib, &stats); 1448 1449 statusString = [NSString stringWithFormat: NSLocalizedString(@"Total DL: %@ Total UL: %@", 1450 "status bar -> status button text"), 1451 [NSString stringForFileSize: stats.downloadedBytes], [NSString stringForFileSize: stats.uploadedBytes]]; 1452 } 1453 else if ([statusLabel isEqualToString: STATUS_TRANSFER_SESSION]) 1454 { 1455 tr_session_stats stats; 1456 tr_getSessionStats(fLib, &stats); 1457 1458 statusString = [NSString stringWithFormat: NSLocalizedString(@"DL: %@ UL: %@", 1459 "status bar -> status button text"), 1460 [NSString stringForFileSize: stats.downloadedBytes], [NSString stringForFileSize: stats.uploadedBytes]]; 1461 } 1462 else 1463 statusString = @""; 1419 1464 1420 1465 [fStatusButton setTitle: statusString]; … … 1923 1968 } 1924 1969 1970 - (void) setStatusLabel: (id) sender 1971 { 1972 NSString * statusLabel; 1973 switch ([sender tag]) 1974 { 1975 case STATUS_RATIO_TOTAL_TAG: 1976 statusLabel = STATUS_RATIO_TOTAL; 1977 break; 1978 case STATUS_RATIO_SESSION_TAG: 1979 statusLabel = STATUS_RATIO_SESSION; 1980 break; 1981 case STATUS_TRANSFER_TOTAL_TAG: 1982 statusLabel = STATUS_TRANSFER_TOTAL; 1983 break; 1984 case STATUS_TRANSFER_SESSION_TAG: 1985 statusLabel = STATUS_TRANSFER_SESSION; 1986 break; 1987 default: 1988 return; 1989 } 1990 1991 [fDefaults setObject: statusLabel forKey: @"StatusLabel"]; 1992 [self updateUI]; 1993 } 1994 1925 1995 - (void) updateControlTint: (NSNotification *) notification 1926 1996 { … … 2820 2890 } 2821 2891 2892 //enable sort options 2893 if (action == @selector(setStatusLabel:)) 2894 { 2895 NSString * statusLabel; 2896 switch ([menuItem tag]) 2897 { 2898 case STATUS_RATIO_TOTAL_TAG: 2899 statusLabel = STATUS_RATIO_TOTAL; 2900 break; 2901 case STATUS_RATIO_SESSION_TAG: 2902 statusLabel = STATUS_RATIO_SESSION; 2903 break; 2904 case STATUS_TRANSFER_TOTAL_TAG: 2905 statusLabel = STATUS_TRANSFER_TOTAL; 2906 break; 2907 case STATUS_TRANSFER_SESSION_TAG: 2908 statusLabel = STATUS_TRANSFER_SESSION; 2909 break; 2910 default: 2911 statusLabel = @"";; 2912 } 2913 2914 [menuItem setState: [statusLabel isEqualToString: [fDefaults stringForKey: @"StatusLabel"]] ? NSOnState : NSOffState]; 2915 return YES; 2916 } 2917 2822 2918 if (action == @selector(toggleSmallView:)) 2823 2919 { -
trunk/macosx/Defaults.plist
r3926 r4063 121 121 <key>StatusBar</key> 122 122 <true/> 123 <key>StatusLabel</key> 124 <string>RatioTotal</string> 123 125 <key>UploadLimit</key> 124 126 <integer>20</integer> -
trunk/macosx/English.lproj/MainMenu.nib/classes.nib
r4062 r4063 118 118 <string>id</string> 119 119 <key>setSortReverse</key> 120 <string>id</string> 121 <key>setStatusLabel</key> 120 122 <string>id</string> 121 123 <key>showAboutWindow</key> … … 236 238 </dict> 237 239 <dict> 238 <key>CLASS</key>239 <string>FilterButton</string>240 <key>LANGUAGE</key>241 <string>ObjC</string>242 <key>SUPERCLASS</key>243 <string>NSButton</string>244 </dict>245 <dict>246 240 <key>ACTIONS</key> 247 241 <dict> … … 280 274 <key>SUPERCLASS</key> 281 275 <string>NSTableView</string> 276 </dict> 277 <dict> 278 <key>CLASS</key> 279 <string>FilterButton</string> 280 <key>LANGUAGE</key> 281 <string>ObjC</string> 282 <key>SUPERCLASS</key> 283 <string>NSButton</string> 282 284 </dict> 283 285 <dict> -
trunk/macosx/English.lproj/MainMenu.nib/info.nib
r4061 r4063 11 11 <key>IBOpenObjects</key> 12 12 <array> 13 <integer>2547</integer> 13 14 <integer>1480</integer> 15 <integer>21</integer> 14 16 </array> 15 17 <key>IBSystem Version</key>
Note: See TracChangeset
for help on using the changeset viewer.