diff options
author | Damiano Galassi <[email protected]> | 2019-07-20 10:15:19 +0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2019-07-20 10:15:19 +0200 |
commit | 40290672aca7579e7c7f220efc36f8569dfde7a1 (patch) | |
tree | 9efd52d36bd2424ef86a96e9628df536fcf9eaab /macosx/HBPlayerHUDController.m | |
parent | 988752d2bce5814044f0db63a952d7e3b29f7ff1 (diff) |
MacGui: fix a number of queue regressions.
Diffstat (limited to 'macosx/HBPlayerHUDController.m')
-rw-r--r-- | macosx/HBPlayerHUDController.m | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/macosx/HBPlayerHUDController.m b/macosx/HBPlayerHUDController.m index 90c847da0..473b5ce0a 100644 --- a/macosx/HBPlayerHUDController.m +++ b/macosx/HBPlayerHUDController.m @@ -5,6 +5,7 @@ It may be used under the terms of the GNU General Public License. */ #import "HBPlayerHUDController.h" +#import "HBAttributedStringAdditions.h" @interface HBPlayerHUDController () @@ -18,9 +19,6 @@ @property (weak) IBOutlet NSPopUpButton *tracksSelection; -@property (nonatomic, readonly) NSDictionary *monospacedAttr; -@property (nonatomic, readonly) NSDictionary *normalMonospacedAttr; - @property (nonatomic, readwrite) id rateObserver; @property (nonatomic, readwrite) id periodicObserver; @@ -39,14 +37,6 @@ return @"HBPlayerHUDController"; } -- (void)viewDidLoad -{ - [super viewDidLoad]; - - _normalMonospacedAttr = @{NSFontAttributeName: [NSFont monospacedDigitSystemFontOfSize:15 weight:NSFontWeightRegular]}; - _monospacedAttr = @{NSFontAttributeName: [NSFont monospacedDigitSystemFontOfSize:[NSFont smallSystemFontSize] weight:NSFontWeightRegular]}; -} - - (BOOL)canBeHidden { return YES; @@ -203,11 +193,6 @@ return [NSString stringWithFormat:@"%02d:%02d.%03d", minutes, seconds, milliseconds]; } -- (NSAttributedString *)_smallMonospacedString:(NSString *)string -{ - return [[NSAttributedString alloc] initWithString:string attributes:self.monospacedAttr]; -} - - (void)_refreshUI { if (self.player) @@ -216,8 +201,8 @@ NSTimeInterval duration = self.player.duration; self.slider.doubleValue = currentTime; - self.currentTimeLabel.attributedStringValue = [self _smallMonospacedString:[self _timeToTimecode:currentTime]]; - self.remaingTimeLabel.attributedStringValue = [self _smallMonospacedString:[self _timeToTimecode:duration - currentTime]]; + self.currentTimeLabel.attributedStringValue = [self _timeToTimecode:currentTime].HB_smallMonospacedString; + self.remaingTimeLabel.attributedStringValue = [self _timeToTimecode:duration - currentTime].HB_smallMonospacedString; if (@available(macOS 10.12.2, *)) { @@ -496,11 +481,6 @@ static NSTouchBarItemIdentifier HBTouchBarTimeSlider = @"fr.handbrake.timeSlider } } -- (NSAttributedString *)_monospacedString:(NSString *)string -{ - return [[NSAttributedString alloc] initWithString:string attributes:self.normalMonospacedAttr]; -} - - (void)_touchBar_updateTime:(NSTimeInterval)currentTime duration:(NSTimeInterval)duration { NSSlider *slider = (NSSlider *)[[self.touchBar itemForIdentifier:HBTouchBarTimeSlider] slider]; @@ -508,8 +488,8 @@ static NSTouchBarItemIdentifier HBTouchBarTimeSlider = @"fr.handbrake.timeSlider NSTextField *remainingTimeLabel = (NSTextField *)[[self.touchBar itemForIdentifier:HBTouchBarRemainingTime] view]; slider.doubleValue = currentTime; - currentTimeLabel.attributedStringValue = [self _monospacedString:[self _timeToString:currentTime negative:NO]]; - remainingTimeLabel.attributedStringValue = [self _monospacedString:[self _timeToString:duration - currentTime negative:YES]]; + currentTimeLabel.attributedStringValue = [self _timeToString:currentTime negative:NO].HB_monospacedString; + remainingTimeLabel.attributedStringValue = [self _timeToString:duration - currentTime negative:YES].HB_monospacedString; } @end |