Add tracks editor UI

This commit is contained in:
Elias Projahn 2025-02-09 10:00:46 +01:00
parent 0fe143a383
commit 143876c4de
12 changed files with 1159 additions and 26 deletions

View file

@ -258,6 +258,11 @@ template $MusicusHomePage: Adw.NavigationPage {
}
menu primary_menu {
item {
label: _("_Import music");
action: "win.import";
}
item {
label: _("_Library manager");
action: "win.library";

View file

@ -0,0 +1,147 @@
using Gtk 4.0;
using Adw 1;
template $MusicusRecordingSelectorPopover: Gtk.Popover {
styles [
"selector"
]
Gtk.Stack stack {
transition-type: slide_left_right;
Adw.ToolbarView composer_view {
[top]
Gtk.SearchEntry composer_search_entry {
placeholder-text: _("Search composers…");
margin-start: 8;
margin-end: 8;
margin-top: 8;
margin-bottom: 6;
search-changed => $composer_search_changed() swapped;
activate => $composer_activate() swapped;
stop-search => $stop_search() swapped;
}
Gtk.ScrolledWindow composer_scrolled_window {
height-request: 200;
Gtk.ListBox composer_list {
styles [
"selector-list"
]
selection-mode: none;
activate-on-single-click: true;
}
}
}
Adw.ToolbarView work_view {
[top]
Gtk.Box {
margin-start: 8;
margin-end: 8;
margin-top: 8;
margin-bottom: 6;
orientation: vertical;
Gtk.CenterBox {
[start]
Gtk.Button {
styles [
"flat"
]
icon-name: "go-previous-symbolic";
clicked => $back_to_composer() swapped;
}
[center]
Gtk.Label composer_label {
styles [
"heading"
]
ellipsize: end;
margin-start: 6;
}
}
Gtk.SearchEntry work_search_entry {
placeholder-text: _("Search works…");
margin-top: 6;
search-changed => $work_search_changed() swapped;
activate => $work_activate() swapped;
stop-search => $stop_search() swapped;
}
}
Gtk.ScrolledWindow work_scrolled_window {
height-request: 200;
Gtk.ListBox work_list {
styles [
"selector-list"
]
selection-mode: none;
activate-on-single-click: true;
}
}
}
Adw.ToolbarView recording_view {
[top]
Gtk.Box {
margin-start: 8;
margin-end: 8;
margin-top: 8;
margin-bottom: 6;
orientation: vertical;
Gtk.CenterBox {
[start]
Gtk.Button {
styles [
"flat"
]
icon-name: "go-previous-symbolic";
clicked => $back_to_work() swapped;
}
[center]
Gtk.Label work_label {
styles [
"heading"
]
ellipsize: end;
margin-start: 6;
}
}
Gtk.SearchEntry recording_search_entry {
placeholder-text: _("Search recordings…");
margin-top: 6;
search-changed => $recording_search_changed() swapped;
activate => $recording_activate() swapped;
stop-search => $stop_search() swapped;
}
}
Gtk.ScrolledWindow recording_scrolled_window {
height-request: 200;
Gtk.ListBox recording_list {
styles [
"selector-list"
]
selection-mode: none;
activate-on-single-click: true;
}
}
}
}
}

98
data/ui/tracks_editor.blp Normal file
View file

@ -0,0 +1,98 @@
using Gtk 4.0;
using Adw 1;
template $MusicusTracksEditor: Adw.NavigationPage {
title: _("Tracks");
Adw.ToolbarView {
[top]
Adw.HeaderBar {}
Gtk.ScrolledWindow {
Adw.Clamp {
Gtk.Box {
orientation: vertical;
margin-bottom: 24;
margin-start: 12;
margin-end: 12;
Gtk.Label {
label: _("Recording");
xalign: 0;
margin-top: 24;
styles [
"heading"
]
}
Gtk.ListBox {
selection-mode: none;
margin-top: 12;
styles [
"boxed-list"
]
Adw.ActionRow recording_row {
title: _("Select recording");
activatable: true;
activated => $select_recording() swapped;
[prefix]
Gtk.Box select_recording_box {
Gtk.Image {
icon-name: "document-edit-symbolic";
}
}
}
}
Gtk.Label {
label: _("Tracks");
xalign: 0;
margin-top: 24;
styles [
"heading"
]
}
Gtk.ListBox track_list {
selection-mode: none;
margin-top: 12;
styles [
"boxed-list"
]
Adw.ActionRow {
title: _("Add files");
activatable: true;
activated => $add_files() swapped;
[prefix]
Gtk.Image {
icon-name: "list-add-symbolic";
}
}
}
Gtk.ListBox {
selection-mode: none;
margin-top: 24;
styles [
"boxed-list"
]
Adw.ButtonRow save_row {
title: _("Import tracks");
activated => $save() swapped;
}
}
}
}
}
}
}

View file

@ -0,0 +1,25 @@
using Gtk 4.0;
using Adw 1;
template $MusicusTracksEditorTrackRow: Adw.ActionRow {
title: _("Select parts");
activatable: true;
activated => $select_parts() swapped;
[prefix]
Gtk.Box select_parts_box {
Gtk.Image {
icon-name: "document-edit-symbolic";
}
}
Gtk.Button {
icon-name: "user-trash-symbolic";
valign: center;
clicked => $remove() swapped;
styles [
"flat"
]
}
}