Ui changes, remove unused buttons

This commit is contained in:
Vyn 2024-10-15 11:55:39 +02:00
parent 36a2fe9220
commit e28ba796cd
53 changed files with 133 additions and 27125 deletions

View file

@ -7,6 +7,7 @@ export component VActionButton inherits Rectangle {
in property<brush> icon-colorize: Palette.foreground;
in property<length> icon-size: 1rem;
in property<string> icon-svg;
in property<length> icon-svg-stroke-width: 2px;
in property enabled <=> ta.enabled;
callback clicked;
@ -33,7 +34,7 @@ export component VActionButton inherits Rectangle {
padding: 8px;
commands: root.icon-svg;
stroke: icon-colorize;
stroke-width: 2px;
stroke-width: icon-svg-stroke-width;
width: icon-size;
height: icon-size;
fill: icon-colorize;

View file

@ -1,12 +1,11 @@
import { Button, DatePickerPopup, Date, Palette } from "std-widgets.slint";
import { VLabeledComponent } from "LabeledComponent.slint";
import { VActionButton } from "ActionButton.slint";
import { VButton } from "Button.slint";
export component VDatePicker inherits VLabeledComponent {
in-out property<Date> date;
in-out property<string> dateDisplay: formatZeroPadding(date.day) + "/" + formatZeroPadding(date.month) + "/" + date.year;
in-out property<string> dateDisplay;
pure function formatZeroPadding(number: int) -> string {
if (number < 10) {
@ -15,10 +14,31 @@ export component VDatePicker inherits VLabeledComponent {
return number;
}
button := VButton {
text: dateDisplay;
enabled: root.enabled;
clicked => { taskDateInput.show() }
pure function getDateDisplay() -> string {
if (date.year == 0) {
return "Unscheduled";
}
return formatZeroPadding(date.day) + "/" + formatZeroPadding(date.month) + "/" + date.year;
}
function resetDate() {
date.year = 0;
date.month = 0;
date.day = 0;
}
HorizontalLayout {
VButton {
text: getDateDisplay();
enabled: root.enabled;
clicked => { taskDateInput.show() }
}
VActionButton {
icon-svg: "M18 28A12 12 0 1 0 6 16v6.2l-3.6-3.6L1 20l6 6l6-6l-1.4-1.4L8 22.2V16a10 10 0 1 1 10 10Z";
icon-svg-stroke-width: 1px;
enabled: root.enabled;
clicked => { resetDate() }
}
}
taskDateInput := DatePickerPopup {

View file

@ -8,6 +8,15 @@ export component VTextInput inherits VLabeledComponent {
in-out property placeholder <=> textInputComponent.accessible-placeholder-text;
in-out property wrap <=> textInputComponent.wrap;
callback accepted();
callback edited();
callback started-writting();
public function edit-text(text: string) {
root.text = text;
root.old-text = text;
}
private property <string> old-text: "";
VerticalLayout {
padding: 4px;
@ -16,6 +25,13 @@ export component VTextInput inherits VLabeledComponent {
textInputComponent := TextInput {
color: Palette.foreground;
accepted => { root.accepted() }
edited => {
root.edited();
if (textInputComponent.text != "" && old-text == "") {
root.started-writting();
}
old-text = textInputComponent.text;
}
HorizontalLayout {
alignment: start;
VText {