settings menu resize

This commit is contained in:
TrueZhuanjia committed 2025-06-13 12:39:16 +08:00
1 parent 23b68b2d15
commit 51a62ce1d8
16 files changed
+116 -59

No files matched your search

+1 -2
View File
@@ -68,8 +68,7 @@ typedef NS_ENUM(NSInteger, SettingsMenuMode) {
unlockDisplayOrientation:(BOOL)unlockDisplayOrientation unlockDisplayOrientation:(BOOL)unlockDisplayOrientation
resolutionSelected:(NSInteger)resolutionSelected resolutionSelected:(NSInteger)resolutionSelected
externalDisplayMode:(NSInteger)externalDisplayMode externalDisplayMode:(NSInteger)externalDisplayMode
localMousePointerMode:(NSInteger)localMousePointerMode localMousePointerMode:(NSInteger)localMousePointerMode;
settinsMenuMode:(NSInteger)settinsMenuMode;
- (NSArray*) getHosts; - (NSArray*) getHosts;
- (void) updateHost:(TemporaryHost*)host; - (void) updateHost:(TemporaryHost*)host;
+1 -3
View File
@@ -89,8 +89,7 @@
unlockDisplayOrientation:(BOOL)unlockDisplayOrientation unlockDisplayOrientation:(BOOL)unlockDisplayOrientation
resolutionSelected:(NSInteger)resolutionSelected resolutionSelected:(NSInteger)resolutionSelected
externalDisplayMode:(NSInteger)externalDisplayMode externalDisplayMode:(NSInteger)externalDisplayMode
localMousePointerMode:(NSInteger)localMousePointerMode localMousePointerMode:(NSInteger)localMousePointerMode{
settinsMenuMode:(NSInteger)settinsMenuMode{
[_managedObjectContext performBlockAndWait:^{ [_managedObjectContext performBlockAndWait:^{
Settings* settingsToSave = [self retrieveSettings]; Settings* settingsToSave = [self retrieveSettings];
@@ -129,7 +128,6 @@
settingsToSave.resolutionSelected = [NSNumber numberWithInteger:resolutionSelected]; settingsToSave.resolutionSelected = [NSNumber numberWithInteger:resolutionSelected];
settingsToSave.externalDisplayMode = [NSNumber numberWithInteger:externalDisplayMode]; settingsToSave.externalDisplayMode = [NSNumber numberWithInteger:externalDisplayMode];
settingsToSave.localMousePointerMode = [NSNumber numberWithInteger:localMousePointerMode]; settingsToSave.localMousePointerMode = [NSNumber numberWithInteger:localMousePointerMode];
settingsToSave.settingsMenuMode = [NSNumber numberWithInteger:settinsMenuMode];
[self saveData]; [self saveData];
}]; }];
} }
+1
View File
@@ -22,6 +22,7 @@
@property (nonatomic, retain) Settings * parent; @property (nonatomic, retain) Settings * parent;
@property (nonatomic, retain) NSNumber * settingsMenuMode; @property (nonatomic, retain) NSNumber * settingsMenuMode;
@property (nonatomic, retain) NSNumber * settingsMenuWidth;
@property (nonatomic, retain) NSNumber * bitrate; @property (nonatomic, retain) NSNumber * bitrate;
@property (nonatomic, retain) NSNumber * framerate; @property (nonatomic, retain) NSNumber * framerate;
@property (nonatomic, retain) NSNumber * height; @property (nonatomic, retain) NSNumber * height;
+1
View File
@@ -74,6 +74,7 @@
self.onscreenControls = [NSNumber numberWithInteger:OnScreenControlsLevelOff]; self.onscreenControls = [NSNumber numberWithInteger:OnScreenControlsLevelOff];
#else #else
self.settingsMenuMode = settings.settingsMenuMode; self.settingsMenuMode = settings.settingsMenuMode;
self.settingsMenuWidth = settings.settingsMenuWidth;
self.bitrate = settings.bitrate; self.bitrate = settings.bitrate;
self.framerate = settings.framerate; self.framerate = settings.framerate;
self.height = settings.height; self.height = settings.height;
-1
View File
@@ -61,7 +61,6 @@ static StreamView* streamView;
fixedResetCoordY = streamViewHeight * 0.4; fixedResetCoordY = streamViewHeight * 0.4;
pointerVelocityFactor = settings.touchPointerVelocityFactor.floatValue; pointerVelocityFactor = settings.touchPointerVelocityFactor.floatValue;
NSLog(@"stream wdith %f, stream height %f", streamViewWidth, streamViewHeight); NSLog(@"stream wdith %f, stream height %f", streamViewWidth, streamViewHeight);
NSLog(@"pointerVelocityFactor: %.2f", pointerVelocityFactor);
} }
@end @end
+5 -9
View File
@@ -145,10 +145,6 @@ static float L3_Y;
return touchAddrsCapturedByOnScreenControls; return touchAddrsCapturedByOnScreenControls;
} }
+ (void) testMethod{
NSLog(@"swift calling test");
}
- (void) sendRightStickTouchPadEvent:(CGFloat) stickX : (CGFloat) stickY{ - (void) sendRightStickTouchPadEvent:(CGFloat) stickX : (CGFloat) stickY{
[_controllerSupport updateRightStick:_controller x: stickX y: stickY]; // stick value populated to the controllerSupport here [_controllerSupport updateRightStick:_controller x: stickX y: stickY]; // stick value populated to the controllerSupport here
[_controllerSupport updateFinished:_controller]; [_controllerSupport updateFinished:_controller];
@@ -370,13 +366,13 @@ static float L3_Y;
// _activeCustomOscButtonPositionDict will be updated every time when the osc profile is reloaded // _activeCustomOscButtonPositionDict will be updated every time when the osc profile is reloaded
OSCProfile *oscProfile = [profilesManager getSelectedProfile]; //returns the currently selected OSCProfile OSCProfile *oscProfile = [profilesManager getSelectedProfile]; //returns the currently selected OSCProfile
[_activeCustomOscButtonPositionDict removeAllObjects]; //reset the Dict. [_activeCustomOscButtonPositionDict removeAllObjects]; //reset the Dict.
NSLog(@"_activeCustomOscButtonPositionDict update: STARTOVER"); // NSLog(@"_activeCustomOscButtonPositionDict update: STARTOVER");
for (NSData *buttonStateEncoded in oscProfile.buttonStates) { for (NSData *buttonStateEncoded in oscProfile.buttonStates) {
OnScreenButtonState* buttonState = [profilesManager unarchiveButtonStateEncoded:buttonStateEncoded]; OnScreenButtonState* buttonState = [profilesManager unarchiveButtonStateEncoded:buttonStateEncoded];
buttonState.position = [self denormalizeWidgetPosition:buttonState.position]; buttonState.position = [self denormalizeWidgetPosition:buttonState.position];
if(!buttonState.isHidden && [validPositionButtonNames containsObject:buttonState.name] && (buttonState.buttonType == LegacyOscButton || [profilesManager getIndexOfSelectedProfile] == 0 ) ){ if(!buttonState.isHidden && [validPositionButtonNames containsObject:buttonState.name] && (buttonState.buttonType == LegacyOscButton || [profilesManager getIndexOfSelectedProfile] == 0 ) ){
[_activeCustomOscButtonPositionDict setObject:[NSValue valueWithCGPoint:buttonState.position] forKey:buttonState.name]; // we got a buttonname -> position dict here [_activeCustomOscButtonPositionDict setObject:[NSValue valueWithCGPoint:buttonState.position] forKey:buttonState.name]; // we got a buttonname -> position dict here
NSLog(@"_activeCustomOscButtonPositionDict update, button name:%@, position: %f, %f", buttonState.name, buttonState.position.x, buttonState.position.y); // NSLog(@"_activeCustomOscButtonPositionDict update, button name:%@, position: %f, %f", buttonState.name, buttonState.position.x, buttonState.position.y);
} }
// retrieve size factors & other necessary configurations for complex control // retrieve size factors & other necessary configurations for complex control
@@ -397,7 +393,7 @@ static float L3_Y;
if(_dPadSizeFactor == 0) _dPadSizeFactor = 1.0; // dealing with invalid sizefactor if(_dPadSizeFactor == 0) _dPadSizeFactor = 1.0; // dealing with invalid sizefactor
} }
} }
NSLog(@"_activeCustomOscButtonPositionDict update, active button number: %lu", (unsigned long)[_activeCustomOscButtonPositionDict count]); //NSLog(@"_activeCustomOscButtonPositionDict update, active button number: %lu", (unsigned long)[_activeCustomOscButtonPositionDict count]);
} }
else{ else{
// deal with simple & full mode configurations // deal with simple & full mode configurations
@@ -405,7 +401,7 @@ static float L3_Y;
_leftStickOpacity = _rightStickOpacity = DEFAULT_STICK_OPACITY; _leftStickOpacity = _rightStickOpacity = DEFAULT_STICK_OPACITY;
} }
NSLog(@"rightStickOpacity: %f", _rightStickOpacity); //NSLog(@"rightStickOpacity: %f", _rightStickOpacity);
// belows are orginal codes: // belows are orginal codes:
switch (self._level) { switch (self._level) {
@@ -849,7 +845,7 @@ static float L3_Y;
[buttonLayer.name isEqualToString:@"rightButton"] || [buttonLayer.name isEqualToString:@"rightButton"] ||
[buttonLayer.name isEqualToString:@"downButton"] || [buttonLayer.name isEqualToString:@"downButton"] ||
[buttonLayer.name isEqualToString:@"leftButton"]){ [buttonLayer.name isEqualToString:@"leftButton"]){
NSLog(@"layerName: %@, alpha: %f", buttonLayer.name, buttonStateDecoded.backgroundAlpha); // NSLog(@"layerName: %@, alpha: %f", buttonLayer.name, buttonStateDecoded.backgroundAlpha);
[self adjustControllerLayerOpacityWith:buttonLayer and:buttonStateDecoded.backgroundAlpha]; [self adjustControllerLayerOpacityWith:buttonLayer and:buttonStateDecoded.backgroundAlpha];
} }
if([buttonLayer.name isEqualToString:@"leftStickBackground"]){ if([buttonLayer.name isEqualToString:@"leftStickBackground"]){
-4
View File
@@ -43,10 +43,6 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2;
StreamView* streamView; StreamView* streamView;
} }
+ (void) testMethod{
NSLog(@"swift calling test 666");
}
- (id)initWithView:(StreamView*)view andSettings:(TemporarySettings*)settings { - (id)initWithView:(StreamView*)view andSettings:(TemporarySettings*)settings {
self = [self init]; self = [self init];
self->streamView = view; self->streamView = view;
+1 -3
View File
@@ -221,13 +221,11 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
[self becomeFirstResponder]; [self becomeFirstResponder];
} }
// this method also deals with lifting streamview for local keyboard
- (void)keyboardWillShow:(NSNotification *)notification{ - (void)keyboardWillShow:(NSNotification *)notification{
if(settings.liftStreamViewForKeyboard && !isInputingText){ if(settings.liftStreamViewForKeyboard && !isInputingText){
NSDictionary *userInfo = notification.userInfo; NSDictionary *userInfo = notification.userInfo;
// Get the keyboard size from the notification // Get the keyboard size from the notification
CGRect keyboardFrame = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; CGRect keyboardFrame = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
// NSLog(@"keyboard height %f, lowest point height %f", keyboardFrame.size.height, keyboardToggleRecognizer.lowestTouchPointHeight);
if(keyboardFrame.size.height < CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.25) return; // return in case of abnormal keyboard height if(keyboardFrame.size.height < CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.25) return; // return in case of abnormal keyboard height
HeightViewLiftedTo = keyboardFrame.size.height - keyboardToggleRecognizer.lowestTouchPointHeight + CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.1; // lift the StreamView to the height of lowest touch point of multi-finger tap gesture, while reserving the view of 1/10 screen height for remote typing. HeightViewLiftedTo = keyboardFrame.size.height - keyboardToggleRecognizer.lowestTouchPointHeight + CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.1; // lift the StreamView to the height of lowest touch point of multi-finger tap gesture, while reserving the view of 1/10 screen height for remote typing.
if(HeightViewLiftedTo < 0) HeightViewLiftedTo = 0; // set HeightViewLiftedTo to 0 if it is high enough and not going to be covered by keyboard. if(HeightViewLiftedTo < 0) HeightViewLiftedTo = 0; // set HeightViewLiftedTo to 0 if it is high enough and not going to be covered by keyboard.
@@ -389,7 +387,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
- (void) reloadOnScreenWidgetViews{ - (void) reloadOnScreenWidgetViews{
NSLog(@"reload on screen keyboard buttons here"); // NSLog(@"reload on screen keyboard buttons here");
// remove all keyboard widget views first // remove all keyboard widget views first
[self clearOnScreenKeyboardButtons]; [self clearOnScreenKeyboardButtons];
@@ -45,6 +45,7 @@
<attribute name="resolutionSelected" optional="YES" attributeType="Integer 16" defaultValueString="5" usesScalarValueType="NO" syncable="YES"/> <attribute name="resolutionSelected" optional="YES" attributeType="Integer 16" defaultValueString="5" usesScalarValueType="NO" syncable="YES"/>
<attribute name="reverseMouseWheelDirection" attributeType="Boolean" defaultValueString="YES" usesScalarValueType="YES" syncable="YES"/> <attribute name="reverseMouseWheelDirection" attributeType="Boolean" defaultValueString="YES" usesScalarValueType="YES" syncable="YES"/>
<attribute name="settingsMenuMode" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="NO" syncable="YES"/> <attribute name="settingsMenuMode" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="NO" syncable="YES"/>
<attribute name="settingsMenuWidth" attributeType="Float" defaultValueString="390" usesScalarValueType="NO" syncable="YES"/>
<attribute name="showKeyboardToolbar" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/> <attribute name="showKeyboardToolbar" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
<attribute name="slideToSettingsDistance" optional="YES" attributeType="Float" defaultValueString="0.25" usesScalarValueType="NO" syncable="YES"/> <attribute name="slideToSettingsDistance" optional="YES" attributeType="Float" defaultValueString="0.25" usesScalarValueType="NO" syncable="YES"/>
<attribute name="slideToSettingsScreenEdge" optional="YES" attributeType="Integer 32" defaultValueString="2" usesScalarValueType="NO" syncable="YES"/> <attribute name="slideToSettingsScreenEdge" optional="YES" attributeType="Integer 32" defaultValueString="2" usesScalarValueType="NO" syncable="YES"/>
+1 -1
View File
@@ -115,7 +115,7 @@
//BOOL ret = NO; //BOOL ret = NO;
freeaddrinfo(result); freeaddrinfo(result);
NSLog(@"IP Check, is prohibited: %d", ret); // NSLog(@"IP Check, is prohibited: %d", ret);
return NO; return NO;
//#else //#else
@@ -119,8 +119,6 @@ static const CGFloat cellOffsetY = 20;
- (void)didMoveToParentViewController:(UIViewController *)parent { - (void)didMoveToParentViewController:(UIViewController *)parent {
[super didMoveToParentViewController:parent]; [super didMoveToParentViewController:parent];
NSLog(@"moved to parentVC: %@", parent);
// 可以在这里进行一些初始化,比如加载数据、刷新 UI 等
} }
- (void)addHost:(TemporaryHost *)host { - (void)addHost:(TemporaryHost *)host {
@@ -130,9 +128,7 @@ static const CGFloat cellOffsetY = 20;
[self.items addObject:host]; [self.items addObject:host];
[self.items addObject:host]; [self.items addObject:host];
[self.collectionView reloadData]; [self.collectionView reloadData];
// [self.view layoutIfNeeded];
} }
NSLog(@"addhost log");
} }
- (void)removeHost:(TemporaryHost *)host { - (void)removeHost:(TemporaryHost *)host {
@@ -194,7 +190,6 @@ static const CGFloat cellOffsetY = 20;
} }
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"config cell log");
HostCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HostCell" forIndexPath:indexPath]; HostCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HostCell" forIndexPath:indexPath];
TemporaryHost *host = self.items[indexPath.item]; TemporaryHost *host = self.items[indexPath.item];
@@ -68,6 +68,8 @@
NSArray* _sortedAppList; NSArray* _sortedAppList;
NSCache* _boxArtCache; NSCache* _boxArtCache;
bool _background; bool _background;
UIView* menuSeparator;
UIView* snapshot;
UINavigationBarAppearance *navBarAppearanceStandard; UINavigationBarAppearance *navBarAppearanceStandard;
UINavigationBarAppearance *navBarAppearanceScroll; UINavigationBarAppearance *navBarAppearanceScroll;
@@ -417,7 +419,6 @@ static NSMutableSet* hostList;
- (void)pairButtonTappedForHost:(TemporaryHost *)host{ - (void)pairButtonTappedForHost:(TemporaryHost *)host{
_selectedHost = host; _selectedHost = host;
NSLog(@"pairButtonTappedForHost");
[self showLoadingFrame: ^{ [self showLoadingFrame: ^{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// Wait for the PC's status to be known // Wait for the PC's status to be known
@@ -665,7 +666,6 @@ static NSMutableSet* hostList;
UIAlertController* netTestAlert = [UIAlertController alertControllerWithTitle:[LocalizationHelper localizedStringForKey:@"Network Test Complete"] message:message preferredStyle:UIAlertControllerStyleAlert]; UIAlertController* netTestAlert = [UIAlertController alertControllerWithTitle:[LocalizationHelper localizedStringForKey:@"Network Test Complete"] message:message preferredStyle:UIAlertControllerStyleAlert];
[netTestAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Ok"] style:UIAlertActionStyleDefault handler:nil]]; [netTestAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Ok"] style:UIAlertActionStyleDefault handler:nil]];
[[self activeViewController] presentViewController:netTestAlert animated:YES completion:^{ [[self activeViewController] presentViewController:netTestAlert animated:YES completion:^{
NSLog(@"restore tint");
[self restoreTintColorForAllSubViews]; [self restoreTintColorForAllSubViews];
}]; }];
}]; }];
@@ -1217,7 +1217,6 @@ static NSMutableSet* hostList;
self->waterMark.font = [UIFont systemFontOfSize:22]; self->waterMark.font = [UIFont systemFontOfSize:22];
self->waterMark.text = [LocalizationHelper localizedStringForKey:@"waterMarkText"]; self->waterMark.text = [LocalizationHelper localizedStringForKey:@"waterMarkText"];
CGFloat labelHeight = 60; CGFloat labelHeight = 60;
NSLog(@"fullscr: %d", [self isFullScreenRequired]);
// the app is unable to automatically lock screen orientation in app window resizable mode(aka. not require fullscreen) // the app is unable to automatically lock screen orientation in app window resizable mode(aka. not require fullscreen)
// if(![self isFullScreenRequired]){ // if(![self isFullScreenRequired]){
@@ -1533,13 +1532,14 @@ static NSMutableSet* hostList;
// SettingsViewController* settingsViewController = (SettingsViewController*)[self.revealViewController rearViewController]; // SettingsViewController* settingsViewController = (SettingsViewController*)[self.revealViewController rearViewController];
// [settingsViewController updateResolutionTable]; // [settingsViewController updateResolutionTable];
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleMenuResize:)];
[self.view addGestureRecognizer:longPress];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPad" bundle:nil]; UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPad" bundle:nil];
SettingsViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"settingsViewController"]; SettingsViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"settingsViewController"];
// 强制加载视图 // 强制加载视图
__unused UIView *view = viewController.view; __unused UIView *view = viewController.view;
} }
-(void)viewDidLayoutSubviews{ -(void)viewDidLayoutSubviews{
@@ -2034,10 +2034,79 @@ static NSMutableSet* hostList;
[_boxArtCache removeAllObjects]; [_boxArtCache removeAllObjects];
} }
- (UIView* )findMenuSeparator{
BOOL shouldBreak = NO;
UIView* seperator=self.view;
while(seperator && !shouldBreak) {
for(UIView* view in seperator.subviews) {
if([view.accessibilityIdentifier isEqualToString:@"menuSeparator"]) {
seperator = view;
shouldBreak = YES;
break;
}
}
if (shouldBreak) break;
seperator = seperator.superview;
}
return seperator;
}
- (void)handleMenuResize:(UILongPressGestureRecognizer *)gesture {
CGPoint locationInView = [gesture locationInView:self.view];
CGPoint locationInSuperView = [gesture locationInView:self.revealViewController.view];
menuSeparator = [self findMenuSeparator];
if(menuSeparator.hidden || menuSeparator == nil) return;
if(gesture.state == UIGestureRecognizerStateBegan){
if(locationInView.x < 30) {
snapshot = [[UIView alloc] init];
snapshot.backgroundColor = [ThemeManager appPrimaryColor];
CGFloat screenWidth = [UIScreen mainScreen].bounds.size.height;
snapshot.frame = CGRectMake(locationInSuperView.x,0, 2, screenWidth);
[self.revealViewController.view addSubview:snapshot];
}
return;
}
CGFloat screenWidthInPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]);
CGFloat limitedWidth = MIN(MAX(locationInSuperView.x, 280),screenWidthInPoints/2);
if(gesture.state == UIGestureRecognizerStateChanged){
if(snapshot) snapshot.center = CGPointMake(limitedWidth, snapshot.center.y);
}
if(gesture.state == UIGestureRecognizerStateEnded || gesture.state == UIGestureRecognizerStateCancelled){
[snapshot removeFromSuperview];
self.revealViewController.rearViewRevealWidth = limitedWidth;
[self.revealViewController setupNavigationBar];
if(self.revealViewController.isStreaming) [self.revealViewController buttonsInStreaming];
else [self.revealViewController buttonsNotInStreaming];
DataManager* dataMan = [[DataManager alloc] init];
Settings* settings = [dataMan retrieveSettings];
settings.settingsMenuWidth = [NSNumber numberWithFloat:self.revealViewController.rearViewRevealWidth];
[dataMan saveData];
}
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[self.view endEditing:YES]; [self.view endEditing:YES];
} }
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
/*
NSLog(@"%f touchesMoved", CACurrentMediaTime());
UITouch* touch = touches.anyObject;
CGPoint touchPoint = [touch locationInView:self.view.superview];
if(snapshot){
snapshot.center = CGPointMake(touchPoint.x, snapshot.center.y);
}
*/
}
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
[snapshot removeFromSuperview];
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField { - (BOOL)textFieldShouldReturn:(UITextField *)textField {
[textField resignFirstResponder]; [textField resignFirstResponder];
return YES; return YES;
@@ -146,6 +146,8 @@
#pragma mark - SWRevealViewController Class #pragma mark - SWRevealViewController Class
// Enum values for setFrontViewPosition:animated: // Enum values for setFrontViewPosition:animated:
typedef NS_ENUM( NSInteger, FrontViewPosition) typedef NS_ENUM( NSInteger, FrontViewPosition)
{ {
@@ -328,7 +330,7 @@ typedef NS_ENUM(NSInteger, SWRevealToggleAnimationType)
- (void)buttonsInStreaming; - (void)buttonsInStreaming;
- (void)buttonsNotInStreaming; - (void)buttonsNotInStreaming;
- (void)setupNavigationBar;
@end @end
@@ -102,6 +102,8 @@ static CGFloat scaledValue( CGFloat v1, CGFloat min2, CGFloat max2, CGFloat min1
_frontView = [[UIView alloc] initWithFrame:bounds]; _frontView = [[UIView alloc] initWithFrame:bounds];
_frontView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; _frontView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
_frontView.userInteractionEnabled = YES;
[self reloadShadow]; [self reloadShadow];
[self addSubview:_frontView]; [self addSubview:_frontView];
@@ -234,6 +236,7 @@ static CGFloat scaledValue( CGFloat v1, CGFloat min2, CGFloat max2, CGFloat min1
# pragma mark - overrides # pragma mark - overrides
- (void)layoutSubviews - (void)layoutSubviews
{ {
if ( _disableLayout ) return; if ( _disableLayout ) return;
@@ -688,7 +691,11 @@ const int FrontViewPositionNone = 0xff;
_rearViewPosition = FrontViewPositionLeft; _rearViewPosition = FrontViewPositionLeft;
_rightViewPosition = FrontViewPositionLeft; _rightViewPosition = FrontViewPositionLeft;
// _rearViewRevealWidth = 492.0f; // _rearViewRevealWidth = 492.0f;
_rearViewRevealWidth = 390; //mark: settingMenuLayout
DataManager* dataMan = [[DataManager alloc] init];
TemporarySettings* currentSettings = [dataMan getSettings];
_rearViewRevealWidth = currentSettings.settingsMenuWidth.floatValue; //mark: settingMenuLayout
// _rearViewRevealOverdraw = 60.0f; // _rearViewRevealOverdraw = 60.0f;
_rearViewRevealOverdraw = 0.0f; _rearViewRevealOverdraw = 0.0f;
_rearViewRevealDisplacement = 40.0f; _rearViewRevealDisplacement = 40.0f;
@@ -783,7 +790,6 @@ const int FrontViewPositionNone = 0xff;
// now set the desired initial position // now set the desired initial position
[self _setFrontViewPosition:initialPosition withDuration:0.0]; [self _setFrontViewPosition:initialPosition withDuration:0.0];
[self setupMenuSeparator]; [self setupMenuSeparator];
} }
- (bool)isIphone{ - (bool)isIphone{
@@ -831,6 +837,7 @@ const int FrontViewPositionNone = 0xff;
- (void)viewDidLoad{ - (void)viewDidLoad{
self.isStreaming = false; //init this flag self.isStreaming = false; //init this flag
} }
@@ -862,6 +869,7 @@ const int FrontViewPositionNone = 0xff;
- (void)willMoveToPosition{ - (void)willMoveToPosition{
SettingsMenuMode currentMenuMode = [self getSettingsMenuMode]; SettingsMenuMode currentMenuMode = [self getSettingsMenuMode];
_separatorLine.hidden = _frontViewPosition == FrontViewPositionLeft; _separatorLine.hidden = _frontViewPosition == FrontViewPositionLeft;
@@ -876,12 +884,17 @@ const int FrontViewPositionNone = 0xff;
//if(currentMenuMode == AllSettings) [self allSettingSelected]; //if(currentMenuMode == AllSettings) [self allSettingSelected];
//if(currentMenuMode == FavoriteSettings) [self favoriteSettingSelected]; //if(currentMenuMode == FavoriteSettings) [self favoriteSettingSelected];
} }
else{
// _rearViewRevealWidth = _rearViewRevealWidth + 20;
[self setupNavigationBar];
}
} }
- (void)setupMenuSeparator{ - (void)setupMenuSeparator{
// 分隔线 // 分隔线
_separatorLine = [[UIView alloc] init]; _separatorLine = [[UIView alloc] init];
_separatorLine.accessibilityIdentifier = @"menuSeparator";
_separatorLine.backgroundColor = [ThemeManager separatorColor]; _separatorLine.backgroundColor = [ThemeManager separatorColor];
_separatorLine.translatesAutoresizingMaskIntoConstraints = NO; _separatorLine.translatesAutoresizingMaskIntoConstraints = NO;
[_contentView.frontView addSubview:_separatorLine]; [_contentView.frontView addSubview:_separatorLine];
@@ -907,7 +920,9 @@ const int FrontViewPositionNone = 0xff;
- (void)setupNavigationBar { - (void)setupNavigationBar {
// 创建导航栏 // 创建导航栏
if (_dockedNavBar == nil) _dockedNavBar = [[UINavigationBar alloc] init]; if (_dockedNavBar == nil || _rearViewRevealWidth != _dockedNavBar.bounds.size.width) _dockedNavBar = [[UINavigationBar alloc] init];
//_dockedNavBar = [[UINavigationBar alloc] init];
_dockedNavBar.translatesAutoresizingMaskIntoConstraints = NO; _dockedNavBar.translatesAutoresizingMaskIntoConstraints = NO;
_dockedNavBar.userInteractionEnabled = YES; _dockedNavBar.userInteractionEnabled = YES;
@@ -942,6 +957,7 @@ const int FrontViewPositionNone = 0xff;
[_dockedNavBar setItems:@[_navItem]]; [_dockedNavBar setItems:@[_navItem]];
_dockedNavBar.titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor]}; _dockedNavBar.titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor]};
[_dockedNavBar removeFromSuperview];
[_contentView.rearNavView addSubview:_dockedNavBar]; [_contentView.rearNavView addSubview:_dockedNavBar];
// 设置导航栏约束 // 设置导航栏约束
@@ -951,7 +967,7 @@ const int FrontViewPositionNone = 0xff;
[_dockedNavBar.leadingAnchor constraintEqualToAnchor:_contentView.rearNavView.leadingAnchor], [_dockedNavBar.leadingAnchor constraintEqualToAnchor:_contentView.rearNavView.leadingAnchor],
[_dockedNavBar.widthAnchor constraintEqualToConstant:_rearViewRevealWidth], [_dockedNavBar.widthAnchor constraintEqualToConstant:_rearViewRevealWidth],
]]; ]];
NSLog(@"rearViewRevealWidth %f", _rearViewRevealWidth); [self layoutSettingsView];
} }
@@ -2018,7 +2034,6 @@ const int FrontViewPositionNone = 0xff;
if ( positionIsChanging ) if ( positionIsChanging )
{ {
if ( [self->_delegate respondsToSelector:@selector(revealController:didMoveToPosition:)] ){ if ( [self->_delegate respondsToSelector:@selector(revealController:didMoveToPosition:)] ){
NSLog(@"expansion: %f", CACurrentMediaTime() - self->timeStamp);
[self->_delegate revealController:self didMoveToPosition:newPosition]; [self->_delegate revealController:self didMoveToPosition:newPosition];
} }
} }
@@ -609,7 +609,7 @@ BOOL isCustomResolution(CGSize res) {
bool scrollDown = location.y > self.view.bounds.size.height - 100; bool scrollDown = location.y > self.view.bounds.size.height - 100;
bool scrollUp = location.y < 150; bool scrollUp = location.y < 150;
NSLog(@"%f flag: %d, %d, obj: %@, locY: %f", CACurrentMediaTime(), scrollUp, scrollDown, _autoScrollDisplayLink, location.y); //NSLog(@"%f flag: %d, %d, obj: %@, locY: %f", CACurrentMediaTime(), scrollUp, scrollDown, _autoScrollDisplayLink, location.y);
if(!(scrollUp||scrollDown)) [self stopAutoScroll]; if(!(scrollUp||scrollDown)) [self stopAutoScroll];
@@ -624,7 +624,7 @@ BOOL isCustomResolution(CGSize res) {
if(scrollDown) scrollDirection = 1; if(scrollDown) scrollDirection = 1;
if(scrollUp) scrollDirection = -1; if(scrollUp) scrollDirection = -1;
_scrollSpeed = _scrollSpeed * scrollDirection; _scrollSpeed = _scrollSpeed * scrollDirection;
NSLog(@"%f, scrollSpeed: %f", CACurrentMediaTime(), _scrollSpeed); //NSLog(@"%f, scrollSpeed: %f", CACurrentMediaTime(), _scrollSpeed);
_autoScrollDisplayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(startScroll)]; _autoScrollDisplayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(startScroll)];
[_autoScrollDisplayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes]; [_autoScrollDisplayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
@@ -711,12 +711,8 @@ BOOL isCustomResolution(CGSize res) {
UIView *subview = parentStack.arrangedSubviews[i]; UIView *subview = parentStack.arrangedSubviews[i];
// CGRect frame = [subview convertRect:subview.bounds toView:parentStack]; // CGRect frame = [subview convertRect:subview.bounds toView:parentStack];
CGFloat stackMinY = CGRectGetMinY(subview.frame); CGFloat stackMinY = CGRectGetMinY(subview.frame);
NSLog(@" index: %ld, stackY: %f, touchY: %f", (long)i, CGRectGetMidY(subview.frame), location.y); // NSLog(@" index: %ld, stackY: %f, touchY: %f", (long)i, CGRectGetMidY(subview.frame), location.y);
if(stackMinY < location.y){ if(stackMinY < location.y) return i;
NSLog(@"index: %ld", i);
//subview.backgroundColor = [ThemeManager appPrimaryColorWithAlpha];
return i;
}
} }
return 0; return 0;
} }
@@ -779,7 +775,6 @@ BOOL isCustomResolution(CGSize res) {
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction * _Nonnull action) { handler:^(UIAlertAction * _Nonnull action) {
[self addSettingToFavorite:self->capturedStack]; [self addSettingToFavorite:self->capturedStack];
// 在这里执行收藏逻辑
}]; }];
[actionSheet addAction:addFavoriteAction]; [actionSheet addAction:addFavoriteAction];
return actionSheet; return actionSheet;
@@ -825,7 +820,7 @@ BOOL isCustomResolution(CGSize res) {
case UIGestureRecognizerStateChanged: case UIGestureRecognizerStateChanged:
snapshot.center = CGPointMake(locationInParentStack.x, locationInParentStack.y); snapshot.center = CGPointMake(locationInParentStack.x, locationInParentStack.y);
NSLog(@"coordY in rootView: %f", locationInRootView.y); // NSLog(@"coordY in rootView: %f", locationInRootView.y);
[self handleAutoScroll:locationInRootView]; [self handleAutoScroll:locationInRootView];
[self updateRelocationIndicatorFor:locationInParentStack]; [self updateRelocationIndicatorFor:locationInParentStack];
@@ -834,7 +829,6 @@ BOOL isCustomResolution(CGSize res) {
case UIGestureRecognizerStateCancelled: case UIGestureRecognizerStateCancelled:
case UIGestureRecognizerStateEnded: case UIGestureRecognizerStateEnded:
// 更新快照视图位置 // 更新快照视图位置
// snapshot.center = CGPointMake(originalCenter.x, point.y);
[self stopAutoScroll]; [self stopAutoScroll];
[snapshot removeFromSuperview]; [snapshot removeFromSuperview];
snapshot = nil; snapshot = nil;
@@ -843,7 +837,6 @@ BOOL isCustomResolution(CGSize res) {
[self clearRelocationIndicator]; [self clearRelocationIndicator];
NSInteger oldIndex = [parentStack.arrangedSubviews indexOfObject:capturedStack]; NSInteger oldIndex = [parentStack.arrangedSubviews indexOfObject:capturedStack];
newIndex = newIndex > oldIndex ? newIndex - 1 : newIndex; newIndex = newIndex > oldIndex ? newIndex - 1 : newIndex;
//NSInteger newIndex = 1;
//NSLog(@"newidx %ld, oldidx %ld", newIndex, oldIndex); //NSLog(@"newidx %ld, oldidx %ld", newIndex, oldIndex);
if(settingStackWillBeRelocatedToLowestPosition){ if(settingStackWillBeRelocatedToLowestPosition){
newIndex = newIndex + 1; newIndex = newIndex + 1;
@@ -978,8 +971,6 @@ BOOL isCustomResolution(CGSize res) {
} }
- (void)switchToAllSettings{ - (void)switchToAllSettings{
for(UIView* view in parentStack.subviews){ for(UIView* view in parentStack.subviews){
[view removeFromSuperview]; [view removeFromSuperview];
} }
@@ -1226,7 +1217,6 @@ BOOL isCustomResolution(CGSize res) {
[self.customResolutionSwitch addTarget:self action:@selector(customResolutionSwitched:) forControlEvents:UIControlEventValueChanged]; [self.customResolutionSwitch addTarget:self action:@selector(customResolutionSwitched:) forControlEvents:UIControlEventValueChanged];
CGSize currentResolution = CGSizeMake(currentSettings.width.intValue, currentSettings.height.intValue); CGSize currentResolution = CGSizeMake(currentSettings.width.intValue, currentSettings.height.intValue);
[self.customResolutionSwitch setOn: isCustomResolution(currentResolution)]; [self.customResolutionSwitch setOn: isCustomResolution(currentResolution)];
NSLog(@"isCustomResolution %d", isCustomResolution(currentResolution));
[self.framerateSelector setSelectedSegmentIndex:framerate]; [self.framerateSelector setSelectedSegmentIndex:framerate];
[self.framerateSelector addTarget:self action:@selector(updateBitrate) forControlEvents:UIControlEventValueChanged]; [self.framerateSelector addTarget:self action:@selector(updateBitrate) forControlEvents:UIControlEventValueChanged];
@@ -1934,15 +1924,13 @@ BOOL isCustomResolution(CGSize res) {
useFramePacing:useFramePacing useFramePacing:useFramePacing
enableHdr:enableHdr enableHdr:enableHdr
btMouseSupport:btMouseSupport btMouseSupport:btMouseSupport
// absoluteTouchMode:absoluteTouchMode
touchMode:touchMode touchMode:touchMode
statsOverlayLevel:statsOverlayLevel statsOverlayLevel:statsOverlayLevel
statsOverlayEnabled:statsOverlayEnabled statsOverlayEnabled:statsOverlayEnabled
unlockDisplayOrientation:unlockDisplayOrientation unlockDisplayOrientation:unlockDisplayOrientation
resolutionSelected:resolutionSelected resolutionSelected:resolutionSelected
externalDisplayMode:externalDisplayMode externalDisplayMode:externalDisplayMode
localMousePointerMode:localMousePointerMode localMousePointerMode:localMousePointerMode];
settinsMenuMode:currentSettingsMenuMode];
} }
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
@@ -294,7 +294,6 @@
UIAlertAction *confirmAction = [UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Got it! (15)"] UIAlertAction *confirmAction = [UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Got it! (15)"]
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction * _Nonnull action) { handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"用户确认了操作");
}]; }];
confirmAction.enabled = NO; confirmAction.enabled = NO;
[alert addAction:confirmAction]; [alert addAction:confirmAction];
@@ -371,7 +370,7 @@
*/ */
if(_settings.externalDisplayMode.intValue == 2) _streamVideoRenderView = _streamView; if(_settings.externalDisplayMode.intValue == 2) _streamVideoRenderView = _streamView;
else { else {
NSLog(@"renderView separated from streamView"); //NSLog(@"renderView separated from streamView");
_streamVideoRenderView = (StreamView*)[[UIView alloc] initWithFrame:self.view.frame]; _streamVideoRenderView = (StreamView*)[[UIView alloc] initWithFrame:self.view.frame];
_streamVideoRenderView.bounds = _streamView.bounds; _streamVideoRenderView.bounds = _streamView.bounds;
_streamVideoRenderView.userInteractionEnabled = false; // this will prevent renderView from intrecepting touchEvents which shall be interacting with streamView _streamVideoRenderView.userInteractionEnabled = false; // this will prevent renderView from intrecepting touchEvents which shall be interacting with streamView