Remove PNG images, replace them with SVGs
9
external/slint-vynui/BurgerIcon.slint
vendored
|
@ -1,9 +0,0 @@
|
||||||
import { Palette } from "./Palette.slint";
|
|
||||||
|
|
||||||
export component BurgerIcon inherits Path {
|
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
commands: "M3 6h18M3 12h18M3 18h18";
|
|
||||||
stroke: Palette.foreground;
|
|
||||||
stroke-width: 2px;
|
|
||||||
}
|
|
3
external/slint-vynui/DatePicker.slint
vendored
|
@ -2,6 +2,7 @@ import { Button, DatePickerPopup, Date, Palette } from "std-widgets.slint";
|
||||||
import { VLabeledComponent } from "LabeledComponent.slint";
|
import { VLabeledComponent } from "LabeledComponent.slint";
|
||||||
import { VActionButton } from "ActionButton.slint";
|
import { VActionButton } from "ActionButton.slint";
|
||||||
import { VButton } from "Button.slint";
|
import { VButton } from "Button.slint";
|
||||||
|
import { Svg } from "Svg.slint";
|
||||||
|
|
||||||
export component VDatePicker inherits VLabeledComponent {
|
export component VDatePicker inherits VLabeledComponent {
|
||||||
in-out property<Date> date;
|
in-out property<Date> date;
|
||||||
|
@ -34,7 +35,7 @@ export component VDatePicker inherits VLabeledComponent {
|
||||||
clicked => { taskDateInput.show() }
|
clicked => { taskDateInput.show() }
|
||||||
}
|
}
|
||||||
VActionButton {
|
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: Svg.reset;
|
||||||
icon-svg-stroke-width: 1px;
|
icon-svg-stroke-width: 1px;
|
||||||
enabled: root.enabled;
|
enabled: root.enabled;
|
||||||
clicked => { resetDate() }
|
clicked => { resetDate() }
|
||||||
|
|
12
external/slint-vynui/Svg.slint
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
export global Svg {
|
||||||
|
out property <string> burger: "M3 6h18M3 12h18M3 18h18";
|
||||||
|
out property <string> play: "M240 128a15.74 15.74 0 0 1-7.6 13.51L88.32 229.65a16 16 0 0 1-16.2.3A15.86 15.86 0 0 1 64 216.13V39.87a15.86 15.86 0 0 1 8.12-13.82a16 16 0 0 1 16.2.3l144.08 88.14A15.74 15.74 0 0 1 240 128";
|
||||||
|
out property <string> pause: "M216 48v160a16 16 0 0 1-16 16h-40a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h40a16 16 0 0 1 16 16M96 32H56a16 16 0 0 0-16 16v160a16 16 0 0 0 16 16h40a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16";
|
||||||
|
out property <string> reset: "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";
|
||||||
|
out property <string> trash: "M19 4h-3.5l-1-1h-5l-1 1H5v2h14M6 19a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7H6z";
|
||||||
|
out property <string> plus: "M11 13H5v-2h6V5h2v6h6v2h-6v6h-2z";
|
||||||
|
out property <string> pen: "M3 17.46v3.04c0 .28.22.5.5.5h3.04c.13 0 .26-.05.35-.15L17.81 9.94l-3.75-3.75L3.15 17.1q-.15.15-.15.36M20.71 7.04a.996.996 0 0 0 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83l3.75 3.75z";
|
||||||
|
out property <string> visible: "M2.933 3.491C4.056 2.681 5.456 2 7 2s2.944.682 4.067 1.491c1.128.812 2.02 1.784 2.56 2.437l.005.005c.241.3.368.681.368 1.067s-.127.766-.368 1.067l-.005.005c-.54.653-1.432 1.625-2.56 2.437C9.944 11.32 8.544 12 7 12s-2.944-.682-4.067-1.49C1.805 9.696.913 8.724.373 8.071l-.005-.005A1.7 1.7 0 0 1 0 7c0-.386.127-.766.368-1.067l.005-.005c.54-.653 1.432-1.625 2.56-2.437M7 9.25a2.25 2.25 0 1 0 0-4.5a2.25 2.25 0 0 0 0 4.5";
|
||||||
|
out property <string> not-visible: "M.264 1.324a.75.75 0 0 1 1.06-1.06l2.629 2.628C4.86 2.393 5.893 2.04 7 2.04c1.532 0 2.92.677 4.035 1.48c1.118.805 2.003 1.769 2.539 2.417l.004.005c.24.298.366.675.366 1.058s-.126.76-.366 1.058l-.004.006a14.5 14.5 0 0 1-2.249 2.2l2.411 2.412a.75.75 0 0 1-1.06 1.06zm8.753 6.633a2.232 2.232 0 0 0-2.974-2.974zm-8.59-2.02c.319-.387.762-.885 1.305-1.395l7.104 7.104A5.7 5.7 0 0 1 7 11.96c-1.532 0-2.92-.676-4.035-1.479C1.847 9.675.962 8.711.426 8.064l-.004-.006A1.7 1.7 0 0 1 .056 7c0-.383.126-.76.366-1.058l.004-.005Z";
|
||||||
|
|
||||||
|
}
|
2
external/slint-vynui/index.slint
vendored
|
@ -12,4 +12,4 @@ export { VTextInput } from "TextInput.slint";
|
||||||
export { VSlider } from "Slider.slint";
|
export { VSlider } from "Slider.slint";
|
||||||
export { ToggleButton } from "ToggleButton.slint";
|
export { ToggleButton } from "ToggleButton.slint";
|
||||||
|
|
||||||
export { BurgerIcon } from "BurgerIcon.slint";
|
export { Svg } from "Svg.slint";
|
||||||
|
|
|
@ -79,7 +79,7 @@ std::optional<Date> stringToDate(const std::string &dateStr)
|
||||||
|
|
||||||
void UiState::setupUtilsCallbacks()
|
void UiState::setupUtilsCallbacks()
|
||||||
{
|
{
|
||||||
mainWindow_->global<Backend>().on_formatDate([&](const Date &date) {
|
mainWindow_->global<Backend>().on_format_date([&](const Date &date) {
|
||||||
std::chrono::year_month_day chronoDate{
|
std::chrono::year_month_day chronoDate{
|
||||||
std::chrono::year(date.year),
|
std::chrono::year(date.year),
|
||||||
std::chrono::month(date.month),
|
std::chrono::month(date.month),
|
||||||
|
@ -116,18 +116,6 @@ void UiState::setupCallbacks()
|
||||||
reloadTasks();
|
reloadTasks();
|
||||||
});
|
});
|
||||||
|
|
||||||
/*mainWindow_->global<Backend>().on_tag_clicked([&](int index) {*/
|
|
||||||
/*const std::string &tag = miraiInstance_->getTags().at(index);*/
|
|
||||||
/*if (std::ranges::find(view_.getActiveTagsFilter(), tag) ==*/
|
|
||||||
/*view_.getActiveTagsFilter().end()) {*/
|
|
||||||
/*view_.addTagFilter(tag);*/
|
|
||||||
/*} else {*/
|
|
||||||
/*view_.removeTagFilter(tag);*/
|
|
||||||
/*}*/
|
|
||||||
/*view_.update();*/
|
|
||||||
/*reloadTasks();*/
|
|
||||||
/*});*/
|
|
||||||
|
|
||||||
mainWindow_->global<Backend>().on_delete_task_clicked([&](int sourceId, int taskId) {
|
mainWindow_->global<Backend>().on_delete_task_clicked([&](int sourceId, int taskId) {
|
||||||
auto source = miraiInstance_->getSourceById(sourceId);
|
auto source = miraiInstance_->getSourceById(sourceId);
|
||||||
assert(source);
|
assert(source);
|
||||||
|
@ -147,9 +135,9 @@ void UiState::setupCallbacks()
|
||||||
|
|
||||||
mainWindow_->global<Backend>().set_sources_selected(sources_);
|
mainWindow_->global<Backend>().set_sources_selected(sources_);
|
||||||
mainWindow_->global<Backend>().set_tags(tags_);
|
mainWindow_->global<Backend>().set_tags(tags_);
|
||||||
mainWindow_->global<Backend>().set_visible_tasks(days_);
|
mainWindow_->global<Backend>().set_days(days_);
|
||||||
|
|
||||||
mainWindow_->global<Backend>().on_saveTask([&](SaveTaskData newTaskData) {
|
mainWindow_->global<Backend>().on_save_task([&](SaveTaskData newTaskData) {
|
||||||
auto source = miraiInstance_->getSourceById(newTaskData.sourceId);
|
auto source = miraiInstance_->getSourceById(newTaskData.sourceId);
|
||||||
assert(source);
|
assert(source);
|
||||||
auto task = source->getTaskById(newTaskData.id);
|
auto task = source->getTaskById(newTaskData.id);
|
||||||
|
@ -167,7 +155,7 @@ void UiState::setupCallbacks()
|
||||||
reloadTasks();
|
reloadTasks();
|
||||||
});
|
});
|
||||||
|
|
||||||
mainWindow_->global<Backend>().on_createTask([&](NewTaskData newTaskData) {
|
mainWindow_->global<Backend>().on_create_task([&](NewTaskData newTaskData) {
|
||||||
std::optional<mirai::Date> date = std::nullopt;
|
std::optional<mirai::Date> date = std::nullopt;
|
||||||
if (newTaskData.date.year != 0) {
|
if (newTaskData.date.year != 0) {
|
||||||
date = SlintDateToMiraiDate(newTaskData.date);
|
date = SlintDateToMiraiDate(newTaskData.date);
|
||||||
|
@ -201,7 +189,7 @@ void UiState::setupCallbacks()
|
||||||
reloadTasks();
|
reloadTasks();
|
||||||
});
|
});
|
||||||
|
|
||||||
mainWindow_->global<Backend>().on_createEvent([&](NewEventParams newEventParams) {
|
mainWindow_->global<Backend>().on_create_event([&](NewEventParams newEventParams) {
|
||||||
const Date &date = newEventParams.date;
|
const Date &date = newEventParams.date;
|
||||||
const std::string dateStr = SlintDateToStdString(date);
|
const std::string dateStr = SlintDateToStdString(date);
|
||||||
auto source = miraiInstance_->getSourceById(newEventParams.sourceId);
|
auto source = miraiInstance_->getSourceById(newEventParams.sourceId);
|
||||||
|
@ -217,7 +205,7 @@ void UiState::setupCallbacks()
|
||||||
reloadTasks();
|
reloadTasks();
|
||||||
});
|
});
|
||||||
|
|
||||||
mainWindow_->global<Backend>().on_saveEvent([&](SaveEventParams newEventParams) {
|
mainWindow_->global<Backend>().on_save_event([&](SaveEventParams newEventParams) {
|
||||||
const Date &date = newEventParams.date;
|
const Date &date = newEventParams.date;
|
||||||
const std::string dateStr = SlintDateToStdString(date);
|
const std::string dateStr = SlintDateToStdString(date);
|
||||||
auto source = miraiInstance_->getSourceById(newEventParams.sourceId);
|
auto source = miraiInstance_->getSourceById(newEventParams.sourceId);
|
||||||
|
@ -311,7 +299,7 @@ void UiState::reloadTasks()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
days_ = slintDays;
|
days_ = slintDays;
|
||||||
mainWindow_->global<Backend>().set_visible_tasks(days_);
|
mainWindow_->global<Backend>().set_days(days_);
|
||||||
|
|
||||||
auto unscheduledTasksView = view_.getUnscheduledTasks();
|
auto unscheduledTasksView = view_.getUnscheduledTasks();
|
||||||
unscheduledTasks_->clear();
|
unscheduledTasks_->clear();
|
||||||
|
|
|
@ -77,25 +77,25 @@ export global Backend {
|
||||||
in-out property<[string]> sources;
|
in-out property<[string]> sources;
|
||||||
in-out property<bool> no-source-selected;
|
in-out property<bool> no-source-selected;
|
||||||
in-out property<[string]> tags;
|
in-out property<[string]> tags;
|
||||||
in-out property<[Day]> visible_tasks;
|
in-out property<[Day]> days;
|
||||||
in-out property<[TaskData]> unscheduled-tasks;
|
in-out property<[TaskData]> unscheduled-tasks;
|
||||||
|
|
||||||
callback task_clicked(int, int);
|
callback task-clicked(int, int);
|
||||||
callback source_clicked(int);
|
callback source-clicked(int);
|
||||||
callback tag_clicked(int);
|
callback tag-clicked(int);
|
||||||
|
|
||||||
callback open_new_task_form(OpenNewTaskFormParams);
|
callback open-new-task-form(OpenNewTaskFormParams);
|
||||||
callback open_edit_task_form(int, int);
|
callback open-edit-task-form(int, int);
|
||||||
callback open_new_event_form();
|
callback open-new-event-form();
|
||||||
callback open_edit_event_form(int, int);
|
callback open-edit-event-form(int, int);
|
||||||
callback toggle_show_completed_tasks();
|
callback toggle-show-completed-tasks();
|
||||||
callback delete_task_clicked(int, int);
|
callback delete-task-clicked(int, int);
|
||||||
callback delete_event_clicked(int, int);
|
callback delete-event-clicked(int, int);
|
||||||
|
|
||||||
callback createTask(NewTaskData);
|
callback create-task(NewTaskData);
|
||||||
callback saveTask(SaveTaskData);
|
callback save-task(SaveTaskData);
|
||||||
callback createEvent(NewEventParams);
|
callback create-event(NewEventParams);
|
||||||
callback saveEvent(SaveEventParams);
|
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 { Backend, TaskData } from "Backend.slint";
|
||||||
import { Button, VerticalBox, CheckBox, ScrollView, ComboBox } from "std-widgets.slint";
|
import { Button, VerticalBox, CheckBox, ScrollView, ComboBox } from "std-widgets.slint";
|
||||||
import { SideBar } from "SideBar.slint";
|
import { TaskLine } from "./components/TaskLine.slint";
|
||||||
import { TaskLine } from "TaskLine.slint";
|
import { EventGroup } from "./components/EventGroup.slint";
|
||||||
import { EventGroup } from "EventGroup.slint";
|
import { VPopupIconMenu, VDatePicker, VTimePicker, VCheckBox, VButton, VTag, VText, VTextInput, Svg, Palette } from "@vynui";
|
||||||
import { VPopupIconMenu, VDatePicker, VTimePicker, VCheckBox, VButton, VTag, VText, VTextInput, Palette } from "@vynui";
|
|
||||||
import { NewTaskData, SaveTaskData } from "Backend.slint";
|
import { NewTaskData, SaveTaskData } from "Backend.slint";
|
||||||
import { CreateTaskOrEvent } from "components/CreateTaskOrEvent.slint";
|
import { CreateTaskOrEvent } from "components/CreateTaskOrEvent.slint";
|
||||||
|
|
||||||
export component MainView inherits Rectangle {
|
export component MainView inherits Rectangle {
|
||||||
|
|
||||||
background: Palette.background;
|
background: Palette.background;
|
||||||
private property<image> icon-visible: @image-url("./images/visible.png");
|
private property<string> icon-visible: Svg.visible;
|
||||||
private property<image> icon-not-visible: @image-url("./images/not-visible.png");
|
private property<string> icon-not-visible: Svg.not-visible;
|
||||||
private property<bool> completed-tasks-visible: false;
|
private property<bool> completed-tasks-visible: false;
|
||||||
|
|
||||||
pure function formatZeroPadding(number: int) -> string {
|
|
||||||
if (number < 10) {
|
|
||||||
return "0\{number}";
|
|
||||||
}
|
|
||||||
return number;
|
|
||||||
}
|
|
||||||
|
|
||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
horizontal-stretch: 1;
|
horizontal-stretch: 1;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
|
@ -33,10 +25,10 @@ export component MainView inherits Rectangle {
|
||||||
VButton {
|
VButton {
|
||||||
text: "Show/Hide completed tasks";
|
text: "Show/Hide completed tasks";
|
||||||
clicked => {
|
clicked => {
|
||||||
Backend.toggle_show_completed_tasks();
|
Backend.toggle-show-completed-tasks();
|
||||||
completed-tasks-visible = !completed-tasks-visible;
|
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;
|
icon-colorize: Palette.control-foreground;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,12 +47,12 @@ export component MainView inherits Rectangle {
|
||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
alignment: start;
|
alignment: start;
|
||||||
spacing: 16px;
|
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";
|
text: "There is no task to show";
|
||||||
horizontal-alignment: center;
|
horizontal-alignment: center;
|
||||||
vertical-alignment: center;
|
vertical-alignment: center;
|
||||||
}
|
}
|
||||||
for day[dayIndex] in Backend.visible_tasks: VerticalLayout {
|
for day[dayIndex] in Backend.days: VerticalLayout {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
background: Palette.card-background;
|
background: Palette.card-background;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
|
@ -69,7 +61,7 @@ export component MainView inherits Rectangle {
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
alignment: start;
|
alignment: start;
|
||||||
VText {
|
VText {
|
||||||
text: Backend.formatDate(day.date);
|
text: Backend.format-date(day.date);
|
||||||
color: day.isLate ? Palette.orange : Palette.foreground;
|
color: day.isLate ? Palette.orange : Palette.foreground;
|
||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import { Time } from "std-widgets.slint";
|
import { Time } from "std-widgets.slint";
|
||||||
|
|
||||||
export global Utils {
|
export global Utils {
|
||||||
pure function formatZeroPadding(number: int) -> string {
|
pure function format-zero-padding(number: int) -> string {
|
||||||
if (number < 10) {
|
if (number < 10) {
|
||||||
return "0\{number}";
|
return "0\{number}";
|
||||||
}
|
}
|
||||||
return number;
|
return number;
|
||||||
}
|
}
|
||||||
|
|
||||||
public pure function timeToString(time: Time) -> string {
|
public pure function time-to-string(time: Time) -> string {
|
||||||
return "\{formatZeroPadding(time.hour)}h\{formatZeroPadding(time.minute)}";
|
return "\{format-zero-padding(time.hour)}h\{format-zero-padding(time.minute)}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
import { Backend } from "Backend.slint";
|
import { Backend } from "Backend.slint";
|
||||||
import { Button, VerticalBox, CheckBox, Palette } from "std-widgets.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 { MainView } from "MainView.slint";
|
||||||
import { TaskWindow } from "windows/TaskWindow.slint";
|
|
||||||
import { EventWindow } from "windows/EventWindow.slint";
|
|
||||||
|
|
||||||
export component AppWindow inherits Window {
|
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 => {
|
accepted => {
|
||||||
if (task-or-event == 1) {
|
if (task-or-event == 1) {
|
||||||
Backend.createTask({
|
Backend.create-task({
|
||||||
sourceId: sourceInput.current-index,
|
sourceId: sourceInput.current-index,
|
||||||
eventId: -1,
|
eventId: -1,
|
||||||
title: newTaskTitleInput.text,
|
title: newTaskTitleInput.text,
|
||||||
|
@ -34,7 +34,7 @@ export component CreateTaskOrEvent inherits Rectangle {
|
||||||
date: taskDateInput.date
|
date: taskDateInput.date
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
Backend.createEvent({
|
Backend.create-event({
|
||||||
sourceId: sourceInput.current-index,
|
sourceId: sourceInput.current-index,
|
||||||
title: newTaskTitleInput.text,
|
title: newTaskTitleInput.text,
|
||||||
date: taskDateInput.date,
|
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 { ScrollView } from "std-widgets.slint";
|
||||||
import { SideBar } from "SideBar.slint";
|
import { VCheckBox, VButton, VActionButton, Svg, VTag, VPopupIconMenu, VText, Palette } from "@vynui";
|
||||||
import { VCheckBox, VButton, VTag, VPopupIconMenu, VText, Palette } from "@vynui";
|
import { TaskLine } from "./TaskLine.slint";
|
||||||
import { TaskLine } from "TaskLine.slint";
|
import { Utils } from "../Utils.slint";
|
||||||
import { Utils } from "Utils.slint";
|
|
||||||
|
|
||||||
export component EventGroup {
|
export component EventGroup {
|
||||||
in property<Event> event;
|
in property<Event> event;
|
||||||
|
|
||||||
eventPopup := VPopupIconMenu {
|
eventPopup := VPopupIconMenu {
|
||||||
VButton {
|
VActionButton {
|
||||||
icon-source: @image-url("./images/add.png");
|
icon-svg: Svg.plus;
|
||||||
icon-colorize: Colors.greenyellow;
|
icon-colorize: Colors.greenyellow;
|
||||||
icon-size: 1.5rem;
|
icon-size: 1.5rem;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
clicked => { Backend.open_new_task_form({
|
clicked => { Backend.open-new-task-form({
|
||||||
eventSourceId: event.sourceId,
|
eventSourceId: event.sourceId,
|
||||||
eventId: event.id,
|
eventId: event.id,
|
||||||
})}
|
})}
|
||||||
}
|
}
|
||||||
VButton {
|
VActionButton {
|
||||||
icon-source: @image-url("./images/edit.png");
|
icon-svg: Svg.pen;
|
||||||
icon-colorize: Colors.grey;
|
icon-colorize: Colors.grey;
|
||||||
icon-size: 1.5rem;
|
icon-size: 1.5rem;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
clicked => { Backend.open_edit_event_form(event.sourceId, event.id) }
|
clicked => { Backend.open-edit-event-form(event.sourceId, event.id) }
|
||||||
}
|
}
|
||||||
|
|
||||||
VButton {
|
VActionButton {
|
||||||
icon-source: @image-url("./images/delete.png");
|
icon-svg: Svg.trash;
|
||||||
icon-colorize: Colors.pink;
|
icon-colorize: Colors.pink;
|
||||||
icon-size: 1.5rem;
|
icon-size: 1.5rem;
|
||||||
border-radius: 0;
|
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 {
|
VerticalLayout {
|
||||||
spacing: 4px;
|
spacing: 4px;
|
||||||
VText {
|
VText {
|
||||||
text: Utils.timeToString(event.startsAt);
|
text: Utils.time-to-string(event.startsAt);
|
||||||
color: Palette.accent;
|
color: Palette.accent;
|
||||||
}
|
}
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
|
@ -61,7 +60,7 @@ export component EventGroup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
VText {
|
VText {
|
||||||
text: Utils.timeToString(event.endsAt);
|
text: Utils.time-to-string(event.endsAt);
|
||||||
color: Palette.accent;
|
color: Palette.accent;
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
horizontal-alignment: center;
|
horizontal-alignment: center;
|
|
@ -1,4 +1,4 @@
|
||||||
import { Backend } from "Backend.slint";
|
import { Backend } from "../Backend.slint";
|
||||||
import { ToggleButton, VText, Palette } from "@vynui";
|
import { ToggleButton, VText, Palette } from "@vynui";
|
||||||
|
|
||||||
export component SideBar inherits Rectangle {
|
export component SideBar inherits Rectangle {
|
||||||
|
@ -18,26 +18,14 @@ export component SideBar inherits Rectangle {
|
||||||
text: "All";
|
text: "All";
|
||||||
text-alignment: left;
|
text-alignment: left;
|
||||||
active: Backend.no-source-selected;
|
active: Backend.no-source-selected;
|
||||||
clicked => { Backend.source_clicked(-1) }
|
clicked => { Backend.source-clicked(-1) }
|
||||||
}
|
}
|
||||||
for item[index] in Backend.sources-selected: ToggleButton {
|
for item[index] in Backend.sources-selected: ToggleButton {
|
||||||
text: item.name;
|
text: item.name;
|
||||||
text-alignment: left;
|
text-alignment: left;
|
||||||
active: item.selected;
|
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 { ToggleButton } from "@vynui";
|
||||||
import { VPopupIconMenu, VTag, VButton, VCheckBox, Palette } from "@vynui";
|
import { VPopupIconMenu, VTag, VButton, VActionButton, VCheckBox, Svg, Palette } from "@vynui";
|
||||||
import { TaskEdit } from "components/TaskEdit.slint";
|
import { TaskEdit } from "./TaskEdit.slint";
|
||||||
import { Date } from "std-widgets.slint";
|
import { Date } from "std-widgets.slint";
|
||||||
|
|
||||||
export component TaskLine inherits VerticalLayout {
|
export component TaskLine inherits VerticalLayout {
|
||||||
|
@ -22,7 +22,7 @@ export component TaskLine inherits VerticalLayout {
|
||||||
|
|
||||||
taskEdit := TaskEdit {
|
taskEdit := TaskEdit {
|
||||||
accepted(task) => {
|
accepted(task) => {
|
||||||
Backend.saveTask({
|
Backend.save-task({
|
||||||
id: task.id,
|
id: task.id,
|
||||||
sourceId: task.sourceId,
|
sourceId: task.sourceId,
|
||||||
title: task.title,
|
title: task.title,
|
||||||
|
@ -35,8 +35,8 @@ export component TaskLine inherits VerticalLayout {
|
||||||
|
|
||||||
if !taskEdit.should-show : Rectangle {
|
if !taskEdit.should-show : Rectangle {
|
||||||
popup := VPopupIconMenu {
|
popup := VPopupIconMenu {
|
||||||
VButton {
|
VActionButton {
|
||||||
icon-source: @image-url("./images/edit.png");
|
icon-svg: Svg.pen;
|
||||||
icon-colorize: Colors.grey;
|
icon-colorize: Colors.grey;
|
||||||
icon-size: 1.5rem;
|
icon-size: 1.5rem;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
|
@ -51,13 +51,13 @@ export component TaskLine inherits VerticalLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VButton {
|
VActionButton {
|
||||||
icon-source: @image-url("./images/delete.png");
|
icon-svg: Svg.trash;
|
||||||
icon-colorize: Colors.pink;
|
icon-colorize: Colors.pink;
|
||||||
icon-size: 1.5rem;
|
icon-size: 1.5rem;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
clicked => {
|
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 {
|
ta := TouchArea {
|
||||||
clicked => {
|
clicked => {
|
||||||
checkbox.checked = !checkbox.checked;
|
checkbox.checked = !checkbox.checked;
|
||||||
Backend.task_clicked(source-index, task-index);
|
Backend.task-clicked(source-index, task-index);
|
||||||
}
|
}
|
||||||
pointer-event(e) => {
|
pointer-event(e) => {
|
||||||
if (e.button == PointerEventButton.right && e.kind == PointerEventKind.up) {
|
if (e.button == PointerEventButton.right && e.kind == PointerEventKind.up) {
|
||||||
|
@ -84,7 +84,7 @@ export component TaskLine inherits VerticalLayout {
|
||||||
text: task.title;
|
text: task.title;
|
||||||
checked: task.checked;
|
checked: task.checked;
|
||||||
toggled => {
|
toggled => {
|
||||||
Backend.task_clicked(source-index, task-index)
|
Backend.task-clicked(source-index, task-index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for tag[tag-index] in task.tags: VTag {
|
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 }
|
|