mirror of
https://github.com/transmission/transmission
synced 2024-12-25 17:17:31 +00:00
Make sure the scheduler 24-hour format is double digits.
This commit is contained in:
parent
eb026f1528
commit
0caa326038
2 changed files with 12 additions and 11 deletions
|
@ -117,8 +117,7 @@
|
|||
while ((torrent = [enumerator nextObject]))
|
||||
size += [torrent size];
|
||||
|
||||
[fSizeField setStringValue: [[NSString stringForFileSize: size]
|
||||
stringByAppendingString: @" Total"]];
|
||||
[fSizeField setStringValue: [[NSString stringForFileSize: size] stringByAppendingString: @" Total"]];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -448,10 +447,8 @@
|
|||
{
|
||||
if (tableView == fPeerTable)
|
||||
return [fPeers count];
|
||||
else if (tableView == fFileTable)
|
||||
return [fFiles count];
|
||||
else
|
||||
return 0;
|
||||
return [fFiles count];
|
||||
}
|
||||
|
||||
- (id) tableView: (NSTableView *) tableView objectValueForTableColumn: (NSTableColumn *) column row: (int) row
|
||||
|
@ -553,8 +550,7 @@
|
|||
NSEnumerator * enumerator = [fTorrents objectEnumerator];
|
||||
|
||||
float ratioLimit = [sender floatValue];
|
||||
if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%.2f", ratioLimit]]
|
||||
|| ratioLimit < 0)
|
||||
if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%.2f", ratioLimit]] || ratioLimit < 0)
|
||||
{
|
||||
NSBeep();
|
||||
float ratioLimit = [[enumerator nextObject] ratioLimit]; //use first torrent
|
||||
|
|
|
@ -174,11 +174,11 @@
|
|||
[fSpeedLimitAutoCheck setState: speedLimitAuto];
|
||||
|
||||
int speedLimitAutoOnHour = [fDefaults integerForKey: @"SpeedLimitAutoOnHour"];
|
||||
[fSpeedLimitAutoOnField setIntValue: speedLimitAutoOnHour];
|
||||
[fSpeedLimitAutoOnField setStringValue: [NSString stringWithFormat: @"%02d", speedLimitAutoOnHour]];
|
||||
[fSpeedLimitAutoOnField setEnabled: speedLimitAuto];
|
||||
|
||||
int speedLimitAutoOffHour = [fDefaults integerForKey: @"SpeedLimitAutoOffHour"];
|
||||
[fSpeedLimitAutoOffField setIntValue: speedLimitAutoOffHour];
|
||||
[fSpeedLimitAutoOffField setStringValue: [NSString stringWithFormat: @"%02d", speedLimitAutoOffHour]];
|
||||
[fSpeedLimitAutoOffField setEnabled: speedLimitAuto];
|
||||
|
||||
//set ratio limit
|
||||
|
@ -512,16 +512,21 @@
|
|||
NSString * key = (sender == fSpeedLimitAutoOnField) ? @"SpeedLimitAutoOnHour" : @"SpeedLimitAutoOffHour";
|
||||
|
||||
int hour = [sender intValue];
|
||||
if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", hour]] || hour < 0 || hour > 23
|
||||
|
||||
//allow numbers under ten in the format 0x
|
||||
if (!([[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", hour]]
|
||||
|| [[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%02d", hour]]) || hour < 0 || hour > 23
|
||||
|| [fSpeedLimitAutoOnField intValue] == [fSpeedLimitAutoOffField intValue])
|
||||
{
|
||||
NSBeep();
|
||||
hour = [fDefaults integerForKey: key];
|
||||
[sender setIntValue: hour];
|
||||
[sender setStringValue: [NSString stringWithFormat: @"%02d", hour]];
|
||||
}
|
||||
else
|
||||
[fDefaults setInteger: hour forKey: key];
|
||||
|
||||
[sender setStringValue: [NSString stringWithFormat: @"%02d", hour]]; //ensure number has 2 digits
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"AutoSpeedLimitChange" object: self];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue