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 a37d6c4b。

main/ root / ui
a37d6c4b· 固定源码快照
ui/seven-segment.slint4.4 KB
1import { MdTokens } from "theme.slint";
2
3component SegmentGlyph inherits Rectangle {
4 in property <int> glyph;
5 in property <brush> lit-color;
6 property <brush> dim-color: transparent;
7
8 width: 14px;
9 height: 24px;
10 background: transparent;
11
12 // Segment order: a, b, c, d, e, f, g.
13 Rectangle {
14 x: 2px; y: 0px; width: 10px; height: 2px;
15 background: root.glyph == 0 || root.glyph == 2 || root.glyph == 3
16 || root.glyph == 5 || root.glyph == 6 || root.glyph == 7
17 || root.glyph == 8 || root.glyph == 9 || root.glyph == 10
18 || root.glyph == 14
19 ? root.lit-color : root.dim-color;
20 }
21 Rectangle {
22 x: 12px; y: 2px; width: 2px; height: 9px;
23 background: root.glyph == 0 || root.glyph == 1 || root.glyph == 2
24 || root.glyph == 3 || root.glyph == 4 || root.glyph == 7
25 || root.glyph == 8 || root.glyph == 9 || root.glyph == 14
26 ? root.lit-color : root.dim-color;
27 }
28 Rectangle {
29 x: 12px; y: 13px; width: 2px; height: 9px;
30 background: root.glyph == 0 || root.glyph == 1 || root.glyph == 3
31 || root.glyph == 4 || root.glyph == 5 || root.glyph == 6
32 || root.glyph == 7 || root.glyph == 8 || root.glyph == 9
33 || root.glyph == 13 || root.glyph == 14
34 ? root.lit-color : root.dim-color;
35 }
36 Rectangle {
37 x: 2px; y: 22px; width: 10px; height: 2px;
38 background: root.glyph == 0 || root.glyph == 2 || root.glyph == 3
39 || root.glyph == 5 || root.glyph == 6 || root.glyph == 8
40 || root.glyph == 9 || root.glyph == 10
41 ? root.lit-color : root.dim-color;
42 }
43 Rectangle {
44 x: 0px; y: 13px; width: 2px; height: 9px;
45 background: root.glyph == 0 || root.glyph == 2 || root.glyph == 6
46 || root.glyph == 8 || root.glyph == 10 || root.glyph == 11
47 || root.glyph == 13 || root.glyph == 14
48 ? root.lit-color : root.dim-color;
49 }
50 Rectangle {
51 x: 0px; y: 2px; width: 2px; height: 9px;
52 background: root.glyph == 0 || root.glyph == 4 || root.glyph == 5
53 || root.glyph == 6 || root.glyph == 8 || root.glyph == 9
54 || root.glyph == 10 || root.glyph == 14
55 ? root.lit-color : root.dim-color;
56 }
57 Rectangle {
58 x: 2px; y: 11px; width: 10px; height: 2px;
59 background: root.glyph == 2 || root.glyph == 3 || root.glyph == 4
60 || root.glyph == 5 || root.glyph == 6 || root.glyph == 8
61 || root.glyph == 9 || root.glyph == 10 || root.glyph == 11
62 || root.glyph == 12 || root.glyph == 13 || root.glyph == 14
63 ? root.lit-color : root.dim-color;
64 }
65}
66
67export component SevenSegmentDisplay inherits Rectangle {
68 in property <int> fps;
69 in property <bool> valid;
70 in property <bool> running;
71 in property <bool> error;
72 in property <bool> not-a-number;
73 property <int> clamped-fps: Math.min(Math.max(root.fps, 0), 999);
74 property <brush> segment-color: root.error ? MdTokens.error : MdTokens.primary;
75
76 width: 76px;
77 height: 36px;
78 background: transparent;
79 accessible-role: text;
80 accessible-label: root.error
81 ? "Mapping error"
82 : (root.not-a-number ? "Stream only output has no local frame rate"
83 : (root.running && root.valid
84 ? "Mapping frame rate " + root.clamped-fps + " frames per second"
85 : "Mapping frame rate unavailable"));
86
87 HorizontalLayout {
88 padding-left: 9px;
89 padding-right: 9px;
90 padding-top: 6px;
91 padding-bottom: 6px;
92 spacing: 4px;
93 alignment: center;
94
95 SegmentGlyph {
96 glyph: root.error ? 10
97 : (root.not-a-number ? 13
98 : (root.running && root.valid
99 ? Math.mod(Math.floor(root.clamped-fps / 100), 10) : 12));
100 lit-color: root.segment-color;
101 }
102 SegmentGlyph {
103 glyph: root.error ? 11
104 : (root.not-a-number ? 14
105 : (root.running && root.valid
106 ? Math.mod(Math.floor(root.clamped-fps / 10), 10) : 12));
107 lit-color: root.segment-color;
108 }
109 SegmentGlyph {
110 glyph: root.error ? 11
111 : (root.not-a-number ? 13
112 : (root.running && root.valid ? Math.mod(root.clamped-fps, 10) : 12));
113 lit-color: root.segment-color;
114 }
115 }
116}
117
118