Remove PNG images, replace them with SVGs
|
@ -77,25 +77,25 @@ export global Backend {
|
|||
in-out property<[string]> sources;
|
||||
in-out property<bool> no-source-selected;
|
||||
in-out property<[string]> tags;
|
||||
in-out property<[Day]> visible_tasks;
|
||||
in-out property<[Day]> days;
|
||||
in-out property<[TaskData]> unscheduled-tasks;
|
||||
|
||||
callback task_clicked(int, int);
|
||||
callback source_clicked(int);
|
||||
callback tag_clicked(int);
|
||||
callback task-clicked(int, int);
|
||||
callback source-clicked(int);
|
||||
callback tag-clicked(int);
|
||||
|
||||
callback open_new_task_form(OpenNewTaskFormParams);
|
||||
callback open_edit_task_form(int, int);
|
||||
callback open_new_event_form();
|
||||
callback open_edit_event_form(int, int);
|
||||
callback toggle_show_completed_tasks();
|
||||
callback delete_task_clicked(int, int);
|
||||
callback delete_event_clicked(int, int);
|
||||
callback open-new-task-form(OpenNewTaskFormParams);
|
||||
callback open-edit-task-form(int, int);
|
||||
callback open-new-event-form();
|
||||
callback open-edit-event-form(int, int);
|
||||
callback toggle-show-completed-tasks();
|
||||
callback delete-task-clicked(int, int);
|
||||
callback delete-event-clicked(int, int);
|
||||
|
||||
callback createTask(NewTaskData);
|
||||
callback saveTask(SaveTaskData);
|
||||
callback createEvent(NewEventParams);
|
||||
callback saveEvent(SaveEventParams);
|
||||
callback create-task(NewTaskData);
|
||||
callback save-task(SaveTaskData);
|
||||
callback create-event(NewEventParams);
|
||||
callback save-event(SaveEventParams);
|
||||
|
||||
pure callback formatDate(Date) -> string;
|
||||
pure callback format-date(Date) -> string;
|
||||
}
|
||||
|
|
|
@ -1,26 +1,18 @@
|
|||
import { Backend, TaskData } from "Backend.slint";
|
||||
import { Button, VerticalBox, CheckBox, ScrollView, ComboBox } from "std-widgets.slint";
|
||||
import { SideBar } from "SideBar.slint";
|
||||
import { TaskLine } from "TaskLine.slint";
|
||||
import { EventGroup } from "EventGroup.slint";
|
||||
import { VPopupIconMenu, VDatePicker, VTimePicker, VCheckBox, VButton, VTag, VText, VTextInput, Palette } from "@vynui";
|
||||
import { TaskLine } from "./components/TaskLine.slint";
|
||||
import { EventGroup } from "./components/EventGroup.slint";
|
||||
import { VPopupIconMenu, VDatePicker, VTimePicker, VCheckBox, VButton, VTag, VText, VTextInput, Svg, Palette } from "@vynui";
|
||||
import { NewTaskData, SaveTaskData } from "Backend.slint";
|
||||
import { CreateTaskOrEvent } from "components/CreateTaskOrEvent.slint";
|
||||
|
||||
export component MainView inherits Rectangle {
|
||||
|
||||
background: Palette.background;
|
||||
private property<image> icon-visible: @image-url("./images/visible.png");
|
||||
private property<image> icon-not-visible: @image-url("./images/not-visible.png");
|
||||
private property<string> icon-visible: Svg.visible;
|
||||
private property<string> icon-not-visible: Svg.not-visible;
|
||||
private property<bool> completed-tasks-visible: false;
|
||||
|
||||
pure function formatZeroPadding(number: int) -> string {
|
||||
if (number < 10) {
|
||||
return "0\{number}";
|
||||
}
|
||||
return number;
|
||||
}
|
||||
|
||||
VerticalLayout {
|
||||
horizontal-stretch: 1;
|
||||
padding: 16px;
|
||||
|
@ -33,10 +25,10 @@ export component MainView inherits Rectangle {
|
|||
VButton {
|
||||
text: "Show/Hide completed tasks";
|
||||
clicked => {
|
||||
Backend.toggle_show_completed_tasks();
|
||||
Backend.toggle-show-completed-tasks();
|
||||
completed-tasks-visible = !completed-tasks-visible;
|
||||
}
|
||||
icon-source: completed-tasks-visible ? icon-visible : icon-not-visible;
|
||||
icon-svg: completed-tasks-visible ? icon-visible : icon-not-visible;
|
||||
icon-colorize: Palette.control-foreground;
|
||||
}
|
||||
}
|
||||
|
@ -55,12 +47,12 @@ export component MainView inherits Rectangle {
|
|||
VerticalLayout {
|
||||
alignment: start;
|
||||
spacing: 16px;
|
||||
if Backend.visible_tasks.length == 0 && Backend.unscheduled-tasks.length == 0 : VText {
|
||||
if Backend.days.length == 0 && Backend.unscheduled-tasks.length == 0 : VText {
|
||||
text: "There is no task to show";
|
||||
horizontal-alignment: center;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
for day[dayIndex] in Backend.visible_tasks: VerticalLayout {
|
||||
for day[dayIndex] in Backend.days: VerticalLayout {
|
||||
Rectangle {
|
||||
background: Palette.card-background;
|
||||
border-radius: 8px;
|
||||
|
@ -69,7 +61,7 @@ export component MainView inherits Rectangle {
|
|||
HorizontalLayout {
|
||||
alignment: start;
|
||||
VText {
|
||||
text: Backend.formatDate(day.date);
|
||||
text: Backend.format-date(day.date);
|
||||
color: day.isLate ? Palette.orange : Palette.foreground;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { Time } from "std-widgets.slint";
|
||||
|
||||
export global Utils {
|
||||
pure function formatZeroPadding(number: int) -> string {
|
||||
pure function format-zero-padding(number: int) -> string {
|
||||
if (number < 10) {
|
||||
return "0\{number}";
|
||||
}
|
||||
return number;
|
||||
}
|
||||
|
||||
public pure function timeToString(time: Time) -> string {
|
||||
return "\{formatZeroPadding(time.hour)}h\{formatZeroPadding(time.minute)}";
|
||||
public pure function time-to-string(time: Time) -> string {
|
||||
return "\{format-zero-padding(time.hour)}h\{format-zero-padding(time.minute)}";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import { Backend } from "Backend.slint";
|
||||
import { Button, VerticalBox, CheckBox, Palette } from "std-widgets.slint";
|
||||
import { SideBar } from "SideBar.slint";
|
||||
import { SideBar } from "./components/SideBar.slint";
|
||||
import { MainView } from "MainView.slint";
|
||||
import { TaskWindow } from "windows/TaskWindow.slint";
|
||||
import { EventWindow } from "windows/EventWindow.slint";
|
||||
|
||||
export component AppWindow inherits Window {
|
||||
|
||||
|
@ -23,4 +21,4 @@ export component AppWindow inherits Window {
|
|||
|
||||
}
|
||||
|
||||
export { Backend, TaskWindow, EventWindow } // Export to make it visible to the C++ backend
|
||||
export { Backend } // Export to make it visible to the C++ backend
|
||||
|
|
|
@ -26,7 +26,7 @@ export component CreateTaskOrEvent inherits Rectangle {
|
|||
}
|
||||
accepted => {
|
||||
if (task-or-event == 1) {
|
||||
Backend.createTask({
|
||||
Backend.create-task({
|
||||
sourceId: sourceInput.current-index,
|
||||
eventId: -1,
|
||||
title: newTaskTitleInput.text,
|
||||
|
@ -34,7 +34,7 @@ export component CreateTaskOrEvent inherits Rectangle {
|
|||
date: taskDateInput.date
|
||||
})
|
||||
} else {
|
||||
Backend.createEvent({
|
||||
Backend.create-event({
|
||||
sourceId: sourceInput.current-index,
|
||||
title: newTaskTitleInput.text,
|
||||
date: taskDateInput.date,
|
||||
|
|
|
@ -1,38 +1,37 @@
|
|||
import { Backend, TaskData, Event } from "Backend.slint";
|
||||
import { Backend, TaskData, Event } from "../Backend.slint";
|
||||
import { ScrollView } from "std-widgets.slint";
|
||||
import { SideBar } from "SideBar.slint";
|
||||
import { VCheckBox, VButton, VTag, VPopupIconMenu, VText, Palette } from "@vynui";
|
||||
import { TaskLine } from "TaskLine.slint";
|
||||
import { Utils } from "Utils.slint";
|
||||
import { VCheckBox, VButton, VActionButton, Svg, VTag, VPopupIconMenu, VText, Palette } from "@vynui";
|
||||
import { TaskLine } from "./TaskLine.slint";
|
||||
import { Utils } from "../Utils.slint";
|
||||
|
||||
export component EventGroup {
|
||||
in property<Event> event;
|
||||
|
||||
eventPopup := VPopupIconMenu {
|
||||
VButton {
|
||||
icon-source: @image-url("./images/add.png");
|
||||
VActionButton {
|
||||
icon-svg: Svg.plus;
|
||||
icon-colorize: Colors.greenyellow;
|
||||
icon-size: 1.5rem;
|
||||
border-radius: 0;
|
||||
clicked => { Backend.open_new_task_form({
|
||||
clicked => { Backend.open-new-task-form({
|
||||
eventSourceId: event.sourceId,
|
||||
eventId: event.id,
|
||||
})}
|
||||
}
|
||||
VButton {
|
||||
icon-source: @image-url("./images/edit.png");
|
||||
VActionButton {
|
||||
icon-svg: Svg.pen;
|
||||
icon-colorize: Colors.grey;
|
||||
icon-size: 1.5rem;
|
||||
border-radius: 0;
|
||||
clicked => { Backend.open_edit_event_form(event.sourceId, event.id) }
|
||||
clicked => { Backend.open-edit-event-form(event.sourceId, event.id) }
|
||||
}
|
||||
|
||||
VButton {
|
||||
icon-source: @image-url("./images/delete.png");
|
||||
VActionButton {
|
||||
icon-svg: Svg.trash;
|
||||
icon-colorize: Colors.pink;
|
||||
icon-size: 1.5rem;
|
||||
border-radius: 0;
|
||||
clicked => { Backend.delete_event_clicked(event.sourceId, event.id) }
|
||||
clicked => { Backend.delete-event-clicked(event.sourceId, event.id) }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +47,7 @@ export component EventGroup {
|
|||
VerticalLayout {
|
||||
spacing: 4px;
|
||||
VText {
|
||||
text: Utils.timeToString(event.startsAt);
|
||||
text: Utils.time-to-string(event.startsAt);
|
||||
color: Palette.accent;
|
||||
}
|
||||
HorizontalLayout {
|
||||
|
@ -61,7 +60,7 @@ export component EventGroup {
|
|||
}
|
||||
}
|
||||
VText {
|
||||
text: Utils.timeToString(event.endsAt);
|
||||
text: Utils.time-to-string(event.endsAt);
|
||||
color: Palette.accent;
|
||||
font-size: 0.8rem;
|
||||
horizontal-alignment: center;
|
|
@ -1,4 +1,4 @@
|
|||
import { Backend } from "Backend.slint";
|
||||
import { Backend } from "../Backend.slint";
|
||||
import { ToggleButton, VText, Palette } from "@vynui";
|
||||
|
||||
export component SideBar inherits Rectangle {
|
||||
|
@ -18,26 +18,14 @@ export component SideBar inherits Rectangle {
|
|||
text: "All";
|
||||
text-alignment: left;
|
||||
active: Backend.no-source-selected;
|
||||
clicked => { Backend.source_clicked(-1) }
|
||||
clicked => { Backend.source-clicked(-1) }
|
||||
}
|
||||
for item[index] in Backend.sources-selected: ToggleButton {
|
||||
text: item.name;
|
||||
text-alignment: left;
|
||||
active: item.selected;
|
||||
clicked => { Backend.source_clicked(index) }
|
||||
clicked => { Backend.source-clicked(index) }
|
||||
}
|
||||
}
|
||||
/*VText {
|
||||
text: "Tags";
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
VerticalLayout {
|
||||
spacing: 4px;
|
||||
for item[index] in Backend.tags: ToggleButton {
|
||||
text: item;
|
||||
text-alignment: left;
|
||||
clicked => { Backend.tag_clicked(index) }
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
import { Backend, TaskData } from "Backend.slint";
|
||||
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 { VPopupIconMenu, VTag, VButton, VActionButton, VCheckBox, Svg, Palette } from "@vynui";
|
||||
import { TaskEdit } from "./TaskEdit.slint";
|
||||
import { Date } from "std-widgets.slint";
|
||||
|
||||
export component TaskLine inherits VerticalLayout {
|
||||
|
@ -22,7 +22,7 @@ export component TaskLine inherits VerticalLayout {
|
|||
|
||||
taskEdit := TaskEdit {
|
||||
accepted(task) => {
|
||||
Backend.saveTask({
|
||||
Backend.save-task({
|
||||
id: task.id,
|
||||
sourceId: task.sourceId,
|
||||
title: task.title,
|
||||
|
@ -35,8 +35,8 @@ export component TaskLine inherits VerticalLayout {
|
|||
|
||||
if !taskEdit.should-show : Rectangle {
|
||||
popup := VPopupIconMenu {
|
||||
VButton {
|
||||
icon-source: @image-url("./images/edit.png");
|
||||
VActionButton {
|
||||
icon-svg: Svg.pen;
|
||||
icon-colorize: Colors.grey;
|
||||
icon-size: 1.5rem;
|
||||
border-radius: 0;
|
||||
|
@ -51,13 +51,13 @@ export component TaskLine inherits VerticalLayout {
|
|||
}
|
||||
}
|
||||
|
||||
VButton {
|
||||
icon-source: @image-url("./images/delete.png");
|
||||
VActionButton {
|
||||
icon-svg: Svg.trash;
|
||||
icon-colorize: Colors.pink;
|
||||
icon-size: 1.5rem;
|
||||
border-radius: 0;
|
||||
clicked => {
|
||||
Backend.delete_task_clicked(source-index, task-index)
|
||||
Backend.delete-task-clicked(source-index, task-index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ export component TaskLine inherits VerticalLayout {
|
|||
ta := TouchArea {
|
||||
clicked => {
|
||||
checkbox.checked = !checkbox.checked;
|
||||
Backend.task_clicked(source-index, task-index);
|
||||
Backend.task-clicked(source-index, task-index);
|
||||
}
|
||||
pointer-event(e) => {
|
||||
if (e.button == PointerEventButton.right && e.kind == PointerEventKind.up) {
|
||||
|
@ -84,7 +84,7 @@ export component TaskLine inherits VerticalLayout {
|
|||
text: task.title;
|
||||
checked: task.checked;
|
||||
toggled => {
|
||||
Backend.task_clicked(source-index, task-index)
|
||||
Backend.task-clicked(source-index, task-index)
|
||||
}
|
||||
}
|
||||
for tag[tag-index] in task.tags: VTag {
|
Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 2.3 KiB |
|
@ -1,100 +0,0 @@
|
|||
import { Date, Time, ComboBox } from "std-widgets.slint";
|
||||
import { VTimePicker, VDatePicker, VButton, VTextInput, VText, Palette } from "@vynui";
|
||||
import { Backend } from "../Backend.slint";
|
||||
|
||||
struct NewEventParams {
|
||||
sourceId: int,
|
||||
title: string,
|
||||
date: Date,
|
||||
startsAt: Time,
|
||||
endsAt: Time
|
||||
}
|
||||
|
||||
struct SaveEventParams {
|
||||
sourceId: int,
|
||||
id: int,
|
||||
title: string,
|
||||
date: Date,
|
||||
startsAt: Time,
|
||||
endsAt: Time
|
||||
}
|
||||
|
||||
export component EventWindow inherits Window {
|
||||
title: "Mirai - " + (eventId == -1 ? "New event" : "Edit event");
|
||||
min-width: 100px;
|
||||
max-width: 1920px;
|
||||
preferred-width: 512px;
|
||||
min-height: 100px;
|
||||
max-height: 4000px;
|
||||
default-font-size: 16px;
|
||||
background: Palette.background;
|
||||
|
||||
in-out property<int> sourceId <=> sourceInput.current-index;
|
||||
in-out property<int> eventId: -1;
|
||||
in-out property<Date> taskDate <=> taskDateInput.date;
|
||||
in-out property<string> taskTitle <=> taskTitleInput.text;
|
||||
in-out property<Time> startsAt <=> eventStartTimeInput.time;
|
||||
in-out property<Time> endsAt <=> eventEndTimeInput.time;
|
||||
|
||||
callback create(NewEventParams);
|
||||
callback save(SaveEventParams);
|
||||
|
||||
VerticalLayout {
|
||||
padding: 16px;
|
||||
spacing: 8px;
|
||||
VText {
|
||||
text: eventId == -1 ? "New event" : "Edit event";
|
||||
}
|
||||
|
||||
sourceInput := ComboBox {
|
||||
model: Backend.sources;
|
||||
enabled: eventId == -1;
|
||||
}
|
||||
|
||||
taskDateInput := VDatePicker {
|
||||
label: "Date";
|
||||
}
|
||||
|
||||
taskTitleInput := VTextInput {
|
||||
label: "Title";
|
||||
wrap: word-wrap;
|
||||
}
|
||||
|
||||
HorizontalLayout {
|
||||
spacing: 4px;
|
||||
eventStartTimeInput := VTimePicker {
|
||||
label: "Starts at";
|
||||
}
|
||||
|
||||
eventEndTimeInput := VTimePicker {
|
||||
label: "Ends at";
|
||||
}
|
||||
}
|
||||
|
||||
VButton {
|
||||
text: eventId == -1 ? "Create" : "Save";
|
||||
clicked => {
|
||||
if (eventId == -1) {
|
||||
create({
|
||||
sourceId: sourceId,
|
||||
title: taskTitle,
|
||||
date: taskDate,
|
||||
startsAt: startsAt,
|
||||
endsAt: endsAt,
|
||||
});
|
||||
} else {
|
||||
save({
|
||||
sourceId: sourceId,
|
||||
id: eventId,
|
||||
title: taskTitle,
|
||||
date: taskDate,
|
||||
startsAt: startsAt,
|
||||
endsAt: endsAt,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { Backend }
|
|
@ -1,93 +0,0 @@
|
|||
import { Date, ComboBox } from "std-widgets.slint";
|
||||
import { VTextInput, VButton, VDatePicker, VText, VCheckBox, Palette } from "@vynui";
|
||||
import { Backend } from "../Backend.slint";
|
||||
|
||||
struct NewTaskData {
|
||||
sourceId: int,
|
||||
eventId: int,
|
||||
title: string,
|
||||
scheduled: bool,
|
||||
date: Date
|
||||
}
|
||||
|
||||
struct SaveTaskData {
|
||||
sourceId: int,
|
||||
id: int,
|
||||
title: string,
|
||||
scheduled: bool,
|
||||
date: Date,
|
||||
}
|
||||
|
||||
export component TaskWindow inherits Window {
|
||||
title: "Mirai - " + (taskId == -1 ? "New task" : "Edit task");
|
||||
min-width: 100px;
|
||||
max-width: 1920px;
|
||||
preferred-width: 512px;
|
||||
min-height: 100px;
|
||||
max-height: 4000px;
|
||||
default-font-size: 16px;
|
||||
background: Palette.background;
|
||||
|
||||
in-out property<int> taskId: -1;
|
||||
in-out property<int> eventId: -1;
|
||||
in-out property<bool> scheduled <=> scheduledInput.checked;
|
||||
in-out property<Date> taskDate <=> taskDateInput.date;
|
||||
in-out property<string> taskTitle <=> taskTitleInput.text;
|
||||
in-out property<int> taskSourceIndex <=> sourceInput.current-index;
|
||||
|
||||
callback create(NewTaskData);
|
||||
callback save(SaveTaskData);
|
||||
|
||||
VerticalLayout {
|
||||
padding: 16px;
|
||||
spacing: 8px;
|
||||
VText {
|
||||
text: taskId == -1 ? "New task" : "Edit task";
|
||||
}
|
||||
|
||||
sourceInput := ComboBox {
|
||||
model: Backend.sources;
|
||||
enabled: taskId == -1 && eventId == -1;
|
||||
}
|
||||
|
||||
scheduledInput := VCheckBox {
|
||||
text: "Scheduled";
|
||||
}
|
||||
|
||||
taskDateInput := VDatePicker {
|
||||
label: "Date";
|
||||
enabled: eventId == -1 && scheduledInput.checked;
|
||||
}
|
||||
|
||||
taskTitleInput := VTextInput {
|
||||
label: "Content";
|
||||
wrap: word-wrap;
|
||||
accepted => { button.clicked() }
|
||||
}
|
||||
|
||||
button := VButton {
|
||||
text: taskId == -1 ? "Create" : "Save";
|
||||
clicked => {
|
||||
if (taskId == -1) {
|
||||
create({
|
||||
sourceId: taskSourceIndex,
|
||||
eventId: eventId,
|
||||
title: taskTitle,
|
||||
scheduled: scheduled,
|
||||
date: taskDate,
|
||||
});
|
||||
} else {
|
||||
save({
|
||||
sourceId: taskSourceIndex,
|
||||
id: taskId,
|
||||
title: taskTitle,
|
||||
scheduled: scheduled,
|
||||
date: taskDate,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { Backend }
|