按 D54 落地,解码在 palette-extract、缓存在 presenter、像素随快照走、壳层只画。
palette-extract(上一提交)→ presenter:
- dto/saves/preview.rs:ScreenshotPreview{NotGenerated,Ready,Failed} + ThumbnailView
(带 is_consistent:长度 ≠ w×h×4 的像素不许进渲染器)+ ScreenshotThumbKind;
ScreenshotView 新增 preview 字段(像素不落盘,随 IPC 面走);
- host/saves/thumbs.rs:attach() 在后台线程(spawn_list 同一条线程)按 mtime 倒序解前
60 张、单张 >8 MiB 先查大小不进解码器、失败也逐条带原因;进程级 memo 键 =
(路径, mtime, 大小),覆盖/替换都会重解;超过 240 条只留本拍碰到的键;
- presenter 新增依赖 unlucky-palette-extract(塔已批,方向 presenter → palette-extract)。
app-iced:
- saves.rs 拆成 model / rows / wall(原文件 385 行,加完墙必破 400):model 里建一次
iced Handle(渲染回调零解码、零重复上传),wall 3 列排格子,没像素的格子给
160×90 占位框 + 逐条原因;text.rs 拆出 text/saves.rs 承载存档/截图一族文案;
- i18n 加 4 条「这一格为什么没有图」(未生成/太大/读不出/解不出)+ 金表同步;
- 出图夹具(saves_shot)合成两种场景的像素,并摆出四种格子(真图×2/未生成/超限失败)。
用例:presenter 9 条(含缓存命中不重解、mtime 变了必重解、第 61 张不解、
>8MiB 不进解码器、缓存有界)+ app-iced 3 条(三种格子的副文案、坏像素降级)。
51 lines
3.0 KiB
TOML
51 lines
3.0 KiB
TOML
[package]
|
||
name = "unlucky-presenter"
|
||
description = "Unlucky-Launcher 的 UI 框架无关宿主层:DTO / 状态 reducer / host 业务装配,Slint 版与 iced 版共用"
|
||
version.workspace = true
|
||
edition.workspace = true
|
||
license.workspace = true
|
||
authors.workspace = true
|
||
repository.workspace = true
|
||
rust-version.workspace = true
|
||
publish.workspace = true
|
||
|
||
# 零 UI 框架依赖是硬约束(M85 / D26):本 crate 是 Slint 版(`crates/app`)与 iced 版
|
||
# (`crates/app-iced`)共用的宿主层,任何时候都不得出现 Slint / iced / winit / gtk / egui 等
|
||
# UI 或渲染框架,也不得出现「把窗口属性灌进去」这种绑定代码。
|
||
# 证据命令写在 `crates/app/Cargo.toml` 的注释里(那个文件允许出现框架名,本 crate 的守门
|
||
# 命令本身在自家 grep 范围内会把自己抓出来,所以那两条命令刻意不放在这里)。
|
||
[dependencies]
|
||
# 跨边界 DTO 必须可序列化(AGENTS §6):事件与快照是 IPC 契约,序列化能力由 derive 钉住。
|
||
serde.workspace = true
|
||
# host 层要读 core 设置/事件里的 JSON 值。
|
||
serde_json.workspace = true
|
||
|
||
# 边界(01c §5 / D3):presenter 只经 DTO 消费 core,**不 import core 的领域类型到 DTO 里**。
|
||
# host 是 core 的快照/事件流与本 crate DTO 之间的唯一翻译层,所以它需要 core。
|
||
unlucky-core = { path = "../core", version = "0.2.3" }
|
||
|
||
# M251(D54 第 1/4 条):截图缩略图在**后台线程**里解码,解码能力只能来自 palette-extract
|
||
# (`image` 一个字节都不进 presenter,否则「解码集中在一处」这条边界当场作废)。
|
||
# 方向只能是 presenter → palette-extract(反向不许);那边也不许反过来依赖 core/presenter。
|
||
unlucky-palette-extract = { path = "../palette-extract", version = "0.2.3" }
|
||
|
||
[lints]
|
||
workspace = true
|
||
|
||
[features]
|
||
# M169:转发 core 的测试通道(默认关)。GUI 侧「更新」这条链的**人工验收**需要它:
|
||
# `cargo run -p unlucky-app-iced --features update-test-source` 配
|
||
# `ULL_UPDATE_DIR` + `ULL_UPDATE_TEST_SOURCE=1` 才能让设置页指向本地更新源
|
||
# (`-p` 认 package 名 `unlucky-app-iced`;`unlucky-launcher-iced` 是 bin 名,写 `-p` 会找不到包)。
|
||
# 官方发布构建不带这个 feature(`packaging/check_test_source_off.py` 守门)。
|
||
update-test-source = ["unlucky-core/update-test-source"]
|
||
|
||
[dev-dependencies]
|
||
# M190:presenter 的**更新链路用例**要构造「本构建认得」的签名清单(真发布必须带
|
||
# `manifest.json.sig`,没有它 core 一律拒装)。这里打开 core 的 `update-test-key`:它**只**把一把
|
||
# **公开**的测试公钥并进信任表,不开任何数据源开关(与 `update-test-source` 是两件事)。
|
||
# 只出现在 `[dev-dependencies]`:库/发布构建拿不到它。守门:`packaging/check_test_key_off.py`。
|
||
unlucky-core = { path = "../core", features = ["update-test-key"] }
|
||
# 夹具用同一套种子现签清单(与 `crates/core/src/update/tests/support_sign.rs` 同源)。
|
||
ed25519-dalek.workspace = true
|