feat(qbz-slint): per-device-type icons in the QConnect device picker
Mirror Qobuz Connect's device icons in the connect flyout: map each renderer's device_type to an icon (6 -> smartphone, 5 -> monitor or globe when the name is a web player/browser, else -> speaker), matching the Tauri QconnectBadge resolveDeviceType. Adds lucide monitor/smartphone/speaker/globe svgs, an icon key on the QconnectDevice model computed in the event sink, and a per-row icon in the PlayerBar device list. cc
This commit is contained in:
7 files changed
+52
-1
No files matched your search
@@ -158,6 +158,8 @@ impl SlintQconnectEventSink {
|
||||
.into(),
|
||||
is_local: Some(r.renderer_id) == session.local_renderer_id,
|
||||
is_active: Some(r.renderer_id) == session.active_renderer_id,
|
||||
icon: device_icon_key(r.device_type, r.friendly_name.as_deref().unwrap_or(""))
|
||||
.into(),
|
||||
})
|
||||
.collect();
|
||||
(devices, session.active_renderer_id.unwrap_or(-1))
|
||||
@@ -495,6 +497,25 @@ impl QconnectEventSink for SlintQconnectEventSink {
|
||||
}
|
||||
}
|
||||
|
||||
/// Map a renderer's `device_type` (+ a name heuristic for web players) to a
|
||||
/// device-icon key, mirroring the Tauri `QconnectBadge.resolveDeviceType`:
|
||||
/// 6 = mobile, 5 = computer (or "web" when the name says web player/browser),
|
||||
/// anything else (3/4/…) = speaker/receiver.
|
||||
fn device_icon_key(device_type: Option<i32>, friendly_name: &str) -> &'static str {
|
||||
match device_type.unwrap_or(5) {
|
||||
6 => "mobile",
|
||||
5 => {
|
||||
let name = friendly_name.to_ascii_lowercase();
|
||||
if name.contains("web player") || name.contains("browser") {
|
||||
"web"
|
||||
} else {
|
||||
"computer"
|
||||
}
|
||||
}
|
||||
_ => "speaker",
|
||||
}
|
||||
}
|
||||
|
||||
/// Format a QConnect event into a one-line DEV-log entry. Big payloads
|
||||
/// (QueueUpdated / SessionManagement) are summarized; the rest use Debug.
|
||||
fn dev_event_line(event: &QconnectAppEvent) -> String {
|
||||
|
||||
Reference in new issue
Block a user