This repository has been archived by the owner on Oct 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: 82Flex <[email protected]>
- Loading branch information
Showing
14 changed files
with
332 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# clang-format | ||
BasedOnStyle: LLVM | ||
IndentWidth: 4 | ||
AccessModifierOffset: -4 | ||
ContinuationIndentWidth: 4 | ||
ColumnLimit: 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
ARCHS := arm64 arm64e | ||
TARGET := iphone:clang:15.6:14.0 | ||
INSTALL_TARGET_PROCESSES := Preferences | ||
|
||
include $(THEOS)/makefiles/common.mk | ||
|
||
BUNDLE_NAME += TrollSpeedPrefs | ||
|
||
TrollSpeedPrefs_FILES += TSPrefsRootListController.m | ||
TrollSpeedPrefs_FRAMEWORKS += UIKit | ||
TrollSpeedPrefs_PRIVATE_FRAMEWORKS += Preferences | ||
TrollSpeedPrefs_INSTALL_PATH += /Library/PreferenceBundles | ||
TrollSpeedPrefs_CFLAGS += -fobjc-arc | ||
TrollSpeedPrefs_CFLAGS += -I../supports/ | ||
|
||
include $(THEOS_MAKE_PATH)/bundle.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?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>CFBundleDevelopmentRegion</key> | ||
<string>English</string> | ||
<key>CFBundleExecutable</key> | ||
<string>TrollSpeedPrefs</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>ch.xxtou.hudapp.prefs</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundlePackageType</key> | ||
<string>BNDL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0.0</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>1.0</string> | ||
<key>NSPrincipalClass</key> | ||
<string>TSPrefsRootListController</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
<?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>label</key> | ||
<string>Custom Font Size</string> | ||
</dict> | ||
<dict> | ||
<key>cell</key> | ||
<string>PSSwitchCell</string> | ||
<key>default</key> | ||
<false/> | ||
<key>defaults</key> | ||
<string>ch.xxtou.hudapp.prefs</string> | ||
<key>key</key> | ||
<string>usesCustomFontSize</string> | ||
<key>label</key> | ||
<string>Uses Custom Font Size</string> | ||
<key>PostNotification</key> | ||
<string>ch.xxtou.notification.hud.reload</string> | ||
</dict> | ||
<dict> | ||
<key>cell</key> | ||
<string>PSSliderCell</string> | ||
<key>default</key> | ||
<real>9</real> | ||
<key>defaults</key> | ||
<string>ch.xxtou.hudapp.prefs</string> | ||
<key>key</key> | ||
<string>realCustomFontSize</string> | ||
<key>label</key> | ||
<string>Custom Font Size</string> | ||
<key>max</key> | ||
<real>12</real> | ||
<key>min</key> | ||
<real>8</real> | ||
<key>showValue</key> | ||
<true/> | ||
<key>PostNotification</key> | ||
<string>ch.xxtou.notification.hud.reload</string> | ||
</dict> | ||
<dict> | ||
<key>cell</key> | ||
<string>PSGroupCell</string> | ||
<key>label</key> | ||
<string>Custom Offset</string> | ||
</dict> | ||
<dict> | ||
<key>cell</key> | ||
<string>PSSwitchCell</string> | ||
<key>default</key> | ||
<false/> | ||
<key>defaults</key> | ||
<string>ch.xxtou.hudapp.prefs</string> | ||
<key>key</key> | ||
<string>usesCustomOffset</string> | ||
<key>label</key> | ||
<string>Uses Custom Offset</string> | ||
<key>PostNotification</key> | ||
<string>ch.xxtou.notification.hud.reload</string> | ||
</dict> | ||
<dict> | ||
<key>cell</key> | ||
<string>PSSliderCell</string> | ||
<key>default</key> | ||
<real>0</real> | ||
<key>defaults</key> | ||
<string>ch.xxtou.hudapp.prefs</string> | ||
<key>key</key> | ||
<string>realCustomOffsetX</string> | ||
<key>label</key> | ||
<string>Custom Offset X</string> | ||
<key>max</key> | ||
<real>100</real> | ||
<key>min</key> | ||
<real>-100</real> | ||
<key>showValue</key> | ||
<true/> | ||
<key>PostNotification</key> | ||
<string>ch.xxtou.notification.hud.reload</string> | ||
</dict> | ||
<dict> | ||
<key>cell</key> | ||
<string>PSSliderCell</string> | ||
<key>default</key> | ||
<real>0</real> | ||
<key>defaults</key> | ||
<string>ch.xxtou.hudapp.prefs</string> | ||
<key>key</key> | ||
<string>realCustomOffsetY</string> | ||
<key>label</key> | ||
<string>Custom Offset Y</string> | ||
<key>max</key> | ||
<real>100</real> | ||
<key>min</key> | ||
<real>-100</real> | ||
<key>showValue</key> | ||
<true/> | ||
<key>PostNotification</key> | ||
<string>ch.xxtou.notification.hud.reload</string> | ||
</dict> | ||
<dict> | ||
<key>cell</key> | ||
<string>PSGroupCell</string> | ||
<key>label</key> | ||
<string></string> | ||
<key>footerText</key> | ||
<string>Made with ♥ by @Lessica and @jmpews</string> | ||
</dict> | ||
<dict> | ||
<key>cell</key> | ||
<string>PSButtonCell</string> | ||
<key>label</key> | ||
<string>Reset to Default</string> | ||
<key>action</key> | ||
<string>resetToDefaults:</string> | ||
<key>defaults</key> | ||
<string>ch.xxtou.hudapp.prefs</string> | ||
<key>PostNotification</key> | ||
<string>ch.xxtou.notification.hud.reload</string> | ||
</dict> | ||
</array> | ||
<key>title</key> | ||
<string>TrollSpeed</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
"Appearance" = "外观"; | ||
|
||
"Custom Font Size" = "自定义字体大小"; | ||
|
||
"Uses Custom Font Size" = "使用自定义字体大小"; | ||
|
||
"Custom Offset" = "自定义偏移位置"; | ||
|
||
"Uses Custom Offset" = "使用自定义偏移位置"; | ||
|
||
"Reset to Default" = "重置为默认值"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#import <Preferences/PSListController.h> | ||
|
||
@interface TSPrefsRootListController : PSListController | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <Preferences/PSSpecifier.h> | ||
|
||
#import <rootless.h> | ||
|
||
#import "TSPrefsRootListController.h" | ||
|
||
@implementation TSPrefsRootListController | ||
|
||
- (NSArray *)specifiers { | ||
if (!_specifiers) { | ||
_specifiers = [self loadSpecifiersFromPlistName:@"Root" target:self]; | ||
} | ||
return _specifiers; | ||
} | ||
|
||
- (id)readPreferenceValue:(PSSpecifier *)specifier { | ||
NSString *containerPath = | ||
[NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) firstObject]; | ||
NSString *path = [NSString | ||
stringWithFormat:ROOT_PATH_NS("%@/Preferences/%@.plist"), containerPath, specifier.properties[@"defaults"]]; | ||
NSMutableDictionary *settings = [NSMutableDictionary dictionary]; | ||
[settings addEntriesFromDictionary:[NSDictionary dictionaryWithContentsOfFile:path]]; | ||
return (settings[specifier.properties[@"key"]]) ?: specifier.properties[@"default"]; | ||
} | ||
|
||
- (void)setPreferenceValue:(id)value specifier:(PSSpecifier *)specifier { | ||
NSString *containerPath = | ||
[NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) firstObject]; | ||
NSString *path = [NSString | ||
stringWithFormat:ROOT_PATH_NS("%@/Preferences/%@.plist"), containerPath, specifier.properties[@"defaults"]]; | ||
NSMutableDictionary *settings = [NSMutableDictionary dictionary]; | ||
[settings addEntriesFromDictionary:[NSDictionary dictionaryWithContentsOfFile:path]]; | ||
[settings setObject:value forKey:specifier.properties[@"key"]]; | ||
[settings writeToFile:path atomically:YES]; | ||
CFStringRef notificationName = (__bridge CFStringRef)specifier.properties[@"PostNotification"]; | ||
if (notificationName) { | ||
CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), notificationName, NULL, NULL, | ||
YES); | ||
} | ||
} | ||
|
||
- (void)resetToDefaults:(PSSpecifier *)specifier { | ||
NSString *containerPath = | ||
[NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) firstObject]; | ||
NSString *path = [NSString | ||
stringWithFormat:ROOT_PATH_NS("%@/Preferences/%@.plist"), containerPath, specifier.properties[@"defaults"]]; | ||
NSMutableDictionary *settings = [NSMutableDictionary dictionary]; | ||
[settings writeToFile:path atomically:YES]; | ||
CFStringRef notificationName = (__bridge CFStringRef)specifier.properties[@"PostNotification"]; | ||
if (notificationName) { | ||
CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), notificationName, NULL, NULL, | ||
YES); | ||
} | ||
[self reloadSpecifiers]; | ||
} | ||
|
||
@end |
21 changes: 21 additions & 0 deletions
21
prefs/layout/Library/PreferenceLoader/Preferences/TrollSpeedPrefs.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?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>entry</key> | ||
<dict> | ||
<key>bundle</key> | ||
<string>TrollSpeedPrefs</string> | ||
<key>cell</key> | ||
<string>PSLinkCell</string> | ||
<key>detail</key> | ||
<string>TSPrefsRootListController</string> | ||
<key>icon</key> | ||
<string>icon.png</string> | ||
<key>isController</key> | ||
<true/> | ||
<key>label</key> | ||
<string>TrollSpeed</string> | ||
</dict> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters