- TrackRow: Korean/CJK titles render via layout-assigned width+height (SongCard parity, never femtovg-measured); explicit "E" badge hugs the title text; duration + position number dropped to 13px so they read smaller than the 14px title. - AlbumView: label/awards rail 214->160px with smaller card/icon/padding and centered headings in the compact rail; removed the dark right gutter (full-width Flickable, content clears the scrollbar via the 32px page padding); column headers homologated to Playlist casing (Title/Duration/ Quality), same in LocalAlbumView. - ArtistView: network sidebar auto-collapses on ShellState.content- constrained (the AlbumView signal) and no longer re-opens on artist-> artist navigation (reset_network_sidebar respects the constraint). - Hero titles homologated to Typography.section (18px) across MyQBZ detail, Musician, Label releases, Artists-by-location, Offline Manager. - Lyrics: Qobuz || LRCLIB parallel fetch, next-track prefetch, source footer, asymmetric line fade. cc
54 lines
2.0 KiB
Rust
54 lines
2.0 KiB
Rust
//! Share-link helpers — Qobuz track URL + Song.link (Odesli) resolution
|
|
//! + clipboard copy. Used by the track context menu's Share actions.
|
|
|
|
/// Canonical Qobuz track URL (the same form Tauri feeds to Song.link).
|
|
pub fn qobuz_track_url(track_id: &str) -> String {
|
|
format!("https://www.qobuz.com/track/{track_id}")
|
|
}
|
|
|
|
/// Qobuz web-player playlist URL (matches Tauri's share-playlist link).
|
|
pub fn qobuz_playlist_url(playlist_id: &str) -> String {
|
|
format!("https://play.qobuz.com/playlist/{playlist_id}")
|
|
}
|
|
|
|
/// Qobuz web-player album URL (matches Tauri's `shareAlbumQobuzLink`,
|
|
/// `https://play.qobuz.com/album/{id}`). Also the source URL fed to
|
|
/// Song.link for the album-level "Album.link".
|
|
pub fn qobuz_album_url(album_id: &str) -> String {
|
|
format!("https://play.qobuz.com/album/{album_id}")
|
|
}
|
|
|
|
/// Copy `text` to the system clipboard. Runs on a blocking thread —
|
|
/// clipboard backends (X11/Wayland) can block, and arboard keeps an
|
|
/// owner thread alive so the contents persist after this returns.
|
|
pub fn copy_to_clipboard(text: String) {
|
|
tokio::task::spawn_blocking(move || match arboard::Clipboard::new() {
|
|
Ok(mut clipboard) => {
|
|
if let Err(e) = clipboard.set_text(text) {
|
|
log::warn!("[qbz-slint] clipboard set failed: {e}");
|
|
}
|
|
}
|
|
Err(e) => log::warn!("[qbz-slint] clipboard unavailable: {e}"),
|
|
});
|
|
}
|
|
|
|
/// Resolve a source URL to its universal Song.link (Odesli) page URL.
|
|
/// One GET to the Odesli API; returns the `pageUrl` field.
|
|
pub async fn songlink_url(source_url: &str) -> Option<String> {
|
|
let resp = reqwest::Client::new()
|
|
.get("https://api.song.link/v1-alpha.1/links")
|
|
.query(&[("url", source_url)])
|
|
.send()
|
|
.await
|
|
.ok()?;
|
|
if !resp.status().is_success() {
|
|
log::warn!("[qbz-slint] song.link status {}", resp.status());
|
|
return None;
|
|
}
|
|
let value: serde_json::Value = resp.json().await.ok()?;
|
|
value
|
|
.get("pageUrl")
|
|
.and_then(|p| p.as_str())
|
|
.map(|s| s.to_string())
|
|
}
|