Move Models and Actions slint definitions in the shared directory

This commit is contained in:
Vyn 2025-06-24 12:04:54 +02:00
parent f2f472a595
commit 72b004b7b0
Signed by: vyn
GPG key ID: E1B2BE34E7A971E7
15 changed files with 58 additions and 66 deletions

View file

@ -1,5 +1,5 @@
import { AppWindowModels, TaskData } from "../Models.slint";
import { AppWindowActions, NewTaskData, SaveTaskData } from "../Actions.slint";
import { AppModels, TaskData } from "../../../shared/Models.slint";
import { AppActions, NewTaskData, SaveTaskData } from "../../../shared/Actions.slint";
import { Button, VerticalBox, CheckBox, ScrollView, ComboBox } from "std-widgets.slint";
import { TaskLine } from "../../../components/TaskLine.slint";
import { EventGroup } from "../../../components/EventGroup.slint";
@ -23,7 +23,7 @@ export component MainView inherits Rectangle {
VButton {
text: "Show/Hide completed tasks";
clicked => {
AppWindowActions.toggle-show-completed-tasks();
AppActions.toggle-show-completed-tasks();
completed-tasks-visible = !completed-tasks-visible;
}
icon-svg: completed-tasks-visible ? icon-visible : icon-not-visible;
@ -37,9 +37,9 @@ export component MainView inherits Rectangle {
}
CreateTaskOrEvent {
sources: AppWindowModels.sources;
sources: AppModels.sources;
create-task(data) => {
AppWindowActions.create-task({
AppActions.create-task({
sourceId: data.sourceId,
eventId: -1,
title: data.title,
@ -54,12 +54,12 @@ export component MainView inherits Rectangle {
horizontal-stretch: 1;
VerticalLayout {
alignment: start;
if AppWindowModels.days.length == 0 && AppWindowModels.unscheduled-tasks.length == 0 : VText {
if AppModels.days.length == 0 && AppModels.unscheduled-tasks.length == 0 : VText {
text: "There is no task to show";
horizontal-alignment: center;
vertical-alignment: center;
}
for day[dayIndex] in AppWindowModels.days: VerticalLayout {
for day[dayIndex] in AppModels.days: VerticalLayout {
spacing: day.tasks.length > 0 ? 16px : 0px;
padding-bottom: 32px;
@ -92,19 +92,19 @@ export component MainView inherits Rectangle {
padding-bottom: 8px;
TaskLine {
title: task.title;
source-name: AppWindowModels.get-source-name-from-id(task.sourceId);
source-name: AppModels.get-source-name-from-id(task.sourceId);
scheduled: task.date.year != 0;
date: day.date;
checked: task.checked;
allow-edit-date: true;
delete => {
AppWindowActions.delete-task-clicked(task.sourceId, task.id)
AppActions.delete-task-clicked(task.sourceId, task.id)
}
toggle-check => {
AppWindowActions.task-clicked(task.sourceId, task.id);
AppActions.task-clicked(task.sourceId, task.id);
}
edited(data) => {
AppWindowActions.save-task({
AppActions.save-task({
id: task.id,
sourceId: task.sourceId,
title: data.title,
@ -117,7 +117,7 @@ export component MainView inherits Rectangle {
}
}
}
if AppWindowModels.unscheduled-tasks.length > 0 : VerticalLayout {
if AppModels.unscheduled-tasks.length > 0 : VerticalLayout {
Rectangle {
//background: Palette.card-background;
border-radius: 8px;
@ -130,22 +130,22 @@ export component MainView inherits Rectangle {
font-size: 1.2rem;
}
}
for task[taskIndex] in AppWindowModels.unscheduled-tasks: VerticalLayout {
for task[taskIndex] in AppModels.unscheduled-tasks: VerticalLayout {
padding-top: taskIndex == 0 ? 16px : 0px;
padding-bottom: 8px;
TaskLine {
title: task.title;
source-name: AppWindowModels.get-source-name-from-id(task.sourceId);
source-name: AppModels.get-source-name-from-id(task.sourceId);
checked: task.checked;
allow-edit-date: true;
delete => {
AppWindowActions.delete-task-clicked(task.sourceId, task.id)
AppActions.delete-task-clicked(task.sourceId, task.id)
}
toggle-check => {
AppWindowActions.task-clicked(task.sourceId, task.id);
AppActions.task-clicked(task.sourceId, task.id);
}
edited(data) => {
AppWindowActions.save-task({
AppActions.save-task({
id: task.id,
sourceId: task.sourceId,
title: data.title,