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) if (startedItem == self.item)
{ {
[self updateLabels]; [self updateUI];
[self updateReset];
} }
}]; }];
@ -66,8 +65,7 @@
if (completedItem == self.item) if (completedItem == self.item)
{ {
[self updateLabels]; [self updateUI];
[self updateReset];
} }
}]; }];
@ -75,12 +73,20 @@
object:nil object:nil
queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification * _Nonnull note) queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification * _Nonnull note)
{ {
[self updateLabels]; [self updateUI];
[self updateReset];
}]; }];
} }
- (void)updateUI
{
[self updateLabels];
[self updateReset];
dispatch_async(dispatch_get_main_queue(), ^{
[self updateDivider];
});
}
- (void)updateReset - (void)updateReset
{ {
self.canReset = self.item && (self.item.state != HBQueueItemStateWorking && self.item.state != HBQueueItemStateReady); self.canReset = self.item && (self.item.state != HBQueueItemStateWorking && self.item.state != HBQueueItemStateReady);
@ -97,7 +103,9 @@
self.statisticsLabel.attributedStringValue = self.item.attributedStatistics; self.statisticsLabel.attributedStringValue = self.item.attributedStatistics;
self.summaryLabel.attributedStringValue = self.item.attributedDescription; self.summaryLabel.attributedStringValue = self.item.attributedDescription;
[self.scrollView flashScrollers]; dispatch_async(dispatch_get_main_queue(), ^{
[self.scrollView flashScrollers];
});
} }
else else
{ {
@ -107,17 +115,21 @@
} }
} }
- (void)updateDivider
{
self.divider.hidden = self.scrollView.frame.size.height > self.scrollView.contentView.documentView.frame.size.height;
}
- (void)viewDidLayout - (void)viewDidLayout
{ {
[super viewDidLayout]; [super viewDidLayout];
self.divider.hidden = self.scrollView.frame.size.height > self.scrollView.contentView.documentView.frame.size.height; [self updateDivider];
} }
- (void)setItem:(HBQueueItem *)item - (void)setItem:(HBQueueItem *)item
{ {
_item = item; _item = item;
[self updateLabels]; [self updateUI];
[self updateReset];
} }
- (IBAction)editItem:(id)sender - (IBAction)editItem:(id)sender