From 1d4fb22294f7c33358cde3c1dd8a741f6a489f2f Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Wed, 29 Jan 2020 15:57:51 +0100 Subject: MacGui: improve divider and scrollbar flashes in the queue info panel. --- macosx/HBQueueInfoViewController.m | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/macosx/HBQueueInfoViewController.m b/macosx/HBQueueInfoViewController.m index 83659c2c5..e2e0872c6 100644 --- a/macosx/HBQueueInfoViewController.m +++ b/macosx/HBQueueInfoViewController.m @@ -53,8 +53,7 @@ if (startedItem == self.item) { - [self updateLabels]; - [self updateReset]; + [self updateUI]; } }]; @@ -66,8 +65,7 @@ if (completedItem == self.item) { - [self updateLabels]; - [self updateReset]; + [self updateUI]; } }]; @@ -75,12 +73,20 @@ object:nil queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification * _Nonnull note) { - [self updateLabels]; - [self updateReset]; + [self updateUI]; }]; } +- (void)updateUI +{ + [self updateLabels]; + [self updateReset]; + dispatch_async(dispatch_get_main_queue(), ^{ + [self updateDivider]; + }); +} + - (void)updateReset { self.canReset = self.item && (self.item.state != HBQueueItemStateWorking && self.item.state != HBQueueItemStateReady); @@ -97,7 +103,9 @@ self.statisticsLabel.attributedStringValue = self.item.attributedStatistics; self.summaryLabel.attributedStringValue = self.item.attributedDescription; - [self.scrollView flashScrollers]; + dispatch_async(dispatch_get_main_queue(), ^{ + [self.scrollView flashScrollers]; + }); } else { @@ -107,17 +115,21 @@ } } +- (void)updateDivider +{ + self.divider.hidden = self.scrollView.frame.size.height > self.scrollView.contentView.documentView.frame.size.height; +} + - (void)viewDidLayout { [super viewDidLayout]; - self.divider.hidden = self.scrollView.frame.size.height > self.scrollView.contentView.documentView.frame.size.height; + [self updateDivider]; } - (void)setItem:(HBQueueItem *)item { _item = item; - [self updateLabels]; - [self updateReset]; + [self updateUI]; } - (IBAction)editItem:(id)sender -- cgit v1.2.3