-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
151 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// SettingsController.h | ||
// ssrMac | ||
// | ||
// Created by ssrlive on 2022/8/10. | ||
// Copyright © 2022 ssrLive. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
#import "SWBAppDelegate.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface SettingsController : NSWindowController | ||
@property (weak) IBOutlet NSTextField *txtPort; | ||
|
||
@property(weak) SWBAppDelegate *appDelegate; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// SettingsController.m | ||
// ssrMac | ||
// | ||
// Created by ssrlive on 2022/8/10. | ||
// Copyright © 2022 ssrLive. All rights reserved. | ||
// | ||
|
||
#import "SettingsController.h" | ||
|
||
@interface SettingsController () | ||
|
||
@end | ||
|
||
@implementation SettingsController | ||
|
||
- (void)windowDidLoad { | ||
[super windowDidLoad]; | ||
|
||
NSString *port = [NSString stringWithFormat:@"%ld", (long)self.appDelegate.listenPort]; | ||
[self.txtPort setStringValue:port]; | ||
} | ||
|
||
- (IBAction) btnOkClicked:(NSButton *)sender { | ||
NSString *s = self.txtPort.stringValue; | ||
NSInteger i = [self integerFromString:s]; | ||
self.appDelegate.listenPort = i; | ||
[self.window performClose:self]; | ||
} | ||
|
||
- (NSInteger) integerFromString:(NSString *)string { | ||
NSNumberFormatter *formatter=[[NSNumberFormatter alloc] init]; | ||
[formatter setNumberStyle:NSNumberFormatterDecimalStyle]; | ||
NSNumber *numberObj = [formatter numberFromString:string]; | ||
return [numberObj integerValue]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="19529" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct"> | ||
<dependencies> | ||
<deployment identifier="macosx"/> | ||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="19529"/> | ||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
</dependencies> | ||
<objects> | ||
<customObject id="-2" userLabel="File's Owner" customClass="SettingsController"> | ||
<connections> | ||
<outlet property="txtPort" destination="p9v-zM-5s6" id="Bas-a5-Acg"/> | ||
<outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/> | ||
</connections> | ||
</customObject> | ||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> | ||
<customObject id="-3" userLabel="Application" customClass="NSObject"/> | ||
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5"> | ||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/> | ||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> | ||
<rect key="contentRect" x="796" y="640" width="375" height="179"/> | ||
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/> | ||
<view key="contentView" id="se5-gp-TjO"> | ||
<rect key="frame" x="0.0" y="0.0" width="375" height="179"/> | ||
<autoresizingMask key="autoresizingMask"/> | ||
<subviews> | ||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jwM-bd-pt8"> | ||
<rect key="frame" x="20" y="116" width="93" height="16"/> | ||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> | ||
<textFieldCell key="cell" lineBreakMode="clipping" title="Listen Port" id="bSs-Je-WCV"> | ||
<font key="font" metaFont="system"/> | ||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> | ||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> | ||
</textFieldCell> | ||
</textField> | ||
<textField identifier="port" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="p9v-zM-5s6"> | ||
<rect key="frame" x="119" y="111" width="118" height="21"/> | ||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> | ||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" id="S3F-Uy-tnH"> | ||
<font key="font" metaFont="system"/> | ||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> | ||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> | ||
</textFieldCell> | ||
</textField> | ||
<button identifier="btnOK" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="XFd-4A-uWc"> | ||
<rect key="frame" x="252" y="13" width="110" height="32"/> | ||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> | ||
<buttonCell key="cell" type="push" title="OK" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="mcr-sn-6rs"> | ||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> | ||
<font key="font" metaFont="system"/> | ||
<string key="keyEquivalent" base64-UTF8="YES"> | ||
DQ | ||
</string> | ||
</buttonCell> | ||
<connections> | ||
<action selector="btnOkClicked:" target="-2" id="YDW-z5-ged"/> | ||
</connections> | ||
</button> | ||
</subviews> | ||
</view> | ||
<connections> | ||
<outlet property="delegate" destination="-2" id="0bl-1N-AYu"/> | ||
</connections> | ||
<point key="canvasLocation" x="36" y="-277"/> | ||
</window> | ||
</objects> | ||
</document> |