From 230ac9d6c79623313dbe74abdd369af0c1d8408b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sat, 28 Oct 2023 18:20:46 +0200 Subject: [PATCH] Ab --- czkawka_slint_gui/README.md | 20 +++++++++ czkawka_slint_gui/ui/color_palette.slint | 11 ++++- czkawka_slint_gui/ui/common.slint | 7 +++ czkawka_slint_gui/ui/left_side_panel.slint | 2 +- czkawka_slint_gui/ui/main_lists.slint | 43 ++++++++++--------- .../ui/selectable_tree_view.slint | 6 +-- 6 files changed, 61 insertions(+), 28 deletions(-) create mode 100644 czkawka_slint_gui/README.md diff --git a/czkawka_slint_gui/README.md b/czkawka_slint_gui/README.md new file mode 100644 index 0000000..18dafa7 --- /dev/null +++ b/czkawka_slint_gui/README.md @@ -0,0 +1,20 @@ +# NAME_TODO + +NAME_TODO is new Czkawka frontend written in Slint(written mostly in Rust) in opposite to Gtk 4 frontend which uses mostly C code. + +Different + +## Requirements +Slint version of app should not have any special runtime requirements - it should work on almost any OpenGL 3 capable device. + +Alternatively, it can be run with software rendering. + +## Compilation +Default compilation is done by `cargo build --release`. + +All dependencies should be handled by cargo, except windows where you need to install m. + +The only exception is building skia frontend, that require + + + diff --git a/czkawka_slint_gui/ui/color_palette.slint b/czkawka_slint_gui/ui/color_palette.slint index 3a87b72..447d035 100644 --- a/czkawka_slint_gui/ui/color_palette.slint +++ b/czkawka_slint_gui/ui/color_palette.slint @@ -1,5 +1,12 @@ +import { StyleMetrics } from "std-widgets.slint"; + export global ColorPalette { // Tabs at left side - in-out property tab_selected_color: NativeStyleMetrics.dark-color-scheme ? red : blue; - in-out property tab_hovered_color: NativeStyleMetrics.dark-color-scheme ? green : yellow; + in-out property tab_selected_color: StyleMetrics.dark-color-scheme ? red : blue; + in-out property tab_hovered_color: StyleMetrics.dark-color-scheme ? green : yellow; + + // ListView + in-out property list_view_normal_color: StyleMetrics.dark-color-scheme ? #474747 : #dddddd; + in-out property list_view_normal_header_color: StyleMetrics.dark-color-scheme ? #292929 : #888888; + in-out property list_view_normal_selected_header: StyleMetrics.dark-color-scheme ? #575757 : #cccccc; } \ No newline at end of file diff --git a/czkawka_slint_gui/ui/common.slint b/czkawka_slint_gui/ui/common.slint index 700cae1..0946e9f 100644 --- a/czkawka_slint_gui/ui/common.slint +++ b/czkawka_slint_gui/ui/common.slint @@ -13,4 +13,11 @@ export struct ProgressToSend { current_progress: int, all_progress: int, step_name: string, +} + +export struct MainListModel { + checked: bool, + header_row: bool, + selected: bool, + data: [string] } \ No newline at end of file diff --git a/czkawka_slint_gui/ui/left_side_panel.slint b/czkawka_slint_gui/ui/left_side_panel.slint index e1b2818..c0139b2 100644 --- a/czkawka_slint_gui/ui/left_side_panel.slint +++ b/czkawka_slint_gui/ui/left_side_panel.slint @@ -12,7 +12,7 @@ component TabItem { Rectangle { width: parent.width; horizontal-stretch: 1.0; - background: touch-area.has-hover ? blue : green; + background: touch-area.has-hover ? ColorPalette.tab-hovered-color : transparent; opacity: 0.05; touch_area:= TouchArea { diff --git a/czkawka_slint_gui/ui/main_lists.slint b/czkawka_slint_gui/ui/main_lists.slint index 0c94efa..645c9d4 100644 --- a/czkawka_slint_gui/ui/main_lists.slint +++ b/czkawka_slint_gui/ui/main_lists.slint @@ -2,12 +2,13 @@ import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListV import {SelectableTableView} from "selectable_tree_view.slint"; import {LeftSidePanel} from "left_side_panel.slint"; import {CurrentTab, TypeOfOpenedItem} from "common.slint"; +import {MainListModel} from "common.slint"; export component MainList { callback item_opened(string); in-out property active-tab; - in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> empty_folder_model; + in-out property <[MainListModel]> empty_folder_model; in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> empty_files_model; in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> similar_images_model; @@ -23,26 +24,26 @@ export component MainList { fileNameIdx: 1; item_opened(item) => {item_opened(item)} } - if root.active-tab == CurrentTab.EmptyFiles: SelectableTableView { - min-width: 200px; + // if root.active-tab == CurrentTab.EmptyFiles: SelectableTableView { + // min-width: 200px; - columns: ["Selection", "Folder Name", "Path"]; - last-column: "Modification Date"; - column-sizes: [30px, 100px, 100px, 100px]; - values <=> empty-files-model; - parentPathIdx: 2; - fileNameIdx: 1; - item_opened(item) => {item_opened(item)} - } - if root.active-tab == CurrentTab.SimilarImages: SelectableTableView { - min-width: 200px; + // columns: ["Selection", "Folder Name", "Path"]; + // last-column: "Modification Date"; + // column-sizes: [30px, 100px, 100px, 100px]; + // values <=> empty-files-model; + // parentPathIdx: 2; + // fileNameIdx: 1; + // item_opened(item) => {item_opened(item)} + // } + // if root.active-tab == CurrentTab.SimilarImages: SelectableTableView { + // min-width: 200px; - columns: ["Selection", "Folder Name", "Path"]; - last-column: "Modification Date"; - column-sizes: [30px, 100px, 100px, 100px]; - values <=> similar-images-model; - parentPathIdx: 2; - fileNameIdx: 1; - item_opened(item) => {item_opened(item)} - } + // columns: ["Selection", "Folder Name", "Path"]; + // last-column: "Modification Date"; + // column-sizes: [30px, 100px, 100px, 100px]; + // values <=> similar-images-model; + // parentPathIdx: 2; + // fileNameIdx: 1; + // item_opened(item) => {item_opened(item)} + // } } \ No newline at end of file diff --git a/czkawka_slint_gui/ui/selectable_tree_view.slint b/czkawka_slint_gui/ui/selectable_tree_view.slint index 2c634cd..11763a1 100644 --- a/czkawka_slint_gui/ui/selectable_tree_view.slint +++ b/czkawka_slint_gui/ui/selectable_tree_view.slint @@ -1,5 +1,6 @@ import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint"; import {TypeOfOpenedItem} from "common.slint"; +import {ColorPalette} from "color_palette.slint"; export component SelectableTableView inherits Rectangle { callback item_opened(string); @@ -75,10 +76,7 @@ export component SelectableTableView inherits Rectangle { for r[idx] in root.values : Rectangle { forward-focus: focus-item; height: 20px; - // TODO move this into singleton - background: r.header-row ? #888888 : (touch-area.has-hover ? (r.selected_row ? #cccccc : #dddddd) : (r.selected_row ? #cccccc: #dddddd)); - // background: touch-area.has-hover ? (selected ? #333333 : #222222) : (selected ? #333333: #222222); - + background: r.header-row ? ColorPalette.list_view_normal_header_color : (touch-area.has-hover ? (r.selected_row ? ColorPalette.list-view-normal-selected-header : ColorPalette.list_view_normal_color) : (r.selected_row ? ColorPalette.list-view-normal-selected-header: ColorPalette.list_view_normal_color)); touch_area:= TouchArea { forward-focus: focus-item; clicked => {