]> git.saurik.com Git - winterboard.git/commitdiff
Move some settings under Advanced.
authorJay Freeman (saurik) <saurik@saurik.com>
Thu, 20 Oct 2011 23:58:47 +0000 (23:58 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 20 Oct 2011 23:58:47 +0000 (23:58 +0000)
Settings.mm
WinterBoardSettings.bundle/Advanced.plist [new file with mode: 0644]
WinterBoardSettings.bundle/WinterBoard.plist

index 59c35e505f5be04322e4d10b4fba2a94efbc3284..89231a0fe229e313c61390ee326b213f8bcc6ee7 100644 (file)
@@ -327,45 +327,43 @@ static NSString *_plist;
 @end
 /* }}} */
 
-@interface WBSettingsController: PSListController {
+@interface WBAdvancedController: PSListController {
 }
 
-- (id) initForContentSize:(CGSize)size;
-- (void) dealloc;
-- (void) suspend;
-- (void) navigationBarButtonClicked:(int)buttonIndex;
-- (void) viewWillRedisplay;
-- (void) pushController:(id)controller;
 - (id) specifiers;
 - (void) settingsChanged;
-- (NSString *) title;
-- (void) setPreferenceValue:(id)value specifier:(PSSpecifier *)spec;
-- (id) readPreferenceValue:(PSSpecifier *)spec;
 
 @end
 
-@implementation WBSettingsController
+@implementation WBAdvancedController
 
-+ (void) load {
-    void *libhide(dlopen("/usr/lib/hide.dylib", RTLD_LAZY));
-    IsIconHiddenDisplayId = reinterpret_cast<BOOL (*)(NSString *)>(dlsym(libhide, "IsIconHiddenDisplayId"));
-    HideIconViaDisplayId = reinterpret_cast<BOOL (*)(NSString *)>(dlsym(libhide, "HideIconViaDisplayId"));
-    UnHideIconViaDisplayId = reinterpret_cast<BOOL (*)(NSString *)>(dlsym(libhide, "UnHideIconViaDisplayId"));
+- (id) specifiers {
+    if (!_specifiers)
+        _specifiers = [[self loadSpecifiersFromPlistName:@"Advanced" target:self] retain];
+    return _specifiers;
 }
 
-- (id) initForContentSize:(CGSize)size {
-    if ((self = [super initForContentSize:size]) != nil) {
-        _plist = [[NSString stringWithFormat:@"%@/Library/Preferences/com.saurik.WinterBoard.plist", NSHomeDirectory()] retain];
-        _settings = [([NSMutableDictionary dictionaryWithContentsOfFile:_plist] ?: [NSMutableDictionary dictionary]) retain];
+- (void) settingsChanged {
+    settingsChanged = YES;
+}
 
-        [_settings setObject:[NSNumber numberWithBool:IsIconHiddenDisplayId(WinterBoardDisplayID)] forKey:@"IconHidden"];
-    } return self;
+- (void) setPreferenceValue:(id)value specifier:(PSSpecifier *)spec {
+    NSString *key([spec propertyForKey:@"key"]);
+    if ([[spec propertyForKey:@"negate"] boolValue])
+        value = [NSNumber numberWithBool:(![value boolValue])];
+    [_settings setValue:value forKey:key];
+    [self settingsChanged];
 }
 
-- (void) dealloc {
-    [_settings release];
-    [_plist release];
-    [super dealloc];
+- (id) readPreferenceValue:(PSSpecifier *)spec {
+    NSString *key([spec propertyForKey:@"key"]);
+    id defaultValue([spec propertyForKey:@"default"]);
+    id plistValue([_settings objectForKey:key]);
+    if (!plistValue)
+        return defaultValue;
+    if ([[spec propertyForKey:@"negate"] boolValue])
+        plistValue = [NSNumber numberWithBool:(![plistValue boolValue])];
+    return plistValue;
 }
 
 - (void) __optimizeThemes {
@@ -422,6 +420,49 @@ static NSString *_plist;
 
 }
 
+@end
+
+@interface WBSettingsController: PSListController {
+}
+
+- (id) initForContentSize:(CGSize)size;
+- (void) dealloc;
+- (void) suspend;
+- (void) navigationBarButtonClicked:(int)buttonIndex;
+- (void) viewWillRedisplay;
+- (void) pushController:(id)controller;
+- (id) specifiers;
+- (void) settingsChanged;
+- (NSString *) title;
+- (void) setPreferenceValue:(id)value specifier:(PSSpecifier *)spec;
+- (id) readPreferenceValue:(PSSpecifier *)spec;
+
+@end
+
+@implementation WBSettingsController
+
++ (void) load {
+    void *libhide(dlopen("/usr/lib/hide.dylib", RTLD_LAZY));
+    IsIconHiddenDisplayId = reinterpret_cast<BOOL (*)(NSString *)>(dlsym(libhide, "IsIconHiddenDisplayId"));
+    HideIconViaDisplayId = reinterpret_cast<BOOL (*)(NSString *)>(dlsym(libhide, "HideIconViaDisplayId"));
+    UnHideIconViaDisplayId = reinterpret_cast<BOOL (*)(NSString *)>(dlsym(libhide, "UnHideIconViaDisplayId"));
+}
+
+- (id) initForContentSize:(CGSize)size {
+    if ((self = [super initForContentSize:size]) != nil) {
+        _plist = [[NSString stringWithFormat:@"%@/Library/Preferences/com.saurik.WinterBoard.plist", NSHomeDirectory()] retain];
+        _settings = [([NSMutableDictionary dictionaryWithContentsOfFile:_plist] ?: [NSMutableDictionary dictionary]) retain];
+
+        [_settings setObject:[NSNumber numberWithBool:IsIconHiddenDisplayId(WinterBoardDisplayID)] forKey:@"IconHidden"];
+    } return self;
+}
+
+- (void) dealloc {
+    [_settings release];
+    [_plist release];
+    [super dealloc];
+}
+
 - (void) suspend {
     if (!settingsChanged)
         return;
diff --git a/WinterBoardSettings.bundle/Advanced.plist b/WinterBoardSettings.bundle/Advanced.plist
new file mode 100644 (file)
index 0000000..7ef162e
--- /dev/null
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>items</key>
+       <array>
+               <dict>
+                       <key>cell</key>
+                       <string>PSGroupCell</string>
+                       <key>footerText</key>
+                       <string>iPhone-optimize PNGs (for speed).</string>
+               </dict>
+               <dict>
+                       <key>action</key>
+                       <string>optimizeThemes</string>
+                       <key>cell</key>
+                       <string>PSButtonCell</string>
+                       <key>label</key>
+                       <string>Optimize Themes (v1.0)</string>
+               </dict>
+               <dict>
+                       <key>cell</key>
+                       <string>PSGroupCell</string>
+                       <key>isStaticText</key>
+                       <string>true</string>
+                       <key>requiredCapabilities</key>
+                       <array>
+                               <dict>
+                                       <key>wildcat</key>
+                                       <false/>
+                                       <key>voip</key>
+                                       <false/>
+                               </dict>
+                       </array>
+               </dict>
+               <dict>
+                       <key>cell</key>
+                       <string>PSTitleValueCell</string>
+                       <key>label</key>
+                       <string>iPhone-optimize PNGs (for speed).</string>
+                       <key>requiredCapabilities</key>
+                       <array>
+                               <dict>
+                                       <key>wildcat</key>
+                                       <false/>
+                                       <key>voip</key>
+                                       <false/>
+                               </dict>
+                       </array>
+               </dict>
+               <dict>
+                       <key>cell</key>
+                       <string>PSGroupCell</string>
+                       <key>footerText</key>
+                       <string>Dumps lots of information (including all filenames being themed) to syslog.</string>
+               </dict>
+               <dict>
+                       <key>cell</key>
+                       <string>PSSwitchCell</string>
+                       <key>default</key>
+                       <false/>
+                       <key>key</key>
+                       <string>Debug</string>
+                       <key>label</key>
+                       <string>Debug Logging</string>
+               </dict>
+               <dict>
+                       <key>cell</key>
+                       <string>PSGroupCell</string>
+                       <key>isStaticText</key>
+                       <string>true</string>
+                       <key>requiredCapabilities</key>
+                       <array>
+                               <dict>
+                                       <key>wildcat</key>
+                                       <false/>
+                                       <key>voip</key>
+                                       <false/>
+                               </dict>
+                       </array>
+               </dict>
+               <dict>
+                       <key>cell</key>
+                       <string>PSTitleValueCell</string>
+                       <key>label</key>
+                       <string>Dumps lots of information (including all filenames being themed) to syslog.</string>
+                       <key>requiredCapabilities</key>
+                       <array>
+                               <dict>
+                                       <key>wildcat</key>
+                                       <false/>
+                                       <key>voip</key>
+                                       <false/>
+                               </dict>
+                       </array>
+               </dict>
+               <dict>
+                       <key>cell</key>
+                       <string>PSGroupCell</string>
+                       <key>footerText</key>
+                       <string>All UIImages that are not themed will be saved as PNGs into /tmp/UIImages.</string>
+               </dict>
+               <dict>
+                       <key>cell</key>
+                       <string>PSSwitchCell</string>
+                       <key>default</key>
+                       <false/>
+                       <key>key</key>
+                       <string>RecordUI</string>
+                       <key>label</key>
+                       <string>Record UIImages</string>
+               </dict>
+               <dict>
+                       <key>cell</key>
+                       <string>PSGroupCell</string>
+                       <key>isStaticText</key>
+                       <string>true</string>
+                       <key>requiredCapabilities</key>
+                       <array>
+                               <dict>
+                                       <key>wildcat</key>
+                                       <false/>
+                                       <key>voip</key>
+                                       <false/>
+                               </dict>
+                       </array>
+               </dict>
+               <dict>
+                       <key>cell</key>
+                       <string>PSTitleValueCell</string>
+                       <key>label</key>
+                       <string>All UIImages that are not themed will be saved as PNGs into /tmp/UIImages.</string>
+                       <key>requiredCapabilities</key>
+                       <array>
+                               <dict>
+                                       <key>wildcat</key>
+                                       <false/>
+                                       <key>voip</key>
+                                       <false/>
+                               </dict>
+                       </array>
+               </dict>
+       </array>
+       <key>title</key>
+       <string>Advanced</string>
+</dict>
+</plist>
index 1dc55701c49f28109289fdbb12c9cb92ebedaceb..ae12724f5452da820df50fe43ee1ea4da9a926ac 100644 (file)
                        <key>cell</key>
                        <string>PSGroupCell</string>
                        <key>footerText</key>
-                       <string>iPhone-optimize PNGs (for speed).</string>
-               </dict>
-               <dict>
-                       <key>action</key>
-                       <string>optimizeThemes</string>
-                       <key>cell</key>
-                       <string>PSButtonCell</string>
-                       <key>label</key>
-                       <string>Optimize Themes (v1.0)</string>
-               </dict>
-               <dict>
-                       <key>cell</key>
-                       <string>PSGroupCell</string>
-                       <key>isStaticText</key>
-                       <string>true</string>
-                       <key>requiredCapabilities</key>
-                       <array>
-                               <dict>
-                                       <key>wildcat</key>
-                                       <false/>
-                                       <key>voip</key>
-                                       <false/>
-                               </dict>
-                       </array>
-               </dict>
-               <dict>
-                       <key>cell</key>
-                       <string>PSTitleValueCell</string>
-                       <key>label</key>
-                       <string>iPhone-optimize PNGs (for speed).</string>
-                       <key>requiredCapabilities</key>
-                       <array>
-                               <dict>
-                                       <key>wildcat</key>
-                                       <false/>
-                                       <key>voip</key>
-                                       <false/>
-                               </dict>
-                       </array>
-               </dict>
-               <dict>
-                       <key>cell</key>
-                       <string>PSGroupCell</string>
-                       <key>footerText</key>
-                       <string>Dumps lots of information (including all filenames being themed) to syslog.</string>
-               </dict>
-               <dict>
-                       <key>cell</key>
-                       <string>PSSwitchCell</string>
-                       <key>default</key>
-                       <false/>
-                       <key>key</key>
-                       <string>Debug</string>
-                       <key>label</key>
-                       <string>Debug Logging</string>
-               </dict>
-               <dict>
-                       <key>cell</key>
-                       <string>PSGroupCell</string>
-                       <key>isStaticText</key>
-                       <string>true</string>
-                       <key>requiredCapabilities</key>
-                       <array>
-                               <dict>
-                                       <key>wildcat</key>
-                                       <false/>
-                                       <key>voip</key>
-                                       <false/>
-                               </dict>
-                       </array>
-               </dict>
-               <dict>
-                       <key>cell</key>
-                       <string>PSTitleValueCell</string>
-                       <key>label</key>
-                       <string>Dumps lots of information (including all filenames being themed) to syslog.</string>
-                       <key>requiredCapabilities</key>
-                       <array>
-                               <dict>
-                                       <key>wildcat</key>
-                                       <false/>
-                                       <key>voip</key>
-                                       <false/>
-                               </dict>
-                       </array>
-               </dict>
-               <dict>
-                       <key>cell</key>
-                       <string>PSGroupCell</string>
-                       <key>footerText</key>
-                       <string>All UIImages that are not themed will be saved as PNGs into /tmp/UIImages.</string>
+                       <string>WinterBoard can also be found under the normal iOS Settings application.</string>
                </dict>
                <dict>
                        <key>cell</key>
                        <key>default</key>
                        <false/>
                        <key>key</key>
-                       <string>RecordUI</string>
+                       <string>IconHidden</string>
                        <key>label</key>
-                       <string>Record UIImages</string>
+                       <string>Hide WinterBoard</string>
                </dict>
                <dict>
                        <key>cell</key>
                        <key>cell</key>
                        <string>PSTitleValueCell</string>
                        <key>label</key>
-                       <string>All UIImages that are not themed will be saved as PNGs into /tmp/UIImages.</string>
+                       <string>WinterBoard can also be found under the normal iOS Settings application.</string>
                        <key>requiredCapabilities</key>
                        <array>
                                <dict>
                <dict>
                        <key>cell</key>
                        <string>PSGroupCell</string>
-                       <key>footerText</key>
-                       <string>WinterBoard can also be found under the normal iOS Settings application.</string>
-               </dict>
-               <dict>
-                       <key>cell</key>
-                       <string>PSSwitchCell</string>
-                       <key>default</key>
-                       <false/>
-                       <key>key</key>
-                       <string>IconHidden</string>
-                       <key>label</key>
-                       <string>Hide WinterBoard</string>
-               </dict>
-               <dict>
-                       <key>cell</key>
-                       <string>PSGroupCell</string>
-                       <key>isStaticText</key>
-                       <string>true</string>
-                       <key>requiredCapabilities</key>
-                       <array>
-                               <dict>
-                                       <key>wildcat</key>
-                                       <false/>
-                                       <key>voip</key>
-                                       <false/>
-                               </dict>
-                       </array>
                </dict>
                <dict>
                        <key>cell</key>
-                       <string>PSTitleValueCell</string>
+                       <string>PSLinkCell</string>
                        <key>label</key>
-                       <string>WinterBoard can also be found under the normal iOS Settings application.</string>
-                       <key>requiredCapabilities</key>
-                       <array>
-                               <dict>
-                                       <key>wildcat</key>
-                                       <false/>
-                                       <key>voip</key>
-                                       <false/>
-                               </dict>
-                       </array>
+                       <string>Advanced (For Themers)</string>
+                       <key>detail</key>
+                       <string>WBAdvancedController</string>
                </dict>
        </array>
        <key>title</key>