mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-03 01:33:19 +00:00
Refactor the whole structure, no more separation for C++ and Slint files
This commit is contained in:
parent
d6c781faa2
commit
893fcc11e3
35 changed files with 920 additions and 518 deletions
54
src/windows/EditSourceWindow/EditSourceWindow.slint
Normal file
54
src/windows/EditSourceWindow/EditSourceWindow.slint
Normal file
|
@ -0,0 +1,54 @@
|
|||
import { VerticalBox, CheckBox } from "std-widgets.slint";
|
||||
import { VButton, VText, VTextInput, Palette } from "@selenite";
|
||||
|
||||
export struct ModifySourceParam {
|
||||
id: int,
|
||||
name: string,
|
||||
path: string
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
callback modify-source(ModifySourceParam);
|
||||
callback delete-source(int);
|
||||
|
||||
VerticalLayout {
|
||||
padding: 16px;
|
||||
spacing: 8px;
|
||||
nameInput := VTextInput {
|
||||
label: "Name";
|
||||
}
|
||||
pathInput := VTextInput {
|
||||
label: "Path";
|
||||
}
|
||||
VButton {
|
||||
text: "Save";
|
||||
clicked => {
|
||||
root.modify-source({
|
||||
id: root.id,
|
||||
name: nameInput.text,
|
||||
path: pathInput.text
|
||||
})
|
||||
}
|
||||
}
|
||||
VButton {
|
||||
text: "Delete";
|
||||
background-color: Palette.red;
|
||||
double-clicked => {
|
||||
root.delete-source(root.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { Palette } // Export to make it visible to the C++ backend
|
Loading…
Add table
Add a link
Reference in a new issue