mirai/ui/windows/EditSourceWindow.slint

47 lines
1.1 KiB
Text

import { Backend } from "../Backend.slint";
import { VerticalBox, CheckBox } from "std-widgets.slint";
import { SideBar } from "../components/SideBar.slint";
import { VButton, VText, VTextInput, Palette } from "@selenite";
export component EditSourceWindow inherits Window {
in-out property <int> id;
in-out property name <=> nameInput.text;
in-out property path <=> pathInput.text;
title: "Mirai - Edit source";
min-height: 100px;
max-height: 4000px; // needed, otherwise the window wants to fit the content (on Swaywm)
min-width: 400px;
default-font-size: 16px;
background: Palette.background;
VerticalLayout {
padding: 16px;
spacing: 8px;
nameInput := VTextInput {
label: "Name";
}
pathInput := VTextInput {
label: "Path";
}
VButton {
text: "Save";
clicked => {
Backend.modify-source({
id: root.id,
name: nameInput.text,
path: pathInput.text
})
}
}
VButton {
text: "Delete";
background-color: Colors.red;
double-clicked => {
Backend.delete-source(root.id)
}
}
}
}
export { Backend, Palette } // Export to make it visible to the C++ backend