Files
LanMountainDesktop/.trae/documents/update-settings-redesign.md
lincube 7a70476ce8 合并对设置系统的更新 (#11)
* Add Windows system chrome patchers (Harmony)

Introduce support for toggling the system chrome on Windows using Harmony patchers. Adds Lib.Harmony.Thin to package props and project, new patcher infrastructure (ChromePatchState, PatcherEntrance) and two Harmony patches that disable FluentAvalonia's Windows chrome when configured. Program.cs now loads the chrome setting and installs patchers conditionally on Windows/x86-x64. Settings viewmodel and view updated: expose IsWindowsOs, require restart on appearance changes, migrate SettingsWindow to FAAppWindow and adapt titlebar/layout (include Windows caption placeholder and footer menu items). Also add a .gitkeep and a build log file.

* Refactor settings window UI and theming

Improve theming and layout for the Settings window and related services.

- MaterialSurfaceService: add special material parameters for SettingsWindowBackground (lower alpha, no blur) and avoid hot-switching real backdrops for non-settings windows.
- GlassEffectService: add AdaptiveSettingsWindowTintBrush + ResolveSettingsWindowTintAlpha to provide optional content tinting tied to system material mode.
- SettingsWindowService: refactor theme application into ApplyThemeVariantAndResources, ensure settings window material is applied at show/activate times, and tidy theme/resource application flow.
- SettingsWindow.axaml / .axaml.cs: restructure title bar (separate Grid.Row=0 border) and FANavigationView host, add pane-footer toggle button for :minimal layout, use dynamic corner radius resource, and update toggle/visibility/icon logic and responsive layout code.
- SettingsPages: remove some IconText usages and adjust margins; use DesignCornerRadiusLg for update card corner radius.
- Add NuGet.Config to set local globalPackagesFolder and ignore .nuget/packages in .gitignore.

These changes aim to improve visuals, avoid backdrop overdraw, and make the settings window behavior consistent across themes and layouts.

* Add localization and localize settings pages

Add many new localization keys (en-US and zh-CN) for notifications, developer tools, about page, status bar, and video wallpaper. Update Notification, Dev, About and StatusBar view models to use LocalizationService, expose localized ObservableProperties, and refresh localized text at construction. Localize selection options and test notification texts, and fix notification severity handling. Wire up XAML to the new localized properties (About/Dev/StatusBar pages) and update the settings page title for notifications. Also adjust copyright line generation and replace hardcoded placeholders with bound Watermark properties.

* Redesign settings window with fluent shell & search

Rebuild the settings window as a Fluent shell: adds a custom 48-DIP titlebar with Back, pane toggle, icon/title, search box, restart/more menu, and caption-button spacer; moves compact pane toggle into the titlebar and preserves FANavigationView as the primary navigation surface. Introduces a SettingsSearchService (with UI AutoComplete integration, search indexing, navigation-by-result, and search result highlighting) plus focused tests for search filtering and theme material normalization. Adds navigation history/back stack, updates SettingsViewModels for new bindings and localization keys, and updates General/Apearance pages to expose new strings and options. Implements an "auto" system material mode: default in AppSettingsSnapshot, new MaterialAuto constants and normalization/resolution logic in ThemeAppearanceValues, WindowMaterialService and MaterialSurfaceService adjustments to prefer Mica on Win11 and Acrylic on Win10 using TransparencyLevelHint. GlassEffectService and AppearanceThemeService updated to use effective material mode and to track live theme state changes. Adds localization entries (en-US, zh-CN), spec/tasks docs, and other UI/style tweaks to support the redesign.

* fix.修折叠与展开按钮

* Add OOBE startup presentation and settings merge

Introduce a new OOBE step for "Startup & Presentation" that exposes startup and UI preferences in OobeWindow (toggles for taskbar, slide/fade transitions, fused popup, and autostart). Add HostAppSettingsOobeMerger to read/write Host settings.json (PascalCase fields) and MergeStartupPresentation behavior, plus LauncherWindowsStartupService to sync the current Launcher into the Windows Run key on Windows. Wire UI handlers, persist choices on Next, and load defaults when entering the step. Include unit tests for the merger, adjust SettingsWindow navigation pane/toggle handling, and update docs/LAUNCHER.md to describe the new OOBE step and implementation files.

* Move whiteboard persistence to file storage

Switch whiteboard note storage from legacy DB rows to per-note JSON files and add migration support. Update WhiteboardNoteSnapshot schema (version bump, viewport, canvas, expires, PathSvgData) and change IWhiteboardNotePersistenceService.SaveNote to return bool to surface write failures (e.g. read-only files). Implement file-based WhiteboardNotePersistenceService with legacy DB migration/cleanup, retention handling, and logging. Add comprehensive unit tests for persistence, stroke path builder, SVG import and viewport helper. Also add ThirdParty/DotNetCampus.InkCanvas project and reference it in the main csproj, and bump PostHog package to 2.6.0.

* Introduce render gate and chart caching

Replace UI DispatcherTimer polling with a StudySnapshotRenderGate across multiple widgets to queue and apply only the latest analytics snapshot; components updated include StudyDeductionReasonsWidget, StudyEnvironmentWidget, StudyInterruptDensityWidget, StudyNoiseCurveWidget. Add StudySnapshotRenderGate implementation to coordinate rendering and monitoring leases and update subscription/lease lifecycle handling (subscribe/unsubscribe, Acquire/Dispose leases, Clear/Dispose gate). Rewrite chart controls (StudyNoiseCurveChartControl and StudyNoiseDistributionScatterChartControl) to use stable logical-time origins, split series into static vs dynamic tails, add geometry/sample caching, stable jitter/coordinate mapping helpers, and expose internal helpers & counts for testing. Add unit tests (StudyComponentRenderingTests) covering the render gate and chart behaviors (layer counts, logical X mapping, stable jitter, cache rebuild). These changes improve rendering correctness and performance by avoiding redundant renders and enabling deterministic chart layout.

* Use MaterialColorSnapshot in appearance flow

Introduce unified material/color spec and tests, and refactor appearance plumbing to use MaterialColorSnapshot as the single source of truth. Add .trae material-color-service spec/checklist/tasks and integration/unit tests for plugin mapping and appearance VM behavior. AppearanceChangedEvent extended with new appearance change flags and HasChanged logic. ComponentEditorMaterialThemeAdapter rewritten to accept MaterialColorSnapshot and derive palette from snapshot data. Simplify AppearanceSettingsPageViewModel and related view code: remove legacy preview/custom-seed UI logic, preserve material/color fields when updating theme or corner radius, and update save calls to use with-expressions. Update ComponentEditorWindow to use adapter-provided OnPrimary brush and minor docs updates.

* Add material color services, plugin DTOs, and tests

Introduce IPC wire-format appearance DTOs (PluginIsolation.Contracts) and clarify they are distinct from the runtime PluginSdk snapshot. Update PluginSdk comments to document the runtime-facing snapshot shape. Change ComponentColorSchemeHelper to use the HostMaterialColorProvider and add an overload that accepts a MaterialColorSnapshot. Add new services and pipelines (MaterialColorService, MaterialSurfaceService, WindowMaterialService, WallpaperColorPipeline) and refactor AppearanceThemeService to depend on MaterialColorService while removing legacy internal implementations. Add multiple unit tests (ComponentColorSchemeHelper, PluginAppearanceBoundary, SettingsCatalogService, WallpaperSettingsPageViewModel) and update localization resources with new material_color and wallpaper keys.

* Add CODE_WIKI and update localization

Add a comprehensive CODE_WIKI.md documenting project architecture, modules, startup flow, plugin system, testing and developer workflows. Update localization resources (en-US.json, zh-CN.json) with new/translated keys for wallpaper controls (custom color UI), material & color settings (semantic roles, surfaces, refresh/polling state), appearance (corner radius), status bar font size options, privacy policy text, component library labels, clock settings, and new language entry (Korean). Also modify settings-related ViewModels and Settings page views to surface these new features and texts (MaterialColorSettingsPageViewModel.cs, SettingsViewModels.cs, WallpaperSettingsPageViewModel.cs, MainWindow.SettingsHardCut.Stubs.cs, ComponentsSettingsPage.axaml, WallpaperSettingsPage.axaml).

* Add Data settings page and storage scanner

Introduce a new "Data" settings page to visualize and manage local app storage. Adds DataStorageService (scanning, disk info, clean operations), DataSettingsPageViewModel, XAML view and code-behind, and HexToColor/HexToBrush converters; registers converters in App.axaml. Also update localization strings for the new page and add icon mapping so the settings entry uses the Database icon. Enables per-category and global cleaning workflows and formatted size display.

* Add IPC backoff/retries and safer disposal

Introduce exponential backoff, jitter and retry logic across IPC components to improve robustness and avoid tight retry loops; make disposal idempotent and add connection guards. Key changes:
- LauncherCoordinatorIpcServer / LauncherIpcServer: add backoff constants, ComputeBackoff(), consecutive error tracking and delayed retries with jitter.
- LanMountainDesktopIpcClient / LauncherIpcClient: add connect retry loops, timeouts, delayed retries, improved error logging, and use ArrayPool for buffered async writes; ensure proper cleanup on failures.
- PublicIpcHostService: add disposed flag, guard OnPeerConnected and Dispose, and clear connected peers on dispose.
- Add many auto-generated commit analysis docs under docs/auto_commit_md and new scripts for analyzing/generating commit docs.
These changes aim to make IPC connection handling more resilient and resource-safe.

* Add preview controls and settings UI tweaks

Introduce GridPreviewControl and CornerRadiusPreviewControl for visual previews and wire them into the Components settings (add ScreenAspectRatio, CornerRadiusPreviewValue, and screen aspect init). Refactor ComponentsSettingsPage UI to show live previews. Improve DataSettingsPage layout and storage bar logic (use item percentages directly, include remaining segment, adjust visuals and visibility triggers). Simplify LauncherSettingsPage header/appearance layout. Add SECURITY_AUDIT_REPORT.md, analysis summary, mockup HTML, and a local .claude settings file.

* Add install checkpoint/resume and DDSS workflows

Introduce install checkpoint support and resume logic for updates, plus related locking and validation. Adds InstallCheckpoint model, AppJsonContext serialization, and UpdatePaths helpers for deployment lock, apply-in-progress lock and install-checkpoint path. UpdateEngineService gains checkpoint load/save/delete, incoming-state validation, resume logic for PLONDS and legacy updates, apply lock handling, and safer cleanup; ApplyPendingPlondsUpdateAsync and ApplyPendingUpdate flow updated accordingly. Add DeploymentLock contract and extend UpdateState with pause/resume/cancel helpers. Tests updated to cover stale/valid checkpoint resume and legacy/PLONDS flows. CI: enhance ddss-publish to detect release channel, validate S3 assets, prepare and atomically publish channel pointer; add ddss-rollback workflow to publish rollbacks; adjust plonds-build concurrency and release events.

* changed.更了好多

* fix.消息盒子媒体播放器组件服务修复

* change.重做天气,为回到系统提供自定义功能。

* feat.airapp与融合桌面

* feat.动画优化与更新界面

* feat.数字时钟,白板功能修复

* feat.完善了时钟轻应用,为启动器提供了多语言支持

* feat.发布与打包优化

* changed.天气选项卡更新
2026-05-19 07:55:21 +08:00

10 KiB
Raw Blame History

更新设置界面重设计实施计划

For agentic workers: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (- [ ]) syntax for tracking.

Goal: 将更新设置页面从丑陋的卡片堆叠布局重设计为遵循 Fluent Design 的 FASettingsExpander 列表布局,与项目其他设置页面保持视觉一致性。

Architecture: 移除所有 Border.settings-section-card 包裹,改用 FASettingsExpander + IconText 分节标题 + Separator 分隔线的统一模式。操作按钮改为仅显示当前可用操作。版本信息改为 FASettingsExpanderItem 行项目展示。ViewModel 层新增 ActiveActions 计算属性来驱动按钮可见性。

Tech Stack: Avalonia UI 11, FluentAvalonia 2.x, CommunityToolkit.Mvvm


当前状态分析

现有文件

文件 职责
LanMountainDesktop/Views/SettingsPages/UpdateSettingsPage.axaml 更新页面 AXAML 布局
LanMountainDesktop/Views/SettingsPages/UpdateSettingsPage.axaml.cs 代码隐藏
LanMountainDesktop/ViewModels/UpdateSettingsViewModel.cs 视图模型
LanMountainDesktop/Styles/SettingsCardStyles.axaml 通用设置样式
LanMountainDesktop/Controls/IconText.axaml(.cs) 分节标题控件
LanMountainDesktop.Shared.Contracts/Update/UpdateState.cs UpdatePhase 枚举和扩展方法

核心问题

  1. 4 个 Border.settings-section-card 卡片:状态卡、版本信息卡、进度卡、操作卡,每个都带边框+阴影+圆角,视觉零碎
  2. FAInfoBar 嵌套在卡片内:冗余的容器层级
  3. 7 个按钮 3×3 网格:大量按钮在当前阶段不可用但仍然占据空间
  4. 与其他设置页面风格不一致GeneralSettingsPage、AppearanceSettingsPage 等全部使用 FASettingsExpander 列表

参考基准


设计决策

决策项 选择 理由
布局模式 FASettingsExpander 列表 与其他设置页面统一Fluent Design 原生控件
按钮策略 仅显示可用操作 简洁、不混乱Windows 11 更新页面也是此模式
版本信息 FASettingsExpanderItem 行项目 每行一个信息,干净可扫描
进度展示 内嵌在状态 Expander 内 进度是状态的一部分,不应独立成卡
偏好设置 保留 FASettingsExpander 已经是正确模式,微调即可

新布局结构

ScrollViewer
└── StackPanel (settings-page-container settings-page-animated)
    ├── TextBlock (settings-section-title: "更新")
    ├── TextBlock (settings-section-description: 描述文字)
    │
    ├── IconText (Icon="ArrowSync", Text="更新状态")
    │
    ├── FASettingsExpander "检查更新" (IsClickEnabled=True, Command=CheckCommand)
    │   ├── IconSource: ArrowSync 图标
    │   └── Footer: Button "检查更新" (仅 CanCheck 时可见)
    │
    ├── FASettingsExpander "更新进度" (IsVisible=IsBusy||IsProgressVisible||IsPaused)
    │   ├── IconSource: FAProgressRing / 对应阶段图标
    │   ├── Footer: PhaseText + ProgressFraction
    │   └── FASettingsExpanderItem
    │       ├── ProgressBar (ProgressFraction)
    │       ├── ProgressDetail 文字
    │       └── 操作按钮行 (仅可用操作)
    │           ├── Button "下载" (CanDownload)
    │           ├── Button "安装" (CanInstall)
    │           ├── Button "暂停" (CanPause)
    │           ├── Button "继续" (CanResume)
    │           ├── Button "回滚" (CanRollback)
    │           └── Button "取消" (CanCancel)
    │
    ├── FASettingsExpander "暂停" (IsVisible=IsPaused)
    │   └── FAInfoBar (PausedBadgeText + PausedHintText)
    │
    ├── Separator (settings-separator)
    │
    ├── IconText (Icon="Info", Text="版本信息")
    │
    ├── FASettingsExpander "当前版本" (IsClickEnabled=False)
    │   ├── IconSource: 版本图标
    │   └── Footer: CurrentVersionText
    │
    ├── FASettingsExpander "最新版本" (IsClickEnabled=False)
    │   ├── IconSource: 下载图标
    │   └── Footer: LatestVersionText (或 "已是最新")
    │
    ├── FASettingsExpander "发布时间" (IsClickEnabled=False)
    │   ├── IconSource: 日历图标
    │   └── Footer: PublishedAtText
    │
    ├── FASettingsExpander "上次检查" (IsClickEnabled=False)
    │   ├── IconSource: 时钟图标
    │   └── Footer: LastCheckedText
    │
    ├── FASettingsExpander "更新类型" (IsClickEnabled=False)
    │   ├── IconSource: 标签图标
    │   └── Footer: UpdateTypeText
    │
    ├── Separator (settings-separator)
    │
    ├── IconText (Icon="Settings", Text="更新偏好")
    │
    └── FASettingsExpander "更新偏好" (IsExpanded=True)
        ├── IconSource: 设置齿轮图标
        ├── FASettingsExpanderItem "更新频道"
        │   └── Footer: ComboBox (stable/preview)
        ├── FASettingsExpanderItem "下载源"
        │   └── Footer: ComboBox (plonds/github/proxy)
        ├── FASettingsExpanderItem "更新模式"
        │   └── Footer: ComboBox (manual/confirm/silent)
        └── FASettingsExpanderItem "下载线程数"
            └── Footer: Slider + TextBlock

Proposed Changes

Task 1: 重写 UpdateSettingsPage.axaml 布局

Files:

  • Modify: LanMountainDesktop/Views/SettingsPages/UpdateSettingsPage.axaml

What: 完全重写 AXAML将 4 个 Border.settings-section-card 替换为 FASettingsExpander 列表布局。

Key changes:

  1. 移除所有 Border.settings-section-card 包裹
  2. 使用 controls:IconText 做分节标题(与 GeneralSettingsPage 一致)
  3. 状态区域:FASettingsExpander + IsClickEnabled=True + Command=CheckCommandFooter 放检查按钮
  4. 进度区域:FASettingsExpander 内嵌 ProgressBar + 操作按钮,仅 IsBusy||IsProgressVisible||IsPaused 时可见
  5. 版本信息:每个字段一个 FASettingsExpanderFooter 直接显示值(参考 Windows 11 更新页面的行项目模式)
  6. 偏好设置:保留 FASettingsExpander + FASettingsExpanderItem 模式,但将 TextBox 改为 ComboBox更符合 Fluent 规范)
  7. 使用 Separator classes="settings-separator" 分隔三大区域

