SettingsList
This commit is contained in:
parent
7ec36a7716
commit
2f192cddca
|
@ -14,6 +14,7 @@ pub fn connect_delete_button(app: &MainWindow) {
|
|||
CurrentTab::EmptyFolders => app.get_empty_folder_model(),
|
||||
CurrentTab::SimilarImages => app.get_similar_images_model(),
|
||||
CurrentTab::EmptyFiles => app.get_empty_files_model(),
|
||||
CurrentTab::Settings => panic!("Button should be disabled"),
|
||||
};
|
||||
|
||||
let new_model = handle_delete_items(&model, active_tab == CurrentTab::EmptyFolders);
|
||||
|
@ -23,6 +24,7 @@ pub fn connect_delete_button(app: &MainWindow) {
|
|||
CurrentTab::EmptyFolders => app.set_empty_folder_model(new_model),
|
||||
CurrentTab::SimilarImages => app.set_similar_images_model(new_model),
|
||||
CurrentTab::EmptyFiles => app.set_empty_files_model(new_model),
|
||||
CurrentTab::Settings => panic!("Button should be disabled"),
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -42,7 +42,8 @@ pub fn connect_scan_button(app: &MainWindow, progress_sender: Sender<ProgressDat
|
|||
}
|
||||
CurrentTab::SimilarImages => {
|
||||
scan_similar_images(a, progress_sender, stop_receiver, custom_settings);
|
||||
} // _ => panic!(),
|
||||
}
|
||||
CurrentTab::Settings => panic!("Button should be disabled"),
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#![windows_subsystem = "windows"]
|
||||
#![allow(clippy::comparison_chain)]
|
||||
#![allow(clippy::collapsible_if)]
|
||||
#![allow(clippy::should_panic_without_expect)]
|
||||
#![allow(clippy::struct_field_names)] // Generated code
|
||||
#![allow(clippy::overly_complex_bool_expr)] // Generated code
|
||||
#![allow(clippy::semicolon_if_nothing_returned)] // Generated code
|
||||
#![allow(clippy::used_underscore_binding)] // Generated code
|
||||
|
|
|
@ -2,6 +2,7 @@ export enum CurrentTab {
|
|||
EmptyFolders,
|
||||
EmptyFiles,
|
||||
SimilarImages,
|
||||
Settings
|
||||
}
|
||||
|
||||
export enum TypeOfOpenedItem {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint";
|
||||
import {CurrentTab} from "common.slint";
|
||||
import {ColorPalette} from "color_palette.slint";
|
||||
import {GuiState} from "gui_state.slint";
|
||||
|
||||
component TabItem {
|
||||
in property <bool> scanning;
|
||||
|
@ -109,11 +110,17 @@ export component LeftSidePanel {
|
|||
}
|
||||
|
||||
HorizontalLayout {
|
||||
height: 20px;
|
||||
padding-bottom: 2px;
|
||||
padding-right: 3px;
|
||||
alignment: end;
|
||||
Image {
|
||||
width: 20px;
|
||||
source: @image-url("../icons/settings.svg");
|
||||
Button {
|
||||
height: 50px;
|
||||
width: self.height;
|
||||
icon: @image-url("../icons/settings.svg");
|
||||
clicked => {
|
||||
active_tab = CurrentTab.Settings;
|
||||
root.changed_current_tab();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ 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";
|
||||
import {SettingsList} from "settings_list.slint";
|
||||
|
||||
export component MainList {
|
||||
in-out property <CurrentTab> active-tab: CurrentTab.EmptyFolders;
|
||||
|
@ -49,6 +50,11 @@ export component MainList {
|
|||
parentPathIdx: 5;
|
||||
fileNameIdx: 4;
|
||||
}
|
||||
|
||||
settings_list := SettingsList {
|
||||
visible: root.active-tab == CurrentTab.Settings;
|
||||
}
|
||||
|
||||
focus_item := FocusScope {
|
||||
width: 0px; // Hack to not steal first click from other components - https://github.com/slint-ui/slint/issues/3503
|
||||
// Hack not works https://github.com/slint-ui/slint/issues/3503#issuecomment-1817809834 because disables key-released event
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
export global Settings {
|
||||
in-out property <[StandardListViewItem]> included_directories: [{text: "ABCD"}, {text: "BCDA"}];
|
||||
in-out property <[StandardListViewItem]> excluded_directories: [{text: "ABCD"}, {text: "BCDA"}, {text: "CDFFF"}];
|
||||
|
||||
// Settings
|
||||
in-out property <string> excluded_items: "Excluded items";
|
||||
in-out property <string> allowed_extensions: "Allowed extensions";
|
||||
}
|
||||
|
|
52
krokiet/ui/settings_list.slint
Normal file
52
krokiet/ui/settings_list.slint
Normal file
|
@ -0,0 +1,52 @@
|
|||
import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox, ScrollView, LineEdit, SpinBox} from "std-widgets.slint";
|
||||
import { Settings } from "settings.slint";
|
||||
|
||||
global SettingsSize {
|
||||
out property <length> item_height: 30px;
|
||||
}
|
||||
|
||||
component TextComponent inherits HorizontalLayout {
|
||||
in-out property <string> model;
|
||||
in property <string> name;
|
||||
spacing: 5px;
|
||||
Text {
|
||||
horizontal-stretch: 0.0;
|
||||
vertical-alignment: TextVerticalAlignment.center;
|
||||
text: name;
|
||||
}
|
||||
LineEdit {
|
||||
horizontal-stretch: 1.0;
|
||||
height: SettingsSize.item_height;
|
||||
text: Settings.excluded_items;
|
||||
}
|
||||
}
|
||||
|
||||
export component SettingsList inherits ScrollView {
|
||||
min-height: 300px;
|
||||
VerticalLayout {
|
||||
spacing: 5px;
|
||||
Text {
|
||||
text: "Settings";
|
||||
height: SettingsSize.item_height;
|
||||
horizontal-alignment: TextHorizontalAlignment.center;
|
||||
font-size: 20px;
|
||||
}
|
||||
Text {
|
||||
text: "General settings";
|
||||
height: SettingsSize.item_height;
|
||||
horizontal-alignment: TextHorizontalAlignment.center;
|
||||
}
|
||||
TextComponent {
|
||||
name: "Excluded item:";
|
||||
model <=> Settings.excluded_items;
|
||||
}
|
||||
TextComponent {
|
||||
name: "Allowed extensions:";
|
||||
model <=> Settings.allowed_extensions;
|
||||
}
|
||||
SpinBox {
|
||||
enabled: true;
|
||||
height: SettingsSize.item_height;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue