feat(app): GUI 全量接线,五页改吃 core 真实数据(M43)
app 从「mock 骨架」切到「真实 core host」:新增 src/host 装配层(env/job/ game/launch/identity/versions/install/meter/java/accounts/logs/settings/engine/ dispatch),是 app 里除 settings_bridge 外唯一 use unlucky_core 的地方,出口只有 crate::dto 的 DTO/事件(三通道纪律,AGENTS §6)。 页面接线: - 实例页:profiles+版本 JSON 继承链+会话索引 → 磁贴(真实版本/加载器徽标/最后启动/ 隔离档位/载荷缺失);启动按钮走 LaunchRequest 装配 → Launcher::spawn → JSONL 尾随 → 运行/失败回写;M30 ModeChangeWarning 进横幅通知条。 - 新建实例向导:版本 → 加载器 → 名字 → 确认 → 真实安装进度;Fabric/Quilt 可装, Forge/NeoForge 因需要 installer processors(仅 CLI 有)显式拒装并给出 CLI 命令。 - 下载页:远端 manifest(12h 缓存)+ 内嵌 unlisted → 分类(正式/预览/远古四子类); 安装进度(文件数/字节/速度/ETA,速度由相邻采样差分)+ 阶段边界可取消; Java 分组:四家发行版 + 回退链可视化(计划链/真实 ChainLog)+ 本地运行时。 - 账户页:三轨账户列表(只读公开字段)+ 离线新增 + 删除/切换 + 微软设备码登录 (用户码/链接/轮询状态;取消后丢弃结果)。凭据只在 host/identity 与 host/accounts 出现,DTO 无 token 字段(单测钉住)。 - 设置页:新增 download/java/data/ai/mcp 五组,行由 core::setting schema 键生成, 写回走 SettingStore::set(与 ull config set / AI set_config 同源 launcher.json)。 - 日志页:会话索引 → 列表;事件 JSONL → 日志行(等级高亮)+ D8 规则引擎诊断卡片; 启动中实时尾随(600ms/拍,只读新增字节);崩溃日志导入分析(hs_err/crash/latest)。 架构与守线: - 新页面状态走 ui/page_state.slint 的 PageState global(main.slint 再导出), Rust 侧 page_sync.rs 灌入、callbacks_pages.rs 接线;避免属性逐层转发顶破 400 行。 - DTO 全部 Serialize+Deserialize(IPC 契约),新增 accounts/java/settings/install/ notices 五个子模块;事件扩展 LogAppended/LaunchFinished/AccountsChanged/ DeviceLoginChanged/JavaChanged/InstallProgress/SettingsChanged/NoticesChanged。 - 截图通道扩展:--data-dir(钉数据根且 settings 同源)/--mock/--screenshot-page/ --screenshot-wizard/--screenshot-session/--screenshot-install/--screenshot-launch (真实中间态,取图后自动 stop 防孤儿进程)。 已知边界:GUI 账户「当前启动账户」仅内存态(core schema 无 auth.* 键,app 不自建键); Forge/NeoForge GUI 安装待 processors 执行器上移。
This commit is contained in:
1 parent
bc41dfcf7d
commit
ddc0577f83
64 files changed
+8047
-408
No files matched your search
@@ -0,0 +1,73 @@
|
||||
// 安装进度卡片(下载页底部 / 向导进度步共用):阶段 + 进度条 + 文件/字节/速度/剩余 + 取消。
|
||||
import { Theme } from "../theme/tokens.slint";
|
||||
import { Metrics } from "../theme/metrics.slint";
|
||||
import { UiInstallProgress, InstallStage } from "../models.slint";
|
||||
import { UiText, TextRole } from "../components/label.slint";
|
||||
import { ProgressBar } from "../components/progress-bar.slint";
|
||||
import { AppIcon, IconKind } from "../components/icons.slint";
|
||||
import { MetroButton, ButtonKind } from "../widgets/button.slint";
|
||||
|
||||
export component InstallPanel inherits Rectangle {
|
||||
in property <UiInstallProgress> data;
|
||||
callback cancel();
|
||||
|
||||
height: 96px;
|
||||
visible: root.data.visible;
|
||||
background: Theme.bg-surface;
|
||||
border-width: 1px;
|
||||
border-color: Theme.stroke;
|
||||
|
||||
VerticalLayout {
|
||||
padding: Metrics.gap-3;
|
||||
spacing: Metrics.gap-1;
|
||||
|
||||
HorizontalLayout {
|
||||
spacing: Metrics.gap-2;
|
||||
|
||||
AppIcon {
|
||||
icon-size: 16px;
|
||||
kind: root.data.failed ? IconKind.error
|
||||
: root.data.terminal ? IconKind.check
|
||||
: IconKind.download;
|
||||
tint: root.data.failed ? Theme.state-danger
|
||||
: root.data.terminal ? Theme.state-success
|
||||
: Theme.accent;
|
||||
}
|
||||
UiText {
|
||||
role: TextRole.bodyStrong;
|
||||
text: root.data.instance + " · " + root.data.loader;
|
||||
horizontal-stretch: 1;
|
||||
}
|
||||
UiText {
|
||||
role: TextRole.caption;
|
||||
text: root.data.stage_label;
|
||||
color: root.data.failed ? Theme.state-danger : Theme.fg-secondary;
|
||||
}
|
||||
if !root.data.terminal : MetroButton {
|
||||
kind: ButtonKind.subtle;
|
||||
text: "取消";
|
||||
button-height: 24px;
|
||||
clicked => { root.cancel(); }
|
||||
}
|
||||
}
|
||||
|
||||
ProgressBar {
|
||||
ratio: root.data.ratio;
|
||||
known: root.data.known;
|
||||
}
|
||||
|
||||
HorizontalLayout {
|
||||
spacing: Metrics.gap-3;
|
||||
UiText {
|
||||
role: TextRole.caption;
|
||||
text: root.data.message;
|
||||
horizontal-stretch: 1;
|
||||
overflow: elide;
|
||||
}
|
||||
UiText { role: TextRole.caption; text: root.data.files_label; }
|
||||
UiText { role: TextRole.caption; text: root.data.bytes_label; }
|
||||
UiText { role: TextRole.caption; text: root.data.speed; color: Theme.accent; }
|
||||
UiText { role: TextRole.caption; text: root.data.eta; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
// 横幅通知条:隔离档位切换提示(M30 ModeChangeWarning)/ 启动失败 / 启动告警。
|
||||
// 与 Toast 的分工:Toast 是「刚发生了什么」,通知条是「现在需要你处理」(用户点了才收)。
|
||||
import { Theme } from "../theme/tokens.slint";
|
||||
import { Metrics } from "../theme/metrics.slint";
|
||||
import { UiNotice, NoticeKind } from "../models.slint";
|
||||
import { PageState } from "../page_state.slint";
|
||||
import { UiText, TextRole } from "../components/label.slint";
|
||||
import { AppIcon, IconKind } from "../components/icons.slint";
|
||||
import { MetroButton, ButtonKind } from "../widgets/button.slint";
|
||||
|
||||
// 横幅通知:隔离档位切换提示(M30 ModeChangeWarning)/ 启动失败 / 启动告警。
|
||||
// 与 Toast 的分工:Toast 是「刚发生了什么」,通知条是「现在需要你处理」。
|
||||
export component NoticeBar inherits Rectangle {
|
||||
in property <[UiNotice]> notices;
|
||||
|
||||
visible: root.notices.length > 0;
|
||||
height: root.notices.length > 0 ? 48px : 0px;
|
||||
background: Theme.state-warn-soft;
|
||||
|
||||
HorizontalLayout {
|
||||
padding-left: Metrics.gap-4;
|
||||
padding-right: Metrics.gap-3;
|
||||
spacing: Metrics.gap-2;
|
||||
|
||||
for notice in root.notices : Rectangle {
|
||||
horizontal-stretch: 1;
|
||||
background: transparent;
|
||||
HorizontalLayout {
|
||||
spacing: Metrics.gap-2;
|
||||
AppIcon {
|
||||
icon-size: 16px;
|
||||
kind: notice.kind == NoticeKind.error ? IconKind.error : IconKind.warn;
|
||||
tint: notice.kind == NoticeKind.error ? Theme.state-danger : Theme.state-warn;
|
||||
}
|
||||
VerticalLayout {
|
||||
vertical-stretch: 1;
|
||||
spacing: 0px;
|
||||
UiText { role: TextRole.caption; text: notice.title; horizontal-stretch: 1; }
|
||||
UiText {
|
||||
role: TextRole.caption;
|
||||
text: notice.body;
|
||||
horizontal-stretch: 1;
|
||||
overflow: elide;
|
||||
color: Theme.fg-secondary;
|
||||
}
|
||||
}
|
||||
MetroButton {
|
||||
kind: ButtonKind.subtle;
|
||||
text: "知道了";
|
||||
button-height: 22px;
|
||||
clicked => { PageState.notice-dismiss(notice.id); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// 细进度条(0.0~1.0):安装进度 / 下载页顶部 / 向导进度共用。
|
||||
// 未知总量(known = false)时画一条不确定态的弱色轨道,而不是假装 0%。
|
||||
import { Theme } from "../theme/tokens.slint";
|
||||
import { Metrics } from "../theme/metrics.slint";
|
||||
|
||||
export component ProgressBar inherits Rectangle {
|
||||
in property <float> ratio: 0.0;
|
||||
in property <bool> known: true;
|
||||
in property <length> bar-height: 6px;
|
||||
|
||||
height: root.bar-height;
|
||||
border-radius: root.bar-height / 2;
|
||||
background: Theme.bg-hover;
|
||||
clip: true;
|
||||
|
||||
Rectangle {
|
||||
x: 0;
|
||||
y: 0;
|
||||
width: root.known ? max(0px, root.width * clamp(root.ratio, 0.0, 1.0)) : 0px;
|
||||
height: root.height;
|
||||
border-radius: root.bar-height / 2;
|
||||
background: Theme.accent;
|
||||
animate width { duration: 180ms; easing: ease-out; }
|
||||
}
|
||||
|
||||
if !root.known : Rectangle {
|
||||
x: 0;
|
||||
y: 0;
|
||||
width: root.width / 3;
|
||||
height: root.height;
|
||||
border-radius: root.bar-height / 2;
|
||||
background: Theme.accent-soft;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user