MacGui: improve divider and scrollbar flashes in the queue info panel.

This commit is contained in:
Damiano Galassi 2020-01-29 15:57:51 +01:00
parent 2056dda7f2
commit 1d4fb22294
No known key found for this signature in database
GPG Key ID: 5452E231DFDBCA11

View File

@ -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