Add preferences for default program

This commit is contained in:
Elias Projahn 2025-03-16 14:06:57 +01:00
parent 653d5cd629
commit fa94d61e1e
11 changed files with 367 additions and 28 deletions

View file

@ -0,0 +1,65 @@
using Gtk 4.0;
using Adw 1;
template $MusicusPreferencesDialog: Adw.PreferencesDialog {
Adw.PreferencesPage {
title: _("Playback");
Adw.PreferencesGroup {
title: _("Default program");
description: _("These settings apply when you add search results to the playlist.");
$MusicusSliderRow {
title: _("Prefer recordings that haven't been played for a long time");
suffix: _("%");
adjustment: Gtk.Adjustment prefer_least_recently_played_adjustment {
lower: 0;
upper: 100;
step-increment: 1;
page-increment: 10;
};
}
$MusicusSliderRow {
title: _("Prefer recordings that were recently added");
suffix: _("%");
adjustment: Gtk.Adjustment prefer_recently_added_adjustment {
lower: 0;
upper: 100;
step-increment: 1;
page-increment: 10;
};
}
$MusicusSliderRow {
title: _("Avoid repeating composers");
suffix: _(" min");
adjustment: Gtk.Adjustment avoid_repeated_composers_adjustment {
lower: 0;
upper: 120;
step-increment: 10;
page-increment: 30;
};
}
$MusicusSliderRow {
title: _("Avoid repeating instruments");
suffix: _(" min");
adjustment: Gtk.Adjustment avoid_repeated_instruments_adjustment {
lower: 0;
upper: 120;
step-increment: 10;
page-increment: 30;
};
}
Adw.SwitchRow play_full_recordings_row {
title: _("Play full recordings");
}
}
}
}

View file

@ -269,7 +269,7 @@ menu primary_menu {
item {
label: _("_Preferences");
action: "app.preferences";
action: "win.preferences";
}
item {

41
data/ui/slider_row.blp Normal file
View file

@ -0,0 +1,41 @@
using Gtk 4.0;
using Adw 1;
template $MusicusSliderRow: Adw.PreferencesRow {
activatable: false;
Gtk.Box {
orientation: vertical;
spacing: 12;
margin-top: 12;
margin-bottom: 12;
margin-start: 12;
margin-end: 12;
Gtk.Box {
spacing: 12;
Gtk.Label {
label: bind template.title;
wrap: true;
xalign: 0.0;
hexpand: true;
}
Gtk.Label value_label {
xalign: 1.0;
valign: center;
styles [
"numeric",
]
}
}
Gtk.Scale {
adjustment: bind template.adjustment;
hexpand: true;
valign: center;
}
}
}

View file

@ -32,7 +32,7 @@ template $MusicusWelcomePage : Adw.NavigationPage {
menu primary_menu {
item {
label: _("_Preferences");
action: "app.preferences";
action: "win.preferences";
}
item {
label: _("_About Musicus");