diff options
author | Damiano Galassi <[email protected]> | 2019-03-28 12:22:29 +0100 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2019-03-28 12:22:29 +0100 |
commit | 3641e770f58d88aadba8315d1053e01520c46936 (patch) | |
tree | 2ab207317763bcc6aa121620601e1fbf5a2bfdfb /macosx/HBQueueController.m | |
parent | 99c35442c9c104e83b9b20624bfaf02fc5813f68 (diff) |
MacGui: improve localized progress number formats, use a monospace string to avoid numbers jumping around.
Diffstat (limited to 'macosx/HBQueueController.m')
-rw-r--r-- | macosx/HBQueueController.m | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/macosx/HBQueueController.m b/macosx/HBQueueController.m index f42067f6c..bd8564ded 100644 --- a/macosx/HBQueueController.m +++ b/macosx/HBQueueController.m @@ -40,7 +40,8 @@ static void *HBControllerQueueCoreContext = &HBControllerQueueCoreContext; @property (nonatomic) BOOL visible; // Progress -@property (nonatomic, strong) NSString *progressInfo; +@property (nonatomic, strong) NSAttributedString *progressInfo; +@property (nonatomic, strong) NSDictionary *monospacedAttr; @property (nonatomic, readonly) HBDockTile *dockTile; @property (nonatomic, readwrite) double dockIconProgress; @@ -93,7 +94,8 @@ static void *HBControllerQueueCoreContext = &HBControllerQueueCoreContext; _core.automaticallyPreventSleep = NO; // Progress - _progressInfo = @""; + _monospacedAttr = @{NSFontAttributeName: [NSFont monospacedDigitSystemFontOfSize:[NSFont smallSystemFontSize] weight:NSFontWeightRegular]}; + _progressInfo = [[NSAttributedString alloc] initWithString:@""]; // Load the queue from disk. _items = [[HBDistributedArray alloc] initWithURL:queueURL class:[HBQueueItem class]]; @@ -582,7 +584,7 @@ static void *HBControllerQueueCoreContext = &HBControllerQueueCoreContext; if ([self.window occlusionState] & NSWindowOcclusionStateVisible) { self.visible = YES; - self.progressTextField.stringValue = self.progressInfo; + self.progressTextField.attributedStringValue = self.progressInfo; } else { @@ -592,12 +594,12 @@ static void *HBControllerQueueCoreContext = &HBControllerQueueCoreContext; - (void)updateProgress:(NSString *)info progress:(double)progress hidden:(BOOL)hidden { - self.progressInfo = info; + self.progressInfo = [[NSAttributedString alloc] initWithString:info attributes:_monospacedAttr]; if (self.visible) { - self.progressTextField.stringValue = info; + self.progressTextField.attributedStringValue = _progressInfo; } - [self.controller setQueueInfo:info progress:progress hidden:hidden]; + [self.controller setQueueInfo:_progressInfo progress:progress hidden:hidden]; } /** |