The single 1700-line app.slint becomes a design system and screens that later waves can compose: - theme.slint: colour, radius, spacing and type tokens (dark and light, a runtime font scale); icons.slint: Lucide icons as tintable images. - components/: Button, IconButton, TextField, SearchBox, Select, Toggle, Slider, SegmentedTabs, Avatar, badges, Card, Meter, NavItem, ListItem, PopupMenu, Tooltip, Modal, Toast, ResizeHandle, Spinner, RichText and the EmojiPicker. - shells/: the desktop frame (server rail, top bar, sidebar with the user card) and the phone frame with a bottom navigation, switched at a breakpoint from the settings. - screens/: today's screens re-skinned (channels, chat, streams panel and viewer, settings page, home, dialogs, phone pages); all callbacks and properties keep their behaviour. Navigation state is the Nav global. On the Rust side app.rs keeps setup and event glue; servers.rs, chat.rs, settings_page.rs and appearance.rs hold the logic, vm/ the pure view models, bind/ the callbacks, dev.rs the development switches. Models are created once and updated row by row (vm::list::sync); each chat tab owns its lines model, so a message appends one row. Emoji come from the bundled Twemoji archive through a size-bounded image cache, split into runs that wrap with the text. New settings ui.theme, ui.font_scale, ui.narrow_breakpoint and ui.image_cache_mb apply live. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
70 lines
2.4 KiB
Plaintext
70 lines
2.4 KiB
Plaintext
import { Theme } from "../theme.slint";
|
|
|
|
// The segmented audio level meter: green, then yellow, red at the top; unlit
|
|
// segments dim. `level` is dBFS; an optional threshold marker (voice
|
|
// activation).
|
|
export component Meter inherits Rectangle {
|
|
in property <float> level: -100;
|
|
in property <float> threshold: -40;
|
|
in property <bool> show-threshold;
|
|
// Dimmed while nothing is sent.
|
|
in property <bool> active: true;
|
|
in property <int> segments: 20;
|
|
// dBFS at the left edge.
|
|
in property <float> floor: -70;
|
|
in property <length> gap: 3px;
|
|
|
|
property <float> lit: clamp((level - floor) / (0 - floor), 0, 1) * segments;
|
|
|
|
height: 10px;
|
|
min-width: 80px;
|
|
horizontal-stretch: 1;
|
|
accessible-role: AccessibleRole.progress-indicator;
|
|
accessible-label: @tr("Microphone level");
|
|
accessible-value: @tr("{} dB", round(level));
|
|
accessible-value-minimum: floor;
|
|
accessible-value-maximum: 0;
|
|
|
|
for i in root.segments: Rectangle {
|
|
property <float> part: i / root.segments;
|
|
x: i * (root.width + root.gap) / root.segments;
|
|
width: (root.width + root.gap) / root.segments - root.gap;
|
|
border-radius: 2px;
|
|
background: i < root.lit
|
|
? (part >= 0.9 ? Theme.meter-high : part >= 0.7 ? Theme.meter-mid : Theme.meter-low).transparentize(root.active ? 0 : 0.45)
|
|
: Theme.meter-off;
|
|
}
|
|
if root.show-threshold: Rectangle {
|
|
x: root.width * clamp((root.threshold - root.floor) / (0 - root.floor), 0, 1) - 1px;
|
|
y: -3px;
|
|
width: 2px;
|
|
height: root.height + 6px;
|
|
border-radius: 1px;
|
|
background: Theme.text;
|
|
}
|
|
}
|
|
|
|
// Three bars that move while someone speaks (the "speaking" glyph).
|
|
export component SpeakingBars inherits Rectangle {
|
|
in property <bool> active: true;
|
|
in property <color> tint: Theme.success;
|
|
property <int> phase;
|
|
width: 14px;
|
|
height: 14px;
|
|
Timer {
|
|
interval: 160ms;
|
|
running: root.active;
|
|
triggered => { root.phase = mod(root.phase + 1, 4); }
|
|
}
|
|
for i in 3: Rectangle {
|
|
property <float> h: !root.active ? 0.35 : mod(i + root.phase, 4) == 0 ? 1.0 : mod(i + root.phase, 4) == 1 ? 0.6 : mod(i + root.phase, 4) == 2 ? 0.8 : 0.45;
|
|
x: i * 5px;
|
|
y: root.height * (1 - h) / 2;
|
|
width: 3px;
|
|
height: root.height * h;
|
|
border-radius: 1.5px;
|
|
background: root.tint;
|
|
animate height, y { duration: 140ms; }
|
|
}
|
|
}
|