diff --git a/Limelight/Base.lproj/iPad.storyboard b/Limelight/Base.lproj/iPad.storyboard index 1d0166ac..e20076ca 100644 --- a/Limelight/Base.lproj/iPad.storyboard +++ b/Limelight/Base.lproj/iPad.storyboard @@ -2,6 +2,7 @@ + @@ -11,7 +12,7 @@ - + @@ -837,7 +838,7 @@ ICAgICAgICAgICAgICA - + @@ -861,7 +862,7 @@ ICAgICAgICAgICAgICA - + diff --git a/Limelight/Localization/Localizable.xcstrings b/Limelight/Localization/Localizable.xcstrings index c989f7df..647af838 100644 --- a/Limelight/Localization/Localizable.xcstrings +++ b/Limelight/Localization/Localizable.xcstrings @@ -237,6 +237,52 @@ } } }, + "Button Height" : { + "extractionState" : "manual", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "按键高度" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "按键高度" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "按键高度" + } + } + } + }, + "Button Size" : { + "extractionState" : "manual", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "按键大小" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "按键大小" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "按键大小" + } + } + } + }, "Cancel" : { "extractionState" : "manual", "localizations" : { diff --git a/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.h b/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.h index f20e68a3..5f7e5b29 100644 --- a/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.h +++ b/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.h @@ -37,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN @property (strong, nonatomic) OSCProfilesTableViewController *oscProfilesTableViewController; @property (nonatomic, assign) NSString *currentProfileName; @property (strong, nonatomic) IBOutlet UILabel *currentProfileLabel; -@property (strong, nonatomic) IBOutlet UISlider *buttonAndControllerWidthSlider; +@property (strong, nonatomic) IBOutlet UISlider *buttonAndControllerSizeSlider; @property (strong, nonatomic) IBOutlet UISlider *buttonAndControllerHeightSlider; @end diff --git a/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m b/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m index 11fd757c..5950e561 100644 --- a/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m +++ b/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m @@ -29,6 +29,9 @@ bool controllerLayerSelected; __weak IBOutlet NSLayoutConstraint *toolbarTopConstraintiPhone; __weak IBOutlet NSLayoutConstraint *toolbarTopConstraintiPad; + UILabel *buttonSizeSliderLabel; + UILabel *buttonHeightSliderLabel; + } @synthesize trashCanButton; @@ -369,7 +372,7 @@ self->controllerLayerSelected = false; self->selectedButtonView = buttonView; // setup slider values - [self.buttonAndControllerWidthSlider setValue:100 * self->selectedButtonView.widthFactor]; + [self.buttonAndControllerSizeSlider setValue:100 * self->selectedButtonView.widthFactor]; [self.buttonAndControllerHeightSlider setValue:100 * self->selectedButtonView.heightFactor]; } @@ -383,7 +386,7 @@ CGFloat sizeFactor = [OnScreenControls getControllerLayerSizeFactor:controllerLayer]; // calculated sizeFactor from loaded layer bounds. // setup slider values - [self.buttonAndControllerWidthSlider setValue:100 * sizeFactor]; + [self.buttonAndControllerSizeSlider setValue:100 * sizeFactor]; } @@ -392,12 +395,12 @@ if(self->selectedButtonView != nil && self->buttonViewSelected){ self->selectedButtonView.translatesAutoresizingMaskIntoConstraints = true; // this is mandatory to prevent unexpected key view location change // when adjusting width, the buttonView height will be syncronized - self->selectedButtonView.widthFactor = self->selectedButtonView.heightFactor = self.buttonAndControllerWidthSlider.value / 100; - [self.buttonAndControllerHeightSlider setValue: self.buttonAndControllerWidthSlider.value]; + self->selectedButtonView.widthFactor = self->selectedButtonView.heightFactor = self.buttonAndControllerSizeSlider.value / 100; + [self.buttonAndControllerHeightSlider setValue: self.buttonAndControllerSizeSlider.value]; [self->selectedButtonView resizeButtonView]; } if(self->selectedControllerLayer != nil && self->controllerLayerSelected){ - [self.layoutOSC resizeControllerLayerWith:self->selectedControllerLayer and:self.buttonAndControllerWidthSlider.value/100]; + [self.layoutOSC resizeControllerLayerWith:self->selectedControllerLayer and:self.buttonAndControllerSizeSlider.value/100]; return; CALayer* superLayer = self->selectedControllerLayer.superlayer; @@ -411,7 +414,7 @@ [self->selectedControllerLayer.name isEqualToString:@"xButton"] || [self->selectedControllerLayer.name isEqualToString:@"yButton"]){ [self->selectedControllerLayer removeFromSuperlayer]; - self->selectedControllerLayer.bounds = CGRectMake(0, 0, self.layoutOSC.standardRoundButtonBounds.size.width * self.buttonAndControllerWidthSlider.value/100, self.layoutOSC.standardRoundButtonBounds.size.height * self.buttonAndControllerWidthSlider.value/100); + self->selectedControllerLayer.bounds = CGRectMake(0, 0, self.layoutOSC.standardRoundButtonBounds.size.width * self.buttonAndControllerSizeSlider.value/100, self.layoutOSC.standardRoundButtonBounds.size.height * self.buttonAndControllerSizeSlider.value/100); [superLayer addSublayer:self->selectedControllerLayer]; } } @@ -435,14 +438,46 @@ [self.currentProfileLabel setText:[LocalizationHelper localizedStringForKey:@"Current Profile: %@",[profilesManager getSelectedProfile].name]]; // display current profile name when profile is being refreshed. // button size sliders - self.buttonAndControllerWidthSlider.hidden = NO; - self.buttonAndControllerWidthSlider.frame = CGRectMake(xPosition, self.buttonAndControllerWidthSlider.frame.origin.y, self.buttonAndControllerWidthSlider.frame.size.width, self.buttonAndControllerWidthSlider.frame.size.height); - [self.buttonAndControllerWidthSlider addTarget:self action:@selector(buttonAndControllerWidthSliderMoved) forControlEvents:(UIControlEventValueChanged)]; + self.buttonAndControllerSizeSlider.hidden = NO; + self.buttonAndControllerSizeSlider.frame = CGRectMake(xPosition, self.buttonAndControllerSizeSlider.frame.origin.y, self.buttonAndControllerSizeSlider.frame.size.width, self.buttonAndControllerSizeSlider.frame.size.height); + [self.buttonAndControllerSizeSlider addTarget:self action:@selector(buttonAndControllerWidthSliderMoved) forControlEvents:(UIControlEventValueChanged)]; + buttonSizeSliderLabel = [[UILabel alloc] init]; + buttonSizeSliderLabel.text = [LocalizationHelper localizedStringForKey:@"Button Size"]; + buttonSizeSliderLabel.font = [UIFont systemFontOfSize:23]; + buttonSizeSliderLabel.textColor = [UIColor whiteColor]; + buttonSizeSliderLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.2]; + buttonSizeSliderLabel.translatesAutoresizingMaskIntoConstraints = NO; // Disable autoresizing mask for Auto Layout + // Add slider and label to the view + [self.view addSubview:buttonSizeSliderLabel]; + // Use Auto Layout to position the label relative to the slider + [NSLayoutConstraint activateConstraints:@[ + // Position the label to the left of the slider + [buttonSizeSliderLabel.trailingAnchor constraintEqualToAnchor:self.buttonAndControllerSizeSlider.leadingAnchor constant:-10], + // Align vertically with the slider + [buttonSizeSliderLabel.centerYAnchor constraintEqualToAnchor:self.buttonAndControllerSizeSlider.centerYAnchor] + ]]; - // button size sliders + + // button height sliders self.buttonAndControllerHeightSlider.hidden = NO; self.buttonAndControllerHeightSlider.frame = CGRectMake(xPosition, self.buttonAndControllerHeightSlider.frame.origin.y, self.buttonAndControllerHeightSlider.frame.size.width, self.buttonAndControllerHeightSlider.frame.size.height); [self.buttonAndControllerHeightSlider addTarget:self action:@selector(buttonAndControllerHeightSliderMoved) forControlEvents:(UIControlEventValueChanged)]; + // button height label + buttonHeightSliderLabel = [[UILabel alloc] init]; + buttonHeightSliderLabel.text = [LocalizationHelper localizedStringForKey:@"Button Height"]; + buttonHeightSliderLabel.font = [UIFont systemFontOfSize:23]; + buttonHeightSliderLabel.textColor = [UIColor whiteColor]; + buttonHeightSliderLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.2]; + buttonHeightSliderLabel.translatesAutoresizingMaskIntoConstraints = NO; // Disable autoresizing mask for Auto Layout + // Add slider and label to the view + [self.view addSubview:buttonHeightSliderLabel]; + // Use Auto Layout to position the label relative to the slider + [NSLayoutConstraint activateConstraints:@[ + // Position the label to the left of the slider + [buttonHeightSliderLabel.trailingAnchor constraintEqualToAnchor:self.buttonAndControllerHeightSlider.leadingAnchor constant:-10], + // Align vertically with the slider + [buttonHeightSliderLabel.centerYAnchor constraintEqualToAnchor:self.buttonAndControllerHeightSlider.centerYAnchor] + ]]; } @@ -504,7 +539,8 @@ [self OSCLayoutChanged]; // fades the 'Undo Button' out }; self.currentProfileLabel.hidden = YES; // Hide Current Profile display before entering the profile table view - self.buttonAndControllerWidthSlider.hidden = YES; + self.buttonAndControllerSizeSlider.hidden = YES; + self.buttonAndControllerHeightSlider.hidden = YES; _oscProfilesTableViewController.currentOSCButtonLayers = self.layoutOSC.OSCButtonLayers; [self presentViewController:_oscProfilesTableViewController animated:YES completion:nil]; }