1 | // Copyright © SixtyFPS GmbH <info@slint.dev> |
2 | // SPDX-License-Identifier: MIT |
3 | |
4 | import { |
5 | AboutSlint, Button, GridBox, HorizontalBox, LineEdit, Slider, |
6 | StandardButton, StandardListView, TabWidget, VerticalBox |
7 | } from "std-widgets.slint" ; |
8 | |
9 | import "../printerdemo/ui/fonts/NotoSans-Regular.ttf" ; |
10 | |
11 | export component Demo inherits Window { |
12 | in property <string> firmware-vendor; |
13 | in property <string> firmware-version; |
14 | in property <string> uefi-version; |
15 | in property <bool> secure-boot; |
16 | |
17 | default-font-size: 22px; |
18 | default-font-family: "Noto Sans" ; |
19 | |
20 | TabWidget { |
21 | width: root.width; |
22 | height: root.height; |
23 | |
24 | Tab { |
25 | title: "Info" ; |
26 | GridBox { |
27 | Row { Rectangle {} } |
28 | |
29 | Row { |
30 | Text { |
31 | colspan: 2; |
32 | text: "UEFI Demo" ; |
33 | horizontal-alignment: center; |
34 | font-size: 44px; |
35 | font-weight: 600; |
36 | } |
37 | } |
38 | |
39 | Row { |
40 | HorizontalLayout { |
41 | colspan: 2; |
42 | alignment: center; |
43 | AboutSlint { |
44 | width: 256px; |
45 | } |
46 | } |
47 | } |
48 | |
49 | Row { |
50 | Text { text: "Firmware vendor:" ; horizontal-alignment: right; } |
51 | Text { text: firmware-vendor; } |
52 | } |
53 | |
54 | Row { |
55 | Text { text: "Firmware version:" ; horizontal-alignment: right; } |
56 | Text { text: firmware-version; } |
57 | } |
58 | |
59 | Row { |
60 | Text { text: "UEFI version:" ; horizontal-alignment: right; } |
61 | Text { text: uefi-version; } |
62 | } |
63 | |
64 | Row { |
65 | Text { text: "Secure boot:" ; horizontal-alignment: right; } |
66 | Text { text: secure-boot ? "enabled" : "disabled" ; } |
67 | } |
68 | |
69 | Row { |
70 | Text { text: "Resolution:" ; horizontal-alignment: right; } |
71 | Text { text: "\{floor(root.width / 1px)}x\{floor(root.height / 1px)}" ; } |
72 | } |
73 | |
74 | Row { Rectangle {} } |
75 | } |
76 | } |
77 | |
78 | Tab { |
79 | title: "Widgets" ; |
80 | |
81 | VerticalBox { |
82 | enabler := Button { |
83 | checked: true; |
84 | checkable: true; |
85 | text: "Widgets enabled" ; |
86 | } |
87 | |
88 | LineEdit { |
89 | enabled: enabler.checked; |
90 | placeholder-text: "Edit Me!" ; |
91 | } |
92 | |
93 | Slider { |
94 | enabled: enabler.checked; |
95 | } |
96 | |
97 | StandardListView { |
98 | vertical-stretch: 1; |
99 | enabled: enabler.checked; |
100 | model: [ |
101 | { text: "Abydos" }, { text: "Asuras" }, { text: "Athos" }, |
102 | { text: "Celestis" }, { text: "Chulak" }, { text: "Dakara" }, |
103 | { text: "Earth" }, { text: "Langara" }, { text: "Tollana" }, |
104 | ]; |
105 | } |
106 | |
107 | HorizontalBox { |
108 | alignment: center; |
109 | |
110 | StandardButton { enabled: enabler.checked; kind: ok; } |
111 | StandardButton { enabled: enabler.checked; kind: reset; } |
112 | StandardButton { enabled: enabler.checked; kind: abort; } |
113 | } |
114 | } |
115 | } |
116 | |
117 | Tab { |
118 | title: "V-Sync" ; |
119 | |
120 | Rectangle { |
121 | for color[index] in [ |
122 | #fff, #f00, #0f0, |
123 | #00f, #0ff, #ff0, |
124 | #f0f]: Rectangle { |
125 | y: 0; |
126 | height: parent.height; |
127 | x: (parent.width - self.width) * 0.5 * |
128 | (1 + 1.1 * sin(animation-tick() * (index + 1) / 17ms * 1deg)); |
129 | width: 25px + 100px * abs(sin(animation-tick() / 25ms * 1deg)); |
130 | background: color; |
131 | } |
132 | } |
133 | } |
134 | } |
135 | } |
136 | |