favorite settings basic fuction
This commit is contained in:
@@ -85,12 +85,13 @@
|
||||
<segment title="Custom"/>
|
||||
</segments>
|
||||
</segmentedControl>
|
||||
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9cG-JD-glb" userLabel="Resolution Display View">
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="9cG-JD-glb" userLabel="Resolution Display View">
|
||||
<rect key="frame" x="0.0" y="61.5" width="380" height="50"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
</view>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="111.5" id="0nu-Oy-daj"/>
|
||||
<constraint firstAttribute="width" constant="380" id="bn6-xc-xEZ"/>
|
||||
</constraints>
|
||||
</stackView>
|
||||
@@ -167,7 +168,7 @@
|
||||
<rect key="frame" x="16" y="516" width="380" height="56.5"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Async Native Touch" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="2Bp-XZ-cCw">
|
||||
<rect key="frame" x="0.0" y="0.0" width="390" height="20.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="380" height="20.5"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.93902439019999995" green="0.9625305918" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
@@ -191,7 +192,7 @@
|
||||
<rect key="frame" x="15" y="382" width="380" height="56.5"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Touch Pointer Velocity: Scaled on 0% of Right Screen " lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="DkI-w6-jku" userLabel="pointerVelocityModeDivider">
|
||||
<rect key="frame" x="0.0" y="0.0" width="390" height="18.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="380" height="18.5"/>
|
||||
<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"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
@@ -199,7 +200,7 @@
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="100" minValue="0.0" maxValue="100" id="AcZ-2i-GI4" userLabel="pointerVelocityModeDivider">
|
||||
<rect key="frame" x="-2" y="23.5" width="394" height="34"/>
|
||||
<rect key="frame" x="-2" y="23.5" width="384" height="34"/>
|
||||
<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"/>
|
||||
</slider>
|
||||
@@ -212,7 +213,7 @@
|
||||
<rect key="frame" x="15" y="446" width="380" height="56.5"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Touch Pointer Velocity: 100% " lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="egA-7n-Dpe" userLabel="touchPointerVelocityFactor">
|
||||
<rect key="frame" x="0.0" y="0.0" width="390" height="18.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="380" height="18.5"/>
|
||||
<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"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
@@ -220,7 +221,7 @@
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="100" minValue="0.0" maxValue="300" id="TVV-EU-Rw1" userLabel="touchPointerVelocityFactor">
|
||||
<rect key="frame" x="-2" y="23.5" width="394" height="34"/>
|
||||
<rect key="frame" x="-2" y="23.5" width="384" height="34"/>
|
||||
<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"/>
|
||||
</slider>
|
||||
@@ -233,7 +234,7 @@
|
||||
<rect key="frame" x="16" y="593" width="380" height="56.5"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Interval of Multi-Touch Move Events: 200 us " lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="FJv-HJ-UYJ" userLabel="touchMoveEventIntervalLabel">
|
||||
<rect key="frame" x="0.0" y="0.0" width="390" height="18.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="380" height="18.5"/>
|
||||
<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"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
@@ -241,7 +242,7 @@
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="150" minValue="0.0" maxValue="3600" id="4gD-tc-95I" userLabel="touchMoveEventIntervalSlider">
|
||||
<rect key="frame" x="-2" y="23.5" width="394" height="34"/>
|
||||
<rect key="frame" x="-2" y="23.5" width="384" height="34"/>
|
||||
<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"/>
|
||||
</slider>
|
||||
@@ -254,7 +255,7 @@
|
||||
<rect key="frame" x="17" y="666" width="380" height="56.5"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Mouse Pointer Velocity: 100% " lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="oPM-G6-u5O" userLabel="mousePointerVelocityFactor">
|
||||
<rect key="frame" x="0.0" y="0.0" width="390" height="18.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="380" height="18.5"/>
|
||||
<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"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
@@ -262,7 +263,7 @@
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="100" minValue="0.0" maxValue="300" id="Ei2-FJ-9oC" userLabel="mousePointerVelocityFactor">
|
||||
<rect key="frame" x="-2" y="23.5" width="394" height="34"/>
|
||||
<rect key="frame" x="-2" y="23.5" width="384" height="34"/>
|
||||
<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"/>
|
||||
</slider>
|
||||
@@ -301,7 +302,7 @@
|
||||
<rect key="frame" x="17" y="806" width="380" height="56.5"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="nh6-cn-z23">
|
||||
<rect key="frame" x="0.0" y="0.0" width="390" height="18.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="380" height="18.5"/>
|
||||
<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"/>
|
||||
<string key="text" base64-UTF8="YES">
|
||||
@@ -313,7 +314,7 @@ ICAgICAgICAgICAgICA
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="3" minValue="3" maxValue="13" id="4wJ-Gd-Dmp">
|
||||
<rect key="frame" x="-2" y="23.5" width="394" height="34"/>
|
||||
<rect key="frame" x="-2" y="23.5" width="384" height="34"/>
|
||||
<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"/>
|
||||
</slider>
|
||||
@@ -326,7 +327,7 @@ ICAgICAgICAgICAgICA
|
||||
<rect key="frame" x="17" y="880" width="380" height="56.5"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Lift Stream View for Local Keyboard " textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="QYJ-84-bvc">
|
||||
<rect key="frame" x="0.0" y="0.0" width="390" height="20.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="380" height="20.5"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.93902439019999995" green="0.9625305918" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
@@ -350,7 +351,7 @@ ICAgICAgICAgICAgICA
|
||||
<rect key="frame" x="15" y="959" width="380" height="56.5"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Show Local Keyboard Toolbar " textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="aup-5k-z6P">
|
||||
<rect key="frame" x="0.0" y="0.0" width="390" height="20.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="380" height="20.5"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.93902439019999995" green="0.9625305918" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
@@ -405,7 +406,7 @@ ICAgICAgICAgICAgICA
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" id="yY7-Sf-Zes" userLabel="Command Sending Screen Edge Selector">
|
||||
<rect key="frame" x="0.0" y="25.5" width="390" height="32"/>
|
||||
<rect key="frame" x="0.0" y="25.5" width="380" height="32"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<segments>
|
||||
<segment title="Left Screen Edge"/>
|
||||
|
||||
@@ -62,7 +62,8 @@ typedef NS_ENUM(NSInteger, TouchEventPriorityEnum) {
|
||||
unlockDisplayOrientation:(BOOL)unlockDisplayOrientation
|
||||
resolutionSelected:(NSInteger)resolutionSelected
|
||||
externalDisplayMode:(NSInteger)externalDisplayMode
|
||||
localMousePointerMode:(NSInteger)localMousePointerMode;
|
||||
localMousePointerMode:(NSInteger)localMousePointerMode
|
||||
settinsMenuMode:(NSInteger)settinsMenuMode;
|
||||
|
||||
- (NSArray*) getHosts;
|
||||
- (void) updateHost:(TemporaryHost*)host;
|
||||
|
||||
@@ -89,7 +89,8 @@
|
||||
unlockDisplayOrientation:(BOOL)unlockDisplayOrientation
|
||||
resolutionSelected:(NSInteger)resolutionSelected
|
||||
externalDisplayMode:(NSInteger)externalDisplayMode
|
||||
localMousePointerMode:(NSInteger)localMousePointerMode {
|
||||
localMousePointerMode:(NSInteger)localMousePointerMode
|
||||
settinsMenuMode:(NSInteger)settinsMenuMode{
|
||||
|
||||
[_managedObjectContext performBlockAndWait:^{
|
||||
Settings* settingsToSave = [self retrieveSettings];
|
||||
@@ -128,6 +129,7 @@
|
||||
settingsToSave.resolutionSelected = [NSNumber numberWithInteger:resolutionSelected];
|
||||
settingsToSave.externalDisplayMode = [NSNumber numberWithInteger:externalDisplayMode];
|
||||
settingsToSave.localMousePointerMode = [NSNumber numberWithInteger:localMousePointerMode];
|
||||
settingsToSave.settingsMenuMode = [NSNumber numberWithInteger:settinsMenuMode];
|
||||
[self saveData];
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
@property (nonatomic, retain) Settings * parent;
|
||||
|
||||
@property (nonatomic, retain) NSNumber * settingsMenuMode;
|
||||
@property (nonatomic, retain) NSNumber * bitrate;
|
||||
@property (nonatomic, retain) NSNumber * framerate;
|
||||
@property (nonatomic, retain) NSNumber * height;
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
}
|
||||
self.onscreenControls = [NSNumber numberWithInteger:OnScreenControlsLevelOff];
|
||||
#else
|
||||
self.settingsMenuMode = settings.settingsMenuMode;
|
||||
self.bitrate = settings.bitrate;
|
||||
self.framerate = settings.framerate;
|
||||
self.height = settings.height;
|
||||
|
||||
@@ -112,7 +112,6 @@ static const float REFRESH_CYCLE = 2.0f;
|
||||
longPressFired = false;
|
||||
return;
|
||||
}
|
||||
NSLog(@"self.delegate: %lu", (uintptr_t)self.delegate);
|
||||
if ([self.delegate respondsToSelector:@selector(appButtonTappedForHost:)]) {
|
||||
[self.delegate appButtonTappedForHost:_host];
|
||||
} else NSLog(@"Delegate not set or does not respond to appButtonTappedForHost:");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="22522" systemVersion="22G313" minimumToolsVersion="Xcode 7.3" sourceLanguage="Objective-C" userDefinedModelVersionIdentifier="">
|
||||
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="23788" systemVersion="24F74" minimumToolsVersion="Xcode 7.3" sourceLanguage="Objective-C" userDefinedModelVersionIdentifier="">
|
||||
<entity name="App" representedClassName="App" syncable="YES" codeGenerationType="class">
|
||||
<attribute name="hdrSupported" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
|
||||
<attribute name="hidden" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
|
||||
@@ -44,6 +44,7 @@
|
||||
<attribute name="preferredCodec" attributeType="Integer 32" defaultValueString="YES" usesScalarValueType="YES" 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="settingsMenuMode" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="NO" 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="slideToSettingsScreenEdge" optional="YES" attributeType="Integer 32" defaultValueString="2" usesScalarValueType="NO" syncable="YES"/>
|
||||
|
||||
@@ -45,14 +45,14 @@
|
||||
- (void)commonInit {
|
||||
// 默认值
|
||||
_leadingTrailingPadding = 0;
|
||||
_separatorLinePadding = 26;
|
||||
_separatorLinePadding = 9;
|
||||
_sectionTitle = @"Section";
|
||||
_expanded = YES;
|
||||
_backgroundColor = [UIColor clearColor];
|
||||
_rootStackViewSpacing = 8.0;
|
||||
_rootStackViewSpacing = 10;
|
||||
_subStackViews = [NSMutableArray array];
|
||||
_headerViewHeight = 37;
|
||||
_headerViewVerticalSpacing = 26;
|
||||
_headerViewVerticalSpacing = 20;
|
||||
|
||||
// 设置视图
|
||||
self.layer.cornerRadius = 10.0;
|
||||
|
||||
@@ -1095,7 +1095,7 @@ static NSMutableSet* hostList;
|
||||
|
||||
- (void)revealController:(SWRevealViewController *)revealController willMoveToPosition:(FrontViewPosition)position {
|
||||
SettingsViewController* settingsViewController = (SettingsViewController*)[revealController rearViewController];
|
||||
|
||||
revealController.navBarMenuDelegate = settingsViewController;
|
||||
if (position == FrontViewPositionLeft) {
|
||||
self.navigationItem.leftBarButtonItems = @[_settingsButton];
|
||||
}
|
||||
@@ -1595,9 +1595,6 @@ static NSMutableSet* hostList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
[dataMan saveData];
|
||||
}
|
||||
|
||||
|
||||
@@ -140,6 +140,7 @@
|
||||
|
||||
@class SWRevealViewController;
|
||||
@protocol SWRevealViewControllerDelegate;
|
||||
@protocol RearNavigationBarMenuDelegate;
|
||||
|
||||
#pragma mark - SWRevealViewController Class
|
||||
|
||||
@@ -318,6 +319,7 @@ typedef NS_ENUM(NSInteger, SWRevealToggleAnimationType)
|
||||
|
||||
// Delegate
|
||||
@property (nonatomic,weak) id<SWRevealViewControllerDelegate> delegate;
|
||||
@property (nonatomic,weak) id<RearNavigationBarMenuDelegate> navBarMenuDelegate;
|
||||
|
||||
@property (nonatomic,assign) bool isStreaming;
|
||||
@property (nonatomic,assign) bool mainFrameIsInHostView;
|
||||
@@ -329,6 +331,7 @@ typedef NS_ENUM(NSInteger, SWRevealToggleAnimationType)
|
||||
@end
|
||||
|
||||
|
||||
|
||||
#pragma mark - SWRevealViewControllerDelegate Protocol
|
||||
|
||||
typedef enum
|
||||
@@ -340,6 +343,15 @@ typedef enum
|
||||
|
||||
} SWRevealControllerOperation;
|
||||
|
||||
#pragma mark - RearNavigationBarMenuDelegate Protocol
|
||||
|
||||
@protocol RearNavigationBarMenuDelegate<NSObject>
|
||||
@optional
|
||||
- (void)switchToFavoriteSettings;
|
||||
- (void)switchToAllSettings;
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@protocol SWRevealViewControllerDelegate<NSObject>
|
||||
|
||||
|
||||
@@ -618,7 +618,6 @@ static CGFloat scaledValue( CGFloat v1, CGFloat min2, CGFloat max2, CGFloat min1
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#pragma mark - SWRevealViewController Class
|
||||
|
||||
@interface SWRevealViewController()<UIGestureRecognizerDelegate>
|
||||
@@ -999,20 +998,16 @@ const int FrontViewPositionNone = 0xff;
|
||||
}
|
||||
|
||||
if (@available(iOS 14.0, *)) {
|
||||
UIAction *action1 = [UIAction actionWithTitle:@"操作1" image:[UIImage systemImageNamed:@"doc"] identifier:nil handler:^(__kindof UIAction * _Nonnull action) {
|
||||
NSLog(@"执行操作1");
|
||||
UIAction *favoriteSettingAction = [UIAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Favorite Settings"] image:[UIImage systemImageNamed:@"bookmark"] identifier:nil handler:^(__kindof UIAction * _Nonnull action) {
|
||||
[self favoriteSettingSelected];
|
||||
}];
|
||||
|
||||
UIAction *action2 = [UIAction actionWithTitle:@"操作2" image:[UIImage systemImageNamed:@"folder"] identifier:nil handler:^(__kindof UIAction * _Nonnull action) {
|
||||
NSLog(@"执行操作2");
|
||||
UIAction *allSettingAction = [UIAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"All Settings"] image:[UIImage systemImageNamed:@"circle.grid.3x3"] identifier:nil handler:^(__kindof UIAction * _Nonnull action) {
|
||||
[self allSettingSelected];
|
||||
}];
|
||||
|
||||
UIAction *deleteAction = [UIAction actionWithTitle:@"删除" image:[UIImage systemImageNamed:@"trash"] identifier:nil handler:^(__kindof UIAction * _Nonnull action) {
|
||||
NSLog(@"执行删除操作");
|
||||
}];
|
||||
deleteAction.attributes = UIMenuElementAttributesDestructive;
|
||||
// 创建菜单
|
||||
UIMenu *menu = [UIMenu menuWithTitle:@"" children:@[action1, action2, deleteAction]];
|
||||
UIMenu *menu = [UIMenu menuWithTitle:@"" children:@[favoriteSettingAction, allSettingAction]];
|
||||
_moreButton.menu = menu;
|
||||
}
|
||||
else{
|
||||
@@ -1023,8 +1018,8 @@ const int FrontViewPositionNone = 0xff;
|
||||
}
|
||||
|
||||
- (void)moreButtonTapped:(UIBarButtonItem *)sender {
|
||||
UIMenuItem *item1 = [[UIMenuItem alloc] initWithTitle:@"操作1" action:@selector(action1)];
|
||||
UIMenuItem *item2 = [[UIMenuItem alloc] initWithTitle:@"操作2" action:@selector(action2)];
|
||||
UIMenuItem *item1 = [[UIMenuItem alloc] initWithTitle:@"操作1" action:@selector(favoriteSettingSelected)];
|
||||
UIMenuItem *item2 = [[UIMenuItem alloc] initWithTitle:@"操作2" action:@selector(allSettingsSelected)];
|
||||
|
||||
UIMenuController *menuController = [UIMenuController sharedMenuController];
|
||||
[menuController setMenuItems:@[item1, item2]];
|
||||
@@ -1041,17 +1036,26 @@ const int FrontViewPositionNone = 0xff;
|
||||
}
|
||||
|
||||
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
|
||||
if (action == @selector(action1) || action == @selector(action2)) {
|
||||
if (action == @selector(favoriteSettingSelected) || action == @selector(allSettingsSelected)) {
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)action1 {
|
||||
NSLog(@"执行操作1");
|
||||
- (void)favoriteSettingSelected {
|
||||
if ([self.navBarMenuDelegate respondsToSelector:@selector(switchToFavoriteSettings)]) {
|
||||
[self.navBarMenuDelegate switchToFavoriteSettings];
|
||||
} else NSLog(@"Delegate not set or does not respond to switchToFavoriteSettings:");
|
||||
}
|
||||
|
||||
- (void)action2 {
|
||||
- (void)allSettingSelected {
|
||||
if ([self.navBarMenuDelegate respondsToSelector:@selector(switchToAllSettings)]) {
|
||||
[self.navBarMenuDelegate switchToAllSettings];
|
||||
} else NSLog(@"Delegate not set or does not respond to switchToAllSettings:");
|
||||
}
|
||||
|
||||
|
||||
- (void)allSettingsSelected {
|
||||
NSLog(@"执行操作2");
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#import "MainFrameViewController.h"
|
||||
#import "CustomEdgeSlideGestureRecognizer.h"
|
||||
|
||||
@interface SettingsViewController : UIViewController
|
||||
@interface SettingsViewController : UIViewController <RearNavigationBarMenuDelegate>
|
||||
@property (strong, nonatomic) IBOutlet UINavigationBar *navigationBar;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *resolutionStack;
|
||||
@property (strong, nonatomic) IBOutlet UIStackView *fpsStack;
|
||||
@@ -104,6 +104,11 @@
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
typedef NS_ENUM(NSInteger, SettingsMenuMode) {
|
||||
AllSettings,
|
||||
FavoriteSettings,
|
||||
};
|
||||
|
||||
- (void)saveSettings;
|
||||
+ (bool)isLandscapeNow;
|
||||
- (void)updateResolutionTable;
|
||||
|
||||
@@ -28,10 +28,14 @@
|
||||
uint16_t oscLayoutFingers;
|
||||
CustomEdgeSlideGestureRecognizer *slideToCloseSettingsViewRecognizer;
|
||||
UIStackView *parentStack;
|
||||
NSMutableDictionary *_settingStackDict;
|
||||
NSMutableArray *_favoriteSettingStackIdentifiers;
|
||||
uint8_t currentSettingsMenuMode;
|
||||
}
|
||||
|
||||
@dynamic overrideUserInterfaceStyle;
|
||||
|
||||
|
||||
//static NSString* bitrateFormat;
|
||||
static const int bitrateTable[] = {
|
||||
500,
|
||||
@@ -398,6 +402,12 @@ BOOL isCustomResolution(CGSize res) {
|
||||
[parentStack.widthAnchor constraintEqualToAnchor:self.scrollView.contentLayoutGuide.widthAnchor]
|
||||
]];
|
||||
}
|
||||
|
||||
- (void)addSetting:(UIStackView *)stack ofIdentifier:(NSString* )identifier to:(MenuSectionView* )menuSection{
|
||||
stack.accessibilityIdentifier = identifier;
|
||||
[_settingStackDict setObject:stack forKey:identifier];
|
||||
[menuSection addSubStackView:stack];
|
||||
}
|
||||
|
||||
- (void)layoutSections{
|
||||
MenuSectionView *videoSection = [[MenuSectionView alloc] init];
|
||||
@@ -405,12 +415,10 @@ BOOL isCustomResolution(CGSize res) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
[videoSection setSectionIcon:[UIImage systemImageNamed:@"airplayvideo"]];
|
||||
} else [videoSection setSectionIcon:nil];
|
||||
self.resolutionStack.accessibilityIdentifier = @"resolutionStack";
|
||||
self.fpsStack.accessibilityIdentifier = @"fpsStack";
|
||||
self.codecStack.accessibilityIdentifier = @"codecStack";
|
||||
[videoSection addSubStackView:_resolutionStack];
|
||||
[videoSection addSubStackView:_fpsStack];
|
||||
[videoSection addSubStackView:_codecStack];
|
||||
|
||||
[self addSetting:self.resolutionStack ofIdentifier:@"resolutionStack" to:videoSection];
|
||||
[self addSetting:self.fpsStack ofIdentifier:@"fpsStack" to:videoSection];
|
||||
[self addSetting:self.codecStack ofIdentifier:@"codecStack" to:videoSection];
|
||||
[videoSection addToParentStack:parentStack];
|
||||
[videoSection setExpanded:YES];
|
||||
//_fpsStack.userInteractionEnabled = NO;
|
||||
@@ -420,19 +428,13 @@ BOOL isCustomResolution(CGSize res) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
[gesturesSection setSectionIcon:[UIImage systemImageNamed:@"hand.draw"]];
|
||||
} else [gesturesSection setSectionIcon:nil];
|
||||
self.keyboardToggleFingerNumStack.accessibilityIdentifier = @"keyboardToggleFingerNumStack";
|
||||
self.slideToSettingsScreenEdgeStack.accessibilityIdentifier = @"slideToSettingsScreenEdgeStack";
|
||||
self.slideToCmdToolScreenEdgeStack.accessibilityIdentifier = @"slideToCmdToolScreenEdgeStack";
|
||||
self.slideToSettingsDistanceStack.accessibilityIdentifier = @"slideToSettingsDistanceStack";
|
||||
[gesturesSection addSubStackView:_keyboardToggleFingerNumStack];
|
||||
[gesturesSection addSubStackView:_slideToSettingsScreenEdgeStack];
|
||||
[gesturesSection addSubStackView:_slideToCmdToolScreenEdgeStack];
|
||||
[gesturesSection addSubStackView:_slideToSettingsDistanceStack];
|
||||
// [gesturesSection addSubStackView:_unlockDisplayOrientationStack];
|
||||
|
||||
[self addSetting:self.keyboardToggleFingerNumStack ofIdentifier:@"keyboardToggleFingerNumStack" to:gesturesSection];
|
||||
[self addSetting:self.slideToSettingsScreenEdgeStack ofIdentifier:@"slideToSettingsScreenEdgeStack" to:gesturesSection];
|
||||
[self addSetting:self.slideToCmdToolScreenEdgeStack ofIdentifier:@"slideToCmdToolScreenEdgeStack" to:gesturesSection];
|
||||
[self addSetting:self.slideToSettingsDistanceStack ofIdentifier:@"slideToSettingsDistanceStack" to:gesturesSection];
|
||||
[gesturesSection addToParentStack:parentStack];
|
||||
[gesturesSection setExpanded:YES];
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -497,6 +499,7 @@ BOOL isCustomResolution(CGSize res) {
|
||||
|
||||
- (void)handleLongPress:(UILongPressGestureRecognizer *)gesture {
|
||||
if (gesture.state == UIGestureRecognizerStateBegan) {
|
||||
// capture setting stack
|
||||
CGPoint point = [gesture locationInView:self.view];
|
||||
UIView *touchedView = [self.view hitTest:point withEvent:nil];
|
||||
UIStackView* capturedStack;
|
||||
@@ -507,16 +510,99 @@ BOOL isCustomResolution(CGSize res) {
|
||||
else NSLog(@"hit test: not setting stack captured");
|
||||
// NSLog(@"hit test obj: %@", touchedView);
|
||||
NSLog(@"hit test name: %@", capturedStack.accessibilityIdentifier);
|
||||
if(capturedStack == nil) return;
|
||||
|
||||
// actionsheet
|
||||
UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:nil
|
||||
message:nil
|
||||
preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
|
||||
UIAlertAction *favoriteAction = [UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Add to favorite"]
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * _Nonnull action) {
|
||||
[self addSettingToFavorite:capturedStack];
|
||||
// 在这里执行收藏逻辑
|
||||
}];
|
||||
[actionSheet addAction:favoriteAction];
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
actionSheet.popoverPresentationController.sourceView = self.view;
|
||||
actionSheet.popoverPresentationController.sourceRect = CGRectMake(point.x, point.y, 1, 1);
|
||||
}
|
||||
|
||||
[self presentViewController:actionSheet animated:YES completion:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)addSettingToFavorite:(UIStackView* )settingStack{
|
||||
[_favoriteSettingStackIdentifiers addObject:settingStack.accessibilityIdentifier];
|
||||
for(NSString *identifier in _favoriteSettingStackIdentifiers){
|
||||
NSLog(@"favorite setting: %@", identifier);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)switchToFavoriteSettings{
|
||||
[self updateTheme];
|
||||
|
||||
currentSettingsMenuMode = FavoriteSettings;
|
||||
DataManager* dataMan = [[DataManager alloc] init];
|
||||
Settings *currentSettings = [dataMan retrieveSettings];
|
||||
currentSettings.settingsMenuMode = [NSNumber numberWithInteger:currentSettingsMenuMode];
|
||||
[dataMan saveData];
|
||||
|
||||
for(UIView* view in parentStack.subviews){
|
||||
[view removeFromSuperview];
|
||||
}
|
||||
parentStack.spacing = 15;
|
||||
for(NSString* settingIdentifier in _favoriteSettingStackIdentifiers){
|
||||
[parentStack addArrangedSubview:_settingStackDict[settingIdentifier]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)switchToAllSettings{
|
||||
[self updateTheme];
|
||||
|
||||
currentSettingsMenuMode = AllSettings;
|
||||
DataManager* dataMan = [[DataManager alloc] init];
|
||||
Settings *currentSettings = [dataMan retrieveSettings];
|
||||
currentSettings.settingsMenuMode = [NSNumber numberWithInteger:currentSettingsMenuMode];
|
||||
[dataMan saveData];
|
||||
|
||||
|
||||
for(UIView* view in parentStack.subviews){
|
||||
[view removeFromSuperview];
|
||||
}
|
||||
[self initParentStack];
|
||||
[self layoutSections];
|
||||
}
|
||||
|
||||
|
||||
- (void)saveFavoriteSettingStackIdentifiers {
|
||||
[[NSUserDefaults standardUserDefaults] setObject:_favoriteSettingStackIdentifiers forKey:@"FavoriteSettingStackIdentifiers"];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
|
||||
- (void)loadFavoriteSettingStackIdentifiers {
|
||||
NSArray *savedArray = [[NSUserDefaults standardUserDefaults] objectForKey:@"FavoriteSettingStackIdentifiers"];
|
||||
if ([savedArray isKindOfClass:[NSArray class]]) {
|
||||
_favoriteSettingStackIdentifiers = [savedArray mutableCopy];
|
||||
} else {
|
||||
_favoriteSettingStackIdentifiers = [NSMutableArray array];
|
||||
}
|
||||
/*
|
||||
for(NSString* str in _favoriteSettingStackIdentifiers){
|
||||
NSLog(@"favarite setting loaded: %@", str);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
//[self updateTheme];
|
||||
|
||||
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
|
||||
[self.view addGestureRecognizer:longPress];
|
||||
|
||||
|
||||
_settingStackDict = [[NSMutableDictionary alloc] init];
|
||||
|
||||
// return;
|
||||
BOOL isIPad = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad);
|
||||
if(isIPad){
|
||||
@@ -530,6 +616,8 @@ BOOL isCustomResolution(CGSize res) {
|
||||
}
|
||||
|
||||
|
||||
// [self swi];
|
||||
|
||||
self->slideToCloseSettingsViewRecognizer = [[CustomEdgeSlideGestureRecognizer alloc] initWithTarget:self action:@selector(edgeSwiped)];
|
||||
slideToCloseSettingsViewRecognizer.edges = UIRectEdgeLeft;
|
||||
slideToCloseSettingsViewRecognizer.normalizedThresholdDistance = 0.0;
|
||||
@@ -553,6 +641,21 @@ BOOL isCustomResolution(CGSize res) {
|
||||
DataManager* dataMan = [[DataManager alloc] init];
|
||||
TemporarySettings* currentSettings = [dataMan getSettings];
|
||||
|
||||
currentSettingsMenuMode = currentSettings.settingsMenuMode.intValue;
|
||||
[self loadFavoriteSettingStackIdentifiers];
|
||||
switch (currentSettingsMenuMode) {
|
||||
case FavoriteSettings:
|
||||
[self switchToFavoriteSettings];
|
||||
break;
|
||||
case AllSettings:
|
||||
[self switchToAllSettings];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Ensure we pick a bitrate that falls exactly onto a slider notch
|
||||
_bitrate = bitrateTable[[self getSliderValueForBitrate:[currentSettings.bitrate intValue]]];
|
||||
|
||||
@@ -1395,7 +1498,9 @@ BOOL isCustomResolution(CGSize res) {
|
||||
unlockDisplayOrientation:unlockDisplayOrientation
|
||||
resolutionSelected:resolutionSelected
|
||||
externalDisplayMode:externalDisplayMode
|
||||
localMousePointerMode:localMousePointerMode];
|
||||
localMousePointerMode:localMousePointerMode
|
||||
settinsMenuMode:currentSettingsMenuMode];
|
||||
[self saveFavoriteSettingStackIdentifiers];
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
|
||||
Reference in New Issue
Block a user