enhanced CustomOSC, allow users to rebase OSC in stream view
This commit is contained in:
+1
-2
@@ -29,8 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *chevronImageView;
|
||||
@property (weak, nonatomic) IBOutlet UIStackView *toolbarStackView;
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
+35
-1
@@ -31,6 +31,12 @@
|
||||
@synthesize chevronView;
|
||||
@synthesize chevronImageView;
|
||||
|
||||
|
||||
- (void) viewWillDisappear:(BOOL)animated{
|
||||
[super viewWillDisappear:animated];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"OscLayoutCloseNotification" object:self];
|
||||
}
|
||||
|
||||
- (void) viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
@@ -57,7 +63,7 @@
|
||||
[self.chevronView addGestureRecognizer:singleFingerTap];
|
||||
|
||||
self.layoutOSC = [[LayoutOnScreenControls alloc] initWithView:self.view controllerSup:nil streamConfig:nil oscLevel:OSCSegmentSelected];
|
||||
self.layoutOSC._level = 4;
|
||||
self.layoutOSC._level = OnScreenControlsCustom;
|
||||
[self.layoutOSC show]; // draw on screen controls
|
||||
|
||||
[self addInnerAnalogSticksToOuterAnalogLayers]; // allows inner and analog sticks to be dragged together around the screen together as one unit which is the expected behavior
|
||||
@@ -93,6 +99,7 @@
|
||||
}];
|
||||
}];
|
||||
});
|
||||
[self profileRefresh];
|
||||
}
|
||||
|
||||
|
||||
@@ -271,6 +278,33 @@
|
||||
[self presentViewController:inputNameAlertController animated:YES completion:nil];
|
||||
}
|
||||
|
||||
|
||||
/* Presents the view controller that lists all OSC profiles the user can choose from */
|
||||
- (void)profileRefresh{
|
||||
UIStoryboard *storyboard;
|
||||
BOOL isIPhone = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone);
|
||||
if (isIPhone) {
|
||||
storyboard = [UIStoryboard storyboardWithName:@"iPhone" bundle:nil];
|
||||
}
|
||||
else {
|
||||
storyboard = [UIStoryboard storyboardWithName:@"iPad" bundle:nil];
|
||||
}
|
||||
|
||||
OSCProfilesTableViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"OSCProfilesTableViewController"] ;
|
||||
|
||||
vc.didDismissOSCProfilesTVC = ^() { // a block that will be called when the modally presented 'OSCProfilesTableViewController' VC is dismissed. By the time the 'OSCProfilesTableViewController' VC is dismissed the user would have potentially selected a different OSC profile with a different layout and they want to see this layout on this 'LayoutOnScreenControlsViewController.' This block of code will load the profile and then hide/show and move each OSC button to their appropriate position
|
||||
[self.layoutOSC updateControls]; // creates and saves a 'Default' OSC profile or loads the one the user selected on the previous screen
|
||||
|
||||
[self addInnerAnalogSticksToOuterAnalogLayers];
|
||||
|
||||
[self.layoutOSC.layoutChanges removeAllObjects]; // since a new OSC profile is being loaded, this will remove all previous layout changes made from the array
|
||||
|
||||
[self OSCLayoutChanged]; // fades the 'Undo Button' out
|
||||
};
|
||||
[self presentViewController:vc animated:YES completion:nil];
|
||||
}
|
||||
|
||||
|
||||
/* Presents the view controller that lists all OSC profiles the user can choose from */
|
||||
- (IBAction) loadTapped:(id)sender {
|
||||
UIStoryboard *storyboard;
|
||||
|
||||
@@ -11,9 +11,7 @@
|
||||
@implementation ToolBarContainerView
|
||||
|
||||
- (BOOL) pointInside:(CGPoint)point withEvent:(UIEvent *)event {
|
||||
|
||||
for (UIView *view in self.subviews) {
|
||||
|
||||
if (!view.hidden && view.alpha > 0 &&
|
||||
view.userInteractionEnabled &&
|
||||
[view pointInside:[self convertPoint:point toView:view] withEvent:event])
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
@property (strong, nonatomic) IBOutlet UISegmentedControl *resolutionSelector;
|
||||
@property (strong, nonatomic) IBOutlet UIView *resolutionDisplayView;
|
||||
@property (strong, nonatomic) IBOutlet UISegmentedControl *touchModeSelector;
|
||||
@property (strong, nonatomic) IBOutlet UILabel *onscreenControllerLabel;
|
||||
@property (strong, nonatomic) IBOutlet UISegmentedControl *onscreenControlSelector;
|
||||
@property (strong, nonatomic) IBOutlet UISegmentedControl *optimizeSettingsSelector;
|
||||
@property (strong, nonatomic) IBOutlet UISegmentedControl *multiControllerSelector;
|
||||
@@ -43,7 +44,6 @@
|
||||
@property (strong, nonatomic) IBOutlet UILabel *mousePointerVelocityFactorUILabel;
|
||||
@property (strong, nonatomic) LayoutOnScreenControlsViewController *layoutOnScreenControlsVC;
|
||||
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunguarded-availability"
|
||||
|
||||
|
||||
@@ -288,10 +288,20 @@ BOOL isCustomResolution(CGSize res) {
|
||||
[self updateBitrateText];
|
||||
[self updateResolutionDisplayViewText];
|
||||
|
||||
[self.keyboardToggleFingerNumSlider setValue:(CGFloat)currentSettings.keyboardToggleFingers.intValue animated:YES]; // Load old setting. old setting was converted to uint16_t before saving.
|
||||
if (self.keyboardToggleFingerNumSlider.value > 10.5f) [self.keyboardToggleFingerNumLabel setText:[NSString stringWithFormat:@"Tap-Toggle Local Keyboard Disabled"]]; // Initiate label display. Allow higher required finger number to completely disable keyboard toggle
|
||||
else [self.keyboardToggleFingerNumLabel setText:[NSString stringWithFormat:@"To Toggle Local Keyboard: Tap %d Fingers", (uint16_t)self.keyboardToggleFingerNumSlider.value]]; // Initiate label display
|
||||
|
||||
if(currentSettings.touchMode.intValue == RELATIVE_TOUCH_MODE){
|
||||
[self.keyboardToggleFingerNumSlider setEnabled:[self.touchModeSelector selectedSegmentIndex] != RELATIVE_TOUCH_MODE];
|
||||
[self.keyboardToggleFingerNumSlider setValue:3.0];
|
||||
[self.keyboardToggleFingerNumLabel setText:[NSString stringWithFormat:@"To Toggle Local Keyboard: Tap %d Fingers", (uint16_t)self.keyboardToggleFingerNumSlider.value]];
|
||||
}
|
||||
else{
|
||||
[self.keyboardToggleFingerNumSlider setValue:(CGFloat)currentSettings.keyboardToggleFingers.intValue animated:YES]; // Load old setting. old setting was converted to uint16_t before saving.
|
||||
if (self.keyboardToggleFingerNumSlider.value > 10.5f) [self.keyboardToggleFingerNumLabel setText:[NSString stringWithFormat:@"Tap-Toggle Local Keyboard Disabled"]]; // Initiate label display. Allow higher required finger number to completely disable keyboard toggle
|
||||
else [self.keyboardToggleFingerNumLabel setText:[NSString stringWithFormat:@"To Toggle Local Keyboard: Tap %d Fingers", (uint16_t)self.keyboardToggleFingerNumSlider.value]]; // Initiate label display
|
||||
}
|
||||
[self.keyboardToggleFingerNumSlider addTarget:self action:@selector(keyboardToggleFingerNumSliderMoved) forControlEvents:(UIControlEventValueChanged)]; // Update label display when slider is being moved.
|
||||
|
||||
|
||||
[self.liftStreamViewForKeyboardSelector setSelectedSegmentIndex:currentSettings.liftStreamViewForKeyboard ? 1 : 0];// Load old setting
|
||||
[self.showKeyboardToolbarSelector setSelectedSegmentIndex:currentSettings.showKeyboardToolbar ? 1 : 0];// Load old setting
|
||||
[self.swipeExitScreenEdgeSelector setSelectedSegmentIndex:[self getSelectorIndexFromScreenEdge:(uint32_t)currentSettings.swipeExitScreenEdge.integerValue]]; // Load old setting
|
||||
@@ -299,16 +309,19 @@ BOOL isCustomResolution(CGSize res) {
|
||||
[self.swipeToExitDistanceUILabel setText:[NSString stringWithFormat:@"Swipe & Exit Distance: %.2f * screen-width", self.swipeToExitDistanceSlider.value]]; // Initiate label display
|
||||
[self.swipeToExitDistanceSlider addTarget:self action:@selector(swipeToExitDistanceSliderMoved) forControlEvents:(UIControlEventValueChanged)]; // Update label display when slider is being moved.
|
||||
|
||||
|
||||
[self.pointerVelocityModeDividerSlider setValue:currentSettings.pointerVelocityModeDivider.floatValue * 100 animated:YES]; // Load old setting.
|
||||
[self.pointerVelocityModeDividerUILabel setText:[NSString stringWithFormat:@"Touch Pointer Velocity: Scaled on %d%% of Right Screen", 100 - (uint8_t)self.pointerVelocityModeDividerSlider.value]]; // Initiate label display
|
||||
[self.pointerVelocityModeDividerSlider addTarget:self action:@selector(pointerVelocityModeDividerSliderMoved) forControlEvents:(UIControlEventValueChanged)]; // Update label display when slider is being moved.
|
||||
[self.pointerVelocityModeDividerSlider setEnabled: currentSettings.touchMode.intValue == NATIVE_TOUCH_MODE]; // pointer velocity scaling works only in native touch mode.
|
||||
|
||||
|
||||
[self.touchPointerVelocityFactorSlider setValue:currentSettings.touchPointerVelocityFactor.floatValue * 100 animated:YES]; // Load old setting.
|
||||
[self.touchPointerVelocityFactorUILabel setText:[NSString stringWithFormat:@"Touch Pointer Velocity: %d%%", (uint16_t)self.touchPointerVelocityFactorSlider.value]]; // Initiate label display
|
||||
[self.touchPointerVelocityFactorSlider addTarget:self action:@selector(touchPointerVelocityFactorSliderMoved) forControlEvents:(UIControlEventValueChanged)]; // Update label display when slider is being moved.
|
||||
[self.touchPointerVelocityFactorSlider setEnabled: currentSettings.touchMode.intValue == NATIVE_TOUCH_MODE]; // pointer velocity scaling works only in native touch mode.
|
||||
|
||||
|
||||
[self.mousePointerVelocityFactorSlider setValue:currentSettings.mousePointerVelocityFactor.floatValue * 100 animated:YES]; // Load old setting.
|
||||
[self.mousePointerVelocityFactorUILabel setText:[NSString stringWithFormat:@"Mouse Pointer Velocity: %d%%", (uint16_t)self.mousePointerVelocityFactorSlider.value]]; // Initiate label display
|
||||
[self.mousePointerVelocityFactorSlider addTarget:self action:@selector(mousePointerVelocityFactorSliderMoved) forControlEvents:(UIControlEventValueChanged)]; // Update label display when slider is being moved.
|
||||
@@ -329,45 +342,57 @@ BOOL isCustomResolution(CGSize res) {
|
||||
self.layoutOnScreenControlsVC = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"];
|
||||
self.layoutOnScreenControlsVC.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
}
|
||||
/*
|
||||
if(currentSettings.touchMode.intValue == RELATIVE_TOUCH_MODE && currentSettings.onscreenControls.intValue == 4){ // load old settings
|
||||
if (self.layoutOnScreenControlsVC.isBeingPresented == NO) {
|
||||
[self presentViewController:self.layoutOnScreenControlsVC animated:YES completion:nil];
|
||||
}
|
||||
}*/
|
||||
if(currentSettings.onscreenControls.intValue == OnScreenControlsCustom && currentSettings.touchMode.intValue == RELATIVE_TOUCH_MODE) {
|
||||
[self.onscreenControllerLabel setText:@"Tap 4 Fingers to Change OSC Layout in Stream View"];
|
||||
//if (self.layoutOnScreenControlsVC.isBeingPresented == NO)
|
||||
}
|
||||
else{
|
||||
[self.onscreenControllerLabel setText:@"On-Screen Controls"];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void)showCustomOSCTip {
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Rebase in Stream View"
|
||||
message:@"Tap 4 fingers to change on-screen controller layout in stream view ~"
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"Got it!"
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
// Continue execution after the alert is dismissed
|
||||
[self invokeOscLayout];
|
||||
NSLog(@"OK button tapped");
|
||||
}];
|
||||
[alertController addAction:okAction];
|
||||
[self presentViewController:alertController animated:YES completion:nil];
|
||||
}
|
||||
|
||||
|
||||
|
||||
- (void)onscreenControlChanged{
|
||||
|
||||
LayoutOnScreenControlsViewController *vc = [[LayoutOnScreenControlsViewController alloc] init];
|
||||
BOOL isIPhone = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone);
|
||||
if (isIPhone) {
|
||||
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPhone" bundle:nil];
|
||||
vc = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"];
|
||||
self.layoutOnScreenControlsVC = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"];
|
||||
}
|
||||
else {
|
||||
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPad" bundle:nil];
|
||||
vc = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"];
|
||||
vc.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
self.layoutOnScreenControlsVC = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"];
|
||||
self.layoutOnScreenControlsVC.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
}
|
||||
|
||||
switch ([self.onscreenControlSelector selectedSegmentIndex]) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
if (self.layoutOnScreenControlsVC.isBeingPresented == NO) {
|
||||
[self presentViewController:self.layoutOnScreenControlsVC animated:YES completion:nil];
|
||||
}
|
||||
break;
|
||||
}
|
||||
if([self.onscreenControlSelector selectedSegmentIndex] == OnScreenControlsCustom && [self.touchModeSelector selectedSegmentIndex] == RELATIVE_TOUCH_MODE) {
|
||||
[self.onscreenControllerLabel setText:@"Tap 4 Fingers to Change OSC Layout in Stream View"];
|
||||
[self showCustomOSCTip];
|
||||
//if (self.layoutOnScreenControlsVC.isBeingPresented == NO)
|
||||
}
|
||||
else{
|
||||
[self.onscreenControllerLabel setText:@"On-Screen Controls"];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void)invokeOscLayout{
|
||||
[self presentViewController:self.layoutOnScreenControlsVC animated:YES completion:nil];
|
||||
}
|
||||
|
||||
|
||||
@@ -409,6 +434,20 @@ BOOL isCustomResolution(CGSize res) {
|
||||
[self.pointerVelocityModeDividerSlider setEnabled:[self.touchModeSelector selectedSegmentIndex] == NATIVE_TOUCH_MODE]; // pointer velocity scaling works only in native touch mode.
|
||||
[self.touchPointerVelocityFactorSlider setEnabled:[self.touchModeSelector selectedSegmentIndex] == NATIVE_TOUCH_MODE]; // pointer velocity scaling works only in native touch mode.
|
||||
[self.mousePointerVelocityFactorSlider setEnabled:[self.touchModeSelector selectedSegmentIndex] == RELATIVE_TOUCH_MODE]; // mouse velocity scaling works only in relative touch mode.
|
||||
// number of touches required to toggle keyboard in relative touch mode will be fixed to 3.
|
||||
[self.keyboardToggleFingerNumSlider setEnabled:[self.touchModeSelector selectedSegmentIndex] != RELATIVE_TOUCH_MODE];
|
||||
if([self.touchModeSelector selectedSegmentIndex] == RELATIVE_TOUCH_MODE) {
|
||||
[self.keyboardToggleFingerNumSlider setValue:3.0];
|
||||
[self.keyboardToggleFingerNumLabel setText:[NSString stringWithFormat:@"To Toggle Local Keyboard: Tap %d Fingers", (uint16_t)self.keyboardToggleFingerNumSlider.value]];
|
||||
}
|
||||
|
||||
if([self.onscreenControlSelector selectedSegmentIndex] == OnScreenControlsCustom && [self.touchModeSelector selectedSegmentIndex] == RELATIVE_TOUCH_MODE) {
|
||||
[self.onscreenControllerLabel setText:@"Tap 4 Fingers to Change OSC Layout in Stream View"];
|
||||
//if (self.layoutOnScreenControlsVC.isBeingPresented == NO)
|
||||
}
|
||||
else{
|
||||
[self.onscreenControllerLabel setText:@"On-Screen Controls"];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) updateBitrate {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#import "Connection.h"
|
||||
#import "StreamConfiguration.h"
|
||||
#import "StreamView.h"
|
||||
#import "LayoutOnScreenControlsViewController.h"
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@@ -18,6 +19,7 @@
|
||||
@interface StreamFrameViewController : GCEventViewController <ConnectionCallbacks, ControllerSupportDelegate, UserInteractionDelegate, UIScrollViewDelegate>
|
||||
#else
|
||||
@interface StreamFrameViewController : UIViewController <ConnectionCallbacks, ControllerSupportDelegate, UserInteractionDelegate, UIScrollViewDelegate>
|
||||
|
||||
#endif
|
||||
@property (nonatomic) StreamConfiguration* streamConfig;
|
||||
|
||||
|
||||
@@ -12,12 +12,13 @@
|
||||
#import "StreamManager.h"
|
||||
#import "ControllerSupport.h"
|
||||
#import "DataManager.h"
|
||||
#import "CustomEdgeSwipeGestureRecognizer.h"
|
||||
#import "CustomTapGestureRecognizer.h"
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <Limelight.h>
|
||||
#import "CustomEdgeSwipeGestureRecognizer.h"
|
||||
|
||||
#if TARGET_OS_TV
|
||||
#import <AVFoundation/AVDisplayCriteria.h>
|
||||
@@ -53,6 +54,8 @@
|
||||
|
||||
#if !TARGET_OS_TV
|
||||
CustomEdgeSwipeGestureRecognizer *_exitSwipeRecognizer;
|
||||
CustomTapGestureRecognizer *_oscLayoutTapRecoginizer;
|
||||
LayoutOnScreenControlsViewController *_layoutOnScreenControlsVC;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -139,6 +142,30 @@
|
||||
_exitSwipeRecognizer.delaysTouchesEnded = NO;
|
||||
[self.view addGestureRecognizer:_exitSwipeRecognizer];
|
||||
|
||||
|
||||
if(_settings.touchMode.intValue == RELATIVE_TOUCH_MODE && _settings.onscreenControls.intValue == OnScreenControlsCustom){
|
||||
_oscLayoutTapRecoginizer = [[CustomTapGestureRecognizer alloc] initWithTarget:self action:@selector(layoutOSC)];
|
||||
_oscLayoutTapRecoginizer.numberOfTouchesRequired = 4; //tap 4 fingers to invoke OSC rebase
|
||||
_oscLayoutTapRecoginizer.tapDownTimeThreshold = 1;
|
||||
_oscLayoutTapRecoginizer.delaysTouchesBegan = NO;
|
||||
_oscLayoutTapRecoginizer.delaysTouchesEnded = NO;
|
||||
[self.view addGestureRecognizer:_oscLayoutTapRecoginizer];
|
||||
/* sets a reference to the correct 'LayoutOnScreenControlsViewController' depending on whether the user is on an iPhone or iPad */
|
||||
_layoutOnScreenControlsVC = [[LayoutOnScreenControlsViewController alloc] init];
|
||||
BOOL isIPhone = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone);
|
||||
if (isIPhone) {
|
||||
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPhone" bundle:nil];
|
||||
_layoutOnScreenControlsVC = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"];
|
||||
}
|
||||
else {
|
||||
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPad" bundle:nil];
|
||||
_layoutOnScreenControlsVC = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"];
|
||||
_layoutOnScreenControlsVC.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
}
|
||||
_layoutOnScreenControlsVC.view.backgroundColor = UIColor.clearColor;
|
||||
_layoutOnScreenControlsVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
_tipLabel = [[UILabel alloc] init];
|
||||
@@ -175,6 +202,11 @@
|
||||
selector: @selector(applicationDidEnterBackground:)
|
||||
name: UIApplicationDidEnterBackgroundNotification
|
||||
object: nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(oscLayoutClosed)
|
||||
name:@"OscLayoutCloseNotification"
|
||||
object:nil];
|
||||
|
||||
#if 0
|
||||
// FIXME: This doesn't work reliably on iPad for some reason. Showing and hiding the keyboard
|
||||
@@ -216,6 +248,19 @@
|
||||
[self.view addSubview:_tipLabel];
|
||||
}
|
||||
|
||||
- (void)layoutOSC{
|
||||
[self->_streamView disableOnScreenControls];
|
||||
[self presentViewController:_layoutOnScreenControlsVC animated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (void)oscLayoutClosed{
|
||||
// Handle the callback
|
||||
[self->_streamView reloadOnScreenControlsWith:(ControllerSupport*)_controllerSupport
|
||||
andConfig:(StreamConfiguration*)_streamConfig];
|
||||
[self->_streamView showOnScreenControls];
|
||||
}
|
||||
|
||||
|
||||
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
|
||||
return _streamView;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user