Compare commits
No commits in common. "83b2db4b76aa8b1cc839f9a7cdf010347c70047d" and "734ffc57584a7fcef6855b340d544709cc472859" have entirely different histories.
83b2db4b76
...
734ffc5758
6 changed files with 129 additions and 106 deletions
|
@ -1,11 +1,3 @@
|
||||||
/*
|
|
||||||
#play-queue-page {
|
|
||||||
background-image: linear-gradient(
|
|
||||||
var(--window-bg-color),
|
|
||||||
var(--accent-bg-color));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#seek-scale slider {
|
#seek-scale slider {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
opacity: 0%;
|
opacity: 0%;
|
||||||
|
@ -19,10 +11,6 @@
|
||||||
min-height: 15px;
|
min-height: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#play-queue .playing .title-label {
|
.playing .title-label {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.drag-handle {
|
|
||||||
color: color-mix(in srgb, currentColor 40%, transparent);
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,19 +1,24 @@
|
||||||
using Gtk 4.0;
|
using Gtk 4.0;
|
||||||
|
using Adw 1;
|
||||||
|
|
||||||
template $UiPlayQueue: Box {
|
template $UiPlayQueue: Adw.NavigationPage {
|
||||||
name: "play-queue";
|
title: _("Play queue");
|
||||||
|
|
||||||
|
Adw.ToolbarView {
|
||||||
|
[top]
|
||||||
|
Adw.HeaderBar {
|
||||||
|
Button {
|
||||||
|
icon-name: "edit-clear-all";
|
||||||
|
clicked => $on_clear ();
|
||||||
|
sensitive: bind template.can_clear_all;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ScrolledWindow {
|
ScrolledWindow {
|
||||||
hexpand: true;
|
|
||||||
vscrollbar-policy: always;
|
|
||||||
hscrollbar-policy: never;
|
|
||||||
|
|
||||||
ListView view {
|
ListView view {
|
||||||
show-separators: true;
|
show-separators: true;
|
||||||
single-click-activate: true;
|
single-click-activate: true;
|
||||||
|
|
||||||
styles [ "rich-list" ]
|
|
||||||
|
|
||||||
activate => $on_row_activated ();
|
activate => $on_row_activated ();
|
||||||
|
|
||||||
model: NoSelection {
|
model: NoSelection {
|
||||||
|
@ -28,3 +33,4 @@ template $UiPlayQueue: Box {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ class Ui.PlayQueueSong : Gtk.ListBoxRow {
|
||||||
}
|
}
|
||||||
|
|
||||||
[GtkTemplate (ui = "/eu/callcc/audrey/ui/play_queue.ui")]
|
[GtkTemplate (ui = "/eu/callcc/audrey/ui/play_queue.ui")]
|
||||||
public class Ui.PlayQueue : Gtk.Box {
|
public class Ui.PlayQueue : Adw.NavigationPage {
|
||||||
private Playbin _playbin;
|
private Playbin _playbin;
|
||||||
public Playbin playbin {
|
public Playbin playbin {
|
||||||
get { return _playbin; }
|
get { return _playbin; }
|
||||||
|
@ -118,14 +118,17 @@ public class Ui.PlayQueue : Gtk.Box {
|
||||||
|
|
||||||
_playbin.play_queue.items_changed.connect (this.on_store_items_changed);
|
_playbin.play_queue.items_changed.connect (this.on_store_items_changed);
|
||||||
this.can_clear_all = _playbin.play_queue.get_n_items () > 0;
|
this.can_clear_all = _playbin.play_queue.get_n_items () > 0;
|
||||||
|
|
||||||
|
_playbin.notify["play-queue-position"].connect (() => {
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool can_clear_all { get; private set; }
|
public bool can_clear_all { get; private set; }
|
||||||
|
|
||||||
/*[GtkCallback] private void on_clear () {
|
[GtkCallback] private void on_clear () {
|
||||||
this.playbin.clear ();
|
this.playbin.clear ();
|
||||||
}*/
|
}
|
||||||
|
|
||||||
private void on_store_items_changed (GLib.ListModel store, uint position, uint removed, uint added) {
|
private void on_store_items_changed (GLib.ListModel store, uint position, uint removed, uint added) {
|
||||||
this.can_clear_all = store.get_n_items () > 0;
|
this.can_clear_all = store.get_n_items () > 0;
|
||||||
|
|
|
@ -2,7 +2,6 @@ using Gtk 4.0;
|
||||||
|
|
||||||
template $UiPlayQueueSong: ListBoxRow {
|
template $UiPlayQueueSong: ListBoxRow {
|
||||||
selectable: false;
|
selectable: false;
|
||||||
activatable: false; // prevents double background change on focus
|
|
||||||
|
|
||||||
Box {
|
Box {
|
||||||
focusable: false;
|
focusable: false;
|
||||||
|
|
|
@ -10,22 +10,20 @@ template $UiWindow: Adw.ApplicationWindow {
|
||||||
can-open: false; // broken in libadwaita
|
can-open: false; // broken in libadwaita
|
||||||
|
|
||||||
[content]
|
[content]
|
||||||
Adw.ToolbarView {
|
Adw.OverlaySplitView {
|
||||||
margin-bottom: bind bottom_sheet.bottom-bar-height;
|
margin-bottom: bind bottom_sheet.bottom-bar-height;
|
||||||
|
|
||||||
|
vexpand: true;
|
||||||
|
|
||||||
|
[sidebar]
|
||||||
|
Adw.NavigationPage {
|
||||||
|
width-request: 100;
|
||||||
|
title: _("audrey");
|
||||||
|
|
||||||
|
Adw.ToolbarView {
|
||||||
[top]
|
[top]
|
||||||
Adw.HeaderBar {
|
Adw.HeaderBar {
|
||||||
[start]
|
show-title: false;
|
||||||
Button {
|
|
||||||
icon-name: "media-playlist-shuffle";
|
|
||||||
sensitive: bind template.can_click_shuffle_all;
|
|
||||||
clicked => $shuffle_all ();
|
|
||||||
}
|
|
||||||
|
|
||||||
title-widget: Adw.ViewSwitcher {
|
|
||||||
stack: stack;
|
|
||||||
policy: wide;
|
|
||||||
};
|
|
||||||
|
|
||||||
[end]
|
[end]
|
||||||
Button {
|
Button {
|
||||||
|
@ -34,46 +32,65 @@ template $UiWindow: Adw.ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
content: Adw.ViewStack stack {
|
content: Box {
|
||||||
Adw.ViewStackPage {
|
orientation: vertical;
|
||||||
title: _("Play queue");
|
|
||||||
icon-name: "media-playback-start";
|
|
||||||
|
|
||||||
child: Box {
|
ListBox sidebar {
|
||||||
name: "play-queue-page";
|
styles [
|
||||||
homogeneous: true;
|
"navigation-sidebar",
|
||||||
|
]
|
||||||
|
|
||||||
Adw.Clamp {
|
row-activated => $on_sidebar_row_activated();
|
||||||
halign: center;
|
|
||||||
maximum-size: 400;
|
|
||||||
width-request: 400;
|
|
||||||
margin-start: 24;
|
|
||||||
margin-end: 24;
|
|
||||||
|
|
||||||
Image {
|
ListBoxRow sidebar_play_queue {
|
||||||
valign: center;
|
Label {
|
||||||
styles [ "frame" ]
|
xalign: 0;
|
||||||
halign: center;
|
label: _("Play queue");
|
||||||
pixel-size: 400;
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Separator {}
|
||||||
|
|
||||||
|
ListBox {
|
||||||
|
selection-mode: none;
|
||||||
|
|
||||||
|
styles [
|
||||||
|
"navigation-sidebar",
|
||||||
|
]
|
||||||
|
|
||||||
|
Adw.ButtonRow shuffle_all_tracks {
|
||||||
|
title: _("Shuffle all tracks");
|
||||||
|
start-icon-name: "media-playlist-shuffle";
|
||||||
|
sensitive: false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Separator {
|
||||||
|
styles [
|
||||||
|
"spacer",
|
||||||
|
]
|
||||||
|
vexpand: true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Picture {
|
||||||
paintable: bind template.playing_cover_art;
|
paintable: bind template.playing_cover_art;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$UiPlayQueue play_queue {
|
[content]
|
||||||
hexpand: true;
|
Stack stack {
|
||||||
halign: fill;
|
StackPage {
|
||||||
|
name: "play_queue";
|
||||||
|
title: _("Play queue");
|
||||||
|
|
||||||
margin-top: 48;
|
child: $UiPlayQueue play_queue {
|
||||||
margin-bottom: 48;
|
|
||||||
margin-start: 24;
|
|
||||||
margin-end: 24;
|
|
||||||
|
|
||||||
styles [ "frame" ]
|
|
||||||
playbin: bind template.playbin;
|
playbin: bind template.playbin;
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[bottom-bar]
|
[bottom-bar]
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
[GtkTemplate (ui = "/eu/callcc/audrey/ui/window.ui")]
|
[GtkTemplate (ui = "/eu/callcc/audrey/ui/window.ui")]
|
||||||
class Ui.Window : Adw.ApplicationWindow {
|
class Ui.Window : Adw.ApplicationWindow {
|
||||||
|
[GtkChild] private unowned Gtk.ListBox sidebar;
|
||||||
|
[GtkChild] private unowned Gtk.ListBoxRow sidebar_play_queue;
|
||||||
|
[GtkChild] private unowned Gtk.Stack stack;
|
||||||
|
|
||||||
[GtkChild] public unowned Ui.PlayQueue play_queue;
|
[GtkChild] public unowned Ui.PlayQueue play_queue;
|
||||||
[GtkChild] public unowned Ui.Playbar playbar;
|
[GtkChild] public unowned Ui.Playbar playbar;
|
||||||
//[GtkChild] public unowned Adw.ButtonRow shuffle_all_tracks;
|
[GtkChild] public unowned Adw.ButtonRow shuffle_all_tracks;
|
||||||
|
|
||||||
private Setup setup;
|
private Setup setup;
|
||||||
|
|
||||||
|
@ -75,10 +79,11 @@ class Ui.Window : Adw.ApplicationWindow {
|
||||||
this.setup.connected.connect ((api) => {
|
this.setup.connected.connect ((api) => {
|
||||||
this.api = api;
|
this.api = api;
|
||||||
this.playbin.api = api;
|
this.playbin.api = api;
|
||||||
this.can_click_shuffle_all = true;
|
|
||||||
});
|
});
|
||||||
this.setup.load ();
|
this.setup.load ();
|
||||||
|
|
||||||
|
this.sidebar.select_row (this.sidebar.get_row_at_index (0));
|
||||||
|
|
||||||
this.playbin.new_track.connect (() => {
|
this.playbin.new_track.connect (() => {
|
||||||
this.now_playing (this.playbin.play_queue.get_item (this.playbin.play_queue_position) as Subsonic.Song);
|
this.now_playing (this.playbin.play_queue.get_item (this.playbin.play_queue_position) as Subsonic.Song);
|
||||||
});
|
});
|
||||||
|
@ -87,16 +92,10 @@ class Ui.Window : Adw.ApplicationWindow {
|
||||||
this.playing_cover_art = null;
|
this.playing_cover_art = null;
|
||||||
this.song = null;
|
this.song = null;
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
[GtkCallback] private void show_setup_dialog () {
|
this.shuffle_all_tracks.sensitive = true;
|
||||||
this.setup.present (this);
|
this.shuffle_all_tracks.activated.connect (() => {
|
||||||
}
|
this.shuffle_all_tracks.sensitive = false;
|
||||||
|
|
||||||
public bool can_click_shuffle_all { get; private set; default = false; }
|
|
||||||
|
|
||||||
[GtkCallback] private void shuffle_all () {
|
|
||||||
this.can_click_shuffle_all = false;
|
|
||||||
this.playbin.clear ();
|
this.playbin.clear ();
|
||||||
api.get_random_songs.begin (null, (song) => {
|
api.get_random_songs.begin (null, (song) => {
|
||||||
this.playbin.append_track (song);
|
this.playbin.append_track (song);
|
||||||
|
@ -106,9 +105,20 @@ class Ui.Window : Adw.ApplicationWindow {
|
||||||
} catch (Error e) {
|
} catch (Error e) {
|
||||||
error ("could not get random songs: %s", e.message);
|
error ("could not get random songs: %s", e.message);
|
||||||
}
|
}
|
||||||
this.can_click_shuffle_all = true;
|
this.shuffle_all_tracks.sensitive = true;
|
||||||
|
|
||||||
this.playbin.select_track (0);
|
this.playbin.select_track (0);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[GtkCallback] private void on_sidebar_row_activated (Gtk.ListBoxRow row) {
|
||||||
|
if (row == this.sidebar_play_queue) {
|
||||||
|
this.stack.set_visible_child_name("play_queue");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[GtkCallback] private void show_setup_dialog () {
|
||||||
|
this.setup.present (this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue