From 3e346314a1156e225f8e0c69ae74b4ce99737120 Mon Sep 17 00:00:00 2001 From: iorebuild Date: Tue, 5 Aug 2025 23:28:35 +0800 Subject: [PATCH] =?UTF-8?q?Slint=E6=B7=BB=E5=8A=A0=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 25 +++++++++++++++++++++++++ Cargo.toml | 12 ++++++++++++ build.rs | 3 +++ components/Window.slint | 5 +++++ src/main.rs | 14 ++++++++++++++ 5 files changed, 59 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.toml create mode 100644 build.rs create mode 100644 components/Window.slint create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2726850 --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +# 编译输出目录 +/target/ + +# 依赖锁文件 +Cargo.lock + +# 本地环境配置文件 +.env + +# 编辑器和 IDE 产生的文件 +.idea/ +.vscode/ +*.iml +*.ipr +*.iws + +# 日志文件 +*.log + +# 临时文件 +temp/ +tmp/ + +# 覆盖配置文件 +Cargo.toml.orig \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..d491ae3 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "VoiletTftp" +version = "1.0.0" +edition = "2024" + +[dependencies] +smol = "1" # or any other runtime/executor +async-tftp = "0.3.6" +slint = "1.12.1" + +[build-dependencies] +slint-build = "1.12" diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..b20a192 --- /dev/null +++ b/build.rs @@ -0,0 +1,3 @@ +fn main() { + slint_build::compile("components/Window.slint").unwrap(); +} \ No newline at end of file diff --git a/components/Window.slint b/components/Window.slint new file mode 100644 index 0000000..9e12b93 --- /dev/null +++ b/components/Window.slint @@ -0,0 +1,5 @@ +export component MainWindow inherits Window { + height: 180px; + width: 320px; + title: "VoileTftpTools"; +} \ No newline at end of file diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..d30fafd --- /dev/null +++ b/src/main.rs @@ -0,0 +1,14 @@ +use async_tftp::server::TftpServerBuilder; +use async_tftp::Result; +slint::include_modules!(); +// fn main() -> Result<()> { +// smol::block_on(async { +// let tftpd = TftpServerBuilder::with_dir_ro("C:/Users/anonymous/Desktop/Rust/VoiletTftp/target/debug")?.build().await?; +// tftpd.serve().await?; +// Ok(()) +// }) +// } + +fn main() { + MainWindow::new().unwrap().run().unwrap(); +} \ No newline at end of file