mirror of
https://github.com/transmission/transmission.git
synced 2026-05-08 09:39:08 +01:00
#1536 Speed Limit Rollover information
This commit is contained in:
@@ -186,6 +186,8 @@ typedef enum
|
||||
- (void) resizeStatusButton;
|
||||
- (void) setBottomCountText: (BOOL) filtering;
|
||||
|
||||
- (void) updateSpeedFieldsToolTips;
|
||||
|
||||
- (void) updateTorrentsInQueue;
|
||||
- (NSInteger) numToStartFromQueue: (BOOL) downloadQueue;
|
||||
|
||||
|
||||
+41
-2
@@ -348,8 +348,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
||||
//set up status bar
|
||||
[fStatusBar setHidden: YES];
|
||||
|
||||
[fTotalDLField setToolTip: NSLocalizedString(@"Total download speed", "Status Bar -> speed tooltip")];
|
||||
[fTotalULField setToolTip: NSLocalizedString(@"Total upload speed", "Status Bar -> speed tooltip")];
|
||||
[self updateSpeedFieldsToolTips];
|
||||
|
||||
NSRect statusBarFrame = [fStatusBar frame];
|
||||
statusBarFrame.size.width = windowSize.width;
|
||||
@@ -489,6 +488,10 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
||||
//update when groups change
|
||||
[nc addObserver: self selector: @selector(updateGroupsFilters:)
|
||||
name: @"UpdateGroups" object: nil];
|
||||
|
||||
//update when speed limits are changed
|
||||
[nc addObserver: self selector: @selector(updateSpeedFieldsToolTips)
|
||||
name: @"SpeedLimitUpdate" object: nil];
|
||||
|
||||
//timer to update the interface every second
|
||||
[self updateUI];
|
||||
@@ -1593,6 +1596,42 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
||||
[fTotalTorrentsField setStringValue: totalTorrentsString];
|
||||
}
|
||||
|
||||
- (void) updateSpeedFieldsToolTips
|
||||
{
|
||||
NSString * uploadText, * downloadText;
|
||||
|
||||
if ([fDefaults boolForKey: @"SpeedLimit"])
|
||||
{
|
||||
NSString * speedString = [NSString stringWithFormat: @"%@ (%@)", NSLocalizedString(@"%d KB/s", "Status Bar -> speed tooltip"),
|
||||
NSLocalizedString(@"Speed Limit", "Status Bar -> speed tooltip")];
|
||||
|
||||
uploadText = [NSString stringWithFormat: speedString, [fDefaults integerForKey: @"SpeedLimitUploadLimit"]];
|
||||
downloadText = [NSString stringWithFormat: speedString, [fDefaults integerForKey: @"SpeedLimitDownloadLimit"]];
|
||||
}
|
||||
else
|
||||
{
|
||||
if ([fDefaults boolForKey: @"CheckUpload"])
|
||||
uploadText = [NSString stringWithFormat: NSLocalizedString(@"%d KB/s", "Status Bar -> speed tooltip"),
|
||||
[fDefaults integerForKey: @"UploadLimit"]];
|
||||
else
|
||||
uploadText = NSLocalizedString(@"unlimited", "Status Bar -> speed tooltip");
|
||||
|
||||
if ([fDefaults boolForKey: @"CheckDownload"])
|
||||
downloadText = [NSString stringWithFormat: NSLocalizedString(@"%d KB/s", "Status Bar -> speed tooltip"),
|
||||
[fDefaults integerForKey: @"DownloadLimit"]];
|
||||
else
|
||||
downloadText = NSLocalizedString(@"unlimited", "Status Bar -> speed tooltip");
|
||||
}
|
||||
|
||||
uploadText = [NSLocalizedString(@"Total upload rate", "Status Bar -> speed tooltip")
|
||||
stringByAppendingFormat: @": %@", uploadText];
|
||||
downloadText = [NSLocalizedString(@"Total download rate", "Status Bar -> speed tooltip")
|
||||
stringByAppendingFormat: @": %@", downloadText];
|
||||
|
||||
[fTotalULField setToolTip: uploadText];
|
||||
[fTotalDLField setToolTip: downloadText];
|
||||
}
|
||||
|
||||
- (void) updateTorrentsInQueue
|
||||
{
|
||||
BOOL download = [fDefaults boolForKey: @"Queue"],
|
||||
|
||||
@@ -536,6 +536,8 @@ tr_handle * fHandle;
|
||||
tr_sessionSetSpeedLimitEnabled(fHandle, TR_DOWN, [fDefaults boolForKey: @"CheckDownload"]);
|
||||
tr_sessionSetSpeedLimit(fHandle, TR_DOWN, [fDefaults integerForKey: @"DownloadLimit"]);
|
||||
}
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"SpeedLimitUpdate" object: nil];
|
||||
}
|
||||
|
||||
- (void) applyRatioSetting: (id) sender
|
||||
@@ -1044,6 +1046,8 @@ tr_handle * fHandle;
|
||||
int upLimit = tr_sessionGetSpeedLimit(fHandle, TR_UP);
|
||||
[fDefaults setInteger: upLimit forKey: @"UploadLimit"];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"SpeedLimitUpdate" object: nil];
|
||||
|
||||
//update gui if loaded
|
||||
if (fHasLoaded)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user