mirai/src/windows/AppWindow/views/SideBar.slint

74 lines
1.8 KiB
Text
Raw Normal View History

2025-06-29 20:07:11 +02:00
import { AppModels } from "../../../shared/Models.slint";
import { AppActions } from "../../../shared/Actions.slint";
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 {
function open-edit-source-window(source-id: int) {
editSourcePopup.edit(source-id)
}
2025-06-29 20:07:11 +02:00
addSourcePopup := AddSourceModal{}
2025-06-24 09:31:34 +02:00
editSourcePopup := EditSourceModal {}
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;
HorizontalLayout {
2025-06-18 18:31:05 +02:00
alignment: stretch;
VText {
text: "Sources";
font-size: 1.5rem;
2025-06-18 18:31:05 +02:00
horizontal-stretch: 0;
}
2025-06-18 18:31:05 +02:00
Rectangle {
horizontal-stretch: 1;
}
VActionButton {
2025-06-18 18:31:05 +02:00
horizontal-stretch: 0;
icon-svg: Svg.plus;
icon-colorize: Palette.green;
background: transparent;
2025-06-24 09:31:34 +02:00
clicked => { addSourcePopup.open() }
}
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;
2025-06-29 20:07:11 +02:00
active: AppModels.sidebar-view.all-active;
clicked => { AppActions.source-clicked(-1) }
2024-10-29 15:02:46 +01:00
}
2025-06-29 20:07:11 +02:00
for source[index] in AppModels.sidebar-view.sources: ToggleButton {
text: source.name;
2024-10-29 15:02:46 +01:00
text-alignment: left;
2025-06-29 20:07:11 +02:00
active: source.active;
clicked => { AppActions.source-clicked(source.id) }
right-clicked => { editSourcePopup.edit(source.id) }
2024-10-29 15:02:46 +01:00
}
2024-08-16 21:35:12 +02:00
}
VerticalLayout {
2024-10-29 15:02:46 +01:00
spacing: 4px;
/*VButton {
2024-10-29 15:02:46 +01:00
icon-svg: Svg.cog;
text: "Settings";
background: transparent;
clicked => { AppModels.open-settings-window() }
}*/
}
2024-08-16 21:35:12 +02:00
}
}
}