Add java arguments to the preferences window, also minor linting
This commit is contained in:
1 parent
de26a09e6f
commit
bc1b1e6cf4
3 files changed
+33
-15
No files matched your search
@@ -13,16 +13,14 @@
|
||||
|
||||
@implementation LauncherPreferencesViewController
|
||||
|
||||
UITextField* jargsTextField;
|
||||
UITextField* versionTextField;
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
|
||||
[self setNeedsUpdateOfScreenEdgesDeferringSystemGestures];
|
||||
[self setNeedsUpdateOfHomeIndicatorAutoHidden];
|
||||
|
||||
[self setTitle:@"Launcher preferences"];
|
||||
[self setTitle:@"Preferences"];
|
||||
|
||||
CGRect screenBounds = [[UIScreen mainScreen] bounds];
|
||||
CGFloat screenScale = [[UIScreen mainScreen] scale];
|
||||
@@ -62,9 +60,37 @@ UITextField* versionTextField;
|
||||
buttonSizeSlider.value = ((NSNumber *) getPreference(@"button_scale")).floatValue;
|
||||
[scrollView addSubview:buttonSizeSlider];
|
||||
|
||||
UILabel *jargsTextView = [[UILabel alloc] initWithFrame:CGRectMake(4.0, 54.0, 0.0, 0.0)];
|
||||
jargsTextView.text = @"Java arguments ";
|
||||
jargsTextView.numberOfLines = 0;
|
||||
[jargsTextView sizeToFit];
|
||||
[scrollView addSubview:jargsTextView];
|
||||
|
||||
jargsTextField = [[UITextField alloc] initWithFrame:CGRectMake(jargsTextView.bounds.size.width + 4.0, 54.0, width - jargsTextView.bounds.size.width - 8.0, height - 58.0)];
|
||||
[jargsTextField addTarget:versionTextField action:@selector(resignFirstResponder) forControlEvents:UIControlEventEditingDidEndOnExit];
|
||||
jargsTextField.tag = 100;
|
||||
jargsTextField.delegate = self;
|
||||
jargsTextField.placeholder = @"Specify arguments...";
|
||||
jargsTextField.text = (NSString *) getPreference(@"java_args");
|
||||
jargsTextField.contentVerticalAlignment = UIControlContentVerticalAlignmentTop;
|
||||
jargsTextField.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
|
||||
[scrollView addSubview:jargsTextField];
|
||||
|
||||
scrollView.contentSize = CGSizeMake(scrollView.frame.size.width, scrollView.frame.size.height + 200);
|
||||
}
|
||||
|
||||
- (void)textFieldDidEndEditing:(UITextField *)textField
|
||||
{
|
||||
if (textField.tag == 100) {
|
||||
setPreference(@"java_args", jargsTextField.text);
|
||||
UIAlertController *fullAlert = [UIAlertController alertControllerWithTitle:@"Restart the launcher" message:@"Changing Java arguments requires a restart of the launcher to take effect."preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:nil];
|
||||
[self presentViewController:fullAlert animated:YES completion:nil];
|
||||
[fullAlert addAction:ok];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void)sliderMoved:(DBNumberedSlider *)sender {
|
||||
switch (sender.tag) {
|
||||
case 1:
|
||||
@@ -76,14 +102,6 @@ UITextField* versionTextField;
|
||||
}
|
||||
}
|
||||
|
||||
- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures {
|
||||
return UIRectEdgeBottom;
|
||||
}
|
||||
|
||||
- (BOOL)prefersHomeIndicatorAutoHidden {
|
||||
return NO;
|
||||
}
|
||||
|
||||
-(void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
|
||||
if(@available(iOS 13.0, *)) {
|
||||
if (UITraitCollection.currentTraitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
|
||||
|
||||
@@ -81,7 +81,7 @@ int versionSelectedAt = 0;
|
||||
handler:^(__kindof UIAction * _Nonnull action) {[self enterModInstaller];}];
|
||||
UIAction *option2 = [UIAction actionWithTitle:@"Custom controls" image:nil identifier:nil
|
||||
handler:^(__kindof UIAction * _Nonnull action) {[self enterCustomControls];}];
|
||||
UIAction *option3 = [UIAction actionWithTitle:@"Settings" image:nil identifier:nil
|
||||
UIAction *option3 = [UIAction actionWithTitle:@"Preferences" image:nil identifier:nil
|
||||
handler:^(__kindof UIAction * _Nonnull action) {[self enterPreferences];}];
|
||||
UIMenu *menu = [UIMenu menuWithTitle:@"Options" image:nil identifier:nil
|
||||
options:UIMenuOptionsDisplayInline children:@[option1, option2, option3]];
|
||||
@@ -204,7 +204,7 @@ int versionSelectedAt = 0;
|
||||
handler:^(UIAlertAction * _Nonnull action) {[self enterModInstaller];}];
|
||||
UIAlertAction *option2 = [UIAlertAction actionWithTitle:@"Custom controls" style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * _Nonnull action) {[self enterCustomControls];}];
|
||||
UIAlertAction *option3 = [UIAlertAction actionWithTitle:@"Settings" style:UIAlertActionStyleDefault
|
||||
UIAlertAction *option3 = [UIAlertAction actionWithTitle:@"Preferences" style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * _Nonnull action) {[self enterPreferences];}];
|
||||
fullAlert.popoverPresentationController.barButtonItem = sender;
|
||||
[self presentViewController:fullAlert animated:YES completion:nil];
|
||||
|
||||
@@ -137,7 +137,7 @@ void loginAccountInput(UINavigationController *controller, int type, const char*
|
||||
}
|
||||
|
||||
- (void)accountType:(UIButton *)sender {
|
||||
UIAlertController *fullAlert = [UIAlertController alertControllerWithTitle:@"Let's get you signed in." message:@"What account do you use to log into Minecraft?"preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
UIAlertController *fullAlert = [UIAlertController alertControllerWithTitle:@"Let's get you signed in." message:@"What account do you use to log into Minecraft?"preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
UIAlertAction *mojang = [UIAlertAction actionWithTitle:@"Mojang account" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {[self loginUsername:TYPE_MOJANG];}];
|
||||
UIAlertAction *microsoft = [UIAlertAction actionWithTitle:@"Microsoft account" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {[self loginMicrosoft];}];
|
||||
UIAlertAction *offline = [UIAlertAction actionWithTitle:@"Local account" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {[self loginOffline:sender];}];
|
||||
|
||||
Reference in new issue
Block a user