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";
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 {
name: "empty";
@ -27,17 +27,16 @@ template $AudreyUiPlayQueue: Adw.Bin {
ListView view {
show-separators: true;
single-click-activate: true;
activate => $on_row_activated () swapped;
activate => $on_row_activated() swapped;
model: NoSelection {
model: bind template.model;
};
factory: SignalListItemFactory {
setup => $on_song_list_setup () swapped;
bind => $on_song_list_bind () swapped;
unbind => $on_song_list_unbind () swapped;
setup => $on_song_list_setup() swapped;
bind => $on_song_list_bind() swapped;
unbind => $on_song_list_unbind() swapped;
};
}
};

View file

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

View file

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

View file

@ -14,7 +14,10 @@ template $AudreyUiSetup: Adw.PreferencesDialog {
[header-suffix]
Gtk.Button {
styles [ "flat" ]
styles [
"flat"
]
icon-name: "edit-undo";
sensitive: bind template.authn_can_validate;
}
@ -24,24 +27,21 @@ template $AudreyUiSetup: Adw.PreferencesDialog {
input-purpose: url;
sensitive: bind template.authn_can_edit;
text: bind template.server_url bidirectional;
changed => $on_authn_changed () swapped;
changed => $on_authn_changed() swapped;
}
Adw.EntryRow {
title: _("Username");
sensitive: bind template.authn_can_edit;
text: bind template.username bidirectional;
changed => $on_authn_changed () swapped;
changed => $on_authn_changed() swapped;
}
Adw.PasswordEntryRow {
title: _("Password");
sensitive: bind template.authn_can_edit;
text: bind template.password bidirectional;
changed => $on_authn_changed () swapped;
changed => $on_authn_changed() swapped;
}
Adw.ActionRow {
@ -56,8 +56,7 @@ template $AudreyUiSetup: Adw.PreferencesDialog {
Adw.ButtonRow {
title: _("Connect and save");
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 {
icon-name: "media-playlist-shuffle";
sensitive: bind template.can_click_shuffle_all;
clicked => $shuffle_all () swapped;
clicked => $shuffle_all() swapped;
}
title-widget: Adw.ViewSwitcher {
@ -27,12 +27,13 @@ template $AudreyUiWindow: Adw.ApplicationWindow {
[end]
Button {
icon-name: "applications-system";
clicked => $show_setup_dialog () swapped;
clicked => $show_setup_dialog() swapped;
}
}
content: Adw.ViewStack stack {
vexpand: true;
Adw.ViewStackPage {
icon-name: "media-optical-cd";
title: _("Albums");
@ -45,11 +46,14 @@ template $AudreyUiWindow: Adw.ApplicationWindow {
child: Adw.ToolbarView {
[top]
CenterBox {
styles [ "toolbar" ]
styles [
"toolbar"
]
[start]
DropDown {
selected: 0;
model: StringList {
strings [
_("Random"),
@ -78,6 +82,7 @@ template $AudreyUiWindow: Adw.ApplicationWindow {
ScrolledWindow {
vexpand: true;
GridView {}
}
};
@ -103,7 +108,11 @@ template $AudreyUiWindow: Adw.ApplicationWindow {
Picture {
valign: center;
styles [ "frame" ]
styles [
"frame"
]
halign: center;
paintable: bind template.playing_cover_art;
}
@ -112,16 +121,18 @@ template $AudreyUiWindow: Adw.ApplicationWindow {
$AudreyUiPlayQueue play_queue {
hexpand: true;
halign: fill;
margin-top: 48;
margin-bottom: 48;
margin-start: 24;
margin-end: 24;
styles [ "frame" ]
styles [
"frame"
]
model: bind template.playlist_model;
playlist-pos: bind template.playlist-pos;
//playbin: bind template.playbin;
// playbin: bind template.playbin;
}
};
}
@ -131,8 +142,7 @@ template $AudreyUiWindow: Adw.ApplicationWindow {
$AudreyUiPlaybar playbar {
song: bind template.song;
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;
mute: bind template.mute bidirectional;
pause: bind template.pause bidirectional;