From 6f0d2ccf72bb4db6c3dca626d5d732f20909cf32 Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Wed, 9 Jul 2014 17:09:34 +0200 Subject: [PATCH] Moved the movie file type to SBQueuePreferences. --- Classes/SBQueueController.m | 13 +++++++------ Classes/SBQueuePreferences.h | 1 + Classes/SBQueuePreferences.m | 4 +++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Classes/SBQueueController.m b/Classes/SBQueueController.m index 8e63ada..a00f455 100755 --- a/Classes/SBQueueController.m +++ b/Classes/SBQueueController.m @@ -18,7 +18,6 @@ #import -static NSString *fileType = @"mp4"; static void *SBQueueContex = &SBQueueContex; #define SublerBatchTableViewDataType @"SublerBatchTableViewDataType" @@ -86,7 +85,7 @@ static void *SBQueueContex = &SBQueueContex; [_progressIndicator setHidden:YES]; // Load a generic movie icon to display in the table view - _docImg = [[[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode('MOOV')] retain]; + _docImg = [[[NSWorkspace sharedWorkspace] iconForFileType:@"public.movie"] retain]; [_docImg setSize:NSMakeSize(16, 16)]; [_tableView registerForDraggedTypes: [NSArray arrayWithObjects: NSFilenamesPboardType, SublerBatchTableViewDataType, nil]]; @@ -117,7 +116,6 @@ static void *SBQueueContex = &SBQueueContex; [_startItem setImage:[NSImage imageNamed:NSImageNameGoRightTemplate]]; [_countLabel setStringValue:@"Done"]; - [self updateDockTile]; [self updateUI]; }]; @@ -257,9 +255,11 @@ static void *SBQueueContex = &SBQueueContex; NSURL *destination = [self.options objectForKey:SBQueueDestination]; if (destination) { - destination = [[[destination URLByAppendingPathComponent:[url lastPathComponent]] URLByDeletingPathExtension] URLByAppendingPathExtension:fileType]; + destination = [[[destination URLByAppendingPathComponent:[url lastPathComponent]] URLByDeletingPathExtension] + URLByAppendingPathExtension:[self.options objectForKey:SBQueueFileType]]; } else { - destination = [[url URLByDeletingPathExtension] URLByAppendingPathExtension:fileType]; + destination = [[url URLByDeletingPathExtension] + URLByAppendingPathExtension:[self.options objectForKey:SBQueueFileType]]; } item.destURL = destination; @@ -434,9 +434,10 @@ static void *SBQueueContex = &SBQueueContex; - (void)updateUI { [_tableView reloadData]; + [self updateDockTile]; + if (self.queue.status != SBQueueStatusWorking) { [_countLabel setStringValue:[NSString stringWithFormat:@"%lu files in queue.", (unsigned long)[self.queue count]]]; - [self updateDockTile]; } } diff --git a/Classes/SBQueuePreferences.h b/Classes/SBQueuePreferences.h index 6e233ee..bc8765d 100644 --- a/Classes/SBQueuePreferences.h +++ b/Classes/SBQueuePreferences.h @@ -8,6 +8,7 @@ #import +extern NSString * const SBQueueFileType; extern NSString * const SBQueueOrganize; extern NSString * const SBQueueMetadata; extern NSString * const SBQueueSubtitles; diff --git a/Classes/SBQueuePreferences.m b/Classes/SBQueuePreferences.m index babf090..bc48093 100644 --- a/Classes/SBQueuePreferences.m +++ b/Classes/SBQueuePreferences.m @@ -11,6 +11,7 @@ #import +NSString * const SBQueueFileType = @"SBQueueFileType"; NSString * const SBQueueOrganize = @"SBQueueOrganize"; NSString * const SBQueueMetadata = @"SBQueueMetadata"; NSString * const SBQueueSubtitles = @"SBQueueSubtitles"; @@ -56,7 +57,8 @@ NSString * const SBQueueSet = @"SBQueueSet"; } + (void)registerUserDefaults { - [[NSUserDefaults standardUserDefaults] registerDefaults:@{ SBQueueOrganize : @YES, + [[NSUserDefaults standardUserDefaults] registerDefaults:@{ SBQueueFileType : @"mp4", + SBQueueOrganize : @YES, SBQueueMetadata : @NO, SBQueueSubtitles: @YES, SBQueueAutoStart: @NO,