Skip to content

Commit 0c7865e

Browse files
committed
CHG: modify ui
1 parent cabaeb9 commit 0c7865e

51 files changed

Lines changed: 6302 additions & 4941 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

macOS/APIExample.xcodeproj/project.pbxproj

Lines changed: 46 additions & 18 deletions
Large diffs are not rendered by default.

macOS/APIExample/Base.lproj/Main.storyboard

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@
734734
<viewController id="frP-Og-4hq" customClass="MenuController" customModule="APIExample" customModuleProvider="target" sceneMemberID="viewController">
735735
<view key="view" id="bDS-2Z-AsB">
736736
<rect key="frame" x="0.0" y="0.0" width="280" height="602"/>
737-
<autoresizingMask key="autoresizingMask"/>
737+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" heightSizable="YES"/>
738738
<subviews>
739739
<scrollView fixedFrame="YES" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Jvf-iG-0lJ">
740740
<rect key="frame" x="0.0" y="30" width="280" height="572"/>
@@ -750,7 +750,7 @@
750750
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
751751
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
752752
<tableColumns>
753-
<tableColumn width="266" minWidth="10" maxWidth="3.4028234663852886e+38" id="b03-7M-wbu">
753+
<tableColumn width="237" minWidth="10" maxWidth="3.4028234663852886e+38" id="b03-7M-wbu">
754754
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left">
755755
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
756756
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -763,11 +763,11 @@
763763
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
764764
<prototypeCellViews>
765765
<tableCellView identifier="menuCell" id="2hx-oV-azK">
766-
<rect key="frame" x="1" y="1" width="275" height="17"/>
766+
<rect key="frame" x="1" y="1" width="246" height="17"/>
767767
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
768768
<subviews>
769769
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Yoo-BB-x79">
770-
<rect key="frame" x="20" y="0.0" width="275" height="17"/>
770+
<rect key="frame" x="20" y="0.0" width="246" height="17"/>
771771
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
772772
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="qG2-7c-SRN">
773773
<font key="font" metaFont="system"/>
@@ -781,11 +781,11 @@
781781
</connections>
782782
</tableCellView>
783783
<tableCellView identifier="headerCell" id="uWY-5d-ieJ">
784-
<rect key="frame" x="1" y="20" width="275" height="17"/>
784+
<rect key="frame" x="1" y="20" width="246" height="17"/>
785785
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
786786
<subviews>
787787
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="QTx-vV-DAq">
788-
<rect key="frame" x="20" y="0.0" width="275" height="14"/>
788+
<rect key="frame" x="20" y="0.0" width="246" height="14"/>
789789
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
790790
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="Nlt-pS-UAz">
791791
<font key="font" metaFont="systemBold" size="10"/>
@@ -810,7 +810,7 @@
810810
</clipView>
811811
<edgeInsets key="contentInsets" left="0.0" right="0.0" top="20" bottom="0.0"/>
812812
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="Bqm-bb-aGK">
813-
<rect key="frame" x="1" y="583" width="238" height="16"/>
813+
<rect key="frame" x="-100" y="-100" width="238" height="16"/>
814814
<autoresizingMask key="autoresizingMask"/>
815815
</scroller>
816816
<scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="iWF-Ou-WIP">

macOS/APIExample/Base.lproj/Settings.storyboard

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@
1111
<objects>
1212
<viewController title="Settings" storyboardIdentifier="Settings" id="58f-m9-Rc4" customClass="SettingsController" customModule="APIExample" customModuleProvider="target" sceneMemberID="viewController">
1313
<view key="view" id="pGL-28-S71">
14-
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
15-
<autoresizingMask key="autoresizingMask"/>
14+
<rect key="frame" x="0.0" y="0.0" width="500" height="600"/>
15+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
1616
<subviews>
1717
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dae-jL-GB0">
18-
<rect key="frame" x="18" y="559" width="564" height="21"/>
18+
<rect key="frame" x="18" y="559" width="464" height="21"/>
1919
<textFieldCell key="cell" lineBreakMode="clipping" alignment="left" title="Video Configuration" id="f6a-rb-HgK">
2020
<font key="font" metaFont="system" size="18"/>
2121
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
2222
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
2323
</textFieldCell>
2424
</textField>
2525
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0gx-V8-KN1">
26-
<rect key="frame" x="18" y="521" width="395" height="18"/>
26+
<rect key="frame" x="18" y="521" width="295" height="18"/>
2727
<constraints>
28-
<constraint firstAttribute="width" constant="391" id="Chg-Vx-lff"/>
28+
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="200" id="Chg-Vx-lff"/>
2929
</constraints>
3030
<textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="prH-7S-pht">
3131
<font key="font" usesAppearanceFont="YES"/>
@@ -34,17 +34,17 @@
3434
</textFieldCell>
3535
</textField>
3636
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8ck-Ow-7rf">
37-
<rect key="frame" x="18" y="449" width="564" height="21"/>
37+
<rect key="frame" x="18" y="449" width="464" height="21"/>
3838
<textFieldCell key="cell" lineBreakMode="clipping" alignment="left" title="Meta Data" id="zLR-cI-iJ0">
3939
<font key="font" metaFont="system" size="18"/>
4040
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
4141
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
4242
</textFieldCell>
4343
</textField>
4444
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="FKk-R7-n5E">
45-
<rect key="frame" x="18" y="497" width="395" height="16"/>
45+
<rect key="frame" x="18" y="497" width="295" height="16"/>
4646
<constraints>
47-
<constraint firstAttribute="width" constant="391" id="xHf-U4-H7H"/>
47+
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="200" id="xHf-U4-H7H"/>
4848
</constraints>
4949
<textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="p8T-Wv-8fv">
5050
<font key="font" usesAppearanceFont="YES"/>
@@ -53,7 +53,7 @@
5353
</textFieldCell>
5454
</textField>
5555
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ADC-m5-Fbc">
56-
<rect key="frame" x="418" y="516" width="166" height="25"/>
56+
<rect key="frame" x="318" y="516" width="166" height="25"/>
5757
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="POp-cQ-sOq">
5858
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
5959
<font key="font" metaFont="menu"/>
@@ -75,7 +75,7 @@
7575
</textFieldCell>
7676
</textField>
7777
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ZdP-fi-5yU">
78-
<rect key="frame" x="418" y="491" width="166" height="25"/>
78+
<rect key="frame" x="318" y="491" width="166" height="25"/>
7979
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="52h-yr-OzS">
8080
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
8181
<font key="font" metaFont="menu"/>
@@ -86,7 +86,7 @@
8686
</connections>
8787
</popUpButton>
8888
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1ju-Qi-n55">
89-
<rect key="frame" x="419" y="418" width="163" height="16"/>
89+
<rect key="frame" x="319" y="418" width="163" height="16"/>
9090
<constraints>
9191
<constraint firstAttribute="width" constant="159" id="GFM-fy-Ilw"/>
9292
</constraints>
@@ -137,7 +137,7 @@
137137
</viewController>
138138
<customObject id="O7G-Ix-9SN" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
139139
</objects>
140-
<point key="canvasLocation" x="-87" y="137"/>
140+
<point key="canvasLocation" x="-137.5" y="137"/>
141141
</scene>
142142
<!--View Controller-->
143143
<scene sceneID="VHG-8a-79z">

