add exit button by storyboard, config widget disabling in streamview settingview
This commit is contained in:
1 parent
38343c20cb
commit
56fc18c378
10 files changed
+308
-104
No files matched your search
@@ -20,6 +20,7 @@
|
||||
@property (weak, nonatomic) IBOutlet UIBarButtonItem *settingsButton;
|
||||
#if !TARGET_OS_TV
|
||||
@property (weak, nonatomic) IBOutlet UIBarButtonItem *upButton;
|
||||
@property (nonatomic, assign) bool settingsExpandedInStreamView;
|
||||
|
||||
-(void)simulateSettingsButtonPress;
|
||||
-(void)reloadStreamConfig;
|
||||
|
||||
@@ -906,6 +906,17 @@ static NSMutableSet* hostList;
|
||||
// If we moved back to the center position, we should save the settings
|
||||
SettingsViewController* settingsViewController = (SettingsViewController*)[revealController rearViewController];
|
||||
settingsViewController.mainFrameViewController = self;
|
||||
// enable / disable widgets acoordingly: in streamview, disable, outside of streamview, enable.
|
||||
[settingsViewController.resolutionSelector setEnabled:!self.settingsExpandedInStreamView];
|
||||
[settingsViewController.framerateSelector setEnabled:!self.settingsExpandedInStreamView];
|
||||
[settingsViewController widget:settingsViewController.bitrateSlider setEnabled:!self.settingsExpandedInStreamView];
|
||||
[settingsViewController.optimizeSettingsSelector setEnabled:!self.settingsExpandedInStreamView];
|
||||
[settingsViewController.audioOnPCSelector setEnabled:!self.settingsExpandedInStreamView];
|
||||
[settingsViewController.codecSelector setEnabled:!self.settingsExpandedInStreamView];
|
||||
[settingsViewController.framePacingSelector setEnabled:!self.settingsExpandedInStreamView];
|
||||
[settingsViewController.btMouseSelector setEnabled:!self.settingsExpandedInStreamView];
|
||||
|
||||
|
||||
if (position == FrontViewPositionLeft) {
|
||||
[settingsViewController saveSettings];
|
||||
_settingsButton.enabled = YES; // make sure these 2 buttons are enabled after closing setting view.
|
||||
@@ -925,7 +936,7 @@ static NSMutableSet* hostList;
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
if ([segue.destinationViewController isKindOfClass:[StreamFrameViewController class]]) {
|
||||
StreamFrameViewController* streamFrame = segue.destinationViewController;
|
||||
streamFrame.mainframeViewcontroller = self;
|
||||
streamFrame.mainFrameViewcontroller = self;
|
||||
streamFrame.streamConfig = _streamConfig;
|
||||
}
|
||||
}
|
||||
@@ -995,7 +1006,7 @@ static NSMutableSet* hostList;
|
||||
[self attachWaterMark];
|
||||
|
||||
#if !TARGET_OS_TV
|
||||
|
||||
_settingsExpandedInStreamView = false; // init this flag
|
||||
|
||||
// Set the side bar button action. When it's tapped, it'll show the sidebar.
|
||||
[_settingsButton setTarget:self.revealViewController];
|
||||
|
||||
@@ -59,5 +59,6 @@
|
||||
|
||||
- (void) saveSettings;
|
||||
+ (bool) isLandscapeNow;
|
||||
- (void) widget:(UISlider*)widget setEnabled:(bool)enabled;
|
||||
|
||||
@end
|
||||
@@ -201,10 +201,46 @@ BOOL isCustomResolution(CGSize res) {
|
||||
|
||||
- (void)viewDidDisappear:(BOOL)animated{
|
||||
[super viewDidDisappear:animated];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"SettingsViewClosed" object:self]; // notify other view that settings view just closed
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"SettingsViewClosedNotification" object:self]; // notify other view that settings view just closed
|
||||
}
|
||||
|
||||
- (void)pushDownExistingWidgets{
|
||||
// Calculate the height needed for the exit button
|
||||
CGFloat exitButtonHeight = 50.0; // Adjust as needed
|
||||
CGFloat topOffset = exitButtonHeight; // Space needed for the exit button
|
||||
// Iterate through subviews of self.view and adjust their frames
|
||||
for (UIView *subview in self.view.subviews) {
|
||||
CGRect frame = subview.frame;
|
||||
frame.origin.y += topOffset;
|
||||
subview.frame = frame;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (IBAction)exitButtonTapped:(id)sender {
|
||||
[self->_mainFrameViewController simulateSettingsButtonPress];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"SessionDisconnectedBySettingsViewNotification" object:self];
|
||||
}
|
||||
|
||||
|
||||
- (void)addExitButtonOnTop{
|
||||
UIButton *exitButton = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
[exitButton setTitle:@"Exit" forState:UIControlStateNormal];
|
||||
[exitButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; // Set font color
|
||||
exitButton.backgroundColor = [UIColor clearColor]; // Set background color
|
||||
exitButton.titleLabel.font = [UIFont boldSystemFontOfSize:16.0]; // Set font size and style
|
||||
exitButton.layer.cornerRadius = 8.0; // Optional: Round corners if desired
|
||||
exitButton.clipsToBounds = YES; // Ensure rounded corners are applied properly
|
||||
[exitButton addTarget:self action:@selector(exitButtonTapped) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self.view addSubview:exitButton];
|
||||
exitButton.frame = CGRectMake(0, 20, 200, 50); // Adjust Y and height as needed
|
||||
}
|
||||
|
||||
|
||||
- (void)viewDidLoad {
|
||||
//[self pushDownExistingWidgets];
|
||||
//[self addExitButtonOnTop];
|
||||
|
||||
justEnteredSettingsViewDoNotOpenOscLayoutTool = true;
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(deviceOrientationDidChange) // handle orientation change since i made portrait mode available
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#endif
|
||||
@property (nonatomic) StreamConfiguration* streamConfig;
|
||||
@property (nonatomic, assign) MainFrameViewController *mainframeViewcontroller;
|
||||
@property (nonatomic, assign) MainFrameViewController *mainFrameViewcontroller;
|
||||
|
||||
|
||||
-(void)updatePreferredDisplayMode:(BOOL)streamActive;
|
||||
|
||||
@@ -97,18 +97,20 @@
|
||||
[self.view addGestureRecognizer:_exitSwipeRecognizer];
|
||||
}
|
||||
|
||||
|
||||
// key implementation of reconfiguring streamview after realtime setting menu is closed.
|
||||
- (void)reConfigStreamViewRealtime{
|
||||
_settings = [[[DataManager alloc] init] getSettings]; //StreamFrameViewController retrieve the settings here.
|
||||
[self configOscLayoutTool];
|
||||
[self configExitGesture];
|
||||
[self->_streamView disableOnScreenControls]; //don't know why but this must be called outside the streamview class, just put it here. execute in streamview class cause hang
|
||||
[self.mainframeViewcontroller reloadStreamConfig]; // reload streamconfig
|
||||
[self.mainFrameViewcontroller reloadStreamConfig]; // reload streamconfig
|
||||
[_streamView setupStreamView:_controllerSupport interactionDelegate:self config:self.streamConfig]; //reinitiate setupStreamView process.
|
||||
[self->_streamView reloadOnScreenControlsRealtimeWith:(ControllerSupport*)_controllerSupport
|
||||
andConfig:(StreamConfiguration*)_streamConfig]; //reload OSC here.
|
||||
}
|
||||
|
||||
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated
|
||||
{
|
||||
[super viewDidAppear:animated];
|
||||
@@ -116,8 +118,13 @@
|
||||
#if !TARGET_OS_TV
|
||||
[[self revealViewController] setPrimaryViewController:self];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(reConfigStreamViewRealtime) // //force expand settings view to update resolution table, and all setting includes current fullscreen resolution will be updated.
|
||||
name:@"SettingsViewClosed"
|
||||
selector:@selector(reConfigStreamViewRealtime) // reconfig streamview when settings view is closed in stream view
|
||||
name:@"SettingsViewClosedNotification"
|
||||
object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(sessionDisconnectedBySettingView) //quit session when exit button is press in setting view during streaming
|
||||
name:@"SessionDisconnectedBySettingsViewNotification"
|
||||
object:nil];
|
||||
#endif
|
||||
}
|
||||
@@ -438,12 +445,13 @@
|
||||
}
|
||||
|
||||
- (void)expandSettingsView{
|
||||
[self.mainframeViewcontroller simulateSettingsButtonPress];
|
||||
self.mainFrameViewcontroller.settingsExpandedInStreamView = true; //notify mainFrameViewContorller that this is a setting expansion in stream view, some settings shall be disabled.
|
||||
[self.mainFrameViewcontroller simulateSettingsButtonPress];
|
||||
}
|
||||
|
||||
- (void)edgeSwiped {
|
||||
Log(LOG_I, @"User swiped to end stream");
|
||||
|
||||
- (void)sessionDisconnectedBySettingView {
|
||||
Log(LOG_I, @"Settings view disconnect the session in stream view");
|
||||
self.mainFrameViewcontroller.settingsExpandedInStreamView = false; // reset this flag to false
|
||||
[self returnToMainFrame];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user