Skip to content

Commit

Permalink
feat: 文件夹 变量名修正
Browse files Browse the repository at this point in the history
  • Loading branch information
jie.zeng committed Aug 3, 2024
1 parent 28dc1f4 commit 0e65cde
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ mod tool;
#[derive(PartialEq, Clone)]
pub enum ToolType {
Unselected,
FolderTree(tool::FolderTreeTool),
FolderInfo(tool::FolderInfoTool),
DecompressCompressStr(tool::DecompressCompressStrTool),
JsonFormat(tool::JsonFormatTool),
}

impl ToolType {
// 获得枚举的所有值
pub fn iter() -> Vec<ToolType> {
vec![ToolType::Unselected, ToolType::FolderTree(tool::FolderTreeTool::new()), ToolType::DecompressCompressStr(tool::DecompressCompressStrTool::new())
vec![ToolType::Unselected, ToolType::FolderInfo(tool::FolderInfoTool::new()), ToolType::DecompressCompressStr(tool::DecompressCompressStrTool::new())
, ToolType::JsonFormat(tool::JsonFormatTool::new())]
}

// 将枚举转换为字符串表示,用于显示
pub fn as_label(&self) -> &str {
match self {
ToolType::FolderTree(_) => "文件夹信息",
ToolType::FolderInfo(_) => "文件夹信息",
ToolType::DecompressCompressStr(_) => "解压、压缩字符串",
ToolType::Unselected => { "请选择" }
ToolType::JsonFormat(_) => { "json格式化" }
Expand Down Expand Up @@ -111,12 +111,12 @@ impl eframe::App for AppInstance {
egui::CentralPanel::default().show(ctx, |ui| {
let tool_type = &mut self.tool_type;
match tool_type {
ToolType::FolderTree(folder_tree) => {
ToolType::FolderInfo(folder_info) => {
ui.horizontal(|ui| {
folder_tree.add_choose_folder_button(ui);
folder_tree.show_select_file_info(ui);
folder_info.add_choose_folder_button(ui);
folder_info.show_select_file_info(ui);
});
folder_tree.show_sub_file_info(ui);
folder_info.show_sub_file_info(ui);
}
ToolType::DecompressCompressStr(decompress_str) => {
decompress_str.show(ctx, ui);
Expand Down
4 changes: 2 additions & 2 deletions src/tool/folder_tree_tool.rs → src/tool/folder_info_tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{AppInstance, ToolType};

/// 文件夹处理
#[derive(PartialEq, Clone)]
pub struct FolderTreeTool {
pub struct FolderInfoTool {
pub folder_path: String,
pub files: Vec<FileInfo>,
pub loading: bool,
Expand All @@ -24,7 +24,7 @@ pub struct FileInfo {
pub(crate) is_file: bool,
}

impl FolderTreeTool {
impl FolderInfoTool {
pub fn new() -> Self {
Self {
folder_path: "".to_string(),
Expand Down
4 changes: 2 additions & 2 deletions src/tool/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::time::{SystemTime, UNIX_EPOCH};

pub use decompress_compress_str_tool::DecompressCompressStrTool;
pub use folder_tree_tool::FolderTreeTool;
pub use folder_info_tool::FolderInfoTool;
pub use json_format_tool::JsonFormatTool;

mod folder_tree_tool;
mod folder_info_tool;
mod decompress_compress_str_tool;
mod json_format_tool;

Expand Down

0 comments on commit 0e65cde

Please sign in to comment.