From 024f98ea589529f42b26fa62fcb5913a6aee6a57 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Thu, 20 Oct 2011 23:58:47 +0000 Subject: [PATCH 1/1] Move some settings under Advanced. --- Settings.mm | 93 ++++++++---- WinterBoardSettings.bundle/Advanced.plist | 147 +++++++++++++++++++ WinterBoardSettings.bundle/WinterBoard.plist | 140 +----------------- 3 files changed, 222 insertions(+), 158 deletions(-) create mode 100644 WinterBoardSettings.bundle/Advanced.plist diff --git a/Settings.mm b/Settings.mm index 59c35e5..89231a0 100644 --- a/Settings.mm +++ b/Settings.mm @@ -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(dlsym(libhide, "IsIconHiddenDisplayId")); - HideIconViaDisplayId = reinterpret_cast(dlsym(libhide, "HideIconViaDisplayId")); - UnHideIconViaDisplayId = reinterpret_cast(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(dlsym(libhide, "IsIconHiddenDisplayId")); + HideIconViaDisplayId = reinterpret_cast(dlsym(libhide, "HideIconViaDisplayId")); + UnHideIconViaDisplayId = reinterpret_cast(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 index 0000000..7ef162e --- /dev/null +++ b/WinterBoardSettings.bundle/Advanced.plist @@ -0,0 +1,147 @@ + + + + + items + + + cell + PSGroupCell + footerText + iPhone-optimize PNGs (for speed). + + + action + optimizeThemes + cell + PSButtonCell + label + Optimize Themes (v1.0) + + + cell + PSGroupCell + isStaticText + true + requiredCapabilities + + + wildcat + + voip + + + + + + cell + PSTitleValueCell + label + iPhone-optimize PNGs (for speed). + requiredCapabilities + + + wildcat + + voip + + + + + + cell + PSGroupCell + footerText + Dumps lots of information (including all filenames being themed) to syslog. + + + cell + PSSwitchCell + default + + key + Debug + label + Debug Logging + + + cell + PSGroupCell + isStaticText + true + requiredCapabilities + + + wildcat + + voip + + + + + + cell + PSTitleValueCell + label + Dumps lots of information (including all filenames being themed) to syslog. + requiredCapabilities + + + wildcat + + voip + + + + + + cell + PSGroupCell + footerText + All UIImages that are not themed will be saved as PNGs into /tmp/UIImages. + + + cell + PSSwitchCell + default + + key + RecordUI + label + Record UIImages + + + cell + PSGroupCell + isStaticText + true + requiredCapabilities + + + wildcat + + voip + + + + + + cell + PSTitleValueCell + label + All UIImages that are not themed will be saved as PNGs into /tmp/UIImages. + requiredCapabilities + + + wildcat + + voip + + + + + + title + Advanced + + diff --git a/WinterBoardSettings.bundle/WinterBoard.plist b/WinterBoardSettings.bundle/WinterBoard.plist index 1dc5570..ae12724 100644 --- a/WinterBoardSettings.bundle/WinterBoard.plist +++ b/WinterBoardSettings.bundle/WinterBoard.plist @@ -100,97 +100,7 @@ cell PSGroupCell footerText - iPhone-optimize PNGs (for speed). - - - action - optimizeThemes - cell - PSButtonCell - label - Optimize Themes (v1.0) - - - cell - PSGroupCell - isStaticText - true - requiredCapabilities - - - wildcat - - voip - - - - - - cell - PSTitleValueCell - label - iPhone-optimize PNGs (for speed). - requiredCapabilities - - - wildcat - - voip - - - - - - cell - PSGroupCell - footerText - Dumps lots of information (including all filenames being themed) to syslog. - - - cell - PSSwitchCell - default - - key - Debug - label - Debug Logging - - - cell - PSGroupCell - isStaticText - true - requiredCapabilities - - - wildcat - - voip - - - - - - cell - PSTitleValueCell - label - Dumps lots of information (including all filenames being themed) to syslog. - requiredCapabilities - - - wildcat - - voip - - - - - - cell - PSGroupCell - footerText - All UIImages that are not themed will be saved as PNGs into /tmp/UIImages. + WinterBoard can also be found under the normal iOS Settings application. cell @@ -198,9 +108,9 @@ default key - RecordUI + IconHidden label - Record UIImages + Hide WinterBoard cell @@ -221,7 +131,7 @@ cell PSTitleValueCell label - All UIImages that are not themed will be saved as PNGs into /tmp/UIImages. + WinterBoard can also be found under the normal iOS Settings application. requiredCapabilities @@ -235,48 +145,14 @@ cell PSGroupCell - footerText - WinterBoard can also be found under the normal iOS Settings application. - - - cell - PSSwitchCell - default - - key - IconHidden - label - Hide WinterBoard - - - cell - PSGroupCell - isStaticText - true - requiredCapabilities - - - wildcat - - voip - - - cell - PSTitleValueCell + PSLinkCell label - WinterBoard can also be found under the normal iOS Settings application. - requiredCapabilities - - - wildcat - - voip - - - + Advanced (For Themers) + detail + WBAdvancedController title -- 2.45.2