Why: 与项目其他设置页面统一风格,遵循 Fluent Design消除卡片堆叠的视觉噪音。

How:

  • 参照 GeneralSettingsPage.axaml 的布局模式
  • 参照 AppearanceSettingsPage.axaml 的 FASettingsExpander 使用方式
  • 参照 AboutSettingsPage.axaml 的 FAInfoBar 使用方式

Task 2: 更新 ViewModel — 添加 ComboBox 数据源和按钮可见性属性

Files:

  • Modify: LanMountainDesktop/ViewModels/UpdateSettingsViewModel.cs

What:

  1. 将更新频道、下载源、更新模式从 TextBox 绑定改为 ComboBox 绑定,添加 ObservableCollection<SelectionOption> 类型的数据源属性
  2. 添加 IsProgressSectionVisible 计算属性(IsBusy || IsProgressVisible || IsPaused
  3. 添加 IsUpdateAvailableSectionVisible 计算属性(IsUpdateAvailable
  4. 添加 IsStatusInfoVisible 计算属性(有 StatusMessage 且非空闲时)
  5. 移除不再需要的独立按钮文本属性CheckButtonText 保留,其他按钮文本属性保留但仅在可见时使用)

Why: ComboBox 比 TextBox 更适合有限选项的输入,且与 GeneralSettingsPage 的模式一致。按钮可见性属性让 AXAML 可以用 IsVisible 绑定控制按钮显示。

How:

  • 参考 GeneralSettingsPageViewModel 中 SelectionOption 的使用方式
  • OnCurrentPhaseChanged 中触发新属性的 OnPropertyChanged

Task 3: 将偏好设置 TextBox 替换为 ComboBox

Files:

  • Modify: LanMountainDesktop/Views/SettingsPages/UpdateSettingsPage.axaml (在 Task 1 中一并完成)
  • Modify: LanMountainDesktop/ViewModels/UpdateSettingsViewModel.cs (在 Task 2 中一并完成)

What: 将更新频道、下载源、更新模式三个 TextBox 替换为 ComboBox,使用 SelectionOption 数据模板。

Why: 有限选项应使用 ComboBox 而非自由文本输入,这是 Fluent Design 的基本规范,也与 GeneralSettingsPage 中的语言/时区选择一致。

Task 4: 构建验证

Files:

  • 无新文件

What: 运行 dotnet build 确保编译通过,检查 AXAML 绑定是否正确。


Assumptions & Decisions

  1. 不修改 UpdateOrchestrator 和 UpdateState — 只改 UI 层和 ViewModel 的展示逻辑,不改底层更新引擎
  2. 不修改 SettingsCardStyles.axaml — 通用样式保持不变,移除的是 UpdateSettingsPage 对它的使用
  3. 保留所有 ViewModel 属性 — 即使某些属性在新布局中不再直接使用(如独立的 ActionsTitle也保留以避免破坏本地化系统
  4. ComboBox 选项硬编码在 ViewModel — 参考 GeneralSettingsPageViewModel 的 SelectionOption 模式
  5. 进度区域在空闲时隐藏 — 不显示空的进度条,只在有活动时展示
  6. FAInfoBar 仅用于暂停/错误提示 — 不再嵌套在卡片内,直接放在 FASettingsExpanderItem 内

Verification Steps

  1. dotnet build LanMountainDesktop.slnx -c Debug 编译通过
  2. 运行应用,导航到设置 > 更新页面,验证:
    • 页面布局与 GeneralSettingsPage 风格一致
    • 无圆角矩形卡片包裹
    • 检查更新按钮可用
    • 进度区域在空闲时隐藏
    • 版本信息以行项目形式展示
    • 偏好设置使用 ComboBox
    • 操作按钮仅显示当前可用的
  3. 点击「检查更新」,验证状态变化和进度展示
  4. 验证偏好设置的 ComboBox 选择能正确保存和加载