Enable "Edit…" menu for completed items.
This commit is contained in:
2 files changed
+14
-4
No files matched your search
@@ -156,7 +156,7 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
if (action == @selector(edit:)) {
|
if (action == @selector(edit:)) {
|
||||||
if (self.table.clickedRow != -1) {
|
if (self.table.clickedRow != -1) {
|
||||||
SBQueueItem *item = [self.queue itemAtIndex:self.table.clickedRow];
|
SBQueueItem *item = [self.queue itemAtIndex:self.table.clickedRow];
|
||||||
if (item.status == SBQueueItemStatusReady)
|
if (item.status == SBQueueItemStatusReady || item.status == SBQueueItemStatusCompleted)
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -193,6 +193,7 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
* and removes it from the queue.
|
* and removes it from the queue.
|
||||||
*/
|
*/
|
||||||
- (void)editItem:(SBQueueItem *)item {
|
- (void)editItem:(SBQueueItem *)item {
|
||||||
|
SBQueueItemStatus originalStatus = item.status;
|
||||||
item.status = SBQueueItemStatusWorking;
|
item.status = SBQueueItemStatusWorking;
|
||||||
[self updateUI];
|
[self updateUI];
|
||||||
|
|
||||||
@@ -200,7 +201,7 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
__block NSError *error;
|
__block NSError *error;
|
||||||
BOOL result = NO;
|
BOOL result = NO;
|
||||||
|
|
||||||
if (!item.mp4File) {
|
if (originalStatus != SBQueueItemStatusCompleted) {
|
||||||
result = [item prepare:&error];
|
result = [item prepare:&error];
|
||||||
if (result == NO) {
|
if (result == NO) {
|
||||||
NSLog(@"%@", error);
|
NSLog(@"%@", error);
|
||||||
@@ -210,7 +211,12 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
|
|
||||||
MP42File *mp4 = item.mp4File;
|
MP42File *mp4 = item.mp4File;
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
SBDocument *doc = [[SBDocument alloc] initWithMp4:mp4 error:&error];
|
SBDocument *doc = nil;
|
||||||
|
if (originalStatus == SBQueueItemStatusCompleted) {
|
||||||
|
doc = [[SBDocument alloc] initWithContentsOfURL:item.destURL ofType:@"" error:&error];
|
||||||
|
} else {
|
||||||
|
doc = [[SBDocument alloc] initWithMp4:mp4 error:&error];
|
||||||
|
}
|
||||||
|
|
||||||
if (doc) {
|
if (doc) {
|
||||||
[[NSDocumentController sharedDocumentController] addDocument:doc];
|
[[NSDocumentController sharedDocumentController] addDocument:doc];
|
||||||
@@ -219,6 +225,7 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
|
|
||||||
[self.itemPopover close];
|
[self.itemPopover close];
|
||||||
|
|
||||||
|
item.status = originalStatus;
|
||||||
[self removeItems:@[item]];
|
[self removeItems:@[item]];
|
||||||
[self updateUI];
|
[self updateUI];
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -201,7 +201,10 @@
|
|||||||
NSString *type;
|
NSString *type;
|
||||||
[self.fileURL getResourceValue:&type forKey:NSURLTypeIdentifierKey error:outError];
|
[self.fileURL getResourceValue:&type forKey:NSURLTypeIdentifierKey error:outError];
|
||||||
|
|
||||||
if ([type isEqualToString:@"com.apple.m4a-audio"] || [type isEqualToString:@"com.apple.m4v-video"] || [type isEqualToString:@"public.mpeg-4"]) {
|
if (self.mp4File) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
else if ([type isEqualToString:@"com.apple.m4a-audio"] || [type isEqualToString:@"com.apple.m4v-video"] || [type isEqualToString:@"public.mpeg-4"]) {
|
||||||
self.mp4File = [[MP42File alloc] initWithURL:self.fileURL error:NULL];
|
self.mp4File = [[MP42File alloc] initWithURL:self.fileURL error:NULL];
|
||||||
} else {
|
} else {
|
||||||
self.mp4File = [[MP42File alloc] init];
|
self.mp4File = [[MP42File alloc] init];
|
||||||
|
|||||||
Reference in new issue
Block a user