Add work and recording editor

This commit is contained in:
Elias Projahn 2025-01-15 11:23:04 +01:00
parent 36b2f1097e
commit 364557d959
30 changed files with 3308 additions and 418 deletions

View file

@ -0,0 +1,42 @@
using Gtk 4.0;
using Adw 1;
template $MusicusEnsembleEditor: Adw.NavigationPage {
title: _("Ensemble");
Adw.ToolbarView {
[top]
Adw.HeaderBar header_bar {}
Adw.Clamp {
Gtk.Box {
orientation: vertical;
Gtk.Label {
label: _("Name");
xalign: 0;
margin-top: 24;
styles [
"heading"
]
}
$MusicusTranslationEditor name_editor {
margin-top: 12;
}
Gtk.Button save_button {
margin-top: 24;
label: _("Create ensemble");
clicked => $save() swapped;
styles [
"card",
"save"
]
}
}
}
}
}

View file

@ -0,0 +1,35 @@
using Gtk 4.0;
using Adw 1;
template $MusicusEnsembleSelectorPopover: Gtk.Popover {
styles [
"selector"
]
Adw.ToolbarView {
[top]
Gtk.SearchEntry search_entry {
placeholder-text: _("Search ensembles…");
margin-start: 8;
margin-end: 8;
margin-top: 8;
margin-bottom: 6;
search-changed => $search_changed() swapped;
activate => $activate() swapped;
stop-search => $stop_search() swapped;
}
Gtk.ScrolledWindow scrolled_window {
height-request: 200;
Gtk.ListBox list_box {
styles [
"selector-list"
]
selection-mode: none;
activate-on-single-click: true;
}
}
}
}

View file

@ -0,0 +1,42 @@
using Gtk 4.0;
using Adw 1;
template $MusicusInstrumentEditor: Adw.NavigationPage {
title: _("Instrument");
Adw.ToolbarView {
[top]
Adw.HeaderBar header_bar {}
Adw.Clamp {
Gtk.Box {
orientation: vertical;
Gtk.Label {
label: _("Name");
xalign: 0;
margin-top: 24;
styles [
"heading"
]
}
$MusicusTranslationEditor name_editor {
margin-top: 12;
}
Gtk.Button save_button {
margin-top: 24;
label: _("Create instrument");
clicked => $save() swapped;
styles [
"card",
"save"
]
}
}
}
}
}

View file

@ -8,5 +8,50 @@ template $MusicusLibraryManager : Adw.NavigationPage {
Adw.ToolbarView {
[top]
Adw.HeaderBar {}
Gtk.Box {
orientation: vertical;
spacing: 12;
Gtk.Button {
label: _("Add person");
clicked => $add_person() swapped;
}
Gtk.Button {
label: _("Add role");
clicked => $add_role() swapped;
}
Gtk.Button {
label: _("Add instrument");
clicked => $add_instrument() swapped;
}
Gtk.Button {
label: _("Add work");
clicked => $add_work() swapped;
}
Gtk.Button {
label: _("Add ensemble");
clicked => $add_ensemble() swapped;
}
Gtk.Button {
label: _("Add recording");
clicked => $add_recording() swapped;
}
Gtk.Button {
label: _("Add album");
clicked => $add_album() swapped;
}
Gtk.Button {
label: _("Add medium");
clicked => $add_medium() swapped;
}
}
}
}

View file

@ -0,0 +1,94 @@
using Gtk 4.0;
using Adw 1;
template $MusicusPerformerRoleSelectorPopover: Gtk.Popover {
styles [
"selector"
]
Gtk.Stack stack {
transition-type: slide_left_right;
Adw.ToolbarView role_view {
[top]
Gtk.SearchEntry role_search_entry {
placeholder-text: _("Search roles…");
margin-start: 8;
margin-end: 8;
margin-top: 8;
margin-bottom: 6;
search-changed => $role_search_changed() swapped;
activate => $role_activate() swapped;
stop-search => $stop_search() swapped;
}
Gtk.ScrolledWindow role_scrolled_window {
height-request: 200;
Gtk.ListBox role_list {
styles [
"selector-list"
]
selection-mode: none;
activate-on-single-click: true;
}
}
}
Adw.ToolbarView instrument_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_button_clicked() swapped;
}
[center]
Gtk.Label {
styles [
"heading"
]
label: _("Performer");
ellipsize: end;
margin-start: 6;
}
}
Gtk.SearchEntry instrument_search_entry {
placeholder-text: _("Search instruments…");
margin-top: 6;
search-changed => $instrument_search_changed() swapped;
activate => $instrument_activate() swapped;
stop-search => $stop_search() swapped;
}
}
Gtk.ScrolledWindow instrument_scrolled_window {
height-request: 200;
Gtk.ListBox instrument_list {
styles [
"selector-list"
]
selection-mode: none;
activate-on-single-click: true;
}
}
}
}
}

