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/geometry.slint10.0 KB
1import { LineEdit, ScrollView } 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 GeometryPage inherits FocusScope {
11 in property <bool> stream-only: false;
12 in property <bool> geometry-valid: false;
13 in property <bool> geometry-save-blocked: false;
14 in property <string> geometry-result: "Enter display measurements";
15 in property <string> geometry-result-detail: "All values use pixels or millimetres";
16 in property <string> geometry-error: "";
17 in-out property <string> reference-width: "";
18 in-out property <string> reference-height: "";
19 in-out property <string> reference-diagonal: "";
20 in-out property <int> reference-aspect-ratio: 0;
21 in-out property <int> reference-rotation: 0;
22 in property <string> reference-width-suggestion: "";
23 in property <string> reference-width-suffix: "";
24 in property <string> reference-height-suggestion: "";
25 in property <string> reference-height-suffix: "";
26 in-out property <int> sizing-strategy: 0;
27
28 callback close-geometry();
29 callback geometry-edited();
30 callback strategy-selected();
31 callback save-geometry();
32
33 key-pressed(event) => {
34 if event.text == Key.Escape {
35 root.close-geometry();
36 return accept;
37 }
38 return reject;
39 }
40
41 Rectangle {
42 width: parent.width;
43 height: parent.height;
44 background: MdTokens.surface;
45
46 VerticalLayout {
47 padding: MdTokens.space-2;
48 spacing: MdTokens.space-1;
49
50 HorizontalLayout {
51 height: MdTokens.target;
52 spacing: MdTokens.space-1;
53
54 BackButton {
55 accessible-label: "Back to quick access";
56 clicked => { root.close-geometry(); }
57 }
58
59 Text {
60 text: "Manual reference";
61 color: MdTokens.on-surface;
62 font-size: MdTokens.type-title-large;
63 font-weight: MdTokens.weight-medium;
64 vertical-alignment: center;
65 }
66 }
67
68 ScrollView {
69 vertical-stretch: 1;
70
71 VerticalLayout {
72 spacing: 12px;
73
74 Rectangle {
75 height: 200px;
76 background: MdTokens.surface-container;
77 border-radius: MdTokens.shape-medium;
78
79 VerticalLayout {
80 padding: 12px;
81 spacing: 4px;
82
83 Text {
84 text: "Reference display";
85 height: 20px;
86 color: MdTokens.on-surface;
87 font-size: MdTokens.type-body-medium;
88 font-weight: MdTokens.weight-medium;
89 }
90
91 HorizontalLayout {
92 height: 48px;
93 spacing: MdTokens.space-1;
94 ResolutionLineEdit {
95 text <=> root.reference-width;
96 placeholder-text: "Width px";
97 field-label: "Reference display width in pixels";
98 suggestion: root.reference-width-suggestion;
99 suggestion-suffix: root.reference-width-suffix;
100 edited => { root.geometry-edited(); }
101 }
102 ResolutionLineEdit {
103 text <=> root.reference-height;
104 placeholder-text: "Height px";
105 field-label: "Reference display height in pixels";
106 suggestion: root.reference-height-suggestion;
107 suggestion-suffix: root.reference-height-suffix;
108 edited => { root.geometry-edited(); }
109 }
110 }
111
112 HorizontalLayout {
113 height: 48px;
114 spacing: MdTokens.space-1;
115 LineEdit {
116 text <=> root.reference-diagonal;
117 placeholder-text: "Diagonal in";
118 input-type: InputType.decimal;
119 accessible-label: "Reference display diagonal in inches";
120 edited => { root.geometry-edited(); }
121 }
122 CompactComboBox {
123 model: ["16:9", "16:10", "3:2", "4:3", "21:9", "32:9"];
124 current-index <=> root.reference-aspect-ratio;
125 field-label: "Reference display physical aspect ratio";
126 selected => { root.geometry-edited(); }
127 }
128 }
129
130 HorizontalLayout {
131 height: 48px;
132 spacing: MdTokens.space-1;
133
134 CompactComboBox {
135 model: [
136 "Landscape",
137 "Landscape (flipped)",
138 "Portrait (clockwise)",
139 "Portrait (counter-clockwise)",
140 ];
141 current-index <=> root.reference-rotation;
142 field-label: "Reference display orientation";
143 selected => { root.geometry-edited(); }
144 }
145
146 CompactComboBox {
147 model: [
148 "Physical",
149 "Rounded",
150 "Integer",
151 ];
152 current-index <=> root.sizing-strategy;
153 field-label: "Virtual display sizing strategy";
154 selected => {
155 root.strategy-selected();
156 root.geometry-edited();
157 }
158 }
159 }
160 }
161 }
162 }
163 }
164
165 Rectangle {
166 height: root.geometry-error == "" ? 64px : 84px;
167 background: root.geometry-error == ""
168 ? MdTokens.primary-container
169 : MdTokens.error-container;
170 border-radius: MdTokens.shape-medium;
171
172 VerticalLayout {
173 padding-left: 12px;
174 padding-right: 12px;
175 alignment: center;
176 spacing: 2px;
177
178 Text {
179 text: root.geometry-result;
180 color: root.geometry-error == ""
181 ? MdTokens.on-primary-container
182 : MdTokens.on-error-container;
183 font-size: MdTokens.type-title-medium;
184 font-weight: MdTokens.weight-medium;
185 }
186 Text {
187 text: root.geometry-error == ""
188 ? root.geometry-result-detail
189 : root.geometry-error;
190 color: root.geometry-error == ""
191 ? MdTokens.on-primary-container
192 : MdTokens.on-error-container;
193 font-size: MdTokens.type-body-small;
194 wrap: word-wrap;
195 }
196 }
197 }
198
199 FullWidthPrimaryButton {
200 text: root.stream-only ? "Save reference" : "Save plan";
201 enabled: root.geometry-valid && !root.geometry-save-blocked;
202 accessible-label: root.stream-only
203 ? "Save manual streaming reference display"
204 : "Save planned virtual display geometry";
205 clicked => { root.save-geometry(); }
206 }
207 }
208 }
209}
210