Files
qbz/crates/qbz-ui/ui/shell/QconnectDevModal.slint
T
vicrodh c4ddca0223 fix(input): gate hotkeys while text inputs are focused
A use-site `changed has-focus` on a std-widgets LineEdit/TextEdit never
fires — has-focus is an alias into the inner TextInput (slint#7747) — so
typing a letter that doubles as a shortcut ran the action instead of
inserting the character. Sweep every text-input surface (search, import,
create/edit playlist & folder, tag editor, colour picker, settings
fields, QConnect dev modal, kiosk shell) and drive
UiFocusState.text-input-focused from a `guard-focused` probe property
that the change tracker does observe.

cc
2026-07-16 20:37:57 -06:00

153 lines
6.7 KiB
Plaintext

// Qobuz Connect — DEV diagnostics modal.
//
// Opened from the connect flyout's "Diagnostics" button. Shows a live status
// block (session topology / active+local renderer / queue version) and a rolling
// event log with relative timestamps. The Rust side (qconnect_service +
// qconnect_event_sink) populates QconnectDevState.status / .log. Backdrop or the
// X closes it (open is in-out, toggled directly here).
import { Theme } from "../foundation/semantic-colors.slint";
import { Typography } from "../foundation/typography.slint";
import { Radius } from "../foundation/radius.slint";
import { QconnectDevState, UiFocusState } from "../state.slint";
import { QbzIcon } from "../primitives/QbzIcon.slint";
import { TextEdit } from "std-widgets.slint";
export component QconnectDevModal inherits Rectangle {
visible: QconnectDevState.open;
if QconnectDevState.open: Rectangle {
background: #000000bf;
TouchArea {
mouse-cursor: default;
clicked => {
QconnectDevState.open = false;
}
}
Rectangle {
width: Math.min(root.width - 80px, 600px);
height: Math.min(root.height - 80px, 640px);
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
border-radius: Radius.md;
background: Theme.surface-card;
border-width: 1px;
border-color: Theme.border-subtle;
drop-shadow-blur: 32px;
drop-shadow-color: #00000080;
// Swallow clicks so they don't reach the backdrop.
TouchArea { }
VerticalLayout {
padding: 20px;
spacing: 14px;
// Header.
HorizontalLayout {
Text {
text: "Qobuz Connect — Diagnostics";
color: Theme.text-primary;
font-size: Typography.heading;
font-weight: Typography.semibold;
horizontal-stretch: 1;
vertical-alignment: center;
}
close-x := TouchArea {
width: 28px;
height: 28px;
mouse-cursor: pointer;
clicked => {
QconnectDevState.open = false;
}
QbzIcon {
source: @image-url("../assets/icons/x.svg");
width: 17px;
height: 17px;
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
tint: close-x.has-hover ? Theme.text-primary : Theme.text-muted;
}
}
}
// Live status block.
Rectangle {
background: Theme.surface-elevated;
border-radius: Radius.sm;
height: 140px;
clip: true;
TextEdit {
width: 100%;
height: 100%;
read-only: true;
wrap: word-wrap;
font-size: 12px;
text: QconnectDevState.status == ""
? "Not connected."
: QconnectDevState.status;
// Read-only but still focusable (select/copy) — keep the
// single-key hotkeys quiet while it holds focus.
// Hotkey-guard probe: a use-site `changed has-focus` on a std-widgets
// input never fires (has-focus is an alias into the inner TextInput),
// so observe it through a local property instead (#619).
property <bool> guard-focused: self.has-focus;
changed guard-focused => { UiFocusState.text-input-focused = self.guard-focused; }
}
}
// Event-log header + clear.
HorizontalLayout {
Text {
text: "Event log (newest first)";
color: Theme.text-primary;
font-size: Typography.body;
font-weight: Typography.semibold;
horizontal-stretch: 1;
vertical-alignment: center;
}
Rectangle {
width: clr.preferred-width + 22px;
height: 26px;
border-radius: Radius.sm;
background: clear-ta.has-hover ? Theme.surface-card : transparent;
border-width: 1px;
border-color: Theme.border-subtle;
clr := Text {
text: "Clear";
color: Theme.text-secondary;
font-size: 12px;
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
}
clear-ta := TouchArea {
mouse-cursor: pointer;
clicked => {
QconnectDevState.clear();
}
}
}
}
// Rolling event log (newest first) — read-only TextEdit so the
// lines are selectable + copyable (Ctrl+C), and it scrolls.
Rectangle {
vertical-stretch: 1;
TextEdit {
width: 100%;
height: 100%;
read-only: true;
wrap: word-wrap;
font-size: 11px;
text: QconnectDevState.log-text;
// Hotkey-guard probe: a use-site `changed has-focus` on a std-widgets
// input never fires (has-focus is an alias into the inner TextInput),
// so observe it through a local property instead (#619).
property <bool> guard-focused: self.has-focus;
changed guard-focused => { UiFocusState.text-input-focused = self.guard-focused; }
}
}
}
}
}
}