Remove unused code, move logic from .h to their .cpp, clean some things

This commit is contained in:
Vyn 2024-09-02 11:52:06 +02:00
parent 924e35ecc4
commit cb6c663833
41 changed files with 492 additions and 978 deletions

View file

@ -35,7 +35,7 @@ struct OpenNewTaskFormParams {
}
export global Backend {
in-out property<[string]> resources;
in-out property<[string]> sources;
in-out property<[string]> tags;
in-out property<[Day]> visible_tasks;

View file

@ -13,7 +13,7 @@ export component SideBar inherits Rectangle {
}
VerticalLayout {
spacing: 4px;
for item[index] in Backend.resources: ToggleButton {
for item[index] in Backend.sources: ToggleButton {
text: item;
text-alignment: left;
clicked => { Backend.source_clicked(index) }

View file

@ -2,7 +2,7 @@ import { Backend } from "Backend.slint";
import { Button, VerticalBox, CheckBox, Palette } from "std-widgets.slint";
import { SideBar } from "SideBar.slint";
import { MainView } from "MainView.slint";
import { TaskEdit } from "windows/TaskEdit.slint";
import { TaskWindow } from "windows/TaskWindow.slint";
import { EventWindow } from "windows/EventWindow.slint";
export component AppWindow inherits Window {
@ -23,4 +23,4 @@ export component AppWindow inherits Window {
}
export { Backend, TaskEdit, EventWindow } // Export to make it visible to the C++ backend
export { Backend, TaskWindow, EventWindow } // Export to make it visible to the C++ backend

View file

@ -29,7 +29,7 @@ export component EventWindow inherits Window {
default-font-size: 16px;
background: Palette.background;
in-out property<int> sourceId <=> resourceInput.current-index;
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;
@ -46,8 +46,8 @@ export component EventWindow inherits Window {
text: eventId == -1 ? "New event" : "Edit event";
}
resourceInput := ComboBox {
model: Backend.resources;
sourceInput := ComboBox {
model: Backend.sources;
enabled: eventId == -1;
}

View file

@ -16,7 +16,7 @@ export struct SaveTaskData {
date: Date,
}
export component TaskEdit inherits Window {
export component TaskWindow inherits Window {
title: "Mirai - " + (taskId == -1 ? "New task" : "Edit task");
min-width: 100px;
max-width: 1920px;
@ -30,7 +30,7 @@ export component TaskEdit inherits Window {
in-out property<int> eventId: -1;
in-out property<Date> taskDate <=> taskDateInput.date;
in-out property<string> taskTitle <=> taskTitleInput.text;
in-out property<int> taskResourceIndex <=> resourceInput.current-index;
in-out property<int> taskSourceIndex <=> sourceInput.current-index;
callback create(NewTaskData);
callback save(SaveTaskData);
@ -42,8 +42,8 @@ export component TaskEdit inherits Window {
text: taskId == -1 ? "New task" : "Edit task";
}
resourceInput := ComboBox {
model: Backend.resources;
sourceInput := ComboBox {
model: Backend.sources;
enabled: taskId == -1 && eventId == -1;
}
@ -63,14 +63,14 @@ export component TaskEdit inherits Window {
clicked => {
if (taskId == -1) {
create({
sourceId: taskResourceIndex,
sourceId: taskSourceIndex,
eventId: eventId,
title: taskTitle,
date: taskDate,
});
} else {
save({
sourceId: taskResourceIndex,
sourceId: taskSourceIndex,
id: taskId,
title: taskTitle,
date: taskDate,