blueprint-compiler format

This commit is contained in:
Erica Z 2024-11-05 09:29:08 +01:00
parent 630b44b352
commit f016778f5e
5 changed files with 109 additions and 75 deletions

View file

@ -5,7 +5,7 @@ template $AudreyUiPlayQueue: Adw.Bin {
name: "play-queue"; name: "play-queue";
child: Stack { child: Stack {
visible-child-name: bind $visible_child_name (template.model as <$GListStore>.n-items) as <string>; visible-child-name: bind $visible_child_name(template.model as <$GListStore>.n-items) as <string>;
StackPage { StackPage {
name: "empty"; name: "empty";
@ -27,17 +27,16 @@ template $AudreyUiPlayQueue: Adw.Bin {
ListView view { ListView view {
show-separators: true; show-separators: true;
single-click-activate: true; single-click-activate: true;
activate => $on_row_activated() swapped;
activate => $on_row_activated () swapped;
model: NoSelection { model: NoSelection {
model: bind template.model; model: bind template.model;
}; };
factory: SignalListItemFactory { factory: SignalListItemFactory {
setup => $on_song_list_setup () swapped; setup => $on_song_list_setup() swapped;
bind => $on_song_list_bind () swapped; bind => $on_song_list_bind() swapped;
unbind => $on_song_list_unbind () swapped; unbind => $on_song_list_unbind() swapped;
}; };
} }
}; };

View file

@ -24,7 +24,11 @@ template $AudreyUiPlayQueueSong: Box {
focusable: false; focusable: false;
halign: end; halign: end;
justify: right; justify: right;
styles [ "dim-label", "numeric" ]
styles [
"dim-label",
"numeric"
]
label: bind template.displayed_position; label: bind template.displayed_position;
} }
@ -35,21 +39,30 @@ template $AudreyUiPlayQueueSong: Box {
margin-top: 1; margin-top: 1;
margin-bottom: 1; margin-bottom: 1;
pixel-size: 50; pixel-size: 50;
//paintable: bind template.song as <$AudreyPlaybinSong>.thumbnail; // paintable: bind template.song as <$AudreyPlaybinSong>.thumbnail;
} }
Box title_box { Box title_box {
styles [ "header"] styles [
"header"
]
focusable: false; focusable: false;
hexpand: true; hexpand: true;
valign: center; valign: center;
Box { Box {
styles [ "title" ] styles [
"title"
]
orientation: vertical; orientation: vertical;
Label { Label {
styles [ "title" ] styles [
"title"
]
focusable: false; focusable: false;
xalign: 0; xalign: 0;
halign: start; halign: start;
@ -57,12 +70,14 @@ template $AudreyUiPlayQueueSong: Box {
ellipsize: end; ellipsize: end;
max-width-chars: 90; max-width-chars: 90;
justify: fill; justify: fill;
label: bind template.song as <$AudreyPlaybinSong>.title; label: bind template.song as <$AudreyPlaybinSong>.title;
} }
Label { Label {
styles [ "subtitle" ] styles [
"subtitle"
]
focusable: false; focusable: false;
xalign: 0; xalign: 0;
halign: start; halign: start;
@ -70,7 +85,6 @@ template $AudreyUiPlayQueueSong: Box {
ellipsize: end; ellipsize: end;
max-width-chars: 90; max-width-chars: 90;
justify: fill; justify: fill;
label: bind template.song as <$AudreyPlaybinSong>.artist; label: bind template.song as <$AudreyPlaybinSong>.artist;
} }
} }
@ -81,24 +95,36 @@ template $AudreyUiPlayQueueSong: Box {
halign: end; halign: end;
hexpand: true; hexpand: true;
single-line-mode: true; single-line-mode: true;
styles [ "numeric", "dim-label" ]
label: bind $format_duration (template.song as <$AudreyPlaybinSong>.duration) as <string>; styles [
"numeric",
"dim-label"
]
label: bind $format_duration(template.song as <$AudreyPlaybinSong>.duration) as <string>;
} }
Button { Button {
focusable: true; focusable: true;
// TODO icon-name: bind $star_button_icon_name (template.song as <$AudreyPlaybinSong>.starred) as <string>; // TODO icon-name: bind $star_button_icon_name (template.song as <$AudreyPlaybinSong>.starred) as <string>;
icon-name: bind $star_button_icon_name () as <string>; icon-name: bind $star_button_icon_name() as <string>;
styles [ "flat" ]
styles [
"flat"
]
valign: center; valign: center;
} }
MenuButton { MenuButton {
//visible: false; // visible: false;
focusable: true; focusable: true;
icon-name: "view-more"; icon-name: "view-more";
styles [ "flat" ]
styles [
"flat"
]
valign: center; valign: center;
popover: PopoverMenu { popover: PopoverMenu {
@ -109,17 +135,15 @@ template $AudreyUiPlayQueueSong: Box {
DragSource { DragSource {
actions: move; actions: move;
propagation-phase: capture; propagation-phase: capture;
prepare => $on_drag_prepare() swapped;
prepare => $on_drag_prepare () swapped; drag-begin => $on_drag_begin() swapped;
drag-begin => $on_drag_begin () swapped;
} }
DropTarget { DropTarget {
actions: move; actions: move;
formats: "AudreyUiPlayQueueSong"; formats: "AudreyUiPlayQueueSong";
preload: true; preload: true;
drop => $on_drop() swapped;
drop => $on_drop () swapped;
} }
} }

View file

@ -4,6 +4,7 @@ using Adw 1;
template $AudreyUiPlaybar: Adw.Bin { template $AudreyUiPlaybar: Adw.Bin {
child: CenterBox { child: CenterBox {
hexpand: true; hexpand: true;
styles [ styles [
"toolbar", "toolbar",
] ]
@ -12,8 +13,7 @@ template $AudreyUiPlaybar: Adw.Bin {
Box { Box {
AspectFrame { AspectFrame {
visible: false; // FIXME annoying annoying annoying annoying visible: false; // FIXME annoying annoying annoying annoying
//visible: bind template.show_cover_art; // visible: bind template.show_cover_art;
vexpand: true; vexpand: true;
ratio: 1.0; ratio: 1.0;
obey-child: false; obey-child: false;
@ -30,24 +30,33 @@ template $AudreyUiPlaybar: Adw.Bin {
valign: center; valign: center;
Label { Label {
styles [ "heading" ] styles [
"heading"
]
xalign: 0; xalign: 0;
halign: start; halign: start;
label: bind $song_title (template.song) as <string>; label: bind $song_title(template.song) as <string>;
ellipsize: end; ellipsize: end;
} }
Label { Label {
styles [ "caption" ] styles [
"caption"
]
xalign: 0; xalign: 0;
label: bind $song_artist (template.song) as <string>; label: bind $song_artist(template.song) as <string>;
ellipsize: end; ellipsize: end;
} }
Label { Label {
styles [ "caption" ] styles [
"caption"
]
xalign: 0; xalign: 0;
label: bind $song_album (template.song) as <string>; label: bind $song_album(template.song) as <string>;
ellipsize: end; ellipsize: end;
} }
} }
@ -66,7 +75,7 @@ template $AudreyUiPlaybar: Adw.Bin {
"numeric", "numeric",
] ]
label: bind $format_timestamp (template.position) as <string>; label: bind $format_timestamp(template.position) as <string>;
} }
[center] [center]
@ -74,15 +83,14 @@ template $AudreyUiPlaybar: Adw.Bin {
name: "seek-scale"; name: "seek-scale";
orientation: horizontal; orientation: horizontal;
width-request: 400; width-request: 400;
//sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>; // sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>;
adjustment: Adjustment { adjustment: Adjustment {
lower: 0; lower: 0;
value: bind template.position; value: bind template.position;
upper: bind template.duration; upper: bind template.duration;
}; };
change-value => $on_play_position_seek () swapped; change-value => $on_play_position_seek() swapped;
} }
[end] [end]
@ -92,7 +100,7 @@ template $AudreyUiPlaybar: Adw.Bin {
"numeric", "numeric",
] ]
label: bind $format_timestamp (template.duration) as <string>; label: bind $format_timestamp(template.duration) as <string>;
} }
} }
@ -103,41 +111,36 @@ template $AudreyUiPlaybar: Adw.Bin {
Button { Button {
icon-name: "media-skip-backward"; icon-name: "media-skip-backward";
valign: center; valign: center;
//sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>; // sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>;
clicked => $on_skip_backward_clicked() swapped;
clicked => $on_skip_backward_clicked () swapped;
} }
Button { Button {
icon-name: "media-seek-backward"; icon-name: "media-seek-backward";
valign: center; valign: center;
//sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>; // sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>;
clicked => $seek_backward() swapped;
clicked => $seek_backward () swapped;
} }
Button { Button {
icon-name: bind $play_pause_icon_name (template.idle-active, template.pause) as <string>; icon-name: bind $play_pause_icon_name(template.idle-active, template.pause) as <string>;
valign: center; valign: center;
//sensitive: bind $can_press_play (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>, template.playbin as <$AudreyPlaybin>.play-queue-length) as <bool>; // sensitive: bind $can_press_play (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>, template.playbin as <$AudreyPlaybin>.play-queue-length) as <bool>;
clicked => $on_play_pause_clicked() swapped;
clicked => $on_play_pause_clicked () swapped;
} }
Button { Button {
icon-name: "media-seek-forward"; icon-name: "media-seek-forward";
valign: center; valign: center;
//sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>; // sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>;
clicked => $seek_forward() swapped;
clicked => $seek_forward () swapped;
} }
Button { Button {
icon-name: "media-skip-forward"; icon-name: "media-skip-forward";
valign: center; valign: center;
//sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>; // sensitive: bind $playbin_active (template.playbin as <$AudreyPlaybin>.state as <$AudreyPlaybinState>) as <bool>;
clicked => $on_skip_forward_clicked() swapped;
clicked => $on_skip_forward_clicked () swapped;
} }
} }
} }
@ -150,10 +153,9 @@ template $AudreyUiPlaybar: Adw.Bin {
} }
Button { Button {
icon-name: bind $mute_button_icon_name (template.mute) as <string>; icon-name: bind $mute_button_icon_name(template.mute) as <string>;
valign: center; valign: center;
clicked => $on_mute_toggle() swapped;
clicked => $on_mute_toggle () swapped;
} }
Scale { Scale {

View file

@ -14,7 +14,10 @@ template $AudreyUiSetup: Adw.PreferencesDialog {
[header-suffix] [header-suffix]
Gtk.Button { Gtk.Button {
styles [ "flat" ] styles [
"flat"
]
icon-name: "edit-undo"; icon-name: "edit-undo";
sensitive: bind template.authn_can_validate; sensitive: bind template.authn_can_validate;
} }
@ -24,24 +27,21 @@ template $AudreyUiSetup: Adw.PreferencesDialog {
input-purpose: url; input-purpose: url;
sensitive: bind template.authn_can_edit; sensitive: bind template.authn_can_edit;
text: bind template.server_url bidirectional; text: bind template.server_url bidirectional;
changed => $on_authn_changed() swapped;
changed => $on_authn_changed () swapped;
} }
Adw.EntryRow { Adw.EntryRow {
title: _("Username"); title: _("Username");
sensitive: bind template.authn_can_edit; sensitive: bind template.authn_can_edit;
text: bind template.username bidirectional; text: bind template.username bidirectional;
changed => $on_authn_changed() swapped;
changed => $on_authn_changed () swapped;
} }
Adw.PasswordEntryRow { Adw.PasswordEntryRow {
title: _("Password"); title: _("Password");
sensitive: bind template.authn_can_edit; sensitive: bind template.authn_can_edit;
text: bind template.password bidirectional; text: bind template.password bidirectional;
changed => $on_authn_changed() swapped;
changed => $on_authn_changed () swapped;
} }
Adw.ActionRow { Adw.ActionRow {
@ -56,8 +56,7 @@ template $AudreyUiSetup: Adw.PreferencesDialog {
Adw.ButtonRow { Adw.ButtonRow {
title: _("Connect and save"); title: _("Connect and save");
sensitive: bind template.authn_can_validate; sensitive: bind template.authn_can_validate;
activated => $on_authn_validate_activated() swapped;
activated => $on_authn_validate_activated () swapped;
} }
} }
} }

View file

@ -16,7 +16,7 @@ template $AudreyUiWindow: Adw.ApplicationWindow {
Button { Button {
icon-name: "media-playlist-shuffle"; icon-name: "media-playlist-shuffle";
sensitive: bind template.can_click_shuffle_all; sensitive: bind template.can_click_shuffle_all;
clicked => $shuffle_all () swapped; clicked => $shuffle_all() swapped;
} }
title-widget: Adw.ViewSwitcher { title-widget: Adw.ViewSwitcher {
@ -27,12 +27,13 @@ template $AudreyUiWindow: Adw.ApplicationWindow {
[end] [end]
Button { Button {
icon-name: "applications-system"; icon-name: "applications-system";
clicked => $show_setup_dialog () swapped; clicked => $show_setup_dialog() swapped;
} }
} }
content: Adw.ViewStack stack { content: Adw.ViewStack stack {
vexpand: true; vexpand: true;
Adw.ViewStackPage { Adw.ViewStackPage {
icon-name: "media-optical-cd"; icon-name: "media-optical-cd";
title: _("Albums"); title: _("Albums");
@ -45,11 +46,14 @@ template $AudreyUiWindow: Adw.ApplicationWindow {
child: Adw.ToolbarView { child: Adw.ToolbarView {
[top] [top]
CenterBox { CenterBox {
styles [ "toolbar" ] styles [
"toolbar"
]
[start] [start]
DropDown { DropDown {
selected: 0; selected: 0;
model: StringList { model: StringList {
strings [ strings [
_("Random"), _("Random"),
@ -78,6 +82,7 @@ template $AudreyUiWindow: Adw.ApplicationWindow {
ScrolledWindow { ScrolledWindow {
vexpand: true; vexpand: true;
GridView {} GridView {}
} }
}; };
@ -103,7 +108,11 @@ template $AudreyUiWindow: Adw.ApplicationWindow {
Picture { Picture {
valign: center; valign: center;
styles [ "frame" ]
styles [
"frame"
]
halign: center; halign: center;
paintable: bind template.playing_cover_art; paintable: bind template.playing_cover_art;
} }
@ -112,16 +121,18 @@ template $AudreyUiWindow: Adw.ApplicationWindow {
$AudreyUiPlayQueue play_queue { $AudreyUiPlayQueue play_queue {
hexpand: true; hexpand: true;
halign: fill; halign: fill;
margin-top: 48; margin-top: 48;
margin-bottom: 48; margin-bottom: 48;
margin-start: 24; margin-start: 24;
margin-end: 24; margin-end: 24;
styles [ "frame" ] styles [
"frame"
]
model: bind template.playlist_model; model: bind template.playlist_model;
playlist-pos: bind template.playlist-pos; playlist-pos: bind template.playlist-pos;
//playbin: bind template.playbin; // playbin: bind template.playbin;
} }
}; };
} }
@ -131,8 +142,7 @@ template $AudreyUiWindow: Adw.ApplicationWindow {
$AudreyUiPlaybar playbar { $AudreyUiPlaybar playbar {
song: bind template.song; song: bind template.song;
playing_cover_art: bind template.playing_cover_art; playing_cover_art: bind template.playing_cover_art;
show_cover_art: bind $show_playbar_cover_art (stack.visible-child-name) as <bool>; show_cover_art: bind $show_playbar_cover_art(stack.visible-child-name) as <bool>;
volume: bind template.volume bidirectional; volume: bind template.volume bidirectional;
mute: bind template.mute bidirectional; mute: bind template.mute bidirectional;
pause: bind template.pause bidirectional; pause: bind template.pause bidirectional;