View file

@ -0,0 +1,141 @@
using Gtk 4.0;
using Adw 1;
template $MusicusRecordingEditor: Adw.NavigationPage {
title: _("Recording");
Adw.ToolbarView {
[top]
Adw.HeaderBar header_bar {}
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 work_row {
title: _("Select work");
activatable: true;
activated => $select_work() swapped;
[prefix]
Gtk.Box select_work_box {
Gtk.Image {
icon-name: "document-edit-symbolic";
}
}
}
Adw.SpinRow year_row {
title: _("Year");
adjustment: Gtk.Adjustment {
lower: 0;
upper: 3000;
value: 2000;
step-increment: 1;
page-increment: 10;
};
}
}
Gtk.Label {
label: _("Performers");
xalign: 0;
margin-top: 24;
styles [
"heading"
]
}
Gtk.ListBox performer_list {
selection-mode: none;
margin-top: 12;
styles [
"boxed-list"
]
Adw.ActionRow {
title: _("Add performer");
activatable: true;
activated => $select_person() swapped;
[prefix]
Gtk.Box select_person_box {
Gtk.Image {
icon-name: "list-add-symbolic";
}
}
}
}
Gtk.Label {
label: _("Ensembles");
xalign: 0;
margin-top: 24;
styles [
"heading"
]
}
Gtk.ListBox ensemble_list {
selection-mode: none;
margin-top: 12;
styles [
"boxed-list"
]
Adw.ActionRow {
title: _("Add ensemble");
activatable: true;
activated => $select_ensemble() swapped;
[prefix]
Gtk.Box select_ensemble_box {
Gtk.Image {
icon-name: "list-add-symbolic";
}
}
}
}
Gtk.Button save_button {
margin-top: 24;
label: _("Create recording");
clicked => $save() swapped;
styles [
"card",
"save"
]
}
}
}
}
}
}

View file

@ -0,0 +1,33 @@
using Gtk 4.0;
using Adw 1;
template $MusicusRecordingEditorEnsembleRow: Adw.ActionRow {
Gtk.Button {
icon-name: "user-trash-symbolic";
valign: center;
clicked => $remove() swapped;
styles [
"flat"
]
}
Gtk.Button {
valign: center;
clicked => $open_role_popover() swapped;
styles [
"flat"
]
Gtk.Box role_box {
spacing: 6;
Gtk.Label role_label {}
Gtk.Image {
icon-name: "pan-down-symbolic";
}
}
}
}

View file

@ -0,0 +1,33 @@
using Gtk 4.0;
using Adw 1;
template $MusicusRecordingEditorPerformerRow: Adw.ActionRow {
Gtk.Button {
icon-name: "user-trash-symbolic";
valign: center;
clicked => $remove() swapped;
styles [
"flat"
]
}
Gtk.Button {
valign: center;
clicked => $open_role_popover() swapped;
styles [
"flat"
]
Gtk.Box role_box {
spacing: 6;
Gtk.Label role_label {}
Gtk.Image {
icon-name: "pan-down-symbolic";
}
}
}
}

View file

@ -1,8 +1,11 @@
using Gtk 4.0;
using Adw 1;
template $MusicusRecordingTile : Gtk.FlowBoxChild {
styles ["card", "activatable", "tile"]
template $MusicusRecordingTile: Gtk.FlowBoxChild {
styles [
"card",
"activatable",
"tile"
]
Gtk.Box {
spacing: 12;
@ -16,31 +19,52 @@ template $MusicusRecordingTile : Gtk.FlowBoxChild {
Gtk.Box {
orientation: vertical;
hexpand: true;
Gtk.Label work_label {
styles ["work"]
styles [
"work"
]
halign: start;
wrap: true;
}
Gtk.Label composer_label {
styles ["composer"]
styles [
"composer"
]
halign: start;
wrap: true;
}
Gtk.Label performances_label {
styles ["performances", "dim-label"]
styles [
"performances",
"dim-label"
]
halign: start;
wrap: true;
}
}
Gtk.Button {
styles ["flat"]
Gtk.MenuButton {
styles [
"flat"
]
valign: start;
margin-top: 12;
icon-name: "view-more-symbolic";
popover: Gtk.PopoverMenu {
menu-model: edit_menu;
};
}
}
}
}
menu edit_menu {
item (_("Edit recording"), "recording.edit")
}

View file

@ -124,6 +124,17 @@ template $MusicusWorkEditor: Adw.NavigationPage {
}
}
}
Gtk.Button save_button {
margin-top: 24;
label: _("Create work");
clicked => $save() swapped;
styles [
"card",
"save"
]
}
}
}
}

View file

@ -0,0 +1,93 @@
using Gtk 4.0;
using Adw 1;
template $MusicusWorkSelectorPopover: 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_button_clicked() 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;
}
}
}
}
}