2026-04-06 18:40:34 +00:00
|
|
|
import { Theme } from "../theme.slint";
|
2026-04-07 11:45:12 +00:00
|
|
|
import { DarkButton } from "../components/dark_button.slint";
|
2026-04-07 06:46:39 +00:00
|
|
|
import { DarkComboBox } from "../components/dark_combo_box.slint";
|
2026-04-07 11:45:12 +00:00
|
|
|
import { SettingsBridge, AppState, ConnectionState } from "../globals.slint";
|
2026-04-06 18:40:34 +00:00
|
|
|
|
|
|
|
|
export component TabSettings inherits Rectangle {
|
|
|
|
|
background: Theme.bg-primary;
|
|
|
|
|
|
|
|
|
|
VerticalLayout {
|
|
|
|
|
padding: 20px;
|
|
|
|
|
spacing: 16px;
|
|
|
|
|
alignment: start;
|
|
|
|
|
|
|
|
|
|
Text {
|
|
|
|
|
text: "Settings";
|
|
|
|
|
color: Theme.fg-primary;
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-07 11:45:12 +00:00
|
|
|
// Keyboard layout
|
2026-04-06 18:40:34 +00:00
|
|
|
Rectangle {
|
|
|
|
|
background: Theme.bg-secondary;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
|
|
|
|
HorizontalLayout {
|
|
|
|
|
padding: 16px;
|
|
|
|
|
spacing: 12px;
|
|
|
|
|
|
|
|
|
|
VerticalLayout {
|
|
|
|
|
alignment: center;
|
2026-04-07 11:45:12 +00:00
|
|
|
Text { text: "Keyboard Layout"; color: Theme.fg-primary; font-size: 14px; }
|
|
|
|
|
Text { text: "Controls how keycodes are displayed"; color: Theme.fg-secondary; font-size: 11px; }
|
2026-04-06 18:40:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Rectangle { horizontal-stretch: 1; }
|
|
|
|
|
|
|
|
|
|
VerticalLayout {
|
|
|
|
|
alignment: center;
|
2026-04-07 06:46:39 +00:00
|
|
|
DarkComboBox {
|
2026-04-06 18:40:34 +00:00
|
|
|
width: 200px;
|
|
|
|
|
model: SettingsBridge.available-layouts;
|
|
|
|
|
current-index <=> SettingsBridge.selected-layout-index;
|
2026-04-07 11:45:12 +00:00
|
|
|
selected(value) => { SettingsBridge.change-layout(self.current-index); }
|
2026-04-06 18:40:34 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-07 11:45:12 +00:00
|
|
|
// OTA Firmware Update
|
2026-04-06 18:40:34 +00:00
|
|
|
Rectangle {
|
|
|
|
|
background: Theme.bg-secondary;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
|
|
|
|
VerticalLayout {
|
|
|
|
|
padding: 16px;
|
2026-04-07 11:45:12 +00:00
|
|
|
spacing: 10px;
|
2026-04-06 18:40:34 +00:00
|
|
|
|
2026-04-07 11:45:12 +00:00
|
|
|
Text { text: "OTA Firmware Update"; color: Theme.accent-cyan; font-size: 14px; font-weight: 600; }
|
|
|
|
|
Text { text: "Update firmware via USB (no programming cable needed)"; color: Theme.fg-secondary; font-size: 11px; }
|
|
|
|
|
|
|
|
|
|
HorizontalLayout {
|
|
|
|
|
spacing: 8px;
|
|
|
|
|
|
|
|
|
|
Text {
|
|
|
|
|
horizontal-stretch: 1;
|
|
|
|
|
text: SettingsBridge.ota-path != "" ? SettingsBridge.ota-path : "No firmware file selected";
|
|
|
|
|
color: SettingsBridge.ota-path != "" ? Theme.fg-primary : Theme.fg-secondary;
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
vertical-alignment: center;
|
|
|
|
|
overflow: elide;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DarkButton {
|
|
|
|
|
text: "Browse...";
|
|
|
|
|
clicked => { SettingsBridge.ota-browse(); }
|
|
|
|
|
}
|
2026-04-06 18:40:34 +00:00
|
|
|
}
|
2026-04-07 11:45:12 +00:00
|
|
|
|
|
|
|
|
HorizontalLayout {
|
|
|
|
|
spacing: 12px;
|
|
|
|
|
|
|
|
|
|
DarkButton {
|
|
|
|
|
text: SettingsBridge.ota-flashing ? "Flashing..." : "Flash OTA";
|
|
|
|
|
primary: true;
|
|
|
|
|
enabled: !SettingsBridge.ota-flashing
|
|
|
|
|
&& SettingsBridge.ota-path != ""
|
|
|
|
|
&& AppState.connection == ConnectionState.connected;
|
|
|
|
|
clicked => { SettingsBridge.ota-start(); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Text {
|
|
|
|
|
text: SettingsBridge.ota-status;
|
|
|
|
|
color: Theme.fg-primary;
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
vertical-alignment: center;
|
|
|
|
|
horizontal-stretch: 1;
|
|
|
|
|
}
|
2026-04-06 18:40:34 +00:00
|
|
|
}
|
2026-04-07 11:45:12 +00:00
|
|
|
|
|
|
|
|
if SettingsBridge.ota-flashing || SettingsBridge.ota-progress > 0 : Rectangle {
|
|
|
|
|
height: 20px;
|
|
|
|
|
background: Theme.bg-primary;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
x: 0;
|
|
|
|
|
width: parent.width * clamp(SettingsBridge.ota-progress, 0, 1);
|
|
|
|
|
height: 100%;
|
|
|
|
|
background: SettingsBridge.ota-progress >= 1.0 ? Theme.accent-green : Theme.accent-purple;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Text {
|
|
|
|
|
text: round(SettingsBridge.ota-progress * 100) + "%";
|
|
|
|
|
color: Theme.fg-primary;
|
|
|
|
|
font-size: 11px;
|
|
|
|
|
horizontal-alignment: center;
|
|
|
|
|
vertical-alignment: center;
|
|
|
|
|
}
|
2026-04-06 18:40:34 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-07 11:45:12 +00:00
|
|
|
// About
|
|
|
|
|
Rectangle {
|
|
|
|
|
background: Theme.bg-secondary;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
|
|
|
|
VerticalLayout {
|
|
|
|
|
padding: 16px;
|
|
|
|
|
spacing: 8px;
|
|
|
|
|
|
|
|
|
|
Text { text: "About"; color: Theme.fg-primary; font-size: 14px; font-weight: 600; }
|
|
|
|
|
Text { text: "KeSp Controller v0.6.0"; color: Theme.fg-secondary; font-size: 12px; }
|
|
|
|
|
Text { text: "Split keyboard configurator"; color: Theme.fg-secondary; font-size: 12px; }
|
|
|
|
|
Text { text: "Made with Slint"; color: Theme.accent-purple; font-size: 11px; }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-06 18:40:34 +00:00
|
|
|
Rectangle { vertical-stretch: 1; }
|
|
|
|
|
}
|
|
|
|
|
}
|