Refactor the queue optimise feature to a stand alone action.
This commit is contained in:
6 files changed
+83
-38
No files matched your search
@@ -80,9 +80,6 @@ static void *SBQueueContex = &SBQueueContex;
|
||||
// Drag & Drop
|
||||
[self.table registerForDraggedTypes:@[NSFilenamesPboardType, SublerBatchTableViewDataType]];
|
||||
|
||||
// Observe the changes to SBQueueOptimize
|
||||
[self addObserver:self forKeyPath:@"options.SBQueueOptimize" options:NSKeyValueObservingOptionInitial context:SBQueueContex];
|
||||
|
||||
// Register to the queue notifications
|
||||
NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
|
||||
|
||||
@@ -174,16 +171,6 @@ static void *SBQueueContex = &SBQueueContex;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
|
||||
if (context == SBQueueContex) {
|
||||
if ([keyPath isEqualToString:@"options.SBQueueOptimize"]) {
|
||||
self.queue.optimize = [(self.options)[SBQueueOptimize] boolValue];
|
||||
}
|
||||
} else {
|
||||
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Queue methods
|
||||
|
||||
/**
|
||||
@@ -294,6 +281,10 @@ static void *SBQueueContex = &SBQueueContex;
|
||||
[item addAction:[[SBQueueSetAction alloc] initWithPreset:self.options[SBQueueSet]]];
|
||||
}
|
||||
|
||||
if ([self.options[SBQueueOptimize] boolValue]) {
|
||||
[item addAction:[[SBQueueOptimizeAction alloc] init]];
|
||||
}
|
||||
|
||||
id type;
|
||||
[url getResourceValue:&type forKey:NSURLTypeIdentifierKey error:NULL];
|
||||
|
||||
|
||||
Reference in new issue
Block a user