macOS/APIExample/Commons/BaseViewController.swift

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,13 @@
99
import Cocoa
1010
import AGEVideoLayout
1111

12+
protocol BaseView: NSViewController {
13+
func showAlert(title: String?, message: String)
14+
func viewWillBeRemovedFromSplitView()
15+
}
1216

13-
class BaseViewController: NSViewController {
17+
class BaseViewController: NSViewController, BaseView {
1418
var configs: [String:Any] = [:]
15-
override func viewDidLoad() {
16-
// self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Show Log",
17-
// style: .plain,
18-
// target: self,
19-
// action: #selector(showLog))
20-
// LogUtils.removeAll()
21-
}
2219

2320
func showAlert(title: String? = nil, message: String) {
2421
let alert = NSAlert()
@@ -36,9 +33,7 @@ class BaseViewController: NSViewController {
3633
return "AUDIO ONLY\n\(isLocal ? "Local" : "Remote")\n\(uid)"
3734
}
3835

39-
func viewWillBeRemovedFromSplitView() {
40-
41-
}
36+
func viewWillBeRemovedFromSplitView() {}
4237
}
4338

4439
extension AGEVideoContainer {

macOS/APIExample/Commons/Configs.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ struct Resolution {
1919
}
2020
}
2121

22+
struct Layout {
23+
let label: String
24+
let value: Int
25+
26+
init(_ k: String, _ v: Int) {
27+
self.label = k
28+
self.value = v
29+
}
30+
}
31+
2232
class Configs {
2333
static var defaultResolutionIdx: Int = 2
2434
static var Resolutions:[Resolution] = [

macOS/APIExample/Commons/VideoView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extension NibLoadable where Self: NSView {
2929
}
3030
}
3131

32-
class VideoView: NSView,NibLoadable {
32+
class VideoView: NSView, NibLoadable {
3333
@IBOutlet weak var placeholder: NSTextField!
3434
@IBOutlet weak var videocanvas: NSView!
3535
@IBOutlet weak var infolabel: NSTextField!

macOS/APIExample/Commons/component/AgoraState.swift

Lines changed: 0 additions & 14 deletions
This file was deleted.

macOS/APIExample/Commons/component/RolePicker.swift

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
//
2+
// Input.swift
3+
// APIExample
4+
//
5+
// Created by XC on 2020/12/21.
6+
// Copyright © 2020 Agora Corp. All rights reserved.
7+
//
8+
9+
import Cocoa
10+
11+
class Input: NSView {
12+
13+
@IBOutlet var contentView: NSView!
14+
@IBOutlet weak var label: NSTextField!
15+
@IBOutlet weak var field: NSTextField!
16+
17+
var isEnabled: Bool {
18+
get {
19+
field.isEnabled
20+
}
21+
set {
22+
field.isEnabled = newValue
23+
}
24+
}
25+
26+
var stringValue: String {
27+
get {
28+
field.stringValue
29+
}
30+
set {
31+
field.stringValue = newValue
32+
}
33+
}
34+
35+
override init(frame frameRect: NSRect) {
36+
super.init(frame: frameRect)
37+
initUI()
38+
}
39+
40+
required init?(coder: NSCoder) {
41+
super.init(coder: coder)
42+
initUI()
43+
}
44+
45+
open func initUI() {
46+
let bundle = Bundle(for: type(of: self))
47+
let nib = NSNib(nibNamed: .init("Input"), bundle: bundle)!
48+
nib.instantiate(withOwner: self, topLevelObjects: nil)
49+
50+
addSubview(contentView)
51+
label.cell?.title = title()
52+
field.placeholderString = placeholderString()
53+
}
54+
55+
open func title() -> String {
56+
return "Label"
57+
}
58+
59+
open func placeholderString() -> String {
60+
return ""
61+
}
62+
}

0 commit comments

Comments
 (0)