Implement Rust and Slint native client migration and fix desktop startup
ci / linux-arm64-cross (push) Successful in 4m7s
ci / linux-x64 (push) Successful in 4m42s

This commit is contained in:
omar committed 2026-11-10 15:45:24 +03:00
1 parent 0d11f8f99d
commit eb24965076
1303 files changed
+732670 -2375

No files matched your search

+92
View File
@@ -0,0 +1,92 @@
import { ScrollView, TextEdit } from "std-widgets.slint";
import { Theme } from "theme.slint";
import { ActionButton, TextField, Choice, Toggle } from "controls.slint";
import { ShellBridge, ShellCommand } from "shell.slint";
export struct ShellField { id: string, label: string, section: string, hint: string, kind: int, value: string, checked: bool, choices: [string], choice-index: int, enabled: bool, advanced: bool, error: string }
export global DialogBridge {
in-out property <bool> visible;
in-out property <bool> onboarding;
in-out property <string> title;
in-out property <string> description;
in-out property <[ShellField]> fields;
in-out property <[ShellCommand]> actions;
in-out property <string> error;
in-out property <bool> busy;
in-out property <bool> destructive;
in-out property <string> confirmation-label;
in-out property <string> confirmation;
in-out property <string> submit-label;
in-out property <string> cancel-label;
in-out property <string> advanced-label;
in-out property <string> loading-label;
callback edit(string, string);
callback choose(string, int);
callback confirm(string);
callback submit();
callback cancel();
}
export component ShellDialog inherits Rectangle {
background: Theme.contrast.with-alpha(0.75);
// An overlay blocks background pointer input without turning Cancel into a submit.
TouchArea { }
dialog := Rectangle {
width: min(parent.width - 24px, 640px);
height: min(parent.height - 24px, layout.preferred-height);
x: (parent.width - self.width)/2;
y: (parent.height - self.height)/2;
background: Theme.contrast;
border-color: Theme.outline;
border-width: 1px;
border-radius: 8px;
accessible-role: form;
accessible-label: DialogBridge.title;
property <bool> advanced: false;
layout := VerticalLayout {
padding: 20px; spacing: 12px;
Text { text: DialogBridge.title; font-size: Theme.font-size * 1.6; font-weight: 700; color: Theme.fg; wrap: word-wrap; }
if DialogBridge.description != "": Text { text: DialogBridge.description; color: Theme.muted; wrap: word-wrap; }
form-scroll := ScrollView {
min-height: 80px; max-height: 600px;
VerticalLayout {
spacing: 12px;
for field in DialogBridge.fields: field-row := Rectangle {
visible: !field.advanced || dialog.advanced;
height: self.visible ? row.preferred-height : 0px;
row := VerticalLayout {
spacing: 4px;
Text { text: field.label; color: Theme.fg; wrap: word-wrap; }
if field.kind == 0 || field.kind == 1 || field.kind == 3 || field.kind == 4: TextField {
text: field.value; placeholder: field.label; secret: field.kind == 1; enabled: field.enabled && !DialogBridge.busy;
edited(value) => { DialogBridge.edit(field.id,value); }
changed has-focus => { if self.has-focus { form-scroll.content-y = clamp(-field-row.y,min(0px,form-scroll.visible-height - form-scroll.content-height),0px); } }
}
if field.kind == 2: TextEdit {
text: field.value; enabled: field.enabled && !DialogBridge.busy; wrap: word-wrap; min-height: 110px;
accessible-label: field.label;
edited => { DialogBridge.edit(field.id,self.text); }
changed has-focus => { if self.has-focus { form-scroll.content-y = clamp(-field-row.y,min(0px,form-scroll.visible-height - form-scroll.content-height),0px); } }
}
if field.kind == 5: Toggle { checked: field.checked; label: field.label; enabled: field.enabled && !DialogBridge.busy; toggled(value) => { DialogBridge.edit(field.id,value ? "true" : "false"); } }
if field.kind == 6: Choice { values: field.choices; current-index: field.choice-index; label: field.label; enabled: field.enabled && !DialogBridge.busy; selected(index) => { DialogBridge.choose(field.id,index); } }
if field.hint != "": Text { text: field.hint; color: Theme.muted; wrap: word-wrap; }
if field.error != "": Text { text: field.error; color: Theme.error; wrap: word-wrap; accessible-role: text; }
}
}
for action in DialogBridge.actions: ActionButton { text: action.label; enabled: action.enabled && !DialogBridge.busy; destructive: action.destructive; clicked => { ShellBridge.invoke(action.id); } }
ActionButton { text: DialogBridge.advanced-label; clicked => { dialog.advanced = !dialog.advanced; } }
if DialogBridge.confirmation-label != "": Text { text: DialogBridge.confirmation-label; color: Theme.warning; wrap: word-wrap; }
if DialogBridge.confirmation-label != "": TextField { text: DialogBridge.confirmation; placeholder: DialogBridge.confirmation-label; enabled: !DialogBridge.busy; edited(value) => { DialogBridge.confirm(value); } }
}
}
if DialogBridge.error != "": Text { text: DialogBridge.error; color: Theme.error; wrap: word-wrap; accessible-live-region: assertive; }
if DialogBridge.busy: Text { text: DialogBridge.loading-label; color: Theme.muted; }
HorizontalLayout {
alignment: end; spacing: 8px;
ActionButton { text: DialogBridge.cancel-label; clicked => { DialogBridge.cancel(); } }
ActionButton { text: DialogBridge.submit-label; primary: true; destructive: DialogBridge.destructive; enabled: !DialogBridge.busy; clicked => { DialogBridge.submit(); } }
}
}
}
}