mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-03 01:33:19 +00:00
Rework mirai core
This commit is contained in:
parent
f885d355cd
commit
36a2fe9220
62 changed files with 27689 additions and 765 deletions
|
@ -1,9 +1,13 @@
|
|||
import { Backend, TaskData } from "Backend.slint";
|
||||
import { ToggleButton } from "@vynui";
|
||||
import { VPopupIconMenu, VTag, VButton, VCheckBox, Palette } from "@vynui";
|
||||
import { TaskEdit } from "components/TaskEdit.slint";
|
||||
import { Date } from "std-widgets.slint";
|
||||
|
||||
export component TaskLine {
|
||||
export component TaskLine inherits VerticalLayout {
|
||||
in property<TaskData> task;
|
||||
in property<Date> date;
|
||||
in property<int> event-index: -1;
|
||||
in property<int> source-index: -1;
|
||||
in property<int> task-index: -1;
|
||||
|
||||
|
@ -16,72 +20,81 @@ export component TaskLine {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
popup := VPopupIconMenu {
|
||||
VButton {
|
||||
icon-source: @image-url("./images/edit.png");
|
||||
icon-colorize: Colors.grey;
|
||||
icon-size: 1.5rem;
|
||||
border-radius: 0;
|
||||
clicked => { Backend.open_edit_task_form(source-index, task-index) }
|
||||
}
|
||||
|
||||
VButton {
|
||||
icon-source: @image-url("./images/delete.png");
|
||||
icon-colorize: Colors.pink;
|
||||
icon-size: 1.5rem;
|
||||
border-radius: 0;
|
||||
clicked => { Backend.delete_task_clicked(source-index, task-index) }
|
||||
taskEdit := TaskEdit {
|
||||
accepted(task) => {
|
||||
Backend.saveTask({
|
||||
id: task.id,
|
||||
sourceId: task.sourceId,
|
||||
title: task.title,
|
||||
scheduled: task.date.year != 0,
|
||||
date: task.date
|
||||
});
|
||||
taskEdit.close();
|
||||
}
|
||||
}
|
||||
|
||||
ta := TouchArea {
|
||||
clicked => {
|
||||
checkbox.checked = !checkbox.checked;
|
||||
Backend.task_clicked(source-index, task-index);
|
||||
}
|
||||
pointer-event(e) => {
|
||||
if (e.button == PointerEventButton.right && e.kind == PointerEventKind.up) {
|
||||
popup.show(ta.mouse-x, ta.mouse-y);
|
||||
}
|
||||
}
|
||||
z: 10;
|
||||
}
|
||||
|
||||
|
||||
|
||||
HorizontalLayout {
|
||||
alignment: space-between;
|
||||
HorizontalLayout {
|
||||
alignment: start;
|
||||
spacing: 8px;
|
||||
checkbox := VCheckBox {
|
||||
text: task.title;
|
||||
checked: task.checked;
|
||||
toggled => {
|
||||
Backend.task_clicked(source-index, task-index)
|
||||
}
|
||||
}
|
||||
for tag[tag-index] in task.tags: VTag {
|
||||
text: tag;
|
||||
size: 0.8rem;
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
alignment: end;
|
||||
spacing: 8px;
|
||||
// Not needed anymore, to remove later
|
||||
/*VButton {
|
||||
if !taskEdit.should-show : Rectangle {
|
||||
popup := VPopupIconMenu {
|
||||
VButton {
|
||||
icon-source: @image-url("./images/edit.png");
|
||||
icon-colorize: Colors.grey;
|
||||
clicked => { Backend.open_edit_task_form(source-index, task-index) }
|
||||
icon-size: 1.5rem;
|
||||
border-radius: 0;
|
||||
clicked => {
|
||||
taskEdit.show({
|
||||
sourceId: task.sourceId,
|
||||
id: task.id,
|
||||
title: task.title,
|
||||
scheduled: root.date.year != 0,
|
||||
date: date,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
VButton {
|
||||
icon-source: @image-url("./images/delete.png");
|
||||
icon-colorize: Colors.pink;
|
||||
clicked => { Backend.delete_task_clicked(source-index, task-index) }
|
||||
}*/
|
||||
icon-size: 1.5rem;
|
||||
border-radius: 0;
|
||||
clicked => {
|
||||
Backend.delete_task_clicked(source-index, task-index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ta := TouchArea {
|
||||
clicked => {
|
||||
checkbox.checked = !checkbox.checked;
|
||||
Backend.task_clicked(source-index, task-index);
|
||||
}
|
||||
pointer-event(e) => {
|
||||
if (e.button == PointerEventButton.right && e.kind == PointerEventKind.up) {
|
||||
popup.show(ta.mouse-x, ta.mouse-y);
|
||||
}
|
||||
}
|
||||
z: 10;
|
||||
}
|
||||
|
||||
HorizontalLayout {
|
||||
alignment: space-between;
|
||||
HorizontalLayout {
|
||||
alignment: start;
|
||||
spacing: 8px;
|
||||
checkbox := VCheckBox {
|
||||
text: task.title;
|
||||
checked: task.checked;
|
||||
toggled => {
|
||||
Backend.task_clicked(source-index, task-index)
|
||||
}
|
||||
}
|
||||
for tag[tag-index] in task.tags: VTag {
|
||||
text: tag;
|
||||
size: 0.8rem;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue