diff options
author | Damiano Galassi <[email protected]> | 2019-07-29 07:34:38 +0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2019-07-29 07:34:38 +0200 |
commit | 8e2843720a9e6a87670da4e3caccfd570f66389f (patch) | |
tree | 9ed0392c6aef95b2f600d948564b030da2293d95 /macosx/HBQueueInfoViewController.m | |
parent | 9446eba9eac07b6b47dc6d6e9f3c2a7331b38aa0 (diff) |
MacGui: refactor the preferences keys and autonaming methods; fix the queue when running multiple HandBrake instances; fixed a number of bugs.
Diffstat (limited to 'macosx/HBQueueInfoViewController.m')
-rw-r--r-- | macosx/HBQueueInfoViewController.m | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/macosx/HBQueueInfoViewController.m b/macosx/HBQueueInfoViewController.m index e5c68a0a2..3b8a6e247 100644 --- a/macosx/HBQueueInfoViewController.m +++ b/macosx/HBQueueInfoViewController.m @@ -16,6 +16,8 @@ @property (weak) id<HBQueueDetailsViewControllerDelegate> delegate; +@property (nonatomic) BOOL canReset; + @end @implementation HBQueueInfoViewController @@ -40,15 +42,16 @@ { NSNotificationCenter * __weak center = NSNotificationCenter.defaultCenter; - [center addObserverForName:HBQueueDidCompleteItemNotification + [center addObserverForName:HBQueueDidStartItemNotification object:nil queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification * _Nonnull note) { - HBQueueItem *completedItem = note.userInfo[HBQueueItemNotificationItemKey]; + HBQueueItem *startedItem = note.userInfo[HBQueueItemNotificationItemKey]; - if (completedItem == self.item) + if (startedItem == self.item) { [self updateLabels]; + [self updateReset]; } }]; @@ -61,17 +64,22 @@ if (completedItem == self.item) { [self updateLabels]; + [self updateReset]; } }]; +} +- (void)updateReset +{ + self.canReset = self.item && (self.item.state != HBQueueItemStateWorking && self.item.state != HBQueueItemStateReady); } - (void)updateLabels { if (self.item) { - self.statisticsLabel.hidden = self.item.endedDate == nil; - self.statisticsHeader.hidden = self.item.endedDate == nil; + self.statisticsLabel.hidden = self.item.startedDate == nil; + self.statisticsHeader.hidden = self.item.startedDate == nil; self.summaryLabel.hidden = NO; self.statisticsLabel.attributedStringValue = self.item.attributedStatistics; @@ -91,6 +99,7 @@ { _item = item; [self updateLabels]; + [self updateReset]; } - (IBAction)editItem:(id)sender @@ -103,5 +112,4 @@ [self.delegate detailsViewResetItem:self.item]; } - @end |