summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2019-07-20 10:15:19 +0200
committerDamiano Galassi <[email protected]>2019-07-20 10:15:19 +0200
commit40290672aca7579e7c7f220efc36f8569dfde7a1 (patch)
tree9efd52d36bd2424ef86a96e9628df536fcf9eaab /macosx
parent988752d2bce5814044f0db63a952d7e3b29f7ff1 (diff)
MacGui: fix a number of queue regressions.
Diffstat (limited to 'macosx')
-rw-r--r--macosx/Base.lproj/HBQueueTableViewController.xib10
-rw-r--r--macosx/Base.lproj/Queue.xib6
-rw-r--r--macosx/HBController.m6
-rw-r--r--macosx/HBJob+UIAdditions.h2
-rw-r--r--macosx/HBPlayerHUDController.m30
-rw-r--r--macosx/HBQueue.h14
-rw-r--r--macosx/HBQueue.m51
-rw-r--r--macosx/HBQueueController.m29
-rw-r--r--macosx/HBQueueItemWorkingView.m4
-rw-r--r--macosx/HBQueueTableViewController.m6
10 files changed, 80 insertions, 78 deletions
diff --git a/macosx/Base.lproj/HBQueueTableViewController.xib b/macosx/Base.lproj/HBQueueTableViewController.xib
index 875c9a879..1cf0c81f5 100644
--- a/macosx/Base.lproj/HBQueueTableViewController.xib
+++ b/macosx/Base.lproj/HBQueueTableViewController.xib
@@ -53,7 +53,7 @@
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="17" id="lzC-jf-dZI"/>
</constraints>
- <textFieldCell key="cell" lineBreakMode="truncatingTail" enabled="NO" allowsUndo="NO" sendsActionOnEndEditing="YES" title="Table View Cell" id="5Rl-P0-bhc">
+ <textFieldCell key="cell" lineBreakMode="truncatingTail" enabled="NO" allowsUndo="NO" sendsActionOnEndEditing="YES" title="Table View Cell" usesSingleLineMode="YES" id="5Rl-P0-bhc">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -70,16 +70,16 @@
<font key="font" metaFont="system"/>
</buttonCell>
</button>
- <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="7OO-Ut-UrC">
+ <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="7OO-Ut-UrC">
<rect key="frame" x="3" y="37" width="14" height="14"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSActionTemplate" id="bqz-sk-X31"/>
</imageView>
<progressIndicator wantsLayer="YES" maxValue="1" style="bar" translatesAutoresizingMaskIntoConstraints="NO" id="xAK-4F-cCr">
<rect key="frame" x="23" y="13" width="490" height="23"/>
</progressIndicator>
- <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fxw-eD-SmJ">
+ <textField verticalHuggingPriority="750" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fxw-eD-SmJ">
<rect key="frame" x="21" y="3" width="494" height="14"/>
- <textFieldCell key="cell" lineBreakMode="truncatingTail" allowsUndo="NO" title="Encoding status" id="eEU-Dr-Qh8">
+ <textFieldCell key="cell" lineBreakMode="truncatingTail" enabled="NO" allowsUndo="NO" sendsActionOnEndEditing="YES" title="Encoding status" usesSingleLineMode="YES" id="eEU-Dr-Qh8">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -119,7 +119,7 @@
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="17" id="5Tc-Oy-HWg"/>
</constraints>
- <textFieldCell key="cell" enabled="NO" allowsUndo="NO" sendsActionOnEndEditing="YES" title="Table View Cell" id="xSd-Hl-5Qk">
+ <textFieldCell key="cell" lineBreakMode="truncatingTail" enabled="NO" allowsUndo="NO" sendsActionOnEndEditing="YES" title="Table View Cell" usesSingleLineMode="YES" id="xSd-Hl-5Qk">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
diff --git a/macosx/Base.lproj/Queue.xib b/macosx/Base.lproj/Queue.xib
index bf105a3fa..6c912fd7b 100644
--- a/macosx/Base.lproj/Queue.xib
+++ b/macosx/Base.lproj/Queue.xib
@@ -19,11 +19,11 @@
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowCollectionBehavior key="collectionBehavior" fullScreenPrimary="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
- <rect key="contentRect" x="157" y="863" width="583" height="423"/>
+ <rect key="contentRect" x="157" y="863" width="584" height="424"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1177"/>
- <value key="minSize" type="size" width="525" height="340"/>
+ <value key="minSize" type="size" width="320" height="240"/>
<view key="contentView" id="2577">
- <rect key="frame" x="0.0" y="0.0" width="583" height="423"/>
+ <rect key="frame" x="0.0" y="0.0" width="584" height="424"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</view>
<toolbar key="toolbar" implicitIdentifier="0FE76B40-49B7-48AE-B44E-D1B8034BC88A" explicitIdentifier="HBQueueToolbar" displayMode="iconAndLabel" sizeMode="regular" id="ZVb-ld-0UP">
diff --git a/macosx/HBController.m b/macosx/HBController.m
index 21f08570c..d353a1c1d 100644
--- a/macosx/HBController.m
+++ b/macosx/HBController.m
@@ -12,6 +12,8 @@
#import "HBTitleSelectionController.h"
#import "NSWindow+HBAdditions.h"
+#import "HBQueue.h"
+
#import "HBPresetsManager.h"
#import "HBPreset.h"
#import "HBMutablePreset.h"
@@ -33,7 +35,7 @@
#import "HBRenamePresetController.h"
#import "HBAutoNamer.h"
-#import "HBQueue.h"
+#import "HBAttributedStringAdditions.h"
@import HandBrakeKit;
@@ -311,7 +313,7 @@ static void *HBControllerQueueCoreContext = &HBControllerQueueCoreContext;
{
info = note.userInfo[HBQueueProgressNotificationInfoKey];
}
- self.progressInfo = [[NSAttributedString alloc] initWithString:info];
+ self.progressInfo = info.HB_smallMonospacedString;
self.progress = [note.userInfo[HBQueueProgressNotificationPercentKey] doubleValue];
if (self->_visible)
diff --git a/macosx/HBJob+UIAdditions.h b/macosx/HBJob+UIAdditions.h
index 7099f08b0..99dcc10c8 100644
--- a/macosx/HBJob+UIAdditions.h
+++ b/macosx/HBJob+UIAdditions.h
@@ -16,9 +16,7 @@
@property (nonatomic, readonly) NSArray<NSString *> *containers;
@property (nonatomic, readonly) NSAttributedString *attributedTitleDescription;
-
@property (nonatomic, readonly) NSAttributedString *attributedDescription;
-@property (nonatomic, readonly) NSAttributedString *attributedExpandedDescription;
@property (nonatomic, readonly) NSString *shortDescription;
@property (nonatomic, readonly) NSString *filtersShortDescription;
diff --git a/macosx/HBPlayerHUDController.m b/macosx/HBPlayerHUDController.m
index 90c847da0..473b5ce0a 100644
--- a/macosx/HBPlayerHUDController.m
+++ b/macosx/HBPlayerHUDController.m
@@ -5,6 +5,7 @@
It may be used under the terms of the GNU General Public License. */
#import "HBPlayerHUDController.h"
+#import "HBAttributedStringAdditions.h"
@interface HBPlayerHUDController ()
@@ -18,9 +19,6 @@
@property (weak) IBOutlet NSPopUpButton *tracksSelection;
-@property (nonatomic, readonly) NSDictionary *monospacedAttr;
-@property (nonatomic, readonly) NSDictionary *normalMonospacedAttr;
-
@property (nonatomic, readwrite) id rateObserver;
@property (nonatomic, readwrite) id periodicObserver;
@@ -39,14 +37,6 @@
return @"HBPlayerHUDController";
}
-- (void)viewDidLoad
-{
- [super viewDidLoad];
-
- _normalMonospacedAttr = @{NSFontAttributeName: [NSFont monospacedDigitSystemFontOfSize:15 weight:NSFontWeightRegular]};
- _monospacedAttr = @{NSFontAttributeName: [NSFont monospacedDigitSystemFontOfSize:[NSFont smallSystemFontSize] weight:NSFontWeightRegular]};
-}
-
- (BOOL)canBeHidden
{
return YES;
@@ -203,11 +193,6 @@
return [NSString stringWithFormat:@"%02d:%02d.%03d", minutes, seconds, milliseconds];
}
-- (NSAttributedString *)_smallMonospacedString:(NSString *)string
-{
- return [[NSAttributedString alloc] initWithString:string attributes:self.monospacedAttr];
-}
-
- (void)_refreshUI
{
if (self.player)
@@ -216,8 +201,8 @@
NSTimeInterval duration = self.player.duration;
self.slider.doubleValue = currentTime;
- self.currentTimeLabel.attributedStringValue = [self _smallMonospacedString:[self _timeToTimecode:currentTime]];
- self.remaingTimeLabel.attributedStringValue = [self _smallMonospacedString:[self _timeToTimecode:duration - currentTime]];
+ self.currentTimeLabel.attributedStringValue = [self _timeToTimecode:currentTime].HB_smallMonospacedString;
+ self.remaingTimeLabel.attributedStringValue = [self _timeToTimecode:duration - currentTime].HB_smallMonospacedString;
if (@available(macOS 10.12.2, *))
{
@@ -496,11 +481,6 @@ static NSTouchBarItemIdentifier HBTouchBarTimeSlider = @"fr.handbrake.timeSlider
}
}
-- (NSAttributedString *)_monospacedString:(NSString *)string
-{
- return [[NSAttributedString alloc] initWithString:string attributes:self.normalMonospacedAttr];
-}
-
- (void)_touchBar_updateTime:(NSTimeInterval)currentTime duration:(NSTimeInterval)duration
{
NSSlider *slider = (NSSlider *)[[self.touchBar itemForIdentifier:HBTouchBarTimeSlider] slider];
@@ -508,8 +488,8 @@ static NSTouchBarItemIdentifier HBTouchBarTimeSlider = @"fr.handbrake.timeSlider
NSTextField *remainingTimeLabel = (NSTextField *)[[self.touchBar itemForIdentifier:HBTouchBarRemainingTime] view];
slider.doubleValue = currentTime;
- currentTimeLabel.attributedStringValue = [self _monospacedString:[self _timeToString:currentTime negative:NO]];
- remainingTimeLabel.attributedStringValue = [self _monospacedString:[self _timeToString:duration - currentTime negative:YES]];
+ currentTimeLabel.attributedStringValue = [self _timeToString:currentTime negative:NO].HB_monospacedString;
+ remainingTimeLabel.attributedStringValue = [self _timeToString:duration - currentTime negative:YES].HB_monospacedString;
}
@end
diff --git a/macosx/HBQueue.h b/macosx/HBQueue.h
index 4a85c47ef..a879b415c 100644
--- a/macosx/HBQueue.h
+++ b/macosx/HBQueue.h
@@ -28,6 +28,9 @@ extern NSString * const HBQueueLowSpaceAlertNotification;
extern NSString * const HBQueueProgressNotification;
extern NSString * const HBQueueProgressNotificationPercentKey; // NSNumber - double
+extern NSString * const HBQueueProgressNotificationHoursKey; // NSNumber - double
+extern NSString * const HBQueueProgressNotificationMinutesKey; // NSNumber - double
+extern NSString * const HBQueueProgressNotificationSecondsKey; // NSNumber - double
extern NSString * const HBQueueProgressNotificationInfoKey; // NSString
extern NSString * const HBQueueDidStartNotification;
@@ -41,8 +44,6 @@ extern NSString * const HBQueueItemNotificationItemKey; // HBQueueI
- (instancetype)initWithURL:(NSURL *)queueURL;
-@property (nonatomic, readonly) NSURL *queueURL;
-
@property (nonatomic, readonly) HBCore *core;
@property (nonatomic, readonly) HBDistributedArray<HBQueueItem *> *items;
@@ -50,6 +51,7 @@ extern NSString * const HBQueueItemNotificationItemKey; // HBQueueI
@property (nonatomic, nullable) HBJobOutputFileWriter *currentLog;
@property (nonatomic) NSUInteger pendingItemsCount;
+@property (nonatomic) NSUInteger failedItemsCount;
@property (nonatomic) NSUInteger completedItemsCount;
@property (nonatomic) NSUndoManager *undoManager;
@@ -57,10 +59,10 @@ extern NSString * const HBQueueItemNotificationItemKey; // HBQueueI
- (void)addJob:(HBJob *)job;
- (void)addJobs:(NSArray<HBJob *> *)jobs;
-- (void)addQueueItems:(NSArray<HBQueueItem *> *)items atIndexes:(NSIndexSet *)indexes;
-- (void)removeQueueItemAtIndex:(NSUInteger)index;
-- (void)removeQueueItemsAtIndexes:(NSIndexSet *)indexes;
-- (void)moveQueueItems:(NSArray<HBQueueItem *> *)items toIndex:(NSUInteger)index;
+- (void)addItems:(NSArray<HBQueueItem *> *)items atIndexes:(NSIndexSet *)indexes;
+- (void)removeItemAtIndex:(NSUInteger)index;
+- (void)removeItemsAtIndexes:(NSIndexSet *)indexes;
+- (void)moveItems:(NSArray<HBQueueItem *> *)items toIndex:(NSUInteger)index;
- (BOOL)itemExistAtURL:(NSURL *)url;
diff --git a/macosx/HBQueue.m b/macosx/HBQueue.m
index 3c9c20a2b..4a4b73b20 100644
--- a/macosx/HBQueue.m
+++ b/macosx/HBQueue.m
@@ -23,6 +23,9 @@ NSString * const HBQueueLowSpaceAlertNotification = @"HBQueueLowSpaceAlertNotifi
NSString * const HBQueueProgressNotification = @"HBQueueProgressNotification";
NSString * const HBQueueProgressNotificationPercentKey = @"HBQueueProgressNotificationPercentKey";
+NSString * const HBQueueProgressNotificationHoursKey = @"HBQueueProgressNotificationHoursKey";
+NSString * const HBQueueProgressNotificationMinutesKey = @"HBQueueProgressNotificationMinutesKey";
+NSString * const HBQueueProgressNotificationSecondsKey = @"HBQueueProgressNotificationSecondsKey";
NSString * const HBQueueProgressNotificationInfoKey = @"HBQueueProgressNotificationInfoKey";
NSString * const HBQueueDidStartNotification = @"HBQueueDidStartNotification";
@@ -82,7 +85,7 @@ NSString * const HBQueueItemNotificationItemKey = @"HBQueueItemNotificationItemK
if (itemsToAdd.count)
{
NSIndexSet *indexes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(self.items.count, itemsToAdd.count)];
- [self addQueueItems:itemsToAdd atIndexes:indexes];
+ [self addItems:itemsToAdd atIndexes:indexes];
}
}
@@ -101,12 +104,7 @@ NSString * const HBQueueItemNotificationItemKey = @"HBQueueItemNotificationItemK
return NO;
}
-- (NSUInteger)count
-{
- return self.items.count;
-}
-
-- (void)addQueueItems:(NSArray<HBQueueItem *> *)items atIndexes:(NSIndexSet *)indexes
+- (void)addItems:(NSArray<HBQueueItem *> *)items atIndexes:(NSIndexSet *)indexes
{
NSParameterAssert(items);
NSParameterAssert(indexes);
@@ -125,7 +123,7 @@ NSString * const HBQueueItemNotificationItemKey = @"HBQueueItemNotificationItemK
[NSNotificationCenter.defaultCenter postNotificationName:HBQueueDidAddItemNotification object:self userInfo:@{HBQueueItemNotificationIndexesKey: indexes}];
NSUndoManager *undo = self.undoManager;
- [[undo prepareWithInvocationTarget:self] removeQueueItemsAtIndexes:indexes];
+ [[undo prepareWithInvocationTarget:self] removeItemsAtIndexes:indexes];
if (!undo.isUndoing)
{
@@ -143,12 +141,12 @@ NSString * const HBQueueItemNotificationItemKey = @"HBQueueItemNotificationItemK
[self.items commit];
}
-- (void)removeQueueItemAtIndex:(NSUInteger)index
+- (void)removeItemAtIndex:(NSUInteger)index
{
- [self removeQueueItemsAtIndexes:[NSIndexSet indexSetWithIndex:index]];
+ [self removeItemsAtIndexes:[NSIndexSet indexSetWithIndex:index]];
}
-- (void)removeQueueItemsAtIndexes:(NSIndexSet *)indexes
+- (void)removeItemsAtIndexes:(NSIndexSet *)indexes
{
NSParameterAssert(indexes);
@@ -169,7 +167,7 @@ NSString * const HBQueueItemNotificationItemKey = @"HBQueueItemNotificationItemK
[NSNotificationCenter.defaultCenter postNotificationName:HBQueueDidRemoveItemNotification object:self userInfo:@{HBQueueItemNotificationIndexesKey: indexes}];
NSUndoManager *undo = self.undoManager;
- [[undo prepareWithInvocationTarget:self] addQueueItems:removeItems atIndexes:indexes];
+ [[undo prepareWithInvocationTarget:self] addItems:removeItems atIndexes:indexes];
if (!undo.isUndoing)
{
@@ -187,7 +185,7 @@ NSString * const HBQueueItemNotificationItemKey = @"HBQueueItemNotificationItemK
[self.items commit];
}
-- (void)moveQueueItems:(NSArray<HBQueueItem *> *)items toIndex:(NSUInteger)index
+- (void)moveItems:(NSArray<HBQueueItem *> *)items toIndex:(NSUInteger)index
{
[self.items beginTransaction];
@@ -296,8 +294,7 @@ NSString * const HBQueueItemNotificationItemKey = @"HBQueueItemNotificationItemK
- (void)removeAllItems
{
[self.items beginTransaction];
-
- [self removeQueueItemsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, self.items.count)]];
+ [self removeItemsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, self.items.count)]];
[self.items commit];
}
@@ -307,7 +304,7 @@ NSString * const HBQueueItemNotificationItemKey = @"HBQueueItemNotificationItemK
NSIndexSet *indexes = [self.items indexesOfObjectsUsingBlock:^BOOL(HBQueueItem *item) {
return (item.state != HBQueueItemStateWorking);
}];
- [self removeQueueItemsAtIndexes:indexes];
+ [self removeItemsAtIndexes:indexes];
[self.items commit];
}
@@ -317,7 +314,7 @@ NSString * const HBQueueItemNotificationItemKey = @"HBQueueItemNotificationItemK
NSIndexSet *indexes = [self.items indexesOfObjectsUsingBlock:^BOOL(HBQueueItem *item) {
return (item.state == HBQueueItemStateCompleted);
}];
- [self removeQueueItemsAtIndexes:indexes];
+ [self removeItemsAtIndexes:indexes];
[self.items commit];
}
@@ -432,7 +429,7 @@ NSString * const HBQueueItemNotificationItemKey = @"HBQueueItemNotificationItemK
/**
* Reloads the queue, this is called
- * when another HandBrake instances modifies the queue
+ * when another HandBrake instance modifies the queue
*/
- (void)reloadQueue
{
@@ -442,9 +439,7 @@ NSString * const HBQueueItemNotificationItemKey = @"HBQueueItemNotificationItemK
- (void)updateStats
{
- // lets get the stats on the status of the queue array
- NSUInteger pendingCount = 0;
- NSUInteger completedCount = 0;
+ NSUInteger pendingCount = 0, failedCount = 0, completedCount = 0;
for (HBQueueItem *item in self.items)
{
@@ -452,17 +447,22 @@ NSString * const HBQueueItemNotificationItemKey = @"HBQueueItemNotificationItemK
{
pendingCount++;
}
- if (item.state == HBQueueItemStateCompleted)
+ else if (item.state == HBQueueItemStateCompleted)
{
completedCount++;
}
+ else if (item.state == HBQueueItemStateFailed)
+ {
+ failedCount++;
+ }
}
self.pendingItemsCount = pendingCount;
+ self.failedItemsCount = failedCount;
self.completedItemsCount = completedCount;
}
-- (BOOL)_isDiskSpaceLowAtURL:(NSURL *)url
+- (BOOL)isDiskSpaceLowAtURL:(NSURL *)url
{
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HBQueuePauseIfLowSpace"])
{
@@ -537,7 +537,7 @@ NSString * const HBQueueItemNotificationItemKey = @"HBQueueItemNotificationItemK
// Check to see if there are any more pending items in the queue
HBQueueItem *nextItem = [self getNextPendingQueueItem];
- if (nextItem && [self _isDiskSpaceLowAtURL:nextItem.outputURL])
+ if (nextItem && [self isDiskSpaceLowAtURL:nextItem.outputURL])
{
// Disk space is low, show an alert
[HBUtilities writeToActivityLog:"Queue Stopped, low space on destination disk"];
@@ -708,6 +708,9 @@ NSString * const HBQueueItemNotificationItemKey = @"HBQueueItemNotificationItemK
[NSNotificationCenter.defaultCenter postNotificationName:HBQueueProgressNotification
object:self
userInfo:@{HBQueueProgressNotificationPercentKey: @(progress.percent),
+ HBQueueProgressNotificationHoursKey: @(progress.hours),
+ HBQueueProgressNotificationMinutesKey: @(progress.minutes),
+ HBQueueProgressNotificationSecondsKey: @(progress.seconds),
HBQueueProgressNotificationInfoKey: info}];
}
};
diff --git a/macosx/HBQueueController.m b/macosx/HBQueueController.m
index e5621db6d..54b6f1a03 100644
--- a/macosx/HBQueueController.m
+++ b/macosx/HBQueueController.m
@@ -123,14 +123,15 @@ static void *HBControllerQueueCoreContext = &HBControllerQueueCoreContext;
[NSNotificationCenter.defaultCenter addObserverForName:HBQueueProgressNotification object:_queue queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification * _Nonnull note) {
// Update dock icon
double progress = [note.userInfo[HBQueueProgressNotificationPercentKey] doubleValue];
- double hours = 1;
- double minutes = 1;
- double seconds = 1;
#define dockTileUpdateFrequency 0.1f
if (self.dockIconProgress < 100.0 * progress)
{
+ double hours = [note.userInfo[HBQueueProgressNotificationHoursKey] doubleValue];
+ double minutes = [note.userInfo[HBQueueProgressNotificationMinutesKey] doubleValue];
+ double seconds = [note.userInfo[HBQueueProgressNotificationSecondsKey] doubleValue];
+
[self.dockTile updateDockIcon:progress hours:hours minutes:minutes seconds:seconds];
self.dockIconProgress += dockTileUpdateFrequency;
}
@@ -253,6 +254,21 @@ static void *HBControllerQueueCoreContext = &HBControllerQueueCoreContext;
return self.queue.canPause || self.queue.canResume;
}
+ if (action == @selector(removeAll:) || action == @selector(resetAll:))
+ {
+ return self.queue.items.count > 0;
+ }
+
+ if (action == @selector(resetFailed:))
+ {
+ return self.queue.failedItemsCount > 0;
+ }
+
+ if (action == @selector(removeCompleted:))
+ {
+ return self.queue.completedItemsCount > 0;
+ }
+
return YES;
}
@@ -277,7 +293,6 @@ static void *HBControllerQueueCoreContext = &HBControllerQueueCoreContext;
return [self validateUserIterfaceItemForAction:action];
}
-
- (void)windowDidChangeOcclusionState:(NSNotification *)notification
{
self.visible = self.window.occlusionState & NSWindowOcclusionStateVisible ? YES : NO;
@@ -337,7 +352,7 @@ static void *HBControllerQueueCoreContext = &HBControllerQueueCoreContext;
NSInteger index = [self.queue.items indexOfObject:self.queue.currentItem];
[self.queue cancelCurrentItemAndContinue];
- [self.queue removeQueueItemAtIndex:index];
+ [self.queue removeItemAtIndex:index];
[self.queue.items commit];
}
}];
@@ -345,7 +360,7 @@ static void *HBControllerQueueCoreContext = &HBControllerQueueCoreContext;
}
// remove the non working items immediately
- [self.queue removeQueueItemsAtIndexes:mutableIndexes];
+ [self.queue removeItemsAtIndexes:mutableIndexes];
}
[self.queue.items commit];
}
@@ -370,7 +385,7 @@ static void *HBControllerQueueCoreContext = &HBControllerQueueCoreContext;
// Now that source is loaded and settings applied, delete the queue item from the queue
NSInteger index = [self.queue.items indexOfObject:item];
item.state = HBQueueItemStateReady;
- [self.queue removeQueueItemAtIndex:index];
+ [self.queue removeItemAtIndex:index];
}
else
{
diff --git a/macosx/HBQueueItemWorkingView.m b/macosx/HBQueueItemWorkingView.m
index 94916e2d4..4a217a78a 100644
--- a/macosx/HBQueueItemWorkingView.m
+++ b/macosx/HBQueueItemWorkingView.m
@@ -9,6 +9,8 @@
#import "HBQueueItem.h"
#import "HBQueue.h"
+#import "HBAttributedStringAdditions.h"
+
@interface HBQueueItemWorkingView ()
@property (nonatomic, weak) IBOutlet NSProgressIndicator *progressBar;
@@ -36,7 +38,7 @@
NSString *progressInfo = note.userInfo[HBQueueProgressNotificationInfoKey];
double progress = [note.userInfo[HBQueueProgressNotificationPercentKey] doubleValue];
- self.progressField.stringValue = progressInfo;
+ self.progressField.attributedStringValue = progressInfo.HB_smallMonospacedString;
self.progressBar.doubleValue = progress;
}];
diff --git a/macosx/HBQueueTableViewController.m b/macosx/HBQueueTableViewController.m
index 309d6d48a..9ced3c216 100644
--- a/macosx/HBQueueTableViewController.m
+++ b/macosx/HBQueueTableViewController.m
@@ -235,7 +235,7 @@
- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row
{
HBQueueItem *item = self.queue.items[row];
- return item.state == HBQueueItemStateWorking ? 56 : 22;
+ return item.state == HBQueueItemStateWorking ? 58 : 22;
}
#pragma mark NSQueueItemView delegate
@@ -243,7 +243,7 @@
- (void)removeQueueItem:(nonnull HBQueueItem *)item
{
NSUInteger index = [self.queue.items indexOfObject:item];
- [self.queue removeQueueItemAtIndex:index];
+ [self.queue removeItemAtIndex:index];
}
- (void)revealQueueItem:(nonnull HBQueueItem *)item
@@ -308,7 +308,7 @@
- (BOOL)tableView:(NSTableView *)tableView acceptDrop:(id<NSDraggingInfo>)info row:(NSInteger)row dropOperation:(NSTableViewDropOperation)dropOperation
{
- [self.queue moveQueueItems:self.dragNodesArray toIndex:row];
+ [self.queue moveItems:self.dragNodesArray toIndex:row];
return YES;
}