2023-10-05 19:06:47 +13:00
|
|
|
fn main() {}
|
|
|
|
|
2023-10-18 03:30:43 +13:00
|
|
|
slint::slint! {
|
2023-10-18 07:51:40 +13:00
|
|
|
import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint";
|
2023-10-18 03:30:43 +13:00
|
|
|
|
2023-10-18 07:51:40 +13:00
|
|
|
component SelectableTableView inherits Rectangle {
|
2023-10-18 04:40:05 +13:00
|
|
|
in property <[string]> columns;
|
|
|
|
in property <[[string]]> values;
|
2023-10-18 03:30:43 +13:00
|
|
|
|
2023-10-18 07:51:40 +13:00
|
|
|
private property <[length]> column_sizes: [30px, 100px, 100px, 100px];
|
|
|
|
private property <int> column_number: 4;
|
2023-10-18 03:30:43 +13:00
|
|
|
|
2023-10-18 04:40:05 +13:00
|
|
|
VerticalBox {
|
|
|
|
padding: 5px;
|
2023-10-18 07:51:40 +13:00
|
|
|
// Widgets
|
2023-10-18 04:40:05 +13:00
|
|
|
HorizontalLayout {
|
|
|
|
padding: 5px; spacing: 5px;
|
|
|
|
vertical-stretch: 0;
|
|
|
|
for title[idx] in root.columns : HorizontalLayout {
|
|
|
|
width: root.column_sizes[idx];
|
2023-10-18 07:51:40 +13:00
|
|
|
Text { overflow: elide; text: title; }
|
2023-10-18 04:40:05 +13:00
|
|
|
Rectangle {
|
|
|
|
width: 1px;
|
|
|
|
background: gray;
|
2023-10-18 07:51:40 +13:00
|
|
|
|
2023-10-18 04:40:05 +13:00
|
|
|
TouchArea {
|
2023-10-18 07:51:40 +13:00
|
|
|
width: 5px;
|
2023-10-18 04:40:05 +13:00
|
|
|
x: (parent.width - self.width) / 2;
|
|
|
|
property <length> cached;
|
|
|
|
pointer-event(event) => {
|
|
|
|
if (event.button == PointerEventButton.left && event.kind == PointerEventKind.down) {
|
|
|
|
self.cached = root.column_sizes[idx];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
moved => {
|
|
|
|
if (self.pressed) {
|
|
|
|
root.column_sizes[idx] += (self.mouse-x - self.pressed-x);
|
|
|
|
if (root.column_sizes[idx] < 0) {
|
|
|
|
root.column_sizes[idx] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mouse-cursor: ew-resize;
|
2023-10-18 03:30:43 +13:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-18 04:40:05 +13:00
|
|
|
}
|
2023-10-18 07:51:40 +13:00
|
|
|
list_view:= ListView {
|
|
|
|
for r[idx] in root.values : Rectangle {
|
|
|
|
private property <bool> selected: false;
|
|
|
|
background: touch-area.has-hover ? (selected ? #333333 : #222222) : (selected ? #333333: #222222);
|
|
|
|
|
|
|
|
touch_area:= TouchArea {
|
|
|
|
clicked => {
|
|
|
|
parent.selected = !parent.selected
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HorizontalLayout {
|
|
|
|
padding: 5px;
|
|
|
|
spacing: 5px;
|
|
|
|
//width: root.column_sizes[idx];
|
|
|
|
|
|
|
|
CheckBox {
|
|
|
|
//min-width: 200px;
|
|
|
|
width: root.column-sizes[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
HorizontalLayout {
|
|
|
|
padding: 5px;
|
|
|
|
spacing: 5px;
|
|
|
|
for f[idx] in r : Text {
|
|
|
|
width: root.column-sizes[idx + 1];
|
|
|
|
text: f;
|
|
|
|
vertical-alignment: center;
|
|
|
|
|
|
|
|
overflow: elide;
|
|
|
|
}
|
|
|
|
}
|
2023-10-18 04:40:05 +13:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export component MainWindow {
|
|
|
|
in-out property <int> active-tab;
|
|
|
|
VerticalBox {
|
|
|
|
HorizontalBox {
|
2023-10-18 07:51:40 +13:00
|
|
|
width: 600px;
|
2023-10-18 04:40:05 +13:00
|
|
|
preferred-height: 300px;
|
|
|
|
|
|
|
|
tab_bar := VerticalLayout {
|
|
|
|
width: 120px;
|
|
|
|
spacing: 3px;
|
2023-10-18 03:30:43 +13:00
|
|
|
Button {
|
2023-10-18 04:40:05 +13:00
|
|
|
text: "Empty Folders";
|
|
|
|
clicked => { root.active-tab = 0; }
|
2023-10-18 03:30:43 +13:00
|
|
|
}
|
|
|
|
Button {
|
2023-10-18 04:40:05 +13:00
|
|
|
text: "Similar Images";
|
|
|
|
clicked => { root.active-tab = 1; }
|
2023-10-18 03:30:43 +13:00
|
|
|
}
|
|
|
|
}
|
2023-10-18 04:40:05 +13:00
|
|
|
|
2023-10-18 07:51:40 +13:00
|
|
|
// TODO - using root.active-tab in visible property will not
|
|
|
|
if root.active-tab == 0: SelectableTableView {
|
|
|
|
columns: ["Selection", "Folder Name", "Path", "Modification Date"];
|
2023-10-18 04:40:05 +13:00
|
|
|
values: [
|
2023-10-18 07:51:40 +13:00
|
|
|
["kropkarz", "/Xd1", "24.10.2023"] ,
|
|
|
|
["witasphere", "/Xd1/Imagerren2", "25.11.1991"] ,
|
|
|
|
["lokkaler", "/Xd1/Vide2", "01.23.1911"] ,
|
2023-10-18 04:40:05 +13:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
HorizontalBox {
|
2023-10-18 07:51:40 +13:00
|
|
|
scan_button:= Button {
|
2023-10-18 04:40:05 +13:00
|
|
|
text: "Scan";
|
|
|
|
}
|
2023-10-18 07:51:40 +13:00
|
|
|
delete_button:= Button {
|
2023-10-18 04:40:05 +13:00
|
|
|
text: "Delete";
|
|
|
|
}
|
2023-10-18 03:30:43 +13:00
|
|
|
}
|
|
|
|
}
|
2023-10-18 04:40:05 +13:00
|
|
|
}
|
2023-10-18 03:30:43 +13:00
|
|
|
|
2023-10-18 07:51:40 +13:00
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-18 03:30:43 +13:00
|
|
|
}
|