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;
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@
|
||||
// 亮/暗双套色板(LightPalette/DarkPalette)、主题三态解析、排版 ramp 与字体栈;M11 的占位
|
||||
// NavItem/Tile 组件由 `components/nav.slint` 与 `components/tile.slint` 取代,占位内核不再保留。
|
||||
|
||||
// P3:页面状态 global 从根文件再导出一遍,Rust 侧才能拿到 `PageState` 类型。
|
||||
export { PageState } from "page_state.slint";
|
||||
import { AppShell } from "shell.slint";
|
||||
import { Theme } from "theme/tokens.slint";
|
||||
import { Metrics } from "theme/metrics.slint";
|
||||
|
||||
@@ -216,3 +216,149 @@ export struct UiToast {
|
||||
kind: ToastKind,
|
||||
text: string,
|
||||
}
|
||||
|
||||
// ── P3 全量接线的视图模型(账户 / Java / 安装 / 设置分组 / 通知 / 向导)──────────
|
||||
// 这些类型由 Rust 的 dto 单向转换(`conv/pages.rs`),Slint 只读不写业务真相。
|
||||
// 全部经 `page_state.slint` 的 `PageState` global 下发(避免 main/shell 的属性转发膨胀)。
|
||||
|
||||
export enum AccountKind {
|
||||
offline,
|
||||
microsoft,
|
||||
authlib,
|
||||
}
|
||||
|
||||
export struct UiAccount {
|
||||
id: string,
|
||||
name: string,
|
||||
kind: AccountKind,
|
||||
kind_label: string,
|
||||
profile_id: string,
|
||||
login_name: string,
|
||||
created: string,
|
||||
active: bool,
|
||||
}
|
||||
|
||||
/// 设备码登录面板(用户码/链接不是凭据,可直接展示)。
|
||||
export struct UiDeviceCode {
|
||||
visible: bool,
|
||||
busy: bool,
|
||||
user_code: string,
|
||||
verification_uri: string,
|
||||
qr_link: string,
|
||||
expires: int,
|
||||
message: string,
|
||||
phase_label: string,
|
||||
}
|
||||
|
||||
export enum JavaStepOutcome {
|
||||
pending,
|
||||
skip,
|
||||
failed,
|
||||
hit,
|
||||
}
|
||||
|
||||
export struct UiJavaStep {
|
||||
vendor: string,
|
||||
outcome: JavaStepOutcome,
|
||||
outcome_label: string,
|
||||
detail: string,
|
||||
}
|
||||
|
||||
export struct UiJavaVendor {
|
||||
id: string,
|
||||
display: string,
|
||||
rank: int,
|
||||
majors: string,
|
||||
sources: string,
|
||||
installed: bool,
|
||||
}
|
||||
|
||||
export struct UiJavaRuntime {
|
||||
binary: string,
|
||||
version: string,
|
||||
vendor: string,
|
||||
origin: string,
|
||||
}
|
||||
|
||||
export enum InstallStage {
|
||||
planning,
|
||||
downloading,
|
||||
installing,
|
||||
registering,
|
||||
done,
|
||||
failed,
|
||||
cancelled,
|
||||
}
|
||||
|
||||
export struct UiInstallProgress {
|
||||
visible: bool,
|
||||
version: string,
|
||||
instance: string,
|
||||
loader: string,
|
||||
stage: InstallStage,
|
||||
stage_label: string,
|
||||
ratio: float,
|
||||
known: bool,
|
||||
files_label: string,
|
||||
bytes_label: string,
|
||||
speed: string,
|
||||
eta: string,
|
||||
message: string,
|
||||
terminal: bool,
|
||||
failed: bool,
|
||||
}
|
||||
|
||||
export enum SettingControl {
|
||||
toggle,
|
||||
choice,
|
||||
text,
|
||||
readonly,
|
||||
action,
|
||||
}
|
||||
|
||||
export struct UiSettingRow {
|
||||
key: string,
|
||||
label: string,
|
||||
description: string,
|
||||
control: SettingControl,
|
||||
flag: bool,
|
||||
selected: int,
|
||||
options: [string],
|
||||
value_text: string,
|
||||
action: string,
|
||||
}
|
||||
|
||||
export struct UiSettingGroup {
|
||||
id: string,
|
||||
title: string,
|
||||
rows: [UiSettingRow],
|
||||
}
|
||||
|
||||
export enum NoticeKind {
|
||||
info,
|
||||
warn,
|
||||
error,
|
||||
}
|
||||
|
||||
export struct UiNotice {
|
||||
id: string,
|
||||
kind: NoticeKind,
|
||||
title: string,
|
||||
body: string,
|
||||
}
|
||||
|
||||
export struct UiWizard {
|
||||
open: bool,
|
||||
step: int,
|
||||
step_label: string,
|
||||
step_index: int,
|
||||
step_total: int,
|
||||
version: string,
|
||||
loader: int,
|
||||
loader_label: string,
|
||||
loader_version: string,
|
||||
name: string,
|
||||
error: string,
|
||||
busy: bool,
|
||||
can-next: bool,
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
// P3 全量接线的页面状态:一个导出的 global,Slint 任何页面都能直接读/回推。
|
||||
//
|
||||
// 为什么用 global 而不是继续经 main.slint → shell.slint 逐层转发:属性表已经 100+ 条,
|
||||
// 再加五页的数据会把 main.slint 顶破 400 行上限(AGENTS §3)。global 在同一个 Slint
|
||||
// 编译单元内是单例,Rust 侧用 `ui.global::<PageState>()` 读写,语义与 property 相同。
|
||||
//
|
||||
// 纪律:这里只放「页面要显示什么」与「用户点了什么」,业务真相在 Rust 的 state.rs。
|
||||
import { UiAccount, UiDeviceCode, UiJavaVendor, UiJavaStep, UiJavaRuntime, UiInstallProgress, UiSettingGroup, UiNotice, UiWizard, UiVersion } from "models.slint";
|
||||
|
||||
export global PageState {
|
||||
// ── 账户页 ────────────────────────────────────────────────
|
||||
in-out property <[UiAccount]> accounts;
|
||||
in property <string> active-account: "";
|
||||
in property <UiDeviceCode> device;
|
||||
/// 离线添加表单的输入(不落盘,点「添加」才提交)
|
||||
in-out property <string> offline-name: "";
|
||||
|
||||
// ── Java(下载页 Java 分组 / 设置页 Java 分组)──────────────
|
||||
in property <[UiJavaVendor]> java-vendors;
|
||||
in property <[UiJavaStep]> java-chain;
|
||||
in property <[UiJavaRuntime]> java-runtimes;
|
||||
in property <string> java-order: "";
|
||||
in property <string> java-region: "";
|
||||
in property <string> java-priority-source: "";
|
||||
in property <string> java-message: "";
|
||||
in property <bool> java-busy: false;
|
||||
in property <int> java-target-major: 17;
|
||||
|
||||
// ── 安装进度(下载页 + 向导共用)────────────────────────────
|
||||
in property <UiInstallProgress> install;
|
||||
/// 下载页右侧视图:0 = 版本列表,1 = Java 运行时(截图通道也从这里切)
|
||||
in-out property <int> download-tab: 0;
|
||||
|
||||
// ── 设置分组(settings_bridge 同源 launcher.json)──────────
|
||||
in property <[UiSettingGroup]> setting-groups;
|
||||
in-out property <string> setting-tab: "download";
|
||||
|
||||
// ── 通知条 / 向导 ─────────────────────────────────────────
|
||||
in property <[UiNotice]> notices;
|
||||
in property <UiWizard> wizard;
|
||||
in property <[UiVersion]> wizard-versions;
|
||||
|
||||
// ── 账户 ──────────────────────────────────────────────────
|
||||
callback account-add-offline(string);
|
||||
callback account-remove(string);
|
||||
callback account-switch(string);
|
||||
callback msa-begin();
|
||||
callback msa-cancel();
|
||||
|
||||
// ── Java ──────────────────────────────────────────────────
|
||||
callback java-install(string);
|
||||
|
||||
// ── 设置 ──────────────────────────────────────────────────
|
||||
callback setting-changed(string, string);
|
||||
callback setting-action(string);
|
||||
callback settings-tab-changed(string);
|
||||
|
||||
// ── 通知 ──────────────────────────────────────────────────
|
||||
callback notice-dismiss(string);
|
||||
|
||||
// ── 向导 ──────────────────────────────────────────────────
|
||||
callback wizard-open();
|
||||
callback wizard-close();
|
||||
callback wizard-select-version(string);
|
||||
callback wizard-select-loader(int);
|
||||
callback wizard-name-changed(string);
|
||||
callback wizard-next();
|
||||
callback wizard-back();
|
||||
callback wizard-confirm();
|
||||
callback install-cancel();
|
||||
|
||||
// ── 日志页:崩溃日志导入 / 手动刷新 ──────────────────────────
|
||||
in-out property <string> crash-path: "";
|
||||
callback crash-import(string);
|
||||
callback logs-refresh();
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
// 下载页 · Java 分组(G2 的第二个分类):四家发行版 + 回退链可视化 + 本地运行时。
|
||||
//
|
||||
// 回退链是「可观测性」核心:安装失败时用户要能看见 Temurin 跳过 → Oracle 失败 →
|
||||
// Microsoft 命中的每一步原因(D23),而不是只看到一句「下载失败」。
|
||||
import { Theme } from "../theme/tokens.slint";
|
||||
import { Metrics } from "../theme/metrics.slint";
|
||||
import { UiJavaVendor, UiJavaStep, UiJavaRuntime, JavaStepOutcome } from "../models.slint";
|
||||
import { PageState } from "../page_state.slint";
|
||||
import { UiText, TextRole } from "../components/label.slint";
|
||||
import { Badge } from "../components/badge.slint";
|
||||
import { AppIcon, IconKind } from "../components/icons.slint";
|
||||
import { MetroButton, ButtonKind } from "../widgets/button.slint";
|
||||
import { ScrollView } from "std-widgets.slint";
|
||||
|
||||
component ChainStep inherits Rectangle {
|
||||
in property <UiJavaStep> step;
|
||||
|
||||
height: 26px;
|
||||
background: transparent;
|
||||
|
||||
HorizontalLayout {
|
||||
spacing: Metrics.gap-1;
|
||||
|
||||
AppIcon {
|
||||
icon-size: 12px;
|
||||
kind: root.step.outcome == JavaStepOutcome.hit ? IconKind.check
|
||||
: root.step.outcome == JavaStepOutcome.failed ? IconKind.error
|
||||
: root.step.outcome == JavaStepOutcome.skip ? IconKind.warn
|
||||
: IconKind.more;
|
||||
tint: root.step.outcome == JavaStepOutcome.hit ? Theme.state-success
|
||||
: root.step.outcome == JavaStepOutcome.failed ? Theme.state-danger
|
||||
: Theme.fg-secondary;
|
||||
}
|
||||
UiText {
|
||||
role: TextRole.caption;
|
||||
text: root.step.vendor;
|
||||
width: 72px;
|
||||
color: root.step.outcome == JavaStepOutcome.hit ? Theme.state-success : Theme.fg-primary;
|
||||
}
|
||||
Badge {
|
||||
text: root.step.outcome_label;
|
||||
tint: root.step.outcome == JavaStepOutcome.hit ? Theme.state-success
|
||||
: root.step.outcome == JavaStepOutcome.failed ? Theme.state-danger
|
||||
: Theme.fg-secondary;
|
||||
}
|
||||
UiText {
|
||||
role: TextRole.caption;
|
||||
text: root.step.detail;
|
||||
horizontal-stretch: 1;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
component VendorRow inherits Rectangle {
|
||||
in property <UiJavaVendor> data;
|
||||
callback install();
|
||||
|
||||
height: 56px;
|
||||
background: vendor-touch.has-hover ? Theme.bg-hover : transparent;
|
||||
|
||||
HorizontalLayout {
|
||||
padding-left: Metrics.gap-3;
|
||||
padding-right: Metrics.gap-3;
|
||||
spacing: Metrics.gap-2;
|
||||
|
||||
UiText {
|
||||
role: TextRole.bodyStrong;
|
||||
text: root.data.rank + ". " + root.data.display;
|
||||
width: 170px;
|
||||
}
|
||||
if root.data.installed : Badge { text: "已装"; tint: Theme.state-success; }
|
||||
UiText {
|
||||
role: TextRole.caption;
|
||||
text: "Java " + root.data.majors;
|
||||
width: 96px;
|
||||
}
|
||||
UiText {
|
||||
role: TextRole.caption;
|
||||
text: root.data.sources;
|
||||
horizontal-stretch: 1;
|
||||
overflow: elide;
|
||||
}
|
||||
MetroButton {
|
||||
kind: ButtonKind.standard;
|
||||
text: "安装此家";
|
||||
button-height: 26px;
|
||||
enabled: !PageState.java-busy;
|
||||
clicked => { root.install(); }
|
||||
}
|
||||
}
|
||||
|
||||
vendor-touch := TouchArea {
|
||||
mouse-cursor: pointer;
|
||||
clicked => { root.install(); }
|
||||
}
|
||||
}
|
||||
|
||||
export component JavaPanel inherits Rectangle {
|
||||
background: Theme.bg-canvas;
|
||||
|
||||
VerticalLayout {
|
||||
// 顶栏:地区 / 优先级来源 / 目标大版本 / 一键按回退链安装
|
||||
Rectangle {
|
||||
height: 56px;
|
||||
background: Theme.bg-canvas;
|
||||
|
||||
HorizontalLayout {
|
||||
padding-left: Metrics.gap-4;
|
||||
padding-right: Metrics.gap-4;
|
||||
spacing: Metrics.gap-3;
|
||||
|
||||
UiText {
|
||||
role: TextRole.subtitle;
|
||||
text: "Java 运行时";
|
||||
width: 110px;
|
||||
}
|
||||
UiText {
|
||||
role: TextRole.caption;
|
||||
text: "地区 " + PageState.java-region + " · 优先级 " + PageState.java-priority-source
|
||||
+ " · 目标 Java " + PageState.java-target-major;
|
||||
horizontal-stretch: 1;
|
||||
overflow: elide;
|
||||
}
|
||||
MetroButton {
|
||||
kind: ButtonKind.accent;
|
||||
text: PageState.java-busy ? "安装中…" : "按回退链安装";
|
||||
button-height: 28px;
|
||||
enabled: !PageState.java-busy;
|
||||
clicked => { PageState.java-install(""); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UiText {
|
||||
x: Metrics.gap-4;
|
||||
role: TextRole.caption;
|
||||
text: PageState.java-order;
|
||||
horizontal-stretch: 1;
|
||||
overflow: elide;
|
||||
}
|
||||
|
||||
if PageState.java-message != "" : Rectangle {
|
||||
height: 30px;
|
||||
background: Theme.accent-soft;
|
||||
UiText {
|
||||
x: Metrics.gap-4;
|
||||
role: TextRole.caption;
|
||||
text: PageState.java-message;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle { height: 1px; background: Theme.stroke; }
|
||||
|
||||
ScrollView {
|
||||
vertical-stretch: 1;
|
||||
|
||||
VerticalLayout {
|
||||
padding-bottom: Metrics.gap-4;
|
||||
|
||||
// 回退链
|
||||
UiText {
|
||||
x: Metrics.gap-4;
|
||||
role: TextRole.bodyStrong;
|
||||
text: "回退链";
|
||||
}
|
||||
for step in PageState.java-chain : ChainStep { step: step; }
|
||||
|
||||
UiText {
|
||||
x: Metrics.gap-4;
|
||||
role: TextRole.bodyStrong;
|
||||
text: "四家发行版";
|
||||
}
|
||||
for vendor in PageState.java-vendors : VendorRow {
|
||||
data: vendor;
|
||||
install => { PageState.java-install(vendor.id); }
|
||||
}
|
||||
|
||||
UiText {
|
||||
x: Metrics.gap-4;
|
||||
role: TextRole.bodyStrong;
|
||||
text: "本地已发现";
|
||||
}
|
||||
if PageState.java-runtimes.length == 0 : UiText {
|
||||
x: Metrics.gap-4;
|
||||
role: TextRole.caption;
|
||||
text: "还没有探测到 Java:点上面的「按回退链安装」装一个托管 JDK。";
|
||||
}
|
||||
for runtime in PageState.java-runtimes : Rectangle {
|
||||
height: 24px;
|
||||
HorizontalLayout {
|
||||
padding-left: Metrics.gap-4;
|
||||
spacing: Metrics.gap-2;
|
||||
UiText { role: TextRole.caption; text: "Java " + runtime.version; width: 120px; }
|
||||
UiText { role: TextRole.caption; text: runtime.vendor; width: 96px; }
|
||||
UiText { role: TextRole.caption; text: runtime.origin; width: 80px; }
|
||||
UiText { role: TextRole.caption; text: runtime.binary; horizontal-stretch: 1; overflow: elide; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+174
-124
@@ -1,14 +1,19 @@
|
||||
// G2 下载页(09 §2 P0·G2 / Q24-4 定案):页内独立左侧分类栏(常驻,非 tab)+ 右侧版本列表。
|
||||
// 远古版入口显式可达(ULL 对 HMCL「隐藏」行为的纠偏),下挂 classic/alpha/beta/unlisted 子类树,
|
||||
// 进入远古版分类时顶部提示兼容性 + 每行带「远古版」徽标(防误装)。
|
||||
//
|
||||
// P3 接线:右侧多一个「Java 运行时」视图(四家发行版 + 回退链),页面底部常驻安装进度条。
|
||||
import { Theme } from "../theme/tokens.slint";
|
||||
import { Metrics } from "../theme/metrics.slint";
|
||||
import { UiVersion, VersionKind, DownloadCategory } from "../models.slint";
|
||||
import { PageState } from "../page_state.slint";
|
||||
import { UiText, TextRole } from "../components/label.slint";
|
||||
import { AppIcon, IconKind } from "../components/icons.slint";
|
||||
import { Badge } from "../components/badge.slint";
|
||||
import { MetroButton, ButtonKind } from "../widgets/button.slint";
|
||||
import { SearchField, CheckBox } from "../widgets/inputs.slint";
|
||||
import { InstallPanel } from "../components/install-panel.slint";
|
||||
import { JavaPanel } from "download-java.slint";
|
||||
import { ListView } from "std-widgets.slint";
|
||||
|
||||
component CategoryRow inherits Rectangle {
|
||||
@@ -112,6 +117,8 @@ export component DownloadPage inherits Rectangle {
|
||||
in-out property <string> query: "";
|
||||
/// 远古版子类树是否展开(默认展开,显式可达)
|
||||
in-out property <bool> ancient-expanded: true;
|
||||
/// 右侧视图:0 = 版本列表,1 = Java 运行时
|
||||
in-out property <int> view-tab <=> PageState.download-tab;
|
||||
|
||||
callback category-changed(DownloadCategory);
|
||||
callback install(string);
|
||||
@@ -123,148 +130,191 @@ export component DownloadPage inherits Rectangle {
|
||||
|
||||
background: Theme.bg-canvas;
|
||||
|
||||
HorizontalLayout {
|
||||
// ── 页内分类侧栏(常驻)───────────────────────────────────
|
||||
VerticalLayout {
|
||||
// 视图切换(版本 / Java)
|
||||
Rectangle {
|
||||
width: 200px;
|
||||
height: 40px;
|
||||
background: Theme.bg-surface;
|
||||
border-width: 1px;
|
||||
border-color: Theme.stroke;
|
||||
HorizontalLayout {
|
||||
padding-left: Metrics.gap-4;
|
||||
spacing: Metrics.gap-2;
|
||||
UiText {
|
||||
role: TextRole.subtitle;
|
||||
text: "版本获取";
|
||||
width: 96px;
|
||||
}
|
||||
MetroButton {
|
||||
kind: root.view-tab == 0 ? ButtonKind.accent : ButtonKind.subtle;
|
||||
text: "版本列表";
|
||||
button-height: 26px;
|
||||
clicked => { root.view-tab = 0; }
|
||||
}
|
||||
MetroButton {
|
||||
kind: root.view-tab == 1 ? ButtonKind.accent : ButtonKind.subtle;
|
||||
text: "Java 运行时";
|
||||
button-height: 26px;
|
||||
clicked => { root.view-tab = 1; }
|
||||
}
|
||||
Rectangle { horizontal-stretch: 1; background: transparent; }
|
||||
if PageState.java-busy : UiText {
|
||||
role: TextRole.caption;
|
||||
text: "Java 安装中…";
|
||||
color: Theme.accent;
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle { height: 1px; background: Theme.stroke; }
|
||||
|
||||
if root.view-tab == 0 : HorizontalLayout {
|
||||
vertical-stretch: 1;
|
||||
|
||||
// ── 页内分类侧栏(常驻)───────────────────────────────────
|
||||
Rectangle {
|
||||
width: 200px;
|
||||
background: Theme.bg-surface;
|
||||
border-width: 1px;
|
||||
border-color: Theme.stroke;
|
||||
|
||||
VerticalLayout {
|
||||
padding-top: Metrics.gap-2;
|
||||
|
||||
CategoryRow {
|
||||
label: "正式版 release";
|
||||
active: root.category == DownloadCategory.release;
|
||||
clicked => { root.category-changed(DownloadCategory.release); }
|
||||
}
|
||||
CategoryRow {
|
||||
label: "预览版 snapshot";
|
||||
active: root.category == DownloadCategory.snapshot;
|
||||
clicked => { root.category-changed(DownloadCategory.snapshot); }
|
||||
}
|
||||
|
||||
// 远古版:可展开的父节点 + 子类树
|
||||
CategoryRow {
|
||||
label: root.ancient-expanded ? "远古版 ▾" : "远古版 ▸";
|
||||
active: root.category == DownloadCategory.ancientClassic
|
||||
|| root.category == DownloadCategory.ancientAlpha
|
||||
|| root.category == DownloadCategory.ancientBeta
|
||||
|| root.category == DownloadCategory.ancientUnlisted;
|
||||
clicked => { root.toggle-ancient(); }
|
||||
}
|
||||
if root.ancient-expanded : CategoryRow {
|
||||
label: "classic(rd-*)";
|
||||
sub: true;
|
||||
active: root.category == DownloadCategory.ancientClassic;
|
||||
clicked => { root.category-changed(DownloadCategory.ancientClassic); }
|
||||
}
|
||||
if root.ancient-expanded : CategoryRow {
|
||||
label: "old_alpha(a1.*)";
|
||||
sub: true;
|
||||
active: root.category == DownloadCategory.ancientAlpha;
|
||||
clicked => { root.category-changed(DownloadCategory.ancientAlpha); }
|
||||
}
|
||||
if root.ancient-expanded : CategoryRow {
|
||||
label: "old_beta(b1.*)";
|
||||
sub: true;
|
||||
active: root.category == DownloadCategory.ancientBeta;
|
||||
clicked => { root.category-changed(DownloadCategory.ancientBeta); }
|
||||
}
|
||||
if root.ancient-expanded : CategoryRow {
|
||||
label: "unlisted 汇总";
|
||||
sub: true;
|
||||
active: root.category == DownloadCategory.ancientUnlisted;
|
||||
clicked => { root.category-changed(DownloadCategory.ancientUnlisted); }
|
||||
}
|
||||
|
||||
CategoryRow {
|
||||
label: "整合包(P1)";
|
||||
disabled: true;
|
||||
}
|
||||
CategoryRow {
|
||||
label: "Mod(P1)";
|
||||
disabled: true;
|
||||
}
|
||||
|
||||
Rectangle { vertical-stretch: 1; background: transparent; }
|
||||
}
|
||||
}
|
||||
|
||||
// ── 右侧版本列表 ──────────────────────────────────────────
|
||||
VerticalLayout {
|
||||
padding-top: Metrics.gap-2;
|
||||
vertical-stretch: 1;
|
||||
|
||||
CategoryRow {
|
||||
label: "正式版 release";
|
||||
active: root.category == DownloadCategory.release;
|
||||
clicked => { root.category-changed(DownloadCategory.release); }
|
||||
}
|
||||
CategoryRow {
|
||||
label: "预览版 snapshot";
|
||||
active: root.category == DownloadCategory.snapshot;
|
||||
clicked => { root.category-changed(DownloadCategory.snapshot); }
|
||||
Rectangle {
|
||||
height: Metrics.page-header-height;
|
||||
background: Theme.bg-canvas;
|
||||
|
||||
HorizontalLayout {
|
||||
padding-left: Metrics.gap-4;
|
||||
padding-right: Metrics.gap-4;
|
||||
spacing: Metrics.gap-3;
|
||||
|
||||
SearchField {
|
||||
width: 220px;
|
||||
placeholder: "筛选版本号";
|
||||
text <=> root.query;
|
||||
edited(t) => { root.query-changed(t); }
|
||||
}
|
||||
CheckBox {
|
||||
text: "仅已装";
|
||||
checked: root.installed-only;
|
||||
toggled(v) => { root.installed-only-changed(v); }
|
||||
}
|
||||
Rectangle { horizontal-stretch: 1; background: transparent; }
|
||||
}
|
||||
}
|
||||
|
||||
// 远古版:可展开的父节点 + 子类树
|
||||
CategoryRow {
|
||||
label: root.ancient-expanded ? "远古版 ▾" : "远古版 ▸";
|
||||
active: root.category == DownloadCategory.ancientClassic
|
||||
// 远古版兼容性提示条(首次进入显示,显式可达的代价告知)
|
||||
Rectangle {
|
||||
height: 44px;
|
||||
visible: root.category == DownloadCategory.ancientClassic
|
||||
|| root.category == DownloadCategory.ancientAlpha
|
||||
|| root.category == DownloadCategory.ancientBeta
|
||||
|| root.category == DownloadCategory.ancientUnlisted;
|
||||
clicked => { root.toggle-ancient(); }
|
||||
}
|
||||
if root.ancient-expanded : CategoryRow {
|
||||
label: "classic(rd-*)";
|
||||
sub: true;
|
||||
active: root.category == DownloadCategory.ancientClassic;
|
||||
clicked => { root.category-changed(DownloadCategory.ancientClassic); }
|
||||
}
|
||||
if root.ancient-expanded : CategoryRow {
|
||||
label: "old_alpha(a1.*)";
|
||||
sub: true;
|
||||
active: root.category == DownloadCategory.ancientAlpha;
|
||||
clicked => { root.category-changed(DownloadCategory.ancientAlpha); }
|
||||
}
|
||||
if root.ancient-expanded : CategoryRow {
|
||||
label: "old_beta(b1.*)";
|
||||
sub: true;
|
||||
active: root.category == DownloadCategory.ancientBeta;
|
||||
clicked => { root.category-changed(DownloadCategory.ancientBeta); }
|
||||
}
|
||||
if root.ancient-expanded : CategoryRow {
|
||||
label: "unlisted 汇总";
|
||||
sub: true;
|
||||
active: root.category == DownloadCategory.ancientUnlisted;
|
||||
clicked => { root.category-changed(DownloadCategory.ancientUnlisted); }
|
||||
background: Theme.state-warn-soft;
|
||||
|
||||
HorizontalLayout {
|
||||
padding-left: Metrics.gap-4;
|
||||
padding-right: Metrics.gap-4;
|
||||
spacing: Metrics.gap-2;
|
||||
|
||||
AppIcon { kind: IconKind.warn; icon-size: 16px; tint: Theme.state-warn; }
|
||||
UiText {
|
||||
role: TextRole.caption;
|
||||
text: "远古版(classic/alpha/beta)需要旧版 Java 与旧启动参数,装完请先看兼容性说明。";
|
||||
wrap: word-wrap;
|
||||
horizontal-stretch: 1;
|
||||
}
|
||||
MetroButton {
|
||||
kind: ButtonKind.subtle;
|
||||
text: "说明";
|
||||
button-height: 26px;
|
||||
clicked => { root.ancient-help(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CategoryRow {
|
||||
label: "整合包(P1)";
|
||||
disabled: true;
|
||||
}
|
||||
CategoryRow {
|
||||
label: "Mod(P1)";
|
||||
disabled: true;
|
||||
}
|
||||
Rectangle { height: 1px; background: Theme.stroke; }
|
||||
|
||||
Rectangle { vertical-stretch: 1; background: transparent; }
|
||||
ListView {
|
||||
vertical-stretch: 1;
|
||||
|
||||
for v in root.versions : VersionRow {
|
||||
data: v;
|
||||
install => { root.install(v.id); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ── 右侧版本列表 ──────────────────────────────────────────
|
||||
VerticalLayout {
|
||||
if root.view-tab == 1 : JavaPanel {
|
||||
vertical-stretch: 1;
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
height: Metrics.page-header-height;
|
||||
background: Theme.bg-canvas;
|
||||
|
||||
HorizontalLayout {
|
||||
padding-left: Metrics.gap-4;
|
||||
padding-right: Metrics.gap-4;
|
||||
spacing: Metrics.gap-3;
|
||||
|
||||
UiText {
|
||||
role: TextRole.subtitle;
|
||||
text: "版本获取";
|
||||
width: 96px;
|
||||
}
|
||||
SearchField {
|
||||
width: 220px;
|
||||
placeholder: "筛选版本号";
|
||||
text <=> root.query;
|
||||
edited(t) => { root.query-changed(t); }
|
||||
}
|
||||
CheckBox {
|
||||
text: "仅已装";
|
||||
checked: root.installed-only;
|
||||
toggled(v) => { root.installed-only-changed(v); }
|
||||
}
|
||||
Rectangle { horizontal-stretch: 1; background: transparent; }
|
||||
}
|
||||
}
|
||||
|
||||
// 远古版兼容性提示条(首次进入显示,显式可达的代价告知)
|
||||
Rectangle {
|
||||
height: 44px;
|
||||
visible: root.category == DownloadCategory.ancientClassic
|
||||
|| root.category == DownloadCategory.ancientAlpha
|
||||
|| root.category == DownloadCategory.ancientBeta
|
||||
|| root.category == DownloadCategory.ancientUnlisted;
|
||||
background: Theme.state-warn-soft;
|
||||
|
||||
HorizontalLayout {
|
||||
padding-left: Metrics.gap-4;
|
||||
padding-right: Metrics.gap-4;
|
||||
spacing: Metrics.gap-2;
|
||||
|
||||
AppIcon { kind: IconKind.warn; icon-size: 16px; tint: Theme.state-warn; }
|
||||
UiText {
|
||||
role: TextRole.caption;
|
||||
text: "远古版(classic/alpha/beta)需要旧版 Java 与旧启动参数,装完请先看兼容性说明。";
|
||||
wrap: word-wrap;
|
||||
horizontal-stretch: 1;
|
||||
}
|
||||
MetroButton {
|
||||
kind: ButtonKind.subtle;
|
||||
text: "说明";
|
||||
button-height: 26px;
|
||||
clicked => { root.ancient-help(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle { height: 1px; background: Theme.stroke; }
|
||||
|
||||
ListView {
|
||||
vertical-stretch: 1;
|
||||
|
||||
for v in root.versions : VersionRow {
|
||||
data: v;
|
||||
install => { root.install(v.id); }
|
||||
}
|
||||
}
|
||||
// 安装进度(下载页行内安装 / 向导共用同一份进度)
|
||||
InstallPanel {
|
||||
data: PageState.install;
|
||||
cancel => { PageState.install-cancel(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import { AppIcon, IconKind } from "../components/icons.slint";
|
||||
import { Badge } from "../components/badge.slint";
|
||||
import { MetroButton, ButtonKind } from "../widgets/button.slint";
|
||||
import { SearchField } from "../widgets/inputs.slint";
|
||||
import { PageState } from "../page_state.slint";
|
||||
import { ListView } from "std-widgets.slint";
|
||||
|
||||
component SessionRow inherits Rectangle {
|
||||
@@ -106,6 +107,8 @@ export component LogsPage inherits Rectangle {
|
||||
callback ask-ai(string);
|
||||
callback apply-fix();
|
||||
callback query-changed(string);
|
||||
/// 重新扫会话索引(手动刷新)
|
||||
callback refresh();
|
||||
|
||||
background: Theme.bg-canvas;
|
||||
|
||||
@@ -157,30 +160,57 @@ export component LogsPage inherits Rectangle {
|
||||
VerticalLayout {
|
||||
vertical-stretch: 1;
|
||||
|
||||
// 会话头:标题 + 实时标记 + 筛选 + 刷新(第一行),崩溃日志导入(第二行)
|
||||
Rectangle {
|
||||
height: 44px;
|
||||
height: 84px;
|
||||
background: Theme.bg-surface;
|
||||
|
||||
HorizontalLayout {
|
||||
padding-left: Metrics.gap-3;
|
||||
padding-right: Metrics.gap-3;
|
||||
spacing: Metrics.gap-2;
|
||||
VerticalLayout {
|
||||
HorizontalLayout {
|
||||
height: 44px;
|
||||
padding-left: Metrics.gap-3;
|
||||
padding-right: Metrics.gap-3;
|
||||
spacing: Metrics.gap-2;
|
||||
|
||||
UiText {
|
||||
role: TextRole.bodyStrong;
|
||||
text: root.selected == "" ? "未选择会话" : root.selected;
|
||||
horizontal-stretch: 1;
|
||||
UiText {
|
||||
role: TextRole.bodyStrong;
|
||||
text: root.selected == "" ? "未选择会话" : root.selected;
|
||||
horizontal-stretch: 1;
|
||||
overflow: elide;
|
||||
}
|
||||
if root.live : Badge { text: "实时"; tint: Theme.state-success; }
|
||||
SearchField {
|
||||
width: 140px;
|
||||
placeholder: "筛选日志行";
|
||||
text <=> root.query;
|
||||
edited(t) => { root.query-changed(t); }
|
||||
}
|
||||
MetroButton {
|
||||
kind: ButtonKind.subtle;
|
||||
text: "刷新";
|
||||
button-height: 26px;
|
||||
clicked => { root.refresh(); }
|
||||
}
|
||||
}
|
||||
SearchField {
|
||||
width: 200px;
|
||||
placeholder: "筛选日志行";
|
||||
text <=> root.query;
|
||||
edited(t) => { root.query-changed(t); }
|
||||
}
|
||||
MetroButton {
|
||||
kind: ButtonKind.subtle;
|
||||
text: "打开目录";
|
||||
button-height: 26px;
|
||||
|
||||
// 崩溃日志导入分析(hs_err_pid*.log / crash-*.txt / latest.log)
|
||||
HorizontalLayout {
|
||||
height: 40px;
|
||||
padding-left: Metrics.gap-3;
|
||||
padding-right: Metrics.gap-3;
|
||||
spacing: Metrics.gap-2;
|
||||
SearchField {
|
||||
horizontal-stretch: 1;
|
||||
placeholder: "崩溃日志路径(如 .minecraft/crash-reports/crash-*.txt)";
|
||||
text <=> PageState.crash-path;
|
||||
}
|
||||
MetroButton {
|
||||
kind: ButtonKind.standard;
|
||||
text: "导入分析";
|
||||
button-height: 26px;
|
||||
enabled: PageState.crash-path != "";
|
||||
clicked => { PageState.crash-import(PageState.crash-path); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
// 设置 → 账户(D9 / G6):三轨账户列表 + 离线添加 + 微软设备码登录 + 删除/切换。
|
||||
//
|
||||
// 凭据红线:这里能看到的只有「名字 / 轨道 / 公开 UUID / 登录名 / 创建时间」——
|
||||
// token 与密码永远不进 UI(Rust 侧的 AccountView 不含这些字段)。
|
||||
import { Theme } from "../theme/tokens.slint";
|
||||
import { Metrics } from "../theme/metrics.slint";
|
||||
import { AccountKind, UiAccount } from "../models.slint";
|
||||
import { PageState } from "../page_state.slint";
|
||||
import { UiText, TextRole } from "../components/label.slint";
|
||||
import { Badge } from "../components/badge.slint";
|
||||
import { AppIcon, IconKind } from "../components/icons.slint";
|
||||
import { MetroButton, ButtonKind } from "../widgets/button.slint";
|
||||
import { SearchField } from "../widgets/inputs.slint";
|
||||
import { SettingGroup } from "../widgets/setting-item.slint";
|
||||
|
||||
component AccountRow inherits Rectangle {
|
||||
in property <UiAccount> data;
|
||||
callback activate();
|
||||
callback remove();
|
||||
|
||||
height: 56px;
|
||||
background: root.data.active ? Theme.accent-soft : transparent;
|
||||
|
||||
if root.data.active : Rectangle {
|
||||
x: 0;
|
||||
y: 0;
|
||||
width: 3px;
|
||||
height: root.height;
|
||||
background: Theme.accent;
|
||||
}
|
||||
|
||||
HorizontalLayout {
|
||||
padding-left: Metrics.gap-3;
|
||||
padding-right: Metrics.gap-3;
|
||||
spacing: Metrics.gap-2;
|
||||
|
||||
AppIcon {
|
||||
icon-size: 16px;
|
||||
kind: root.data.kind == AccountKind.offline ? IconKind.instances : IconKind.ai;
|
||||
tint: root.data.active ? Theme.accent : Theme.fg-secondary;
|
||||
}
|
||||
VerticalLayout {
|
||||
spacing: 0px;
|
||||
vertical-stretch: 1;
|
||||
UiText { role: TextRole.bodyStrong; text: root.data.name; horizontal-stretch: 1; }
|
||||
UiText {
|
||||
role: TextRole.caption;
|
||||
text: root.data.profile_id + (root.data.login_name == "" ? "" : " · " + root.data.login_name);
|
||||
horizontal-stretch: 1;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
Badge { text: root.data.kind_label; tint: Theme.fg-secondary; }
|
||||
UiText { role: TextRole.caption; text: root.data.created; width: 108px; }
|
||||
if !root.data.active : MetroButton {
|
||||
kind: ButtonKind.standard;
|
||||
text: "用这个";
|
||||
button-height: 24px;
|
||||
clicked => { root.activate(); }
|
||||
}
|
||||
if root.data.active : Badge { text: "启动中"; tint: Theme.accent; }
|
||||
MetroButton {
|
||||
kind: ButtonKind.subtle;
|
||||
text: "删除";
|
||||
button-height: 24px;
|
||||
clicked => { root.remove(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export component AccountSection inherits Rectangle {
|
||||
background: transparent;
|
||||
|
||||
VerticalLayout {
|
||||
// 设备码登录面板(Waiting 时显示用户码 + 链接;失败显示原因)
|
||||
if PageState.device.visible : Rectangle {
|
||||
height: PageState.device.busy ? 96px : 84px;
|
||||
background: PageState.device.phase_label == "失败" ? Theme.state-danger-soft : Theme.accent-soft;
|
||||
|
||||
VerticalLayout {
|
||||
padding: Metrics.gap-3;
|
||||
spacing: Metrics.gap-1;
|
||||
|
||||
HorizontalLayout {
|
||||
spacing: Metrics.gap-2;
|
||||
AppIcon {
|
||||
icon-size: 16px;
|
||||
kind: PageState.device.phase_label == "失败" ? IconKind.error : IconKind.ai;
|
||||
tint: PageState.device.phase_label == "失败" ? Theme.state-danger : Theme.accent;
|
||||
}
|
||||
UiText {
|
||||
role: TextRole.bodyStrong;
|
||||
text: "微软登录 · " + PageState.device.phase_label;
|
||||
horizontal-stretch: 1;
|
||||
}
|
||||
if PageState.device.busy : MetroButton {
|
||||
kind: ButtonKind.subtle;
|
||||
text: "取消";
|
||||
button-height: 24px;
|
||||
clicked => { PageState.msa-cancel(); }
|
||||
}
|
||||
if !PageState.device.busy : MetroButton {
|
||||
kind: ButtonKind.subtle;
|
||||
text: "关闭";
|
||||
button-height: 24px;
|
||||
clicked => { PageState.msa-cancel(); }
|
||||
}
|
||||
}
|
||||
|
||||
if PageState.device.user_code != "" : HorizontalLayout {
|
||||
spacing: Metrics.gap-3;
|
||||
UiText {
|
||||
role: TextRole.title;
|
||||
text: PageState.device.user_code;
|
||||
color: Theme.accent;
|
||||
}
|
||||
UiText {
|
||||
role: TextRole.caption;
|
||||
text: "在浏览器打开 " + PageState.device.verification_uri + " 输入上面的用户码";
|
||||
horizontal-stretch: 1;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
UiText {
|
||||
role: TextRole.caption;
|
||||
text: PageState.device.message;
|
||||
horizontal-stretch: 1;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
if PageState.device.qr_link != "" : UiText {
|
||||
role: TextRole.monoSmall;
|
||||
text: PageState.device.qr_link;
|
||||
horizontal-stretch: 1;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 离线添加表单
|
||||
SettingGroup { title: "添加离线账户"; }
|
||||
HorizontalLayout {
|
||||
padding-left: Metrics.gap-4;
|
||||
padding-right: Metrics.gap-4;
|
||||
spacing: Metrics.gap-2;
|
||||
SearchField {
|
||||
width: 220px;
|
||||
text <=> PageState.offline-name;
|
||||
placeholder: "玩家名(离线 UUID 自动生成)";
|
||||
}
|
||||
MetroButton {
|
||||
kind: ButtonKind.accent;
|
||||
text: "添加离线";
|
||||
button-height: 28px;
|
||||
enabled: PageState.offline-name != "";
|
||||
clicked => { PageState.account-add-offline(PageState.offline-name); }
|
||||
}
|
||||
MetroButton {
|
||||
kind: ButtonKind.standard;
|
||||
text: "微软登录(设备码)";
|
||||
button-height: 28px;
|
||||
enabled: !PageState.device.busy;
|
||||
clicked => { PageState.msa-begin(); }
|
||||
}
|
||||
}
|
||||
|
||||
// 账户列表
|
||||
SettingGroup { title: "账户(" + PageState.accounts.length + ")"; }
|
||||
if PageState.accounts.length == 0 : Rectangle {
|
||||
height: 72px;
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
spacing: 2px;
|
||||
UiText {
|
||||
role: TextRole.caption;
|
||||
text: "还没有账户:启动时会用「Player」离线占位。";
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
for account in PageState.accounts : AccountRow {
|
||||
data: account;
|
||||
activate => { PageState.account-switch(account.id); }
|
||||
remove => { PageState.account-remove(account.id); }
|
||||
}
|
||||
|
||||
UiText {
|
||||
role: TextRole.caption;
|
||||
x: Metrics.gap-4;
|
||||
text: "凭据只存在 <数据根>/data/auth/(账号文件与凭据文件分离),界面与 AI 都拿不到 token。";
|
||||
horizontal-stretch: 1;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
// 设置页右栏的「schema 分组」渲染器:下载 / Java / 数据 / AI / MCP 五组。
|
||||
//
|
||||
// 行来自 Rust 侧的 `SettingGroupView`(core::setting schema 的键),这里只按控件类型画:
|
||||
// 开关 → toggle;分段 → segmented;文本 → text;只读 → 纯文案;动作 → 按钮。
|
||||
// 写回一律 `PageState.setting-changed(key, value)` / `setting-action(action)`,
|
||||
// 由 host 走 `SettingStore::set`(同源 launcher.json)。
|
||||
import { Theme } from "../theme/tokens.slint";
|
||||
import { Metrics } from "../theme/metrics.slint";
|
||||
import { UiSettingGroup, UiSettingRow, SettingControl } from "../models.slint";
|
||||
import { PageState } from "../page_state.slint";
|
||||
import { UiText, TextRole } from "../components/label.slint";
|
||||
import { SettingItem, SettingGroup, ControlKind } from "../widgets/setting-item.slint";
|
||||
|
||||
component RowView inherits Rectangle {
|
||||
in property <UiSettingRow> item;
|
||||
/// 文本编辑的本地缓冲(编辑中不回写模型,失焦/回车才提交)
|
||||
in-out property <string> draft;
|
||||
|
||||
height: root.item.control == SettingControl.readonly ? 48px
|
||||
: root.item.description == "" ? 44px : 58px;
|
||||
background: transparent;
|
||||
|
||||
init => { self.draft = root.item.value_text; }
|
||||
changed item => { self.draft = root.item.value_text; }
|
||||
|
||||
if root.item.control == SettingControl.toggle : SettingItem {
|
||||
label: root.item.label;
|
||||
description: root.item.description;
|
||||
kind: ControlKind.toggle;
|
||||
checked: root.item.flag;
|
||||
toggled(v) => { PageState.setting-changed(root.item.key, v ? "true" : "false"); }
|
||||
}
|
||||
|
||||
if root.item.control == SettingControl.choice : SettingItem {
|
||||
label: root.item.label;
|
||||
description: root.item.description;
|
||||
kind: ControlKind.segmented;
|
||||
options: root.item.options;
|
||||
selected: root.item.selected;
|
||||
changed(i) => {
|
||||
if (i >= 0 && i < root.item.options.length) {
|
||||
PageState.setting-changed(root.item.key, root.item.options[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if root.item.control == SettingControl.text : SettingItem {
|
||||
label: root.item.label;
|
||||
description: root.item.description;
|
||||
kind: ControlKind.text;
|
||||
value: root.draft;
|
||||
edited(t) => {
|
||||
root.draft = t;
|
||||
PageState.setting-changed(root.item.key, t);
|
||||
}
|
||||
}
|
||||
|
||||
if root.item.control == SettingControl.action : SettingItem {
|
||||
label: root.item.label;
|
||||
description: root.item.description;
|
||||
kind: ControlKind.button;
|
||||
button-text: "执行";
|
||||
clicked => { PageState.setting-action(root.item.action); }
|
||||
}
|
||||
|
||||
if root.item.control == SettingControl.readonly : HorizontalLayout {
|
||||
padding-left: Metrics.gap-4;
|
||||
padding-right: Metrics.gap-4;
|
||||
spacing: Metrics.gap-3;
|
||||
|
||||
UiText {
|
||||
role: TextRole.body;
|
||||
text: root.item.label;
|
||||
width: 200px;
|
||||
}
|
||||
UiText {
|
||||
role: TextRole.caption;
|
||||
text: root.item.description;
|
||||
horizontal-stretch: 1;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export component SettingsGroups inherits Rectangle {
|
||||
in property <string> tab: "";
|
||||
|
||||
background: transparent;
|
||||
|
||||
VerticalLayout {
|
||||
padding-bottom: Metrics.gap-5;
|
||||
|
||||
if PageState.setting-groups.length == 0 : Rectangle {
|
||||
height: 120px;
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
spacing: 2px;
|
||||
UiText {
|
||||
role: TextRole.caption;
|
||||
text: "设置还没加载出来(host 未就绪或数据根不可写)";
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for group in PageState.setting-groups : Rectangle {
|
||||
visible: group.id == root.tab;
|
||||
height: group.rows.length * 58px + 40px;
|
||||
background: transparent;
|
||||
|
||||
VerticalLayout {
|
||||
SettingGroup { title: group.title; }
|
||||
for setting-row in group.rows : RowView { item: setting-row; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,9 @@ import { SettingSection, TileSize, ThemeMode, BgFillKind } from "../models.slint
|
||||
import { UiText, TextRole } from "../components/label.slint";
|
||||
import { SettingItem, SettingGroup, ControlKind } from "../widgets/setting-item.slint";
|
||||
import { AppearanceSection } from "settings-appearance.slint";
|
||||
import { AccountSection } from "settings-account.slint";
|
||||
import { SettingsGroups } from "settings-groups.slint";
|
||||
import { PageState } from "../page_state.slint";
|
||||
import { SearchField } from "../widgets/inputs.slint";
|
||||
import { AboutSlint, ScrollView } from "std-widgets.slint";
|
||||
|
||||
@@ -235,101 +238,15 @@ export component SettingsPage inherits Rectangle {
|
||||
toggled(v) => { root.close-to-tray-changed(v); }
|
||||
}
|
||||
|
||||
// ── 数据 ────────────────────────────────────────
|
||||
if root.section == SettingSection.data : SettingGroup { title: "数据目录(D6 三模式)"; }
|
||||
if root.section == SettingSection.data : SettingItem {
|
||||
label: "存储模式";
|
||||
description: "便携(运行目录 .ULL/.minecraft)/ 标准(系统应用数据目录)/ 自定义";
|
||||
kind: ControlKind.segmented;
|
||||
options: ["便携", "标准", "自定义"];
|
||||
selected: root.data-mode;
|
||||
changed(i) => {
|
||||
root.data-mode = i;
|
||||
root.data-mode-changed(i);
|
||||
}
|
||||
}
|
||||
if root.section == SettingSection.data : SettingItem {
|
||||
label: "当前路径";
|
||||
description: root.data-path;
|
||||
kind: ControlKind.button;
|
||||
button-text: "迁移…";
|
||||
clicked => { root.migrate-data(); }
|
||||
}
|
||||
|
||||
// ── 下载 ────────────────────────────────────────
|
||||
if root.section == SettingSection.download : SettingGroup { title: "下载(D7)"; }
|
||||
if root.section == SettingSection.download : SettingItem {
|
||||
label: "并发数";
|
||||
kind: ControlKind.segmented;
|
||||
options: ["4", "8", "16"];
|
||||
selected: root.download-concurrency;
|
||||
changed(i) => {
|
||||
root.download-concurrency = i;
|
||||
root.download-concurrency-changed(i);
|
||||
}
|
||||
}
|
||||
if root.section == SettingSection.download : SettingItem {
|
||||
label: "地区判定";
|
||||
description: "当前:" + root.region-label + "(决定是否走国内镜像)";
|
||||
kind: ControlKind.button;
|
||||
button-text: "重新检测";
|
||||
clicked => { root.detect-region(); }
|
||||
}
|
||||
|
||||
// ── Java ────────────────────────────────────────
|
||||
if root.section == SettingSection.java : SettingGroup { title: "Java(D13)"; }
|
||||
if root.section == SettingSection.java : SettingItem {
|
||||
label: "Java 管理";
|
||||
description: "基准 JDK17 自动下载 · 多版本可选 · 不匹配时黄条提示";
|
||||
kind: ControlKind.button;
|
||||
button-text: "管理多版本";
|
||||
clicked => { root.manage-java(); }
|
||||
}
|
||||
|
||||
// ── 账户 ────────────────────────────────────────
|
||||
if root.section == SettingSection.account : SettingGroup { title: "账户(D9)"; }
|
||||
if root.section == SettingSection.account : SettingItem {
|
||||
label: "当前账户";
|
||||
description: root.account-label;
|
||||
kind: ControlKind.button;
|
||||
button-text: "登录 / 切换";
|
||||
clicked => { root.login(); }
|
||||
}
|
||||
|
||||
// ── AI ──────────────────────────────────────────
|
||||
if root.section == SettingSection.ai : SettingGroup { title: "AI 助手(D4)"; }
|
||||
if root.section == SettingSection.ai : SettingItem {
|
||||
label: "模型端点";
|
||||
description: "OpenAI 兼容 / 本地 llama.cpp / Anthropic / 自定义";
|
||||
kind: ControlKind.segmented;
|
||||
options: ["OpenAI", "llama.cpp", "Anthropic", "自定义"];
|
||||
selected: root.ai-endpoint;
|
||||
changed(i) => {
|
||||
root.ai-endpoint = i;
|
||||
root.ai-endpoint-changed(i);
|
||||
}
|
||||
}
|
||||
if root.section == SettingSection.ai : SettingItem {
|
||||
label: "YOLO 模式";
|
||||
description: "跳过全部确认弹窗(审计照记),账户/凭据操作永不 YOLO";
|
||||
kind: ControlKind.toggle;
|
||||
checked: root.yolo;
|
||||
toggled(v) => { root.yolo-changed(v); }
|
||||
}
|
||||
if root.section == SettingSection.ai : SettingItem {
|
||||
label: "MCP server";
|
||||
description: "允许外部客户端(如 Claude Desktop)调用工具集";
|
||||
kind: ControlKind.toggle;
|
||||
checked: root.mcp-enabled;
|
||||
toggled(v) => { root.mcp-changed(v); }
|
||||
}
|
||||
if root.section == SettingSection.ai : SettingItem {
|
||||
label: "审计日志";
|
||||
description: "AI 的所有写操作都有记录";
|
||||
kind: ControlKind.button;
|
||||
button-text: "查看";
|
||||
clicked => { root.open-audit-log(); }
|
||||
}
|
||||
// ── 数据 / 下载 / Java / 账户 / AI / MCP ────────────
|
||||
// 行来自 core::setting schema(`PageState.setting-groups`),写回走
|
||||
// `SettingStore::set`——与 `ull config set` / AI `set_config` 同一份 launcher.json。
|
||||
if root.section == SettingSection.data : SettingsGroups { tab: "data"; }
|
||||
if root.section == SettingSection.download : SettingsGroups { tab: "download"; }
|
||||
if root.section == SettingSection.java : SettingsGroups { tab: "java"; }
|
||||
if root.section == SettingSection.ai : SettingsGroups { tab: "ai"; }
|
||||
if root.section == SettingSection.ai : SettingsGroups { tab: "mcp"; }
|
||||
if root.section == SettingSection.account : AccountSection { }
|
||||
|
||||
// ── 代理 ────────────────────────────────────────
|
||||
if root.section == SettingSection.proxy : SettingGroup { title: "代理"; }
|
||||
|
||||
@@ -7,6 +7,8 @@ import {
|
||||
RouteKind, TileSize, InstanceView, SettingSection, DownloadCategory, ThemeMode, BgFillKind,
|
||||
UiTile, UiVersion, UiLogSession, UiLogLine, UiDiagnosis, UiChatMessage, UiDialog, UiToast,
|
||||
} from "models.slint";
|
||||
import { PageState } from "page_state.slint";
|
||||
import { NewInstanceWizard } from "widgets/wizard.slint";
|
||||
import { TitleBar } from "components/titlebar.slint";
|
||||
import { Nav } from "components/nav.slint";
|
||||
import { AiPanel } from "components/ai-panel.slint";
|
||||
@@ -14,11 +16,13 @@ import { UiText, TextRole } from "components/label.slint";
|
||||
import { MetroButton, ButtonKind } from "widgets/button.slint";
|
||||
import { DialogHost } from "widgets/dialog.slint";
|
||||
import { ToastHost } from "widgets/toast.slint";
|
||||
import { NoticeBar } from "components/notice-bar.slint";
|
||||
import { InstancesPage } from "pages/instances.slint";
|
||||
import { DownloadPage } from "pages/download.slint";
|
||||
import { LogsPage } from "pages/logs.slint";
|
||||
import { SettingsPage } from "pages/settings.slint";
|
||||
|
||||
|
||||
export component AppShell inherits Rectangle {
|
||||
// ── 窗口 ────────────────────────────────────────────────────
|
||||
in property <string> app-title: "Unlucky Launcher";
|
||||
@@ -189,6 +193,10 @@ export component AppShell inherits Rectangle {
|
||||
request-close => { root.request-close(); }
|
||||
}
|
||||
|
||||
NoticeBar {
|
||||
notices: PageState.notices;
|
||||
}
|
||||
|
||||
HorizontalLayout {
|
||||
// 左侧主导航
|
||||
Nav {
|
||||
@@ -259,6 +267,7 @@ export component AppShell inherits Rectangle {
|
||||
select(id) => { root.log-select(id); }
|
||||
ask-ai(id) => { root.log-ask-ai(id); }
|
||||
apply-fix => { root.log-apply-fix(); }
|
||||
refresh => { PageState.logs-refresh(); }
|
||||
}
|
||||
|
||||
if root.route == RouteKind.settings : SettingsPage {
|
||||
@@ -356,6 +365,11 @@ export component AppShell inherits Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// 新建实例向导(全屏模态;数据来自 PageState)
|
||||
NewInstanceWizard {
|
||||
versions: root.versions;
|
||||
}
|
||||
|
||||
// 覆盖层:模态队列(一次一条)+ 右下 Toast
|
||||
DialogHost {
|
||||
current: root.dialog;
|
||||
|
||||
@@ -0,0 +1,301 @@
|
||||
// 新建实例向导(G5,全屏模态):版本 → 加载器 → 名字 → 确认 → 进度。
|
||||
// 步骤推进/校验在 Rust(`crate::wizard`),这里只画当前步与提交按钮。
|
||||
import { Theme } from "../theme/tokens.slint";
|
||||
import { Metrics } from "../theme/metrics.slint";
|
||||
import { UiVersion, VersionKind } from "../models.slint";
|
||||
import { PageState } from "../page_state.slint";
|
||||
import { UiText, TextRole } from "../components/label.slint";
|
||||
import { Badge } from "../components/badge.slint";
|
||||
import { AppIcon, IconKind } from "../components/icons.slint";
|
||||
import { MetroButton, ButtonKind } from "../widgets/button.slint";
|
||||
import { SearchField } from "../widgets/inputs.slint";
|
||||
import { InstallPanel } from "../components/install-panel.slint";
|
||||
import { ScrollView } from "std-widgets.slint";
|
||||
|
||||
component StepDot inherits Rectangle {
|
||||
in property <int> index: 0;
|
||||
in property <string> label: "";
|
||||
|
||||
height: 28px;
|
||||
background: transparent;
|
||||
|
||||
HorizontalLayout {
|
||||
spacing: Metrics.gap-1;
|
||||
alignment: center;
|
||||
Rectangle {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 9px;
|
||||
background: PageState.wizard.step >= root.index ? Theme.accent : Theme.bg-hover;
|
||||
UiText {
|
||||
role: TextRole.caption;
|
||||
text: root.index + 1;
|
||||
horizontal-alignment: center;
|
||||
color: PageState.wizard.step >= root.index ? Theme.fg-on-accent : Theme.fg-secondary;
|
||||
}
|
||||
}
|
||||
UiText {
|
||||
role: TextRole.caption;
|
||||
text: root.label;
|
||||
color: PageState.wizard.step >= root.index ? Theme.fg-primary : Theme.fg-disabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
component VersionChoice inherits Rectangle {
|
||||
in property <UiVersion> data;
|
||||
callback picked();
|
||||
|
||||
height: 36px;
|
||||
background: PageState.wizard.version == root.data.id ? Theme.accent-soft
|
||||
: (touch.has-hover ? Theme.bg-hover : transparent);
|
||||
|
||||
HorizontalLayout {
|
||||
padding-left: Metrics.gap-3;
|
||||
padding-right: Metrics.gap-3;
|
||||
spacing: Metrics.gap-2;
|
||||
UiText { role: TextRole.body; text: root.data.id; width: 160px; }
|
||||
Badge {
|
||||
text: root.data.kind == VersionKind.release ? "正式版" : "预览版";
|
||||
tint: Theme.fg-secondary;
|
||||
}
|
||||
UiText { role: TextRole.caption; text: root.data.released; horizontal-stretch: 1; }
|
||||
if PageState.wizard.version == root.data.id : AppIcon {
|
||||
kind: IconKind.check;
|
||||
icon-size: 14px;
|
||||
tint: Theme.accent;
|
||||
}
|
||||
}
|
||||
|
||||
touch := TouchArea {
|
||||
mouse-cursor: pointer;
|
||||
clicked => { root.picked(); }
|
||||
}
|
||||
}
|
||||
|
||||
component LoaderChoice inherits Rectangle {
|
||||
in property <string> label: "";
|
||||
in property <string> hint: "";
|
||||
in property <int> index: 0;
|
||||
callback picked();
|
||||
|
||||
height: 48px;
|
||||
background: PageState.wizard.loader == root.index ? Theme.accent-soft
|
||||
: (touch.has-hover ? Theme.bg-hover : transparent);
|
||||
|
||||
HorizontalLayout {
|
||||
padding-left: Metrics.gap-3;
|
||||
padding-right: Metrics.gap-3;
|
||||
spacing: Metrics.gap-2;
|
||||
VerticalLayout {
|
||||
vertical-stretch: 1;
|
||||
spacing: 0px;
|
||||
UiText { role: TextRole.body; text: root.label; }
|
||||
UiText { role: TextRole.caption; text: root.hint; horizontal-stretch: 1; }
|
||||
}
|
||||
if PageState.wizard.loader == root.index : AppIcon {
|
||||
kind: IconKind.check;
|
||||
icon-size: 14px;
|
||||
tint: Theme.accent;
|
||||
}
|
||||
}
|
||||
|
||||
touch := TouchArea {
|
||||
mouse-cursor: pointer;
|
||||
clicked => { root.picked(); }
|
||||
}
|
||||
}
|
||||
|
||||
export component NewInstanceWizard inherits Rectangle {
|
||||
// 版本列表由 shell 传入(与下载页共用一份,避免二次拉取)
|
||||
in property <[UiVersion]> versions;
|
||||
in-out property <string> query: "";
|
||||
|
||||
visible: PageState.wizard.open;
|
||||
background: rgba(0, 0, 0, 0.45);
|
||||
|
||||
// 吃掉底层点击(模态)
|
||||
TouchArea { }
|
||||
|
||||
Rectangle {
|
||||
x: (parent.width - self.width) / 2;
|
||||
y: (parent.height - self.height) / 2;
|
||||
width: min(parent.width - 80px, 720px);
|
||||
height: min(parent.height - 60px, 560px);
|
||||
background: Theme.bg-surface;
|
||||
border-radius: Metrics.radius-md;
|
||||
border-width: 1px;
|
||||
border-color: Theme.stroke;
|
||||
|
||||
VerticalLayout {
|
||||
// 标题栏
|
||||
Rectangle {
|
||||
height: 52px;
|
||||
background: transparent;
|
||||
HorizontalLayout {
|
||||
padding-left: Metrics.gap-4;
|
||||
padding-right: Metrics.gap-3;
|
||||
spacing: Metrics.gap-2;
|
||||
UiText {
|
||||
role: TextRole.subtitle;
|
||||
text: "新建实例 · " + PageState.wizard.step_label;
|
||||
horizontal-stretch: 1;
|
||||
}
|
||||
MetroButton {
|
||||
kind: ButtonKind.subtle;
|
||||
text: "关闭";
|
||||
button-height: 24px;
|
||||
clicked => { PageState.wizard-close(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 步骤指示
|
||||
HorizontalLayout {
|
||||
padding-left: Metrics.gap-4;
|
||||
spacing: Metrics.gap-3;
|
||||
StepDot { index: 0; label: "版本"; }
|
||||
StepDot { index: 1; label: "加载器"; }
|
||||
StepDot { index: 2; label: "名字"; }
|
||||
StepDot { index: 3; label: "确认"; }
|
||||
StepDot { index: 4; label: "进度"; }
|
||||
}
|
||||
|
||||
Rectangle { height: 1px; background: Theme.stroke; }
|
||||
|
||||
// 步骤内容
|
||||
Rectangle {
|
||||
vertical-stretch: 1;
|
||||
background: transparent;
|
||||
|
||||
// ① 选版本(只列正式版/快照,远古版走下载页的显式入口)
|
||||
if PageState.wizard.step == 0 : VerticalLayout {
|
||||
padding: Metrics.gap-3;
|
||||
spacing: Metrics.gap-2;
|
||||
SearchField {
|
||||
width: 220px;
|
||||
text <=> root.query;
|
||||
placeholder: "筛选版本号";
|
||||
}
|
||||
ScrollView {
|
||||
vertical-stretch: 1;
|
||||
VerticalLayout {
|
||||
for v in root.versions : VersionChoice {
|
||||
visible: !v.ancient;
|
||||
data: v;
|
||||
picked => { PageState.wizard-select-version(v.id); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ② 选加载器
|
||||
if PageState.wizard.step == 1 : VerticalLayout {
|
||||
padding: Metrics.gap-3;
|
||||
spacing: 0px;
|
||||
LoaderChoice { index: 0; label: "原版(Vanilla)"; hint: "不装加载器,最快最稳"; picked => { PageState.wizard-select-loader(0); } }
|
||||
LoaderChoice { index: 1; label: "Fabric"; hint: "轻量模组加载器(GUI 可直接装)"; picked => { PageState.wizard-select-loader(1); } }
|
||||
LoaderChoice { index: 2; label: "Quilt"; hint: "Fabric 的分支(GUI 可直接装)"; picked => { PageState.wizard-select-loader(2); } }
|
||||
LoaderChoice { index: 3; label: "Forge"; hint: "需要 installer processors:本轮请用 ull install"; picked => { PageState.wizard-select-loader(3); } }
|
||||
LoaderChoice { index: 4; label: "NeoForge"; hint: "需要 installer processors:本轮请用 ull install"; picked => { PageState.wizard-select-loader(4); } }
|
||||
}
|
||||
|
||||
// ③ 名字
|
||||
if PageState.wizard.step == 2 : VerticalLayout {
|
||||
padding: Metrics.gap-4;
|
||||
spacing: Metrics.gap-2;
|
||||
UiText { role: TextRole.body; text: "实例名(默认用版本号)"; }
|
||||
SearchField {
|
||||
width: 320px;
|
||||
text: PageState.wizard.name;
|
||||
placeholder: "例如:生存 1.20.4";
|
||||
edited(t) => { PageState.wizard-name-changed(t); }
|
||||
}
|
||||
if PageState.wizard.error != "" : UiText {
|
||||
role: TextRole.caption;
|
||||
text: PageState.wizard.error;
|
||||
color: Theme.state-danger;
|
||||
}
|
||||
UiText {
|
||||
role: TextRole.caption;
|
||||
text: "不能包含 / \\ : * ? \" < > |,最多 64 个字符。";
|
||||
}
|
||||
}
|
||||
|
||||
// ④ 确认
|
||||
if PageState.wizard.step == 3 : VerticalLayout {
|
||||
padding: Metrics.gap-4;
|
||||
spacing: Metrics.gap-2;
|
||||
UiText { role: TextRole.bodyStrong; text: "将创建实例"; }
|
||||
UiText { role: TextRole.body; text: "版本 " + PageState.wizard.version; }
|
||||
UiText { role: TextRole.body; text: "加载器 " + PageState.wizard.loader_label; }
|
||||
UiText { role: TextRole.body; text: "实例名 " + PageState.wizard.name; }
|
||||
UiText {
|
||||
role: TextRole.caption;
|
||||
text: "确认后会按 core 安装管线下载:版本 JSON → 客户端 jar → 库 → 资源索引 → 登记实例。";
|
||||
wrap: word-wrap;
|
||||
}
|
||||
if PageState.wizard.error != "" : UiText {
|
||||
role: TextRole.caption;
|
||||
text: PageState.wizard.error;
|
||||
color: Theme.state-danger;
|
||||
}
|
||||
}
|
||||
|
||||
// ⑤ 进度
|
||||
if PageState.wizard.step == 4 : VerticalLayout {
|
||||
padding: Metrics.gap-3;
|
||||
spacing: Metrics.gap-2;
|
||||
InstallPanel {
|
||||
data: PageState.install;
|
||||
cancel => { PageState.install-cancel(); }
|
||||
}
|
||||
UiText {
|
||||
role: TextRole.caption;
|
||||
text: "装完会自动跳到实例页;失败原因会显示在上面。";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle { height: 1px; background: Theme.stroke; }
|
||||
|
||||
// 底部按钮
|
||||
Rectangle {
|
||||
height: 56px;
|
||||
background: transparent;
|
||||
HorizontalLayout {
|
||||
padding: Metrics.gap-4;
|
||||
spacing: Metrics.gap-2;
|
||||
Rectangle { horizontal-stretch: 1; background: transparent; }
|
||||
MetroButton {
|
||||
kind: ButtonKind.subtle;
|
||||
text: "上一步";
|
||||
button-height: 30px;
|
||||
enabled: PageState.wizard.step > 0 && PageState.wizard.step < 4;
|
||||
clicked => { PageState.wizard-back(); }
|
||||
}
|
||||
if PageState.wizard.step < 3 : MetroButton {
|
||||
kind: ButtonKind.accent;
|
||||
text: "下一步";
|
||||
button-height: 30px;
|
||||
enabled: PageState.wizard.can-next;
|
||||
clicked => { PageState.wizard-next(); }
|
||||
}
|
||||
if PageState.wizard.step == 3 : MetroButton {
|
||||
kind: ButtonKind.accent;
|
||||
text: "开始安装";
|
||||
button-height: 30px;
|
||||
enabled: PageState.wizard.can-next && !PageState.wizard.busy;
|
||||
clicked => { PageState.wizard-confirm(); }
|
||||
}
|
||||
if PageState.wizard.step == 4 : MetroButton {
|
||||
kind: ButtonKind.standard;
|
||||
text: "后台继续";
|
||||
button-height: 30px;
|
||||
clicked => { PageState.wizard-close(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user