mirror of
https://github.com/transmission/transmission
synced 2025-03-03 18:25:35 +00:00
the status label in the status bar now gives 4 different options of info to display
This commit is contained in:
parent
7c190b84f9
commit
19b791def5
6 changed files with 117 additions and 13 deletions
|
@ -182,6 +182,8 @@
|
|||
- (void) setFilterSearchType: (id) sender;
|
||||
- (void) switchFilter: (id) sender;
|
||||
|
||||
- (void) setStatusLabel: (id) sender;
|
||||
|
||||
- (void) toggleSpeedLimit: (id) sender;
|
||||
- (void) autoSpeedLimitChange: (NSNotification *) notification;
|
||||
- (void) autoSpeedLimit;
|
||||
|
|
|
@ -84,6 +84,19 @@ typedef enum
|
|||
#define FILTER_TYPE_TAG_NAME 401
|
||||
#define FILTER_TYPE_TAG_TRACKER 402
|
||||
|
||||
#define STATUS_RATIO_TOTAL @"RatioTotal"
|
||||
#define STATUS_RATIO_SESSION @"RatioSession"
|
||||
#define STATUS_TRANSFER_TOTAL @"TransferTotal"
|
||||
#define STATUS_TRANSFER_SESSION @"TransferSession"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
STATUS_RATIO_TOTAL_TAG = 0,
|
||||
STATUS_RATIO_SESSION_TAG = 1,
|
||||
STATUS_TRANSFER_TOTAL_TAG = 2,
|
||||
STATUS_TRANSFER_SESSION_TAG = 3
|
||||
} statusTag;
|
||||
|
||||
#define GROWL_DOWNLOAD_COMPLETE @"Download Complete"
|
||||
#define GROWL_SEEDING_COMPLETE @"Seeding Complete"
|
||||
#define GROWL_AUTO_ADD @"Torrent Auto Added"
|
||||
|
@ -1411,11 +1424,43 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
[fTotalULField setStringValue: [NSString stringForSpeed: uploadRate]];
|
||||
|
||||
//set status button text
|
||||
tr_session_stats stats;
|
||||
tr_getCumulativeSessionStats(fLib, &stats);
|
||||
|
||||
NSString * statusString = [NSLocalizedString(@"Total Ratio: ", "status bar -> status button text")
|
||||
stringByAppendingString: [NSString stringForRatio: stats.ratio]];
|
||||
NSString * statusLabel = [fDefaults stringForKey: @"StatusLabel"], * statusString;
|
||||
if ([statusLabel isEqualToString: STATUS_RATIO_TOTAL])
|
||||
{
|
||||
tr_session_stats stats;
|
||||
tr_getCumulativeSessionStats(fLib, &stats);
|
||||
|
||||
statusString = [NSLocalizedString(@"Total Ratio: ", "status bar -> status button text")
|
||||
stringByAppendingString: [NSString stringForRatio: stats.ratio]];
|
||||
}
|
||||
else if ([statusLabel isEqualToString: STATUS_RATIO_SESSION])
|
||||
{
|
||||
tr_session_stats stats;
|
||||
tr_getSessionStats(fLib, &stats);
|
||||
|
||||
statusString = [NSLocalizedString(@"Ratio: ", "status bar -> status button text")
|
||||
stringByAppendingString: [NSString stringForRatio: stats.ratio]];
|
||||
}
|
||||
else if ([statusLabel isEqualToString: STATUS_TRANSFER_TOTAL])
|
||||
{
|
||||
tr_session_stats stats;
|
||||
tr_getCumulativeSessionStats(fLib, &stats);
|
||||
|
||||
statusString = [NSString stringWithFormat: NSLocalizedString(@"Total DL: %@ Total UL: %@",
|
||||
"status bar -> status button text"),
|
||||
[NSString stringForFileSize: stats.downloadedBytes], [NSString stringForFileSize: stats.uploadedBytes]];
|
||||
}
|
||||
else if ([statusLabel isEqualToString: STATUS_TRANSFER_SESSION])
|
||||
{
|
||||
tr_session_stats stats;
|
||||
tr_getSessionStats(fLib, &stats);
|
||||
|
||||
statusString = [NSString stringWithFormat: NSLocalizedString(@"DL: %@ UL: %@",
|
||||
"status bar -> status button text"),
|
||||
[NSString stringForFileSize: stats.downloadedBytes], [NSString stringForFileSize: stats.uploadedBytes]];
|
||||
}
|
||||
else
|
||||
statusString = @"";
|
||||
|
||||
[fStatusButton setTitle: statusString];
|
||||
[fStatusButton sizeToFit];
|
||||
|
@ -1922,6 +1967,31 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
[self setFilter: button];
|
||||
}
|
||||
|
||||
- (void) setStatusLabel: (id) sender
|
||||
{
|
||||
NSString * statusLabel;
|
||||
switch ([sender tag])
|
||||
{
|
||||
case STATUS_RATIO_TOTAL_TAG:
|
||||
statusLabel = STATUS_RATIO_TOTAL;
|
||||
break;
|
||||
case STATUS_RATIO_SESSION_TAG:
|
||||
statusLabel = STATUS_RATIO_SESSION;
|
||||
break;
|
||||
case STATUS_TRANSFER_TOTAL_TAG:
|
||||
statusLabel = STATUS_TRANSFER_TOTAL;
|
||||
break;
|
||||
case STATUS_TRANSFER_SESSION_TAG:
|
||||
statusLabel = STATUS_TRANSFER_SESSION;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
[fDefaults setObject: statusLabel forKey: @"StatusLabel"];
|
||||
[self updateUI];
|
||||
}
|
||||
|
||||
- (void) updateControlTint: (NSNotification *) notification
|
||||
{
|
||||
if ([fDefaults boolForKey: @"SpeedLimit"])
|
||||
|
@ -2819,6 +2889,32 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
return [fWindow isVisible];
|
||||
}
|
||||
|
||||
//enable sort options
|
||||
if (action == @selector(setStatusLabel:))
|
||||
{
|
||||
NSString * statusLabel;
|
||||
switch ([menuItem tag])
|
||||
{
|
||||
case STATUS_RATIO_TOTAL_TAG:
|
||||
statusLabel = STATUS_RATIO_TOTAL;
|
||||
break;
|
||||
case STATUS_RATIO_SESSION_TAG:
|
||||
statusLabel = STATUS_RATIO_SESSION;
|
||||
break;
|
||||
case STATUS_TRANSFER_TOTAL_TAG:
|
||||
statusLabel = STATUS_TRANSFER_TOTAL;
|
||||
break;
|
||||
case STATUS_TRANSFER_SESSION_TAG:
|
||||
statusLabel = STATUS_TRANSFER_SESSION;
|
||||
break;
|
||||
default:
|
||||
statusLabel = @"";;
|
||||
}
|
||||
|
||||
[menuItem setState: [statusLabel isEqualToString: [fDefaults stringForKey: @"StatusLabel"]] ? NSOnState : NSOffState];
|
||||
return YES;
|
||||
}
|
||||
|
||||
if (action == @selector(toggleSmallView:))
|
||||
{
|
||||
[menuItem setState: [fDefaults boolForKey: @"SmallView"] ? NSOnState : NSOffState];
|
||||
|
|
|
@ -120,6 +120,8 @@
|
|||
<integer>30</integer>
|
||||
<key>StatusBar</key>
|
||||
<true/>
|
||||
<key>StatusLabel</key>
|
||||
<string>RatioTotal</string>
|
||||
<key>UploadLimit</key>
|
||||
<integer>20</integer>
|
||||
<key>UseIncompleteDownloadFolder</key>
|
||||
|
|
18
macosx/English.lproj/MainMenu.nib/classes.nib
generated
18
macosx/English.lproj/MainMenu.nib/classes.nib
generated
|
@ -118,6 +118,8 @@
|
|||
<string>id</string>
|
||||
<key>setSortReverse</key>
|
||||
<string>id</string>
|
||||
<key>setStatusLabel</key>
|
||||
<string>id</string>
|
||||
<key>showAboutWindow</key>
|
||||
<string>id</string>
|
||||
<key>showInfo</key>
|
||||
|
@ -234,14 +236,6 @@
|
|||
<key>SUPERCLASS</key>
|
||||
<string>NSObject</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CLASS</key>
|
||||
<string>FilterButton</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
<key>SUPERCLASS</key>
|
||||
<string>NSButton</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>ACTIONS</key>
|
||||
<dict>
|
||||
|
@ -280,6 +274,14 @@
|
|||
<key>SUPERCLASS</key>
|
||||
<string>NSTableView</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CLASS</key>
|
||||
<string>FilterButton</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
<key>SUPERCLASS</key>
|
||||
<string>NSButton</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CLASS</key>
|
||||
<string>ActionPopUpButton</string>
|
||||
|
|
2
macosx/English.lproj/MainMenu.nib/info.nib
generated
2
macosx/English.lproj/MainMenu.nib/info.nib
generated
|
@ -10,7 +10,9 @@
|
|||
<integer>5</integer>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>2547</integer>
|
||||
<integer>1480</integer>
|
||||
<integer>21</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>9B18</string>
|
||||
|
|
BIN
macosx/English.lproj/MainMenu.nib/keyedobjects.nib
generated
BIN
macosx/English.lproj/MainMenu.nib/keyedobjects.nib
generated
Binary file not shown.
Loading…
Reference in a new issue