1
1
import { AboutSlint , Button , ComboBox , CheckBox , SpinBox , Switch , LineEdit , VerticalBox } from "std-widgets.slint" ;
2
2
import { ChannelConfigView , ChannelConfig } from "./channel-config.slint" ;
3
+ import { ToolbarButton } from "./toolbar-button.slint" ;
3
4
import { ColorUtils } from "./color-picker.slint" ;
4
5
export { ColorUtils }
5
6
6
- export enum InputType {
7
+ export enum SongInputType {
7
8
None , LSDj , GBS , VGM
8
9
}
9
10
@@ -31,7 +32,7 @@ export component MainWindow inherits Window {
31
32
in property <string > sav-path-2x : "" ;
32
33
in-out property <string > background-path : "" ;
33
34
in property <bool > input-valid : false ;
34
- in property <InputType > input-type : None;
35
+ in property <SongInputType > input-type : None;
35
36
in-out property <int > selected-track-index : -1 ;
36
37
in-out property <string > selected-track-text : "Select a track..." ;
37
38
in-out property <int > selected-track-index-2x : -1 ;
@@ -69,21 +70,26 @@ export component MainWindow inherits Window {
69
70
in property <bool > progress-error : false ;
70
71
in property <bool > progress-indeterminate : false ;
71
72
73
+ property <bool > configuration-open : true ;
74
+
72
75
property <float > i-progress-anim-tick : -cos (180deg * mod(animation-tick() / 1.3s , 2 ) / 2 ) + 1 ;
73
76
property<bool> lsdj-2 x: false ;
74
77
in property<bool> vgm-2 x: false ;
75
78
76
79
public pure function is-2 x() -> bool {
77
- (root .input-type == InputType .LSDj && root .lsdj-2 x) || (root .input-type == InputType .VGM && root .vgm-2 x)
80
+ (root .input-type == SongInputType .LSDj && root .lsdj-2 x) || (root .input-type == SongInputType .VGM && root .vgm-2 x)
78
81
}
79
82
80
83
title: "GBPresenter" ;
81
84
icon: @image-url ("gb-presenter-icon.png" ) ;
85
+ height: self .min-height;
86
+ width: self .min-width;
82
87
83
88
Rectangle {
84
- Button {
89
+ ToolbarButton {
85
90
icon: @image-url ("info.svg" ) ;
86
- x: parent .width - self .width - 8px ;
91
+ tooltip: "About" ;
92
+ x: parent .width - self .width - 16px ;
87
93
y: 16px ;
88
94
clicked => {
89
95
i-about-popup.show()
@@ -165,7 +171,6 @@ export component MainWindow inherits Window {
165
171
}
166
172
}
167
173
}
168
-
169
174
AboutSlint {
170
175
preferred-height: 100px ;
171
176
}
@@ -182,6 +187,8 @@ export component MainWindow inherits Window {
182
187
VerticalBox {
183
188
alignment: start;
184
189
spacing: 12px ;
190
+ z: -5 ;
191
+
185
192
Text {
186
193
text: "GBPresenter" ;
187
194
font-size: 32px ;
@@ -208,7 +215,7 @@ export component MainWindow inherits Window {
208
215
}
209
216
}
210
217
}
211
- if input-type == InputType .LSDj : HorizontalLayout {
218
+ if input-type == SongInputType .LSDj : HorizontalLayout {
212
219
alignment: stretch;
213
220
spacing: 8px ;
214
221
Text {
@@ -228,7 +235,7 @@ export component MainWindow inherits Window {
228
235
}
229
236
}
230
237
}
231
- if input-type == InputType .LSDj : HorizontalLayout {
238
+ if input-type == SongInputType .LSDj : HorizontalLayout {
232
239
alignment: stretch;
233
240
spacing: 8px ;
234
241
@@ -241,7 +248,7 @@ export component MainWindow inherits Window {
241
248
}
242
249
}
243
250
}
244
- if input-type == InputType .LSDj && lsdj-2 x : HorizontalLayout {
251
+ if input-type == SongInputType .LSDj && lsdj-2 x : HorizontalLayout {
245
252
alignment: stretch;
246
253
spacing: 8px ;
247
254
Text {
@@ -261,7 +268,7 @@ export component MainWindow inherits Window {
261
268
}
262
269
}
263
270
}
264
- if input-type == InputType .LSDj && lsdj-2 x : HorizontalLayout {
271
+ if input-type == SongInputType .LSDj && lsdj-2 x : HorizontalLayout {
265
272
alignment: stretch;
266
273
spacing: 8px ;
267
274
Text {
@@ -285,7 +292,7 @@ export component MainWindow inherits Window {
285
292
alignment: stretch;
286
293
spacing: 8px ;
287
294
Text {
288
- text: (input-type == InputType .LSDj && lsdj-2 x)
295
+ text: (input-type == SongInputType .LSDj && lsdj-2 x)
289
296
? "Track 1:"
290
297
: "Track:" ;
291
298
vertical-alignment: center;
@@ -300,7 +307,7 @@ export component MainWindow inherits Window {
300
307
}
301
308
}
302
309
}
303
- if input-type == InputType .LSDj && lsdj-2 x : HorizontalLayout {
310
+ if input-type == SongInputType .LSDj && lsdj-2 x : HorizontalLayout {
304
311
alignment: stretch;
305
312
spacing: 8px ;
306
313
Text {
@@ -317,7 +324,7 @@ export component MainWindow inherits Window {
317
324
}
318
325
}
319
326
}
320
- if input-type == InputType .VGM : HorizontalLayout {
327
+ if input-type == SongInputType .VGM : HorizontalLayout {
321
328
alignment: stretch;
322
329
spacing: 8px ;
323
330
@@ -365,42 +372,73 @@ export component MainWindow inherits Window {
365
372
}
366
373
}
367
374
}
368
- HorizontalLayout {
369
- alignment: end;
370
- spacing: 8px ;
371
- Text {
372
- text: "Configuration:" ;
373
- vertical-alignment: center;
375
+ TouchArea {
376
+ mouse-cursor: pointer;
377
+ clicked => {
378
+ root .configuration-open = !root .configuration-open;
374
379
}
375
- Button {
376
- text: "Import..." ;
380
+
381
+ HorizontalLayout {
382
+ alignment: start;
383
+ spacing: 8px ;
384
+
385
+ Image {
386
+ source: @image-url ("chevron-down.svg" ) ;
387
+ rotation-angle: root .configuration-open ? 0deg : -90deg ;
388
+ animate rotation-angle {
389
+ duration: 100ms ;
390
+ easing: ease-in-out;
391
+ }
392
+ }
393
+ Text {
394
+ text: "Visualizer configuration" ;
395
+ }
396
+ }
397
+ }
398
+ if root .configuration-open: HorizontalLayout {
399
+ alignment: stretch;
400
+ spacing: 8px ;
401
+
402
+ ToolbarButton {
403
+ horizontal-stretch: 0.0 ;
404
+ icon: @image-url ("arrow-import.svg" ) ;
405
+ text: "Import" ;
377
406
enabled: !rendering;
378
407
clicked => {
379
408
root .import-config();
380
409
}
381
410
}
382
- Button {
383
- text: "Export..." ;
411
+ ToolbarButton {
412
+ horizontal-stretch: 0.0 ;
413
+ icon: @image-url ("arrow-export.svg" ) ;
414
+ text: "Export" ;
384
415
enabled: !rendering;
385
416
clicked => {
386
417
root .export-config();
387
418
}
388
419
}
389
- Button {
420
+ Rectangle {
421
+ horizontal-stretch: 1.0 ;
422
+ }
423
+ ToolbarButton {
424
+ horizontal-stretch: 0.0 ;
425
+ icon: @image-url ("arrow-reset.svg" ) ;
390
426
text: "Reset" ;
391
427
enabled: !rendering;
428
+ destructive: true ;
392
429
clicked => {
393
430
root .reset-config();
394
431
}
395
432
}
396
433
}
397
- ChannelConfigView {
434
+ if root .configuration-open: ChannelConfigView {
398
435
enabled: !rendering;
399
436
active-chips: root .is-2 x()
400
437
? ["LR35902" , "LR35902 (2x)" ]
401
438
: ["LR35902" ];
402
439
config-lr35902 <=> root .config-lr35902 ;
403
440
config-lr35902-2 x <=> root .config-lr35902-2 x;
441
+ z: -10 ;
404
442
}
405
443
HorizontalLayout {
406
444
alignment: stretch;
@@ -444,8 +482,8 @@ export component MainWindow inherits Window {
444
482
}
445
483
}
446
484
ComboBox {
447
- model: input-type == InputType .VGM ? ["seconds" , "frames" , "loops" ]
448
- : input-type == InputType .LSDj ? ["seconds" , "frames" , "loops" ]
485
+ model: input-type == SongInputType .VGM ? ["seconds" , "frames" , "loops" ]
486
+ : input-type == SongInputType .LSDj ? ["seconds" , "frames" , "loops" ]
449
487
: ["seconds" , "frames" ];
450
488
current-value <=> track-duration-type;
451
489
enabled: !rendering;
0 commit comments