1 /* HBPresetsManager.h $ 2 3 This file is part of the HandBrake source code. 4 Homepage: <http://handbrake.fr/>. 5 It may be used under the terms of the GNU General Public License. */ 6 7 #import <Foundation/Foundation.h> 8 9 NS_ASSUME_NONNULL_BEGIN 10 11 @class HBPreset; 12 13 /** 14 * Posted when a preset is changed/added/deleted. 15 */ 16 extern NSString *HBPresetsChangedNotification; 17 18 /** 19 * HBPresetManager 20 * Manages the load/save of presets to an in memory tree. 21 */ 22 @interface HBPresetsManager : NSObject 23 24 /** 25 * The root of the presets tree. 26 */ 27 @property (nonatomic, readonly) HBPreset *root; 28 29 /** 30 * defaultPreset and its index path in the tree 31 */ 32 @property (nonatomic, readwrite, strong) HBPreset *defaultPreset; 33 34 /** 35 * Returns a HBPresetManager with the presets loaded at the passed URL. 36 * 37 * @param url the URL of the presets file to load. 38 * 39 * @return the initialized presets manager. 40 */ 41 - (instancetype)initWithURL:(NSURL *)url; 42 43 /** 44 * Saves the presets to disk. 45 */ 46 - (BOOL)savePresets; 47 48 /** 49 * Adds a given preset to the manager. 50 * 51 * @param preset the preset dict. 52 */ 53 - (void)addPreset:(HBPreset *)preset; 54 55 /** 56 * Deletes the presets at the specified index path. 57 * 58 * @param idx the NSIndexPath of the preset to delete. 59 */ 60 - (void)deletePresetAtIndexPath:(NSIndexPath *)idx; 61 62 - (void)replacePresetAtIndexPath:(NSIndexPath *)idx withPreset:(HBPreset *)preset; 63 64 /** 65 * Returns the index path of the specified object. 66 * 67 * @param preset the preset. 68 * 69 * @return The index path whose corresponding value is equal to the preset. Returns nil if not found. 70 */ 71 - (nullable NSIndexPath *)indexPathOfPreset:(HBPreset *)preset; 72 73 /** 74 * Adds back the built in presets. 75 */ 76 - (void)generateBuiltInPresets; 77 78 @end 79 80 NS_ASSUME_NONNULL_END 81