Not compilable
This commit is contained in:
parent
d298bf524b
commit
c753c06620
3376
Cargo.lock
generated
3376
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -3,10 +3,10 @@ members = [
|
||||||
"czkawka_core",
|
"czkawka_core",
|
||||||
"czkawka_cli",
|
"czkawka_cli",
|
||||||
"czkawka_gui",
|
"czkawka_gui",
|
||||||
|
"czkawka_slint_gui"
|
||||||
]
|
]
|
||||||
exclude = [
|
exclude = [
|
||||||
"ci_tester",
|
"ci_tester",
|
||||||
"czkawka_slint_gui"
|
|
||||||
]
|
]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,11 @@ description = "Slint frontend of Czkawka"
|
||||||
license = "GPL-3"
|
license = "GPL-3"
|
||||||
homepage = "https://github.com/qarmin/czkawka"
|
homepage = "https://github.com/qarmin/czkawka"
|
||||||
repository = "https://github.com/qarmin/czkawka"
|
repository = "https://github.com/qarmin/czkawka"
|
||||||
|
build = "build.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
slint = "1.2.2"
|
slint = "1.2.2"
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
slint-build = "1.2.2"
|
3
czkawka_slint_gui/build.rs
Normal file
3
czkawka_slint_gui/build.rs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
fn main() {
|
||||||
|
slint_build::compile("ui/main_window.slint").unwrap();
|
||||||
|
}
|
|
@ -1,130 +1,7 @@
|
||||||
fn main() {}
|
slint::include_modules!();
|
||||||
|
|
||||||
slint::slint! {
|
fn main() {
|
||||||
import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint";
|
MainWindow::new().unwrap().run().unwrap();
|
||||||
|
|
||||||
component SelectableTableView inherits Rectangle {
|
|
||||||
in property <[string]> columns;
|
|
||||||
in property <[[string]]> values;
|
|
||||||
|
|
||||||
private property <[length]> column_sizes: [30px, 100px, 100px, 100px];
|
|
||||||
private property <int> column_number: 4;
|
|
||||||
|
|
||||||
VerticalBox {
|
|
||||||
padding: 5px;
|
|
||||||
// Widgets
|
|
||||||
HorizontalLayout {
|
|
||||||
padding: 5px; spacing: 5px;
|
|
||||||
vertical-stretch: 0;
|
|
||||||
for title[idx] in root.columns : HorizontalLayout {
|
|
||||||
width: root.column_sizes[idx];
|
|
||||||
Text { overflow: elide; text: title; }
|
|
||||||
Rectangle {
|
|
||||||
width: 1px;
|
|
||||||
background: gray;
|
|
||||||
|
|
||||||
TouchArea {
|
|
||||||
width: 5px;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export component MainWindow {
|
slint::slint! {}
|
||||||
in-out property <int> active-tab;
|
|
||||||
VerticalBox {
|
|
||||||
HorizontalBox {
|
|
||||||
width: 600px;
|
|
||||||
preferred-height: 300px;
|
|
||||||
|
|
||||||
tab_bar := VerticalLayout {
|
|
||||||
width: 120px;
|
|
||||||
spacing: 3px;
|
|
||||||
Button {
|
|
||||||
text: "Empty Folders";
|
|
||||||
clicked => { root.active-tab = 0; }
|
|
||||||
}
|
|
||||||
Button {
|
|
||||||
text: "Similar Images";
|
|
||||||
clicked => { root.active-tab = 1; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO - using root.active-tab in visible property will not
|
|
||||||
if root.active-tab == 0: SelectableTableView {
|
|
||||||
columns: ["Selection", "Folder Name", "Path", "Modification Date"];
|
|
||||||
values: [
|
|
||||||
["kropkarz", "/Xd1", "24.10.2023"] ,
|
|
||||||
["witasphere", "/Xd1/Imagerren2", "25.11.1991"] ,
|
|
||||||
["lokkaler", "/Xd1/Vide2", "01.23.1911"] ,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
HorizontalBox {
|
|
||||||
scan_button:= Button {
|
|
||||||
text: "Scan";
|
|
||||||
}
|
|
||||||
delete_button:= Button {
|
|
||||||
text: "Delete";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
49
czkawka_slint_gui/ui/main_window.slint
Normal file
49
czkawka_slint_gui/ui/main_window.slint
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint";
|
||||||
|
import {SelectableTableView} from "selectable_tree_view.slint";
|
||||||
|
|
||||||
|
enum CurrentTab {
|
||||||
|
EmptyFolders,
|
||||||
|
SimilarImages,
|
||||||
|
}
|
||||||
|
|
||||||
|
export component MainWindow {
|
||||||
|
in-out property <CurrentTab> active-tab;
|
||||||
|
VerticalBox {
|
||||||
|
HorizontalBox {
|
||||||
|
width: 600px;
|
||||||
|
preferred-height: 300px;
|
||||||
|
|
||||||
|
tab_bar := VerticalLayout {
|
||||||
|
width: 120px;
|
||||||
|
spacing: 3px;
|
||||||
|
Button {
|
||||||
|
text: "Empty Folders";
|
||||||
|
clicked => { root.active-tab = CurrentTab.EmptyFolders; }
|
||||||
|
}
|
||||||
|
Button {
|
||||||
|
text: "Similar Images";
|
||||||
|
clicked => { root.active-tab = CurrentTab.SimilarImages; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO - using root.active-tab in visible property will not
|
||||||
|
if root.active-tab == CurrentTab.EmptyFolders: SelectableTableView {
|
||||||
|
columns: ["Selection", "Folder Name", "Path", "Modification Date"];
|
||||||
|
values: [
|
||||||
|
["kropkarz", "/Xd1", "24.10.2023"] ,
|
||||||
|
["witasphere", "/Xd1/Imagerren2", "25.11.1991"] ,
|
||||||
|
["lokkaler", "/Xd1/Vide2", "01.23.1911"] ,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HorizontalBox {
|
||||||
|
scan_button:= Button {
|
||||||
|
text: "Scan";
|
||||||
|
}
|
||||||
|
delete_button:= Button {
|
||||||
|
text: "Delete";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
81
czkawka_slint_gui/ui/selectable_tree_view.slint
Normal file
81
czkawka_slint_gui/ui/selectable_tree_view.slint
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint";
|
||||||
|
|
||||||
|
export component SelectableTableView inherits Rectangle {
|
||||||
|
in property <[string]> columns;
|
||||||
|
in property <[[string]]> values;
|
||||||
|
|
||||||
|
private property <[length]> column_sizes: [30px, 100px, 100px, 100px];
|
||||||
|
private property <int> column_number: 4;
|
||||||
|
|
||||||
|
VerticalBox {
|
||||||
|
padding: 5px;
|
||||||
|
// Widgets
|
||||||
|
HorizontalLayout {
|
||||||
|
padding: 5px; spacing: 5px;
|
||||||
|
vertical-stretch: 0;
|
||||||
|
for title[idx] in root.columns : HorizontalLayout {
|
||||||
|
width: root.column_sizes[idx];
|
||||||
|
Text { overflow: elide; text: title; }
|
||||||
|
Rectangle {
|
||||||
|
width: 1px;
|
||||||
|
background: gray;
|
||||||
|
|
||||||
|
TouchArea {
|
||||||
|
width: 5px;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue