Various clean ups.

This commit is contained in:
Damiano Galassi committed 2015-08-21 09:11:04 +02:00
1 parent 7a23fcd29f
commit a8c11702ce
8 files changed
+107 -67

No files matched your search

+1 -1
View File
@@ -50,7 +50,7 @@ typedef enum SBCachePolicy : NSUInteger {
- (void) cancel;
#pragma Methods to be overridden
#pragma mark Methods to be overridden
- (NSArray<NSString *> *) languages;
- (NSArray<MP42Metadata *> * _Nullable) searchTVSeries:(NSString *)aSeriesName language:(NSString *)aLanguage;
+1 -1
View File
@@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface iTunesStore : MetadataImporter
#pragma mark iTunes stores
+ (NSDictionary * __nullable) getStoreFor:(NSString *)aLanguageString;
+ (nullable NSDictionary *) getStoreFor:(NSString *)aLanguageString;
#pragma mark Quick iTunes search for metadata
+ (MP42Metadata *) quickiTunesSearchTV:(NSString *)aSeriesName episodeTitle:(NSString *)aEpisodeTitle;
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8173.3" systemVersion="15A262e" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6250"/>
<plugIn identifier="com.apple.imagekit.ibplugin" version="6250"/>
<development version="6300" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8173.3"/>
<plugIn identifier="com.apple.imagekit.ibplugin" version="8173.3"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="SBMovieViewController">
@@ -34,6 +35,7 @@
<tabView controlSize="small" id="10">
<rect key="frame" x="-11" y="-12" width="502" height="279"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<tabViewItems>
<tabViewItem label="Metadata" identifier="1" id="11">
<view key="view" id="12">
@@ -48,10 +50,11 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" columnReordering="NO" columnSelection="YES" autosaveColumns="NO" rowHeight="14" headerView="23" id="22" customClass="SBTableView">
<rect key="frame" x="0.0" y="0.0" width="446" height="16"/>
<rect key="frame" x="0.0" y="0.0" width="446" height="177"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<tableViewGridLines key="gridStyleMask" vertical="YES"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
@@ -315,7 +318,7 @@
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
</tableColumn>
<tableColumn identifier="value" width="333" minWidth="40" maxWidth="2000" id="25">
<tableColumn identifier="value" width="333" minWidth="40" maxWidth="4000" id="25">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Value">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
@@ -335,24 +338,30 @@
</connections>
</tableView>
</subviews>
<animations/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</clipView>
<animations/>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" controlSize="small" horizontal="YES" id="21">
<rect key="frame" x="1" y="184" width="446" height="14"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
</scroller>
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" doubleValue="1" controlSize="small" horizontal="NO" id="20">
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" controlSize="small" horizontal="NO" id="20">
<rect key="frame" x="412" y="17" width="11" height="152"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
</scroller>
<tableHeaderView key="headerView" id="23">
<rect key="frame" x="0.0" y="0.0" width="446" height="17"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
</tableHeaderView>
</scrollView>
<popUpButton verticalHuggingPriority="750" id="30">
<rect key="frame" x="17" y="7" width="32" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<popUpButtonCell key="cell" type="smallSquare" bezelStyle="smallSquare" alignment="center" controlSize="small" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" inset="2" pullsDown="YES" selectedItem="33" id="31">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -371,6 +380,7 @@
<button verticalHuggingPriority="750" id="53">
<rect key="frame" x="48" y="7" width="24" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="NSRemoveTemplate" imagePosition="overlaps" alignment="center" enabled="NO" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="54">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -382,6 +392,7 @@
<popUpButton verticalHuggingPriority="750" id="179">
<rect key="frame" x="80" y="7" width="33" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<popUpButtonCell key="cell" type="smallSquare" bezelStyle="smallSquare" alignment="center" controlSize="small" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" pullsDown="YES" selectedItem="184" id="180">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -395,6 +406,7 @@
</popUpButtonCell>
</popUpButton>
</subviews>
<animations/>
</view>
</tabViewItem>
<tabViewItem label="Artwork" identifier="Item 1" id="15">
@@ -412,6 +424,7 @@
<ikImageBrowserView autoresizesSubviews="NO" zoomValue="1" allowsReordering="YES" animates="YES" id="217" customClass="SBImageBrowserView">
<rect key="frame" x="0.0" y="0.0" width="446" height="197"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<autoresizingMask key="contentResizingMask" heightSizable="YES"/>
<size key="cellSize" width="177" height="177"/>
<connections>
@@ -424,19 +437,24 @@
</connections>
</ikImageBrowserView>
</subviews>
<animations/>
</clipView>
<animations/>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="216">
<rect key="frame" x="-100" y="-100" width="438" height="15"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
</scroller>
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="215">
<rect key="frame" x="424" y="1" width="15" height="250"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
</scroller>
</scrollView>
<button verticalHuggingPriority="750" id="223">
<rect key="frame" x="17" y="7" width="24" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="NSAddTemplate" imagePosition="overlaps" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="224">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -448,6 +466,7 @@
<button verticalHuggingPriority="750" id="226">
<rect key="frame" x="40" y="7" width="24" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="NSRemoveTemplate" imagePosition="overlaps" alignment="center" enabled="NO" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="227">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -459,12 +478,14 @@
<slider verticalHuggingPriority="750" id="235">
<rect key="frame" x="350" y="11" width="115" height="15"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<animations/>
<sliderCell key="cell" controlSize="small" continuous="YES" state="on" alignment="left" maxValue="2" doubleValue="1" tickMarkPosition="above" sliderType="linear" id="236"/>
<connections>
<action selector="zoomSliderDidChange:" target="-2" id="237"/>
</connections>
</slider>
</subviews>
<animations/>
</view>
</tabViewItem>
<tabViewItem label="Other Settings" identifier="Item 2" id="40">
@@ -482,6 +503,7 @@
<button id="57">
<rect key="frame" x="122" y="53" width="71" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
<buttonCell key="cell" type="check" title="Gapless" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="58">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -493,6 +515,7 @@
<button id="194">
<rect key="frame" x="122" y="33" width="71" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
<buttonCell key="cell" type="check" title="Podcast" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="195">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -504,6 +527,7 @@
<popUpButton verticalHuggingPriority="750" id="59">
<rect key="frame" x="122" y="139" width="143" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
<popUpButtonCell key="cell" type="push" title="Normal (Music)" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" tag="1" imageScaling="proportionallyDown" inset="2" selectedItem="212" id="60">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -538,6 +562,7 @@
<textField verticalHuggingPriority="750" id="72">
<rect key="frame" x="52" y="143" width="67" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Media Kind:" id="73">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -547,6 +572,7 @@
<popUpButton verticalHuggingPriority="750" id="74">
<rect key="frame" x="122" y="112" width="143" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
<popUpButtonCell key="cell" type="push" title="None" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="86" id="77">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -565,6 +591,7 @@
<textField verticalHuggingPriority="750" id="75">
<rect key="frame" x="32" y="117" width="88" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Content Rating:" id="76">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -574,6 +601,7 @@
<popUpButton verticalHuggingPriority="750" id="199">
<rect key="frame" x="121" y="85" width="143" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
<popUpButtonCell key="cell" type="push" title="No" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="206" id="202">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -592,6 +620,7 @@
<textField verticalHuggingPriority="750" id="200">
<rect key="frame" x="95" y="90" width="24" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="HD:" id="201">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -601,6 +630,7 @@
<textField verticalHuggingPriority="750" id="139">
<rect key="frame" x="70" y="55" width="50" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<animations/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Options:" id="140">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -608,17 +638,22 @@
</textFieldCell>
</textField>
</subviews>
<animations/>
</view>
<animations/>
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<font key="titleFont" size="11" name="LucidaGrande"/>
</box>
</subviews>
<animations/>
</view>
</tabViewItem>
</tabViewItems>
</tabView>
</subviews>
<animations/>
<point key="canvasLocation" x="422" y="477"/>
</customView>
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" visibleAtLaunch="NO" animationBehavior="default" id="167" userLabel="Preset Save">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
@@ -632,6 +667,7 @@
<textField verticalHuggingPriority="750" id="173">
<rect key="frame" x="17" y="90" width="87" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<animations/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Preset Name:" id="174">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -641,6 +677,7 @@
<textField verticalHuggingPriority="750" id="171">
<rect key="frame" x="20" y="60" width="306" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<animations/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="176">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -650,6 +687,7 @@
<button verticalHuggingPriority="750" id="170">
<rect key="frame" x="236" y="12" width="96" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<animations/>
<buttonCell key="cell" type="push" title="Save" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="177">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -664,6 +702,7 @@ DQ
<button verticalHuggingPriority="750" id="169">
<rect key="frame" x="140" y="12" width="96" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<animations/>
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="178">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -676,6 +715,7 @@ Gw
</connections>
</button>
</subviews>
<animations/>
</view>
</window>
</objects>
+1 -1
View File
@@ -204,7 +204,7 @@
CFRetain(completionHandler);
dispatch_async(dispatch_get_main_queue(), ^{
NSError *outError;
NSError *outError = nil;
SBDocument *doc = [[self openUntitledDocumentAndDisplay:displayDocument error:&outError] retain];
completionHandler(doc, NO, outError);
+2 -1
View File
@@ -20,9 +20,10 @@
IBOutlet NSSlider *slider;
IBOutlet NSButton *addArtworkButton;
IBOutlet NSButton *loadMoreArtworkButton;
NSMutableArray<NSURL *> *imageURLsUnloaded;
NSMutableArray *images;
NSArray<NSString *> *artworkProviderNames;
NSArray<NSString *> *artworkProviderNames;
}
#pragma mark Initialization
+2 -2
View File
@@ -33,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
IBOutlet NSToolbarItem *searchMetadata;
IBOutlet NSToolbarItem *sendToQueue;
NSArray *languages;
NSArray<NSString *> *languages;
NSViewController *propertyView;
IBOutlet NSView *targetView;
@@ -59,7 +59,7 @@ NS_ASSUME_NONNULL_BEGIN
- (IBAction)setTrackOffset:(id)sender;
- (IBAction)closeOffsetSheet:(id)sender;
- (IBAction)setSaveFormat:(id)sender;
- (IBAction)setSaveFormat:(NSPopUpButton *)sender;
- (IBAction)cancelSaveOperation:(id)sender;
- (IBAction)sendToExternalApp:(id)sender;
+50 -51
View File
@@ -149,39 +149,8 @@
return YES;
}
- (BOOL)saveDidComplete:(NSError *)outError URL:(NSURL *)absoluteURL
{
[NSApp endSheet:savingWindow];
[savingWindow orderOut:self];
[optBar stopAnimation:self];
if (outError && [outError code] == 101) {
// Write permission error, don't reload the file
} else {
[self reloadFile:absoluteURL];
}
if (outError) {
[self presentError:outError
modalForWindow:documentWindow
delegate:nil
didPresentSelector:NULL
contextInfo:NULL];
[outError release];
}
return YES;
}
- (BOOL)writeSafelyToURL:(NSURL *)url ofType:(NSString *)typeName forSaveOperation:(NSSaveOperationType)saveOperation error:(NSError * _Nullable *)outError
{
NSMutableDictionary * attributes = [[NSMutableDictionary alloc] init];
if ([[[NSUserDefaults standardUserDefaults] valueForKey:@"chaptersPreviewTrack"] boolValue])
[attributes setObject:@YES forKey:MP42GenerateChaptersPreviewTrack];
if ([[[NSUserDefaults standardUserDefaults] valueForKey:@"SBOrganizeAlternateGroups"] boolValue])
[attributes setObject:@YES forKey:MP42OrganizeAlternateGroups];
dispatch_async(dispatch_get_main_queue(), ^{
[optBar setIndeterminate:YES];
[optBar startAnimation:self];
@@ -197,20 +166,32 @@
CFStringRef reasonForActivity= CFSTR("Subler Save Operation");
IOReturn io_success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoIdleSleep,
kIOPMAssertionLevelOn, reasonForActivity, &assertionID);
BOOL success = NO;
BOOL result = NO;
NSError *inError = nil;
NSMutableDictionary<NSString *, NSNumber *> * attributes = [[NSMutableDictionary alloc] init];
if ([[[NSUserDefaults standardUserDefaults] valueForKey:@"chaptersPreviewTrack"] boolValue]) {
attributes[MP42GenerateChaptersPreviewTrack] = @YES;
}
if ([[[NSUserDefaults standardUserDefaults] valueForKey:@"SBOrganizeAlternateGroups"] boolValue]) {
attributes[MP42OrganizeAlternateGroups] = @YES;
}
switch (saveOperation) {
case NSSaveOperation:
// movie file already exists, so we'll just update
// the movie resource
success = [self.mp4 updateMP4FileWithAttributes:attributes error:&inError];
// the movie resource.
result = [self.mp4 updateMP4FileWithAttributes:attributes error:&inError];
break;
case NSSaveAsOperation:
if ([_64bit_data state]) [attributes setObject:@YES forKey:MP4264BitData];
if ([_64bit_time state]) [attributes setObject:@YES forKey:MP4264BitTime];
success = [self.mp4 writeToUrl:url withAttributes:attributes error:&inError];
// movie doesn not exist, create a new one from scratch.
if ([_64bit_data state]) { attributes[MP4264BitData] = @YES; }
if ([_64bit_time state]) { attributes[MP4264BitTime] = @YES; }
result = [self.mp4 writeToUrl:url withAttributes:attributes error:&inError];
break;
default:
NSAssert(NO, @"Unhandled save operation");
break;
@@ -218,11 +199,11 @@
[attributes release];
if (success && _optimize) {
if (result && _optimize) {
dispatch_async(dispatch_get_main_queue(), ^{
[saveOperationName setStringValue:@"Optimizing…"];
});
success = [self.mp4 optimize];
result = [self.mp4 optimize];
_optimize = NO;
}
@@ -231,17 +212,33 @@
}
dispatch_async(dispatch_get_main_queue(), ^{
[self saveDidComplete:inError URL:url];
[NSApp endSheet:savingWindow];
[savingWindow orderOut:self];
[optBar stopAnimation:self];
if (inError && inError.code == 101) {
// Write permission error, don't reload the file
} else {
[self reloadFile:url];
}
if (inError) {
[self presentError:inError
modalForWindow:documentWindow
delegate:nil
didPresentSelector:NULL
contextInfo:NULL];
}
});
return success;
return result;
}
- (BOOL)prepareSavePanel:(NSSavePanel *)savePanel
{
_currentSavePanel = savePanel;
[savePanel setExtensionHidden:NO];
[savePanel setAccessoryView:saveView];
savePanel.extensionHidden = NO;
savePanel.accessoryView = saveView;
NSArray<NSString *> *formats = [self writableTypesForSaveOperation:NSSaveAsOperation];
@@ -251,6 +248,7 @@
}
[fileFormat selectItemAtIndex:[[[NSUserDefaults standardUserDefaults] valueForKey:@"defaultSaveFormat"] integerValue]];
if ([[NSUserDefaults standardUserDefaults] valueForKey:@"SBSaveFormat"]) {
_currentSavePanel.allowedFileTypes = @[[[NSUserDefaults standardUserDefaults] valueForKey:@"SBSaveFormat"]];
}
@@ -258,13 +256,13 @@
NSString *filename = nil;
for (MP42Track *track in self.mp4.tracks) {
if (track.sourceURL) {
filename = [[track.sourceURL lastPathComponent] stringByDeletingPathExtension];
filename = track.sourceURL.lastPathComponent.stringByDeletingPathExtension;
break;
}
}
if (filename) {
[savePanel performSelector:@selector(setNameFieldStringValue:) withObject:filename];
savePanel.nameFieldStringValue = filename;
}
if (self.mp4.dataSize > 4200000000) {
@@ -274,7 +272,7 @@
return YES;
}
- (IBAction)setSaveFormat:(id)sender
- (IBAction)setSaveFormat:(NSPopUpButton *)sender
{
NSString *requiredFileType = nil;
NSInteger index = [sender indexOfSelectedItem];
@@ -317,12 +315,13 @@
- (IBAction)sendToExternalApp:(id)sender
{
/* send to itunes after save */
NSAppleScript *myScript = [[NSAppleScript alloc] initWithSource:
[NSString stringWithFormat:@"%@%@%@", @"tell application \"iTunes\" to open (POSIX file \"", [[self fileURL] path], @"\")"]];
// Send to itunes after save.
NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
NSString *appPath = [workspace fullPathForApplication:@"iTunes"];
[myScript executeAndReturnError: nil];
[myScript release];
if (appPath) {
[workspace openFile:self.fileURL.path withApplication:appPath];
}
}
#pragma mark Interface validation
+3 -3
View File
@@ -175,11 +175,11 @@ NSString *SBQueueCancelledNotification = @"SBQueueCancelledNotification";
[self disableSleep];
dispatch_async(self.workQueue, ^{
NSError *outError = nil;
BOOL noErr = NO;
for (;;) {
@autoreleasepool {
NSError *outError = nil;
BOOL noErr = NO;
// Save the queue
[self saveQueueToDisk];