Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/ui/src/player/equalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1516,6 +1516,7 @@ impl Editor {
let weak = Rc::downgrade(self);
glib::spawn_future_local(async move {
let Some(root) = root.upgrade() else { return };
crate::widgets::popup::hide_popover_while_open(&confirm, &root);
if confirm.choose_future(Some(&root)).await != "accept" {
return;
}
Expand Down
20 changes: 20 additions & 0 deletions crates/ui/src/widgets/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,29 @@ where
D: IsA<adw::Dialog> + Clone + 'static,
{
install_light_dismiss(dialog);
hide_popover_while_open(dialog, parent);
dialog.present(Some(parent));
}

/// Dialogs draw inside the window, under any open popover: the popover holding `parent` hides
/// while `dialog` is open and comes back when it closes.
pub fn hide_popover_while_open(dialog: &impl IsA<adw::Dialog>, parent: &impl IsA<gtk::Widget>) {
let Some(popover) = parent
.ancestor(gtk::Popover::static_type())
.and_downcast::<gtk::Popover>()
.filter(|popover| popover.is_visible())
else {
return;
};
popover.popdown();
let popover = popover.downgrade();
dialog.connect_closed(move |_| {
if let Some(popover) = popover.upgrade() {
popover.popup();
}
});
}

/// Presents a page's Customize display dialog as tall as its rows, up to the large popup height.
pub fn present_settings_dialog(dialog: &adw::PreferencesDialog, window: &impl IsA<gtk::Widget>) {
let width = crate::widgets::layout::large_popup_content_width(560);
Expand Down
1 change: 1 addition & 0 deletions crates/ui/src/widgets/settings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub fn connect_confirmed_reset(
dialog.set_default_response(Some("cancel"));
dialog.set_close_response("cancel");
let reset = Rc::clone(&reset);
crate::widgets::popup::hide_popover_while_open(&dialog, button);
dialog.choose(
Some(button),
None::<&gtk::gio::Cancellable>,
Expand Down
21 changes: 21 additions & 0 deletions crates/web/src/equalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,27 @@ pub(super) fn routes() -> Router<ProductHandles> {
.route("/api/equalizer/presets", get(presets))
.route("/api/equalizer/events", get(events))
.route("/api/equalizer/response", get(response))
.route("/api/playback/outputs", get(outputs))
}
/// This host's audio devices, as GTK's Audio output lists them, and the receiver's name while casting.
async fn outputs(State(products): State<ProductHandles>) -> Result<Response<Body>, Error> {
let playback = products.playback.clone();
let selected = products.settings.load().playback.audio_output.clone();
let value = tokio::task::spawn_blocking(move || {
let devices: Vec<_> = playback
.available_audio_outputs()
.into_iter()
.map(|output| json!({"id": output.id, "name": output.name}))
.collect();
let casting = match playback.playback_output() {
playback::PlaybackOutput::Remote(output) => Some(output.name),
_ => None,
};
json!({"devices": devices, "selected": selected, "casting": casting})
})
.await
.map_err(internal)?;
Ok(json_response(StatusCode::OK, value))
}
#[derive(Default, Deserialize)]
struct Target {
Expand Down
3 changes: 2 additions & 1 deletion crates/web/src/help.json
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@
"POST /api/equalizer": "Shared EQ operations: preview {output,edit}, commit {output}, select {output,preset:null or ID}, save {output,name:null or text}, duplicate {output,name}, rename {id,name}, delete {id}, import {output,text,format:Json|Apo}, export {output,format}, assign {output,assigned}, apply {output}. Edits use enum objects such as {BandGain:{index:0,value:6}} and {Enabled:{value:true}}. Preview does not write settings; commit persists the final editor. Cast previews await apply except discrete bypass/format changes.",
"GET /api/equalizer/presets": "Built-in and named custom preset identities and names. Custom is the retained draft, selected with preset:null.",
"GET /api/equalizer/events": "Equalizer server-sent events. Optional output, meter=true and spectrum=true. Measurement stops when the connection closes.",
"GET /api/equalizer/response": "Calculated response from the shared filter model, with frequency and dB arrays. Uses actual stream sample rate or 48 kHz for preview."
"GET /api/equalizer/response": "Calculated response from the shared filter model, with frequency and dB arrays. Uses actual stream sample rate or 48 kHz for preview.",
"GET /api/playback/outputs": "This host's audio devices as {devices:[{id,name}], selected:null or a device id, casting:null or the receiver's name}. Choose one with the /playback/audio_output preference (null is the system default)."
},
"commands": "Playback and queue commands return 202 when received. Check playback status or follow playback updates to see the result or any error. Source and playlist changes return when finished. Use IDs exactly as returned, including negative numbers. Positions and offsets start at zero. Each copy of a track in a playlist or queue has its own ID.",
"login": "Keep the login connection open until sign-in finishes. Closing it cancels sign-in. Updates use event: login with JSON {event,data}, or {error}. Plex also accepts {method: password, data: {username,password,verification_code:null}}; Emby accepts {method: password, data: {username,password}}. Use the returned login details unchanged when adding the source.",
Expand Down
1 change: 1 addition & 0 deletions crates/web/src/preferences.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const SETTINGS: &[&str] = &[
"/external_site_links/lastfm",
"/external_site_links/musicbrainz",
"/external_site_links/server",
"/playback/audio_output",
"/playback/transition_mode",
"/playback/crossfade_seconds",
"/playback/skip_same_album_crossfade",
Expand Down
25 changes: 0 additions & 25 deletions locales/rufin.pot
Original file line number Diff line number Diff line change
Expand Up @@ -676,9 +676,6 @@ msgstr ""
msgid "Auto DJ"
msgstr ""

msgid "Auto"
msgstr ""

msgid "AutoEQ / APO"
msgstr ""

Expand Down Expand Up @@ -747,12 +744,6 @@ msgstr ""
msgid "Band"
msgstr ""

msgid "Bands"
msgstr ""

msgid "Bandwidth"
msgstr ""

msgid "Bar count"
msgstr ""

Expand Down Expand Up @@ -1230,10 +1221,6 @@ msgstr ""
msgid "Copy link"
msgstr ""

#, rust-format
msgid "Copy of {name}"
msgstr ""

msgid "Copy"
msgstr ""

Expand Down Expand Up @@ -1757,9 +1744,6 @@ msgstr ""
msgid "Enable"
msgstr ""

msgid "Enabled"
msgstr ""

msgid "Encoding peak"
msgstr ""

Expand Down Expand Up @@ -3571,9 +3555,6 @@ msgstr ""
msgid "Preserve pitch"
msgstr ""

msgid "Preset name"
msgstr ""

msgid "Preset text"
msgstr ""

Expand Down Expand Up @@ -4937,9 +4918,6 @@ msgstr ""
msgid "Toggle Fullscreen"
msgstr ""

msgid "Tone and channels"
msgstr ""

msgid "Tools"
msgstr ""

Expand Down Expand Up @@ -5093,9 +5071,6 @@ msgstr ""
msgid "Unplayed"
msgstr ""

msgid "Unsaved"
msgstr ""

msgid "Untitled"
msgstr ""

Expand Down
Loading
Loading