58 lines
1.4 KiB
Plaintext
58 lines
1.4 KiB
Plaintext
import { Palette } from "../_imports/coop-widgets.slint";
|
|
import { Clickable } from "clickable.slint";
|
|
|
|
export global MediaLogic {
|
|
pure callback play-pause();
|
|
pure callback next();
|
|
pure callback previous();
|
|
in-out property <bool> playing;
|
|
in-out property <string> now_playing: "Loading...";
|
|
}
|
|
|
|
export component Buttons {
|
|
HorizontalLayout {
|
|
width: 450px;
|
|
Clickable {
|
|
icon: @image-url("../../icons/media-controls/back.png");
|
|
action => {
|
|
MediaLogic.previous();
|
|
}
|
|
}
|
|
|
|
Clickable {
|
|
icon: MediaLogic.playing ? @image-url("../../icons/media-controls/pause.png"): @image-url("../../icons/media-controls/play.png");
|
|
action => {
|
|
MediaLogic.playing = !MediaLogic.playing;
|
|
MediaLogic.play-pause();
|
|
}
|
|
}
|
|
Clickable {
|
|
icon: @image-url("../../icons/media-controls/skip.png");
|
|
action => {
|
|
MediaLogic.next();
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
export component MediaControls inherits Clickable {
|
|
|
|
VerticalLayout {
|
|
alignment: center;
|
|
|
|
Buttons { }
|
|
Text {
|
|
horizontal-alignment: center;
|
|
color: Palette.foreground;
|
|
text: MediaLogic.now_playing;
|
|
font-size:35px;
|
|
font-weight: 600;
|
|
wrap: word-wrap;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|