Fixed the optimize checkbox, the tableview not updating and the skeleton for a new action.
This commit is contained in:
1 parent
7253a86c8d
commit
60490b4039
8 files changed
+56
-22
No files matched your search
+5
-4
@@ -236,7 +236,7 @@ NSString *SBQueueCancelledNotification = @"SBQueueCancelledNotification";
|
||||
self.currentIndex = [self.items indexOfObject:self.currentItem];
|
||||
self.currentItem.status = SBQueueItemStatusWorking;
|
||||
|
||||
[self handleSBStatusWorking:self.currentIndex];
|
||||
[self handleSBStatusWorking:0 index:self.currentIndex];
|
||||
noErr = [self processItem:self.currentItem optimize:self.optimize error:&outError];
|
||||
|
||||
// Check results
|
||||
@@ -338,17 +338,18 @@ NSString *SBQueueCancelledNotification = @"SBQueueCancelledNotification";
|
||||
}
|
||||
|
||||
- (void)progressStatus:(CGFloat)progress {
|
||||
[self handleSBStatusWorking:progress];
|
||||
[self handleSBStatusWorking:progress index:-1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes SBQueueStatusWorking state information. Current implementation just
|
||||
* sends SBQueueWorkingNotification.
|
||||
*/
|
||||
- (void)handleSBStatusWorking:(CGFloat)progress {
|
||||
- (void)handleSBStatusWorking:(CGFloat)progress index:(NSInteger)index {
|
||||
NSString *info = [NSString stringWithFormat:@"Processing file %ld of %lu.",(long)self.currentIndex + 1, (unsigned long)[self.items count]];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SBQueueWorkingNotification object:self userInfo:@{@"ProgressString": info,
|
||||
@"Progress": @(progress)}];
|
||||
@"Progress": @(progress),
|
||||
@"ItemIndex": @(index)}];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,5 +20,8 @@
|
||||
@interface SBQueueSubtitlesAction : NSObject <SBQueueActionProtocol>
|
||||
@end
|
||||
|
||||
@interface SBQueueSetAction : NSObject <SBQueueActionProtocol>
|
||||
@end
|
||||
|
||||
@interface SBQueueOrganizeGroupsAction : NSObject <SBQueueActionProtocol>
|
||||
@end
|
||||
@@ -125,7 +125,7 @@
|
||||
if (artwork)
|
||||
[metadata.artworks addObject:artwork];
|
||||
}
|
||||
|
||||
|
||||
return metadata;
|
||||
}
|
||||
|
||||
@@ -146,6 +146,13 @@
|
||||
|
||||
@end
|
||||
|
||||
@implementation SBQueueSetAction
|
||||
|
||||
- (void)runAction:(SBQueueItem *)item {
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation SBQueueOrganizeGroupsAction
|
||||
|
||||
- (void)runAction:(SBQueueItem *)item {
|
||||
|
||||
@@ -86,6 +86,10 @@ static NSString *fileType = @"mp4";
|
||||
[_countLabel setStringValue:[info valueForKey:@"ProgressString"]];
|
||||
[_progressIndicator setIndeterminate:NO];
|
||||
[_progressIndicator setDoubleValue:[[info valueForKey:@"Progress"] doubleValue]];
|
||||
|
||||
if ([[info valueForKey:@"ItemIndex"] integerValue] != -1) {
|
||||
[self updateUI];
|
||||
}
|
||||
}];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:SBQueueCompletedNotification object:self.queue queue:mainQueue usingBlock:^(NSNotification *note) {
|
||||
@@ -110,6 +114,10 @@ static NSString *fileType = @"mp4";
|
||||
|
||||
- (void)initOptions {
|
||||
_options = [[NSMutableDictionary alloc] init];
|
||||
|
||||
// Observe the changes to SBQueueOptimize
|
||||
[self addObserver:self forKeyPath:@"options.SBQueueOptimize" options:0 context:NULL];
|
||||
|
||||
[_options setObject:@YES forKey:@"SBQueueOrganize"];
|
||||
[_options setObject:@YES forKey:@"SBQueueMetadata"];
|
||||
[_options setObject:@NO forKey:@"SBQueueAutoStart"];
|
||||
@@ -136,6 +144,14 @@ static NSString *fileType = @"mp4";
|
||||
}
|
||||
}
|
||||
|
||||
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
|
||||
if ([keyPath isEqualToString:@"options.SBQueueOptimize"]) {
|
||||
self.queue.optimize = [[self.options objectForKey:@"SBQueueOptimize"] boolValue];
|
||||
} else {
|
||||
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
|
||||
}
|
||||
}
|
||||
|
||||
- (SBQueueStatus)status {
|
||||
return self.queue.status;
|
||||
}
|
||||
@@ -154,7 +170,6 @@ static NSString *fileType = @"mp4";
|
||||
// the popover retains us and we retain the popover,
|
||||
// we drop the popover whenever it is closed to avoid a cycle
|
||||
self.popover.contentViewController = [[[SBOptionsViewController alloc] initWithOptions:self.options] autorelease];
|
||||
|
||||
self.popover.appearance = NSPopoverAppearanceMinimal;
|
||||
self.popover.animates = YES;
|
||||
|
||||
@@ -179,7 +194,6 @@ static NSString *fileType = @"mp4";
|
||||
|
||||
#pragma mark - UI methods
|
||||
|
||||
|
||||
- (void)updateDockTile {
|
||||
NSUInteger count = [self.queue readyCount];
|
||||
|
||||
@@ -383,9 +397,17 @@ static NSString *fileType = @"mp4";
|
||||
- (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)anItem {
|
||||
SEL action = [anItem action];
|
||||
|
||||
if (action == @selector(removeSelectedItems:))
|
||||
if ([_tableView selectedRow] != -1 || [_tableView clickedRow] != -1)
|
||||
return YES;
|
||||
if (action == @selector(removeSelectedItems:)) {
|
||||
if ([_tableView selectedRow] != -1) {
|
||||
SBQueueItem *item = [self.queue itemAtIndex:[_tableView selectedRow]];
|
||||
if ([item status] != SBQueueItemStatusWorking)
|
||||
return YES;
|
||||
} else if ([_tableView clickedRow] != -1) {
|
||||
SBQueueItem *item = [self.queue itemAtIndex:[_tableView clickedRow]];
|
||||
if ([item status] != SBQueueItemStatusWorking)
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
if (action == @selector(showInFinder:)) {
|
||||
if ([_tableView clickedRow] != -1) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
@class MP42File;
|
||||
|
||||
typedef enum SBQueueItemStatus : NSInteger {
|
||||
SBQueueItemtatusUnknown = 0,
|
||||
SBQueueItemStatusUnknown = 0,
|
||||
SBQueueItemStatusReady,
|
||||
SBQueueItemStatusEditing,
|
||||
SBQueueItemStatusWorking,
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_actions = [[NSMutableArray alloc] init];
|
||||
_status = SBQueueItemStatusReady;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="233" y="759" width="488" height="332"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1418"/>
|
||||
<value key="minSize" type="size" width="300" height="200"/>
|
||||
<value key="minSize" type="size" width="360" height="200"/>
|
||||
<view key="contentView" id="2">
|
||||
<rect key="frame" x="0.0" y="0.0" width="488" height="332"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application"/>
|
||||
<customView id="UlG-O3-eNc" userLabel="OptionsView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="316" height="133"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="321" height="143"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<subviews>
|
||||
<button id="zEH-aV-Tl7">
|
||||
<rect key="frame" x="119" y="17" width="71" height="18"/>
|
||||
<rect key="frame" x="111" y="17" width="71" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="Optimize" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" state="on" inset="2" id="nig-pN-efw">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
@@ -33,7 +33,7 @@
|
||||
</connections>
|
||||
</button>
|
||||
<button id="9GN-f6-r2j">
|
||||
<rect key="frame" x="119" y="74" width="103" height="18"/>
|
||||
<rect key="frame" x="111" y="107" width="103" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="Fetch Metadata" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" state="on" inset="2" id="QNO-e1-WUJ">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
@@ -48,7 +48,7 @@
|
||||
</connections>
|
||||
</button>
|
||||
<button id="MGZ-hB-jhx">
|
||||
<rect key="frame" x="119" y="35" width="79" height="18"/>
|
||||
<rect key="frame" x="111" y="35" width="79" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="Auto-Start" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" state="on" inset="2" id="LYO-G0-9jA">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
@@ -63,7 +63,7 @@
|
||||
</connections>
|
||||
</button>
|
||||
<button id="ccd-Xn-Dj3">
|
||||
<rect key="frame" x="119" y="56" width="112" height="18"/>
|
||||
<rect key="frame" x="111" y="89" width="112" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="Organize Groups" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" state="on" inset="2" id="240-c7-2UW">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
@@ -78,7 +78,7 @@
|
||||
</connections>
|
||||
</button>
|
||||
<popUpButton verticalHuggingPriority="750" id="86l-GG-SpO">
|
||||
<rect key="frame" x="119" y="95" width="180" height="22"/>
|
||||
<rect key="frame" x="171" y="65" width="133" height="22"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="8bb-Gy-KAS">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||
@@ -101,16 +101,16 @@
|
||||
</popUpButtonCell>
|
||||
</popUpButton>
|
||||
<textField verticalHuggingPriority="750" id="vJ5-JB-k1m">
|
||||
<rect key="frame" x="18" y="100" width="98" height="14"/>
|
||||
<rect key="frame" x="112" y="70" width="56" height="14"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Default location:" id="17e-9u-rVn">
|
||||
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Location:" id="17e-9u-rVn">
|
||||
<font key="font" metaFont="smallSystemBold"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField verticalHuggingPriority="750" id="Uoo-hZ-D1f">
|
||||
<rect key="frame" x="26" y="37" width="90" height="14"/>
|
||||
<rect key="frame" x="18" y="37" width="90" height="14"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Global options:" id="NBN-VA-pg2">
|
||||
<font key="font" metaFont="smallSystemBold"/>
|
||||
@@ -119,7 +119,7 @@
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField verticalHuggingPriority="750" id="S7L-mA-j3Y">
|
||||
<rect key="frame" x="57" y="76" width="59" height="14"/>
|
||||
<rect key="frame" x="49" y="109" width="59" height="14"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Add item:" id="9ls-xq-YGz">
|
||||
<font key="font" metaFont="smallSystemBold"/>
|
||||
|
||||
Reference in new issue
Block a user