Slint添加成功

This commit is contained in:
iorebuild 2025-08-05 23:28:35 +08:00
commit 3e346314a1
5 changed files with 59 additions and 0 deletions

25
.gitignore vendored Normal file
View File

@ -0,0 +1,25 @@
# 编译输出目录
/target/
# 依赖锁文件
Cargo.lock
# 本地环境配置文件
.env
# 编辑器和 IDE 产生的文件
.idea/
.vscode/
*.iml
*.ipr
*.iws
# 日志文件
*.log
# 临时文件
temp/
tmp/
# 覆盖配置文件
Cargo.toml.orig

12
Cargo.toml Normal file
View File

@ -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"

3
build.rs Normal file
View File

@ -0,0 +1,3 @@
fn main() {
slint_build::compile("components/Window.slint").unwrap();
}

5
components/Window.slint Normal file
View File

@ -0,0 +1,5 @@
export component MainWindow inherits Window {
height: 180px;
width: 320px;
title: "VoileTftpTools";
}

14
src/main.rs Normal file
View File

@ -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();
}