2024-11-04 14:45:27 +01:00
|
|
|
import { AppWindowModels, TaskData } from "../Models.slint";
|
|
|
|
import { AppWindowActions } from "../Actions.slint";
|
2024-11-01 13:43:45 +01:00
|
|
|
import { VButton, ToggleButton, VActionButton, VText, Svg, Palette } from "@selenite";
|
2025-06-24 09:31:34 +02:00
|
|
|
import { EditSourceModal } from "../../../modals/EditSourceModal.slint";
|
|
|
|
import { AddSourceModal } from "../../../modals/AddSourceModal.slint";
|
2024-08-16 21:35:12 +02:00
|
|
|
|
|
|
|
export component SideBar inherits Rectangle {
|
2024-10-09 17:07:17 +02:00
|
|
|
|
2025-06-24 08:35:38 +02:00
|
|
|
function open-edit-source-window(source-id: int) {
|
|
|
|
editSourcePopup.edit(source-id)
|
|
|
|
}
|
|
|
|
|
2025-06-24 09:31:34 +02:00
|
|
|
addSourcePopup := AddSourceModal{}
|
|
|
|
editSourcePopup := EditSourceModal {}
|
2025-06-24 08:35:38 +02:00
|
|
|
|
2024-08-16 21:35:12 +02:00
|
|
|
VerticalLayout {
|
2024-10-29 15:02:46 +01:00
|
|
|
height: parent.height;
|
2024-08-16 21:35:12 +02:00
|
|
|
padding: 16px;
|
|
|
|
spacing: 16px;
|
2024-11-01 13:43:45 +01:00
|
|
|
HorizontalLayout {
|
2025-06-18 18:31:05 +02:00
|
|
|
alignment: stretch;
|
2024-11-01 13:43:45 +01:00
|
|
|
VText {
|
|
|
|
text: "Sources";
|
|
|
|
font-size: 1.5rem;
|
2025-06-18 18:31:05 +02:00
|
|
|
horizontal-stretch: 0;
|
2024-11-01 13:43:45 +01:00
|
|
|
}
|
|
|
|
|
2025-06-18 18:31:05 +02:00
|
|
|
Rectangle {
|
|
|
|
horizontal-stretch: 1;
|
|
|
|
}
|
|
|
|
|
2024-11-01 13:43:45 +01:00
|
|
|
VActionButton {
|
2025-06-18 18:31:05 +02:00
|
|
|
horizontal-stretch: 0;
|
2024-11-01 13:43:45 +01:00
|
|
|
icon-svg: Svg.plus;
|
|
|
|
icon-colorize: Palette.green;
|
|
|
|
background: transparent;
|
2025-06-24 09:31:34 +02:00
|
|
|
clicked => { addSourcePopup.open() }
|
2024-11-01 13:43:45 +01:00
|
|
|
}
|
2024-08-16 21:35:12 +02:00
|
|
|
}
|
|
|
|
VerticalLayout {
|
2024-10-29 15:02:46 +01:00
|
|
|
alignment: space-between;
|
|
|
|
vertical-stretch: 1;
|
|
|
|
VerticalLayout {
|
|
|
|
vertical-stretch: 1;
|
|
|
|
spacing: 4px;
|
|
|
|
ToggleButton {
|
|
|
|
text: "All";
|
|
|
|
text-alignment: left;
|
2024-11-04 14:45:27 +01:00
|
|
|
active: AppWindowModels.no-source-selected;
|
|
|
|
clicked => { AppWindowActions.source-clicked(-1) }
|
2024-11-01 13:43:45 +01:00
|
|
|
|
|
|
|
|
2024-10-29 15:02:46 +01:00
|
|
|
}
|
2024-11-04 14:45:27 +01:00
|
|
|
for item[index] in AppWindowModels.sources-selected: ToggleButton {
|
2024-10-29 15:02:46 +01:00
|
|
|
text: item.name;
|
|
|
|
text-alignment: left;
|
|
|
|
active: item.selected;
|
2024-11-04 14:45:27 +01:00
|
|
|
clicked => { AppWindowActions.source-clicked(item.id) }
|
2024-11-01 13:43:45 +01:00
|
|
|
VActionButton {
|
|
|
|
visible: parent.active;
|
|
|
|
icon-svg: Svg.cog;
|
|
|
|
background: transparent;
|
2025-06-24 08:35:38 +02:00
|
|
|
clicked => { editSourcePopup.edit(item.id) }
|
2024-11-01 13:43:45 +01:00
|
|
|
}
|
2024-10-29 15:02:46 +01:00
|
|
|
}
|
2024-08-16 21:35:12 +02:00
|
|
|
}
|
2024-11-01 13:43:45 +01:00
|
|
|
VerticalLayout {
|
2024-10-29 15:02:46 +01:00
|
|
|
spacing: 4px;
|
2024-11-01 13:43:45 +01:00
|
|
|
/*VButton {
|
2024-10-29 15:02:46 +01:00
|
|
|
icon-svg: Svg.cog;
|
|
|
|
text: "Settings";
|
|
|
|
background: transparent;
|
2024-11-04 14:45:27 +01:00
|
|
|
clicked => { AppWindowModels.open-settings-window() }
|
2024-11-01 13:43:45 +01:00
|
|
|
}*/
|
|
|
|
}
|
2024-08-16 21:35:12 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|