summaryrefslogtreecommitdiffstats
path: root/macosx/HBQueueController.m
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2020-09-11 18:02:23 +0200
committerDamiano Galassi <[email protected]>2020-09-11 18:02:23 +0200
commit3a90d6a6ad023ff1b066c2890315d51ee0ea0612 (patch)
treee9981f19c3f2a36cfc5e2a6a166cf52738830118 /macosx/HBQueueController.m
parentf6bb5723d1d4a23a3878628bb6fe146f536d1f8a (diff)
MacGui: show a stop row in the queue when 'Stop after current job' option is selected.
Diffstat (limited to 'macosx/HBQueueController.m')
-rw-r--r--macosx/HBQueueController.m37
1 files changed, 23 insertions, 14 deletions
diff --git a/macosx/HBQueueController.m b/macosx/HBQueueController.m
index d67f11483..00f9f6992 100644
--- a/macosx/HBQueueController.m
+++ b/macosx/HBQueueController.m
@@ -68,7 +68,7 @@
[NSNotificationCenter.defaultCenter addObserverForName:HBQueueDidCompleteItemNotification object:_queue queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification * _Nonnull note) {
// Run the per item notification and actions
- HBQueueItem *item = note.userInfo[HBQueueItemNotificationItemKey];
+ HBQueueJobItem *item = note.userInfo[HBQueueItemNotificationItemKey];
if (item.state == HBQueueItemStateCompleted)
{
[self sendToExternalApp:item];
@@ -308,7 +308,7 @@
// if this is a currently encoding job, we need to be sure to alert the user,
// to let them decide to cancel it first, then if they do, we can come back and
// remove it
- NSIndexSet *workingIndexes = [self.queue.items indexesOfObjectsUsingBlock:^BOOL(HBQueueItem *item) {
+ NSIndexSet *workingIndexes = [self.queue.items indexesOfObjectsUsingBlock:^BOOL(HBQueueJobItem *item) {
return item.state == HBQueueItemStateWorking;
}];
@@ -349,7 +349,7 @@
}
}
-- (void)doEditQueueItem:(HBQueueItem *)item
+- (void)doEditQueueItem:(HBQueueJobItem *)item
{
[self.queue prepareItemForEditingAtIndex:[self.queue.items indexOfObject:item]];
@@ -371,7 +371,7 @@
/**
* Send the selected queue item back to the main window for rescan and possible edit.
*/
-- (void)editQueueItem:(HBQueueItem *)item
+- (void)editQueueItem:(HBQueueJobItem *)item
{
// if this is a currently encoding item, we need to be sure to alert the user,
// to let them decide to cancel it first, then if they do, we can come back and
@@ -448,7 +448,7 @@ NSString * const HBQueueItemNotificationPathKey = @"HBQueueItemNotificationPathK
*
* @param job the job of the file to send
*/
-- (void)sendToExternalApp:(HBQueueItem *)item
+- (void)sendToExternalApp:(HBQueueJobItem *)item
{
// This end of encode action is called as each encode rolls off of the queue
if ([NSUserDefaults.standardUserDefaults boolForKey:HBSendToAppEnabled] == YES)
@@ -489,7 +489,7 @@ NSString * const HBQueueItemNotificationPathKey = @"HBQueueItemNotificationPathK
/**
* Runs the alert for a single job
*/
-- (void)itemCompletedAlerts:(HBQueueItem *)item
+- (void)itemCompletedAlerts:(HBQueueJobItem *)item
{
NSUserDefaults *ud = NSUserDefaults.standardUserDefaults;
@@ -735,7 +735,7 @@ NSString * const HBQueueItemNotificationPathKey = @"HBQueueItemNotificationPathK
}
else
{
- NSArray<HBQueueItem *> *items = [self.queue.items objectsAtIndexes:indexes];
+ NSArray<id<HBQueueItem>> *items = [self.queue.items objectsAtIndexes:indexes];
self.infoViewController.item = items.firstObject;
[self switchToViewController:self.infoViewController];
}
@@ -760,9 +760,12 @@ NSString * const HBQueueItemNotificationPathKey = @"HBQueueItemNotificationPathK
}
}
-- (void)tableViewEditItem:(HBQueueItem *)item
+- (void)tableViewEditItem:(id<HBQueueItem>)item
{
- [self editQueueItem:item];
+ if ([item isKindOfClass:[HBQueueJobItem class]])
+ {
+ [self editQueueItem:item];
+ }
}
- (void)tableViewRemoveItemsAtIndexes:(nonnull NSIndexSet *)indexes
@@ -774,15 +777,21 @@ NSString * const HBQueueItemNotificationPathKey = @"HBQueueItemNotificationPathK
[self resetQueueItemsAtIndexes:indexes];
}
-- (void)detailsViewEditItem:(nonnull HBQueueItem *)item
+- (void)detailsViewEditItem:(nonnull id<HBQueueItem>)item
{
- [self editQueueItem:item];
+ if ([item isKindOfClass:[HBQueueJobItem class]])
+ {
+ [self editQueueItem:item];
+ }
}
-- (void)detailsViewResetItem:(nonnull HBQueueItem *)item
+- (void)detailsViewResetItem:(nonnull id<HBQueueItem>)item
{
- NSUInteger index = [self.queue.items indexOfObject:item];
- [self resetQueueItemsAtIndexes:[NSIndexSet indexSetWithIndex:index]];
+ if ([item isKindOfClass:[HBQueueJobItem class]])
+ {
+ NSUInteger index = [self.queue.items indexOfObject:item];
+ [self resetQueueItemsAtIndexes:[NSIndexSet indexSetWithIndex:index]];
+ }
}
- (IBAction)resetAll:(id)sender