summaryrefslogtreecommitdiffstats
path: root/macosx/HBController.m
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2015-10-20 18:55:08 +0200
committerDamiano Galassi <[email protected]>2015-10-20 18:55:08 +0200
commit7f50c27989a63e87d2f17c6495d29e136ccfd837 (patch)
tree280036131fa6d7dd1a11ef84a55c4dfad3e96aca /macosx/HBController.m
parentc32d5236135c6be0b4987fb74de511e3332d7396 (diff)
MacGui: added undo/redo support to the video, picture, filters, chapters and range parts of HBJob.
Diffstat (limited to 'macosx/HBController.m')
-rw-r--r--macosx/HBController.m25
1 files changed, 20 insertions, 5 deletions
diff --git a/macosx/HBController.m b/macosx/HBController.m
index 9b8a68883..d4baf40f6 100644
--- a/macosx/HBController.m
+++ b/macosx/HBController.m
@@ -563,9 +563,15 @@
{
[self removeJobObservers];
+ // Clear the undo manager
+ [_job.undo removeAllActions];
+ _job.undo = nil;
+
// Retain the new job
_job = job;
+ job.undo = self.window.undoManager;
+
// Set the jobs info to the view controllers
fPictureViewController.picture = job.picture;
fPictureViewController.filters = job.filters;
@@ -935,8 +941,9 @@
}
else
{
- self.job = [[HBJob alloc] initWithTitle:title andPreset:self.currentPreset];
- self.job.destURL = [self destURLForJob:self.job];
+ HBJob *job = [[HBJob alloc] initWithTitle:title andPreset:self.currentPreset];
+ job.destURL = [self destURLForJob:job];
+ self.job = job;
}
// If we are a stream type and a batch scan, grok the output file name from title->name upon title change
@@ -998,9 +1005,17 @@
{
// Deselect the currently selected Preset if there is one
[fPresetsView deselect];
- // Change UI to show "Custom" settings are being used
- self.job.presetName = NSLocalizedString(@"Custom", @"");
- [self updateFileName];
+
+ // Update the preset and file name only if we are not
+ // undoing or redoing, because if so it's already stored
+ // in the undo manager.
+ NSUndoManager *undo = self.window.undoManager;
+ if (!(undo.isUndoing || undo.isRedoing))
+ {
+ // Change UI to show "Custom" settings are being used
+ self.job.presetName = NSLocalizedString(@"Custom", @"");
+ [self updateFileName];
+ }
}
#pragma mark - Queue progress