summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--macosx/English.lproj/Queue.xib31
-rw-r--r--macosx/HBQueueController.m56
2 files changed, 66 insertions, 21 deletions
diff --git a/macosx/English.lproj/Queue.xib b/macosx/English.lproj/Queue.xib
index 297e3c964..82fc7ee3b 100644
--- a/macosx/English.lproj/Queue.xib
+++ b/macosx/English.lproj/Queue.xib
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6724" systemVersion="14C99d" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6724" systemVersion="14C109" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment version="1060" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6724"/>
@@ -58,9 +58,6 @@
<font key="font" metaFont="cellTitle"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
- <connections>
- <outlet property="menu" destination="2649" id="2653"/>
- </connections>
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
</tableColumn>
@@ -79,6 +76,7 @@
<connections>
<outlet property="dataSource" destination="-2" id="2602"/>
<outlet property="delegate" destination="-2" id="2603"/>
+ <outlet property="menu" destination="2649" id="ZZa-hT-PUa"/>
</connections>
</outlineView>
</subviews>
@@ -137,7 +135,7 @@
<connections>
<outlet property="delegate" destination="-2" id="2579"/>
</connections>
- <point key="canvasLocation" x="383" y="524.5"/>
+ <point key="canvasLocation" x="666" y="695.5"/>
</window>
<menu id="2649" userLabel="ContextMenu">
<items>
@@ -147,19 +145,34 @@
<action selector="editSelectedQueueItem:" target="-2" id="2654"/>
</connections>
</menuItem>
- <menuItem title="Delete" id="2652">
+ <menuItem title="Show in Finder" id="2655">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
- <action selector="removeSelectedQueueItem:" target="-2" id="2656"/>
+ <action selector="revealSelectedQueueItem:" target="-2" id="2657"/>
</connections>
</menuItem>
- <menuItem title="Show" id="2655">
+ <menuItem isSeparatorItem="YES" id="Au5-j1-AAd"/>
+ <menuItem title="Clear All" id="2652">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
- <action selector="revealSelectedQueueItem:" target="-2" id="2657"/>
+ <action selector="clearAll:" target="-2" id="Q3d-9G-k0i"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Clear completed items" id="XdJ-Sl-pwu">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="clearCompleted:" target="-2" id="LMt-sj-JIh"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="Vww-Gx-tlr"/>
+ <menuItem title="Delete" id="Wfz-Kj-Vtx">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="removeSelectedQueueItem:" target="-2" id="i8t-gS-Bi3"/>
</connections>
</menuItem>
</items>
+ <point key="canvasLocation" x="192" y="450.5"/>
</menu>
</objects>
<resources>
diff --git a/macosx/HBQueueController.m b/macosx/HBQueueController.m
index 054db0568..46d9bae69 100644
--- a/macosx/HBQueueController.m
+++ b/macosx/HBQueueController.m
@@ -172,7 +172,14 @@
return (self.core.state == HBStateWorking || self.core.state == HBStatePaused);
}
-
+
+ if (action == @selector(editSelectedQueueItem:) ||
+ action == @selector(removeSelectedQueueItem:) ||
+ action == @selector(revealSelectedQueueItem:))
+ {
+ return (self.outlineView.selectedRow != -1 || self.outlineView.clickedRow != -1);
+ }
+
return YES;
}
@@ -370,18 +377,10 @@
- (void)clearEncodedJobs
{
[self.jobs beginTransaction];
- NSMutableArray *encodedJobs = [NSMutableArray array];
- for (HBJob *job in self.jobs)
- {
- if (job.state == HBJobStateCompleted || job.state == HBJobStateCanceled)
- {
- [encodedJobs addObject:job];
- }
- }
-
- [self.jobs removeObjectsInArray:encodedJobs];
+ [self removeItemsUsingBlock:^BOOL(HBJob *item) {
+ return (item.state == HBJobStateCompleted || item.state == HBJobStateCanceled);
+ }];
[self.jobs commit];
-
[self reloadQueue];
}
@@ -397,6 +396,19 @@
[self reloadQueue];
}
+- (void)removeItemsUsingBlock:(BOOL (^)(HBJob *item))predicate
+{
+ NSMutableArray *encodedJobs = [NSMutableArray array];
+ for (HBJob *job in self.jobs)
+ {
+ if (predicate(job))
+ {
+ [encodedJobs addObject:job];
+ }
+ }
+ [self.jobs removeObjectsInArray:encodedJobs];
+}
+
/**
* this is actually called from the queue controller to modify the queue array and return it back to the queue controller
*/
@@ -1122,6 +1134,26 @@
}
}
+- (IBAction)clearAll:(id)sender
+{
+ [self.jobs beginTransaction];
+ [self removeItemsUsingBlock:^BOOL(HBJob *item) {
+ return (item.state != HBJobStateWorking);
+ }];
+ [self.jobs commit];
+ [self reloadQueue];
+}
+
+- (IBAction)clearCompleted:(id)sender
+{
+ [self.jobs beginTransaction];
+ [self removeItemsUsingBlock:^BOOL(HBJob *item) {
+ return (item.state == HBJobStateCompleted);
+ }];
+ [self.jobs commit];
+ [self reloadQueue];
+}
+
#pragma mark -
#pragma mark NSOutlineView delegate