Evan's Blog
EvanZhu0721 / 公开仓库

SBMS

镜像已同步

SBMS complete the calculation rules for the default logical desktop topology relationship and the physical dimensions of the displays in the Windows multi-screen collaboration system.

上游 GitHub
READ-ONLY MIRROR

README、源码与 Release 已保存到本站;源码视图固定到 commit bd87fa1e。

main/ root / ui/pages
bd87fa1e· 固定源码快照
ui/pages/stream.slint9.4 KB
1import { LineEdit } from "std-widgets.slint";
2import {
3 BackButton,
4 CompactComboBox,
5 FullWidthPrimaryButton,
6 ResolutionLineEdit,
7} from "../controls.slint";
8import { MdTokens } from "../theme.slint";
9
10export component StreamPage inherits FocusScope {
11 in-out property <string> stream-width: "3840";
12 in-out property <string> stream-height: "2160";
13 in-out property <string> stream-diagonal: "";
14 in-out property <string> stream-refresh: "60";
15 in-out property <int> stream-aspect-ratio-index: 1;
16 in-out property <int> stream-rotation: 0;
17 in property <string> stream-width-suggestion: "";
18 in property <string> stream-width-suffix: "";
19 in property <string> stream-height-suggestion: "";
20 in property <string> stream-height-suffix: "";
21 in property <string> stream-aspect-ratio: "";
22 in property <string> stream-result: "Configure the streaming screen";
23 in property <string> stream-result-detail: "Reference geometry determines the virtual mode";
24 in property <string> stream-error: "";
25
26 callback close-stream-config();
27 callback stream-edited();
28 callback save-stream-config();
29
30 key-pressed(event) => {
31 if event.text == Key.Escape {
32 root.close-stream-config();
33 return accept;
34 }
35 return reject;
36 }
37
38 Rectangle {
39 width: parent.width;
40 height: parent.height;
41 background: MdTokens.surface;
42
43 VerticalLayout {
44 padding: MdTokens.space-2;
45 spacing: MdTokens.space-1;
46
47 HorizontalLayout {
48 height: MdTokens.target;
49 spacing: MdTokens.space-1;
50 BackButton {
51 accessible-label: "Back to mapping group";
52 clicked => { root.close-stream-config(); }
53 }
54 Text {
55 text: "Streaming screen";
56 color: MdTokens.on-surface;
57 font-size: MdTokens.type-title-large;
58 font-weight: MdTokens.weight-medium;
59 vertical-alignment: center;
60 }
61 }
62
63 Rectangle {
64 height: 260px;
65 background: MdTokens.surface-container;
66 border-radius: MdTokens.shape-medium;
67
68 VerticalLayout {
69 padding: 12px;
70 spacing: MdTokens.space-1;
71 Text {
72 text: "Screen mode";
73 color: MdTokens.on-surface;
74 font-size: MdTokens.type-body-medium;
75 font-weight: MdTokens.weight-medium;
76 }
77 HorizontalLayout {
78 height: 48px;
79 spacing: MdTokens.space-1;
80 ResolutionLineEdit {
81 text <=> root.stream-width;
82 placeholder-text: "Width px";
83 field-label: "Streaming screen width in pixels";
84 suggestion: root.stream-width-suggestion;
85 suggestion-suffix: root.stream-width-suffix;
86 edited => { root.stream-edited(); }
87 }
88 ResolutionLineEdit {
89 text <=> root.stream-height;
90 placeholder-text: "Height px";
91 field-label: "Streaming screen height in pixels";
92 suggestion: root.stream-height-suggestion;
93 suggestion-suffix: root.stream-height-suffix;
94 edited => { root.stream-edited(); }
95 }
96 }
97 HorizontalLayout {
98 height: 48px;
99 spacing: MdTokens.space-1;
100 LineEdit {
101 text <=> root.stream-diagonal;
102 placeholder-text: "Diagonal in";
103 input-type: InputType.decimal;
104 accessible-label: "Streaming screen diagonal in inches";
105 edited => { root.stream-edited(); }
106 }
107 LineEdit {
108 text <=> root.stream-refresh;
109 placeholder-text: "Refresh Hz";
110 input-type: InputType.decimal;
111 accessible-label: "Streaming screen refresh rate in hertz";
112 edited => { root.stream-edited(); }
113 }
114 }
115 HorizontalLayout {
116 height: 48px;
117 spacing: MdTokens.space-2;
118 Text {
119 width: 132px;
120 text: "Screen ratio";
121 color: MdTokens.on-surface-variant;
122 font-size: MdTokens.type-body-medium;
123 vertical-alignment: center;
124 }
125 CompactComboBox {
126 model: ["16:9", "16:10", "3:2", "4:3", "21:9", "32:9"];
127 current-index <=> root.stream-aspect-ratio-index;
128 field-label: "Streaming screen physical aspect ratio";
129 selected => { root.stream-edited(); }
130 }
131 }
132 HorizontalLayout {
133 height: 48px;
134 spacing: MdTokens.space-2;
135 Text {
136 width: 132px;
137 text: "Direction";
138 color: MdTokens.on-surface-variant;
139 font-size: MdTokens.type-body-medium;
140 vertical-alignment: center;
141 }
142 CompactComboBox {
143 model: [
144 "Landscape",
145 "Landscape (flipped)",
146 "Portrait (clockwise)",
147 "Portrait (counter-clockwise)",
148 ];
149 current-index <=> root.stream-rotation;
150 field-label: "Streaming screen orientation";
151 selected => { root.stream-edited(); }
152 }
153 }
154 }
155 }
156
157 Rectangle {
158 height: 76px;
159 background: root.stream-error == ""
160 ? MdTokens.primary-container : MdTokens.error-container;
161 border-radius: MdTokens.shape-medium;
162 VerticalLayout {
163 padding: 12px;
164 alignment: center;
165 spacing: 3px;
166 Text {
167 text: root.stream-error == ""
168 ? root.stream-result
169 : "Check the values";
170 color: root.stream-error == ""
171 ? MdTokens.on-primary-container : MdTokens.on-error-container;
172 font-size: MdTokens.type-title-medium;
173 font-weight: MdTokens.weight-medium;
174 }
175 Text {
176 text: root.stream-error == ""
177 ? root.stream-result-detail
178 : root.stream-error;
179 color: root.stream-error == ""
180 ? MdTokens.on-primary-container : MdTokens.on-error-container;
181 font-size: MdTokens.type-body-small;
182 wrap: word-wrap;
183 }
184 }
185 }
186
187 Rectangle { vertical-stretch: 1; }
188
189 FullWidthPrimaryButton {
190 text: "Save screen";
191 enabled: root.stream-error == "";
192 accessible-label: "Save stream-only screen mode";
193 clicked => { root.save-stream-config(); }
194 }
195 }
196 }
197}
198