enhanced CustomOSC, allow users to rebase OSC in stream view

This commit is contained in:
True Zhuanjia committed 2024-06-26 03:16:41 +08:00
1 parent 46770f4588
commit b79a762ce1
12 files changed
+181 -48

No files matched your search

+3
View File
@@ -28,6 +28,9 @@
interactionDelegate:(id<UserInteractionDelegate>)interactionDelegate interactionDelegate:(id<UserInteractionDelegate>)interactionDelegate
config:(StreamConfiguration*)streamConfig; config:(StreamConfiguration*)streamConfig;
- (void) showOnScreenControls; - (void) showOnScreenControls;
- (void) disableOnScreenControls;
- (void) reloadOnScreenControlsWith:(ControllerSupport*)controllerSupport
andConfig:(StreamConfiguration*)streamConfig;
- (CGSize) getVideoAreaSize; - (CGSize) getVideoAreaSize;
- (CGPoint) adjustCoordinatesForVideoArea:(CGPoint)point; - (CGPoint) adjustCoordinatesForVideoArea:(CGPoint)point;
- (uint16_t)getRotationFromAzimuthAngle:(float)azimuthAngle; - (uint16_t)getRotationFromAzimuthAngle:(float)azimuthAngle;
+14 -2
View File
@@ -74,7 +74,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
isInputingText = false; isInputingText = false;
keyboardToggleRecognizer = [[CustomTapGestureRecognizer alloc] initWithTarget:self action:@selector(toggleKeyboard)]; keyboardToggleRecognizer = [[CustomTapGestureRecognizer alloc] initWithTarget:self action:@selector(toggleKeyboard)];
keyboardToggleRecognizer.numberOfTouchesRequired = settings.keyboardToggleFingers.intValue; keyboardToggleRecognizer.numberOfTouchesRequired = settings.keyboardToggleFingers.intValue; //will be changed accordinly by touch modes.
keyboardToggleRecognizer.tapDownTimeThreshold = 0.3; // tap down time threshold in seconds. keyboardToggleRecognizer.tapDownTimeThreshold = 0.3; // tap down time threshold in seconds.
keyboardToggleRecognizer.delaysTouchesBegan = NO; keyboardToggleRecognizer.delaysTouchesBegan = NO;
keyboardToggleRecognizer.delaysTouchesEnded = NO; keyboardToggleRecognizer.delaysTouchesEnded = NO;
@@ -101,7 +101,8 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
self->touchHandler = [[NativeTouchHandler alloc] initWithView:self andSettings:settings];break; self->touchHandler = [[NativeTouchHandler alloc] initWithView:self andSettings:settings];break;
case RELATIVE_TOUCH_MODE: case RELATIVE_TOUCH_MODE:
self->touchHandler = [[RelativeTouchHandler alloc] initWithView:self andSettings:settings]; self->touchHandler = [[RelativeTouchHandler alloc] initWithView:self andSettings:settings];
keyboardToggleRecognizer.immediateTriggering = true; //triggers signal in touchesBegan callback stage keyboardToggleRecognizer.immediateTriggering = false;
keyboardToggleRecognizer.numberOfTouchesRequired = 3; //fixing keyboard taps to 3, in order to invoke OSC rebase in stream view by 4-finger tap.
break; break;
case ABSOLUTE_TOUCH_MODE: case ABSOLUTE_TOUCH_MODE:
self->touchHandler = [[AbsoluteTouchHandler alloc] initWithView:self]; self->touchHandler = [[AbsoluteTouchHandler alloc] initWithView:self];
@@ -269,6 +270,17 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
[onScreenControls show]; [onScreenControls show];
#endif #endif
} }
- (void) disableOnScreenControls {
#if !TARGET_OS_TV
[onScreenControls setLevel:OnScreenControlsLevelOff];
#endif
}
- (void) reloadOnScreenControlsWith:(ControllerSupport*)controllerSupport
andConfig:(StreamConfiguration*)streamConfig {
onScreenControls = [[OnScreenControls alloc] initWithView:self controllerSup:controllerSupport streamConfig:streamConfig];
[onScreenControls setLevel:OnScreenControlsCustom];
}
- (OnScreenControlsLevel) getCurrentOscState { - (OnScreenControlsLevel) getCurrentOscState {
if (onScreenControls == nil) { if (onScreenControls == nil) {
@@ -29,8 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (weak, nonatomic) IBOutlet UIImageView *chevronImageView; @property (weak, nonatomic) IBOutlet UIImageView *chevronImageView;
@property (weak, nonatomic) IBOutlet UIStackView *toolbarStackView; @property (weak, nonatomic) IBOutlet UIStackView *toolbarStackView;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
@@ -31,6 +31,12 @@
@synthesize chevronView; @synthesize chevronView;
@synthesize chevronImageView; @synthesize chevronImageView;
- (void) viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[[NSNotificationCenter defaultCenter] postNotificationName:@"OscLayoutCloseNotification" object:self];
}
- (void) viewDidLoad { - (void) viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
@@ -57,7 +63,7 @@
[self.chevronView addGestureRecognizer:singleFingerTap]; [self.chevronView addGestureRecognizer:singleFingerTap];
self.layoutOSC = [[LayoutOnScreenControls alloc] initWithView:self.view controllerSup:nil streamConfig:nil oscLevel:OSCSegmentSelected]; 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.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 [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]; [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 */ /* Presents the view controller that lists all OSC profiles the user can choose from */
- (IBAction) loadTapped:(id)sender { - (IBAction) loadTapped:(id)sender {
UIStoryboard *storyboard; UIStoryboard *storyboard;
@@ -11,9 +11,7 @@
@implementation ToolBarContainerView @implementation ToolBarContainerView
- (BOOL) pointInside:(CGPoint)point withEvent:(UIEvent *)event { - (BOOL) pointInside:(CGPoint)point withEvent:(UIEvent *)event {
for (UIView *view in self.subviews) { for (UIView *view in self.subviews) {
if (!view.hidden && view.alpha > 0 && if (!view.hidden && view.alpha > 0 &&
view.userInteractionEnabled && view.userInteractionEnabled &&
[view pointInside:[self convertPoint:point toView:view] withEvent:event]) [view pointInside:[self convertPoint:point toView:view] withEvent:event])
@@ -17,6 +17,7 @@
@property (strong, nonatomic) IBOutlet UISegmentedControl *resolutionSelector; @property (strong, nonatomic) IBOutlet UISegmentedControl *resolutionSelector;
@property (strong, nonatomic) IBOutlet UIView *resolutionDisplayView; @property (strong, nonatomic) IBOutlet UIView *resolutionDisplayView;
@property (strong, nonatomic) IBOutlet UISegmentedControl *touchModeSelector; @property (strong, nonatomic) IBOutlet UISegmentedControl *touchModeSelector;
@property (strong, nonatomic) IBOutlet UILabel *onscreenControllerLabel;
@property (strong, nonatomic) IBOutlet UISegmentedControl *onscreenControlSelector; @property (strong, nonatomic) IBOutlet UISegmentedControl *onscreenControlSelector;
@property (strong, nonatomic) IBOutlet UISegmentedControl *optimizeSettingsSelector; @property (strong, nonatomic) IBOutlet UISegmentedControl *optimizeSettingsSelector;
@property (strong, nonatomic) IBOutlet UISegmentedControl *multiControllerSelector; @property (strong, nonatomic) IBOutlet UISegmentedControl *multiControllerSelector;
@@ -43,7 +44,6 @@
@property (strong, nonatomic) IBOutlet UILabel *mousePointerVelocityFactorUILabel; @property (strong, nonatomic) IBOutlet UILabel *mousePointerVelocityFactorUILabel;
@property (strong, nonatomic) LayoutOnScreenControlsViewController *layoutOnScreenControlsVC; @property (strong, nonatomic) LayoutOnScreenControlsViewController *layoutOnScreenControlsVC;
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunguarded-availability" #pragma clang diagnostic ignored "-Wunguarded-availability"
@@ -288,10 +288,20 @@ BOOL isCustomResolution(CGSize res) {
[self updateBitrateText]; [self updateBitrateText];
[self updateResolutionDisplayViewText]; [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 if(currentSettings.touchMode.intValue == RELATIVE_TOUCH_MODE){
else [self.keyboardToggleFingerNumLabel setText:[NSString stringWithFormat:@"To Toggle Local Keyboard: Tap %d Fingers", (uint16_t)self.keyboardToggleFingerNumSlider.value]]; // Initiate label display [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.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.liftStreamViewForKeyboardSelector setSelectedSegmentIndex:currentSettings.liftStreamViewForKeyboard ? 1 : 0];// Load old setting
[self.showKeyboardToolbarSelector setSelectedSegmentIndex:currentSettings.showKeyboardToolbar ? 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 [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.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.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.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.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 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.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.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.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 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.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.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.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. [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 = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"];
self.layoutOnScreenControlsVC.modalPresentationStyle = UIModalPresentationFullScreen; self.layoutOnScreenControlsVC.modalPresentationStyle = UIModalPresentationFullScreen;
} }
/* if(currentSettings.onscreenControls.intValue == OnScreenControlsCustom && currentSettings.touchMode.intValue == RELATIVE_TOUCH_MODE) {
if(currentSettings.touchMode.intValue == RELATIVE_TOUCH_MODE && currentSettings.onscreenControls.intValue == 4){ // load old settings [self.onscreenControllerLabel setText:@"Tap 4 Fingers to Change OSC Layout in Stream View"];
if (self.layoutOnScreenControlsVC.isBeingPresented == NO) { //if (self.layoutOnScreenControlsVC.isBeingPresented == NO)
[self presentViewController:self.layoutOnScreenControlsVC animated:YES completion:nil]; }
} else{
}*/ [self.onscreenControllerLabel setText:@"On-Screen Controls"];
}
} }
- (void)onscreenControlChanged{
LayoutOnScreenControlsViewController *vc = [[LayoutOnScreenControlsViewController alloc] init]; - (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{
BOOL isIPhone = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone); BOOL isIPhone = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone);
if (isIPhone) { if (isIPhone) {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPhone" bundle:nil]; UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPhone" bundle:nil];
vc = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"]; self.layoutOnScreenControlsVC = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"];
} }
else { else {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPad" bundle:nil]; UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPad" bundle:nil];
vc = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"]; self.layoutOnScreenControlsVC = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"];
vc.modalPresentationStyle = UIModalPresentationFullScreen; self.layoutOnScreenControlsVC.modalPresentationStyle = UIModalPresentationFullScreen;
} }
switch ([self.onscreenControlSelector selectedSegmentIndex]) { if([self.onscreenControlSelector selectedSegmentIndex] == OnScreenControlsCustom && [self.touchModeSelector selectedSegmentIndex] == RELATIVE_TOUCH_MODE) {
case 0: [self.onscreenControllerLabel setText:@"Tap 4 Fingers to Change OSC Layout in Stream View"];
break; [self showCustomOSCTip];
case 1: //if (self.layoutOnScreenControlsVC.isBeingPresented == NO)
break; }
case 2: else{
break; [self.onscreenControllerLabel setText:@"On-Screen Controls"];
case 3: }
break; }
case 4:
if (self.layoutOnScreenControlsVC.isBeingPresented == NO) {
[self presentViewController:self.layoutOnScreenControlsVC animated:YES completion:nil];
}
break;
}
- (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.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.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. [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 { - (void) updateBitrate {
@@ -9,6 +9,7 @@
#import "Connection.h" #import "Connection.h"
#import "StreamConfiguration.h" #import "StreamConfiguration.h"
#import "StreamView.h" #import "StreamView.h"
#import "LayoutOnScreenControlsViewController.h"
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@@ -18,6 +19,7 @@
@interface StreamFrameViewController : GCEventViewController <ConnectionCallbacks, ControllerSupportDelegate, UserInteractionDelegate, UIScrollViewDelegate> @interface StreamFrameViewController : GCEventViewController <ConnectionCallbacks, ControllerSupportDelegate, UserInteractionDelegate, UIScrollViewDelegate>
#else #else
@interface StreamFrameViewController : UIViewController <ConnectionCallbacks, ControllerSupportDelegate, UserInteractionDelegate, UIScrollViewDelegate> @interface StreamFrameViewController : UIViewController <ConnectionCallbacks, ControllerSupportDelegate, UserInteractionDelegate, UIScrollViewDelegate>
#endif #endif
@property (nonatomic) StreamConfiguration* streamConfig; @property (nonatomic) StreamConfiguration* streamConfig;
@@ -12,12 +12,13 @@
#import "StreamManager.h" #import "StreamManager.h"
#import "ControllerSupport.h" #import "ControllerSupport.h"
#import "DataManager.h" #import "DataManager.h"
#import "CustomEdgeSwipeGestureRecognizer.h"
#import "CustomTapGestureRecognizer.h"
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <Limelight.h> #include <Limelight.h>
#import "CustomEdgeSwipeGestureRecognizer.h"
#if TARGET_OS_TV #if TARGET_OS_TV
#import <AVFoundation/AVDisplayCriteria.h> #import <AVFoundation/AVDisplayCriteria.h>
@@ -53,6 +54,8 @@
#if !TARGET_OS_TV #if !TARGET_OS_TV
CustomEdgeSwipeGestureRecognizer *_exitSwipeRecognizer; CustomEdgeSwipeGestureRecognizer *_exitSwipeRecognizer;
CustomTapGestureRecognizer *_oscLayoutTapRecoginizer;
LayoutOnScreenControlsViewController *_layoutOnScreenControlsVC;
#endif #endif
} }
@@ -139,6 +142,30 @@
_exitSwipeRecognizer.delaysTouchesEnded = NO; _exitSwipeRecognizer.delaysTouchesEnded = NO;
[self.view addGestureRecognizer:_exitSwipeRecognizer]; [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 #endif
_tipLabel = [[UILabel alloc] init]; _tipLabel = [[UILabel alloc] init];
@@ -176,6 +203,11 @@
name: UIApplicationDidEnterBackgroundNotification name: UIApplicationDidEnterBackgroundNotification
object: nil]; object: nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(oscLayoutClosed)
name:@"OscLayoutCloseNotification"
object:nil];
#if 0 #if 0
// FIXME: This doesn't work reliably on iPad for some reason. Showing and hiding the keyboard // FIXME: This doesn't work reliably on iPad for some reason. Showing and hiding the keyboard
// several times in a row will not correctly restore the state of the UIScrollView. // several times in a row will not correctly restore the state of the UIScrollView.
@@ -216,6 +248,19 @@
[self.view addSubview:_tipLabel]; [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 { - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
return _streamView; return _streamView;
} }
+5 -7
View File
@@ -198,8 +198,8 @@
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="selectedSegmentTintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="selectedSegmentTintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</segmentedControl> </segmentedControl>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="On-Screen Controls" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LGV-5y-piG"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="On-Screen Controls " lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LGV-5y-piG">
<rect key="frame" x="16" y="532" width="153" height="21"/> <rect key="frame" x="16" y="532" width="452" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="tintColor" red="0.81533776120000001" green="0.85979419950000002" blue="0.91372549020000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="tintColor" red="0.81533776120000001" green="0.85979419950000002" blue="0.91372549020000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/> <fontDescription key="fontDescription" type="system" pointSize="17"/>
@@ -458,6 +458,7 @@ ICAgICAgICAgICAgICA
<outlet property="mousePointerVelocityFactorUILabel" destination="oPM-G6-u5O" id="Eco-5u-PRR"/> <outlet property="mousePointerVelocityFactorUILabel" destination="oPM-G6-u5O" id="Eco-5u-PRR"/>
<outlet property="multiControllerSelector" destination="KlC-fG-wEi" id="giM-F7-So5"/> <outlet property="multiControllerSelector" destination="KlC-fG-wEi" id="giM-F7-So5"/>
<outlet property="onscreenControlSelector" destination="qSU-wh-tqA" id="j8d-fB-Z2c"/> <outlet property="onscreenControlSelector" destination="qSU-wh-tqA" id="j8d-fB-Z2c"/>
<outlet property="onscreenControllerLabel" destination="LGV-5y-piG" id="GsV-fS-lX9"/>
<outlet property="optimizeSettingsSelector" destination="nCO-OT-dV1" id="FB0-Rt-C44"/> <outlet property="optimizeSettingsSelector" destination="nCO-OT-dV1" id="FB0-Rt-C44"/>
<outlet property="pointerVelocityModeDividerSlider" destination="AcZ-2i-GI4" id="dGf-ZU-w3S"/> <outlet property="pointerVelocityModeDividerSlider" destination="AcZ-2i-GI4" id="dGf-ZU-w3S"/>
<outlet property="pointerVelocityModeDividerUILabel" destination="DkI-w6-jku" id="edY-gX-2Cw"/> <outlet property="pointerVelocityModeDividerUILabel" destination="DkI-w6-jku" id="edY-gX-2Cw"/>
@@ -576,7 +577,7 @@ ICAgICAgICAgICAgICA
<viewControllerLayoutGuide type="top" id="O1f-cu-KVo"/> <viewControllerLayoutGuide type="top" id="O1f-cu-KVo"/>
<viewControllerLayoutGuide type="bottom" id="eaS-aj-VtA"/> <viewControllerLayoutGuide type="bottom" id="eaS-aj-VtA"/>
</layoutGuides> </layoutGuides>
<view key="view" contentMode="scaleToFill" id="Acw-S4-f8a"> <view key="view" opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="Acw-S4-f8a">
<rect key="frame" x="0.0" y="0.0" width="834" height="1194"/> <rect key="frame" x="0.0" y="0.0" width="834" height="1194"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
@@ -692,7 +693,7 @@ ICAgICAgICAgICAgICA
</connections> </connections>
</button> </button>
</subviews> </subviews>
<color key="backgroundColor" systemColor="systemGrayColor"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints> <constraints>
<constraint firstAttribute="trailing" secondItem="fZU-G0-fgM" secondAttribute="trailing" id="6wU-vF-mZw"/> <constraint firstAttribute="trailing" secondItem="fZU-G0-fgM" secondAttribute="trailing" id="6wU-vF-mZw"/>
<constraint firstItem="fZU-G0-fgM" firstAttribute="leading" secondItem="Acw-S4-f8a" secondAttribute="leading" id="DVc-cD-qO0"/> <constraint firstItem="fZU-G0-fgM" firstAttribute="leading" secondItem="Acw-S4-f8a" secondAttribute="leading" id="DVc-cD-qO0"/>
@@ -781,9 +782,6 @@ ICAgICAgICAgICAgICA
<systemColor name="systemBackgroundColor"> <systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor> </systemColor>
<systemColor name="systemGrayColor">
<color red="0.5568627451" green="0.5568627451" blue="0.57647058819999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="viewFlipsideBackgroundColor"> <systemColor name="viewFlipsideBackgroundColor">
<color red="0.12156862745098039" green="0.12941176470588237" blue="0.14117647058823529" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.12156862745098039" green="0.12941176470588237" blue="0.14117647058823529" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor> </systemColor>
+3 -2
View File
@@ -217,8 +217,8 @@ ICAgICAgICAgICAgIA
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</slider> </slider>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="On-Screen Controls" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HZT-dd-DuQ"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="On-Screen Controls " lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HZT-dd-DuQ">
<rect key="frame" x="19" y="861" width="208" height="21"/> <rect key="frame" x="19" y="861" width="431" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/> <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<color key="textColor" red="0.9513210654258728" green="0.97490358352661133" blue="0.99987185001373291" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="textColor" red="0.9513210654258728" green="0.97490358352661133" blue="0.99987185001373291" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -477,6 +477,7 @@ ICAgICAgICAgICAgIA
<outlet property="mousePointerVelocityFactorUILabel" destination="ecG-dC-PT1" id="MCr-m1-WHm"/> <outlet property="mousePointerVelocityFactorUILabel" destination="ecG-dC-PT1" id="MCr-m1-WHm"/>
<outlet property="multiControllerSelector" destination="OCT-oL-Dqb" id="bLT-gB-FcH"/> <outlet property="multiControllerSelector" destination="OCT-oL-Dqb" id="bLT-gB-FcH"/>
<outlet property="onscreenControlSelector" destination="WGf-9d-eAm" id="hob-se-4Sn"/> <outlet property="onscreenControlSelector" destination="WGf-9d-eAm" id="hob-se-4Sn"/>
<outlet property="onscreenControllerLabel" destination="HZT-dd-DuQ" id="xyM-q6-IAK"/>
<outlet property="optimizeSettingsSelector" destination="Gob-Lu-b1y" id="9Wl-yp-0Ou"/> <outlet property="optimizeSettingsSelector" destination="Gob-Lu-b1y" id="9Wl-yp-0Ou"/>
<outlet property="pointerVelocityModeDividerSlider" destination="xet-C9-l5y" id="GnQ-xU-e0N"/> <outlet property="pointerVelocityModeDividerSlider" destination="xet-C9-l5y" id="GnQ-xU-e0N"/>
<outlet property="pointerVelocityModeDividerUILabel" destination="VlN-ZW-1gm" id="vbe-QK-hZb"/> <outlet property="pointerVelocityModeDividerUILabel" destination="VlN-ZW-1gm" id="vbe-QK-hZb"/>
+2
View File
@@ -1495,6 +1495,7 @@
"$(PROJECT_DIR)/Limelight/Input/CustomOSC", "$(PROJECT_DIR)/Limelight/Input/CustomOSC",
"$(PROJECT_DIR)/Limelight/ViewControllers/CustomOSCViewControl", "$(PROJECT_DIR)/Limelight/ViewControllers/CustomOSCViewControl",
"$(PROJECT_DIR)/Limelight/ViewControllers/CustomOSCViewControl/Cells", "$(PROJECT_DIR)/Limelight/ViewControllers/CustomOSCViewControl/Cells",
"$(PROJECT_DIR)/Limelight/Input",
); );
INFOPLIST_FILE = "Limelight/Limelight-Info.plist"; INFOPLIST_FILE = "Limelight/Limelight-Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = MoonlightZWM; INFOPLIST_KEY_CFBundleDisplayName = MoonlightZWM;
@@ -1549,6 +1550,7 @@
"$(PROJECT_DIR)/Limelight/Input/CustomOSC", "$(PROJECT_DIR)/Limelight/Input/CustomOSC",
"$(PROJECT_DIR)/Limelight/ViewControllers/CustomOSCViewControl", "$(PROJECT_DIR)/Limelight/ViewControllers/CustomOSCViewControl",
"$(PROJECT_DIR)/Limelight/ViewControllers/CustomOSCViewControl/Cells", "$(PROJECT_DIR)/Limelight/ViewControllers/CustomOSCViewControl/Cells",
"$(PROJECT_DIR)/Limelight/Input",
); );
INFOPLIST_FILE = "Limelight/Limelight-Info.plist"; INFOPLIST_FILE = "Limelight/Limelight-Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = MoonlightZWM; INFOPLIST_KEY_CFBundleDisplayName = MoonlightZWM;