summaryrefslogtreecommitdiffstats
path: root/macosx/HBPreset.h
diff options
context:
space:
mode:
authorritsuka <[email protected]>2015-05-14 19:37:49 +0000
committerritsuka <[email protected]>2015-05-14 19:37:49 +0000
commit2659b80cc0d4e078db19436f4f144b50525f2983 (patch)
tree54a8813f4a53c25e1630e6aa654c348e603f9ee8 /macosx/HBPreset.h
parent970688a142998ddf68cf1950436bb92e0385139c (diff)
MacGui: use libhb built-in presets and validation functions. Update the format and save the presets in UserPresets.json, the old presets are automatically imported if the new presets file is not found. The mac gui now requires 10.7 or later.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7181 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBPreset.h')
-rw-r--r--macosx/HBPreset.h65
1 files changed, 61 insertions, 4 deletions
diff --git a/macosx/HBPreset.h b/macosx/HBPreset.h
index a0a10e7f6..1b74bcd3a 100644
--- a/macosx/HBPreset.h
+++ b/macosx/HBPreset.h
@@ -4,9 +4,13 @@
Homepage: <http://handbrake.fr/>.
It may be used under the terms of the GNU General Public License. */
-#import <Cocoa/Cocoa.h>
+#import <Foundation/Foundation.h>
#import "HBTreeNode.h"
+typedef NS_ENUM(NSUInteger, HBPresetFormat) {
+ HBPresetFormatPlist,
+ HBPresetFormatJson,
+};
/**
* HBPreset
* Stores a preset dictionary.
@@ -15,14 +19,67 @@
*/
@interface HBPreset : HBTreeNode <NSCopying>
-- (instancetype)initWithName:(NSString *)title content:(NSDictionary *)content builtIn:(BOOL)builtIn;
- (instancetype)initWithFolderName:(NSString *)title builtIn:(BOOL)builtIn;
+- (instancetype)initWithName:(NSString *)title content:(NSDictionary *)content builtIn:(BOOL)builtIn;
+
+- (instancetype)initWithDictionary:(NSDictionary *)dict;
+
+/**
+ * Initializes a newly allocated preset object initialized with the data found at a given URL.
+ *
+ * @param url An URL that identifies a resource containing a string representation of a property list or json in the HandBrake preset format.
+ *
+ * @return An initialized preset—which might be different than the original receiver—that contains the preset at URL,
+ * or nil if there is an error or if the contents of the resource are not and HandBrake preset.
+ */
+- (instancetype)initWithContentsOfURL:(NSURL *)url;
+
+/**
+ * Writes a property list or json representation of the contents of the preset to a given URL.
+ *
+ * @param url The URL to which to write the preset.
+ * @param atomically A flag that specifies whether the output should be written atomically.
+ * @param format the format of the file to write.
+ * @param removeRoot whether the root preset should be written or not.
+ *
+ * @return YES if the location is written successfully, otherwise NO.
+ */
+- (BOOL)writeToURL:(NSURL *)url atomically:(BOOL)atomically format:(HBPresetFormat)format removeRoot:(BOOL)removeRoot;
+
+/**
+ * Removes unknown keys and normalizes values.
+ */
+- (void)cleanUp;
+
+/**
+ * The name of the preset.
+ */
@property (nonatomic, copy) NSString *name;
+
+/**
+ * A long textual description of the preset.
+ */
@property (nonatomic, copy) NSString *presetDescription;
-@property (nonatomic, strong) NSDictionary *content;
-@property (nonatomic) BOOL isDefault;
+/**
+ * Whether the preset is one of the HandBrake built-in ones or not.
+ */
@property (nonatomic, readonly) BOOL isBuiltIn;
+/**
+ * Whether the preset is the default one or not. Only one preset can be the default.
+ */
+@property (nonatomic) BOOL isDefault;
+
+/**
+ * The actual content of the preset.
+ */
+@property (nonatomic, strong) NSDictionary *content;
+
+/**
+ * A dictionary representation of the preset.
+ */
+@property (readonly, copy) NSDictionary *dictionary;
+
@end