合并对设置系统的更新 (#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.天气选项卡更新
This commit is contained in:
lincube
2026-05-19 07:55:21 +08:00
committed by GitHub
parent 458494d131
commit 7a70476ce8
904 changed files with 78052 additions and 18366 deletions

View File

@@ -0,0 +1,17 @@
namespace DotNetCampus.Inking.Settings;
/// <summary>
/// 对清空笔迹的配置
/// </summary>
record CleanStrokeSettings
{
/// <summary>
/// 清空笔迹之后,需要绘制背景图。对于一些背景是没有任何内容的应用,则不需要绘制,提升性能。因为清空笔迹之后,会将当前的静态笔迹都绘制一次,除非背景有图片或其他内容,否则不需要绘制背景
/// </summary>
public bool ShouldDrawBackground { get; init; } = false;
/// <summary>
/// 清空笔迹之后,是否需要更新背景图。解决当前有两个笔迹,只删除其中一个笔迹,如果此时背景没有更新,则可能导致两个笔迹都被删除,或被删除的笔迹依然在背景里
/// </summary>
public bool ShouldUpdateBackground { get; init; } = true;
}

View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DotNetCampus.Inking.Settings;
/// <summary>
/// 丢点配置
/// </summary>
record DropPointSettings
{
/// <summary>
/// 最大丢点数量
/// </summary>
public int MaxDropPointCount { get; init; } = 10;
public int MaxDistanceLength { get; init; } = 2;
/// <summary>
/// 丢点策略
/// </summary>
public DropPointStrategy DropPointStrategy { get; init; } = DropPointStrategy.Normal;
}
/// <summary>
/// 丢点策略
/// </summary>
public enum DropPointStrategy
{
/// <summary>
/// 普通的丢点,不会丢太多
/// </summary>
Normal,
/// <summary>
/// 激进策略,会丢很多点
/// </summary>
Aggressive,
}

View File

@@ -0,0 +1,28 @@
using DotNetCampus.Inking.Utils;
namespace DotNetCampus.Inking.Settings;
/// <summary>
/// 笔尖渲染模式
/// </summary>
enum InkCanvasDynamicRenderTipStrokeType
{
/// <summary>
/// 通过裁剪画布的方式进行绘制所有的笔迹
/// </summary>
/// 这是当前最快的笔迹,写的快炸的快
/// 这里面用了绕过 Skia 的裁剪,使用 <see cref="SkiaExtension.ReplacePixels(SkiaSharp.SKBitmap,SkiaSharp.SKBitmap)"/> 替换为背景
RenderAllTouchingStrokeWithClip,
/// <summary>
/// 所有触摸按下的笔迹都每次重新绘制,不区分笔尖和笔身
/// 此方式可以实现比较好的平滑效果
/// </summary>
/// 此方式性能比较差,但是最符合预期的
RenderAllTouchingStrokeWithoutTipStroke,
/// <summary>
/// 只渲染笔尖部分
/// </summary>
RenderTipStrokeOnly,
}

View File

@@ -0,0 +1,31 @@
namespace DotNetCampus.Inking.Settings;
/// <summary>
/// 橡皮擦算法模式
/// </summary>
enum InkCanvasEraserAlgorithmMode
{
/// <summary>
/// 是否允许使用裁剪方式的橡皮擦,而不是走静态笔迹层。使用裁剪而不是使用笔迹计算,将笔迹的点给去掉
/// </summary>
EnableClippingEraser,
/// <summary>
/// 是否允许使用裁剪方式的橡皮擦,橡皮擦每次裁剪都写入画布,需要有多余的画布拷贝逻辑,但是不需要做 Path 处理。原理同 <see cref="EnableClippingEraser"/> 但是具体的裁剪逻辑不相同。用来减少擦除时间长时的越擦越卡的问题
/// 此模式不支持漫游画布和切页。因为漫游画布和切页需要 Path 处理,而此模式没有进行 Path 处理,只是进行位图处理
/// </summary>
/// 非路径 Path 的点擦情况下,当前最优的橡皮擦算法
EnableClippingEraserWithoutEraserPathCombine,
/// <summary>
/// 是否允许使用裁剪方式的橡皮擦,带不安全模式的二进制,橡皮擦每次裁剪都写入画布,需要有多余的画布拷贝逻辑,但是不需要做 Path 处理。原理同 <see cref="EnableClippingEraserWithoutEraserPathCombine"/> 但是具体的裁剪逻辑不相同。用来减少擦除时间长时的越擦越卡的问题。带不安全的二进制处理可以提升画图片的性能
/// </summary>
/// 尚未全部完成
EnableClippingEraserWithBinaryWithoutEraserPathCombine,
/// <summary>
/// 进行点和 Path 的命中测试的橡皮擦,真实擦掉笔迹点和 Path 的橡皮擦。移动过程走 <see cref="EnableClippingEraserWithoutEraserPathCombine"/> 算法,抬手使用点命中擦掉笔迹点的算法
/// </summary>
/// 路径 Path 的点擦情况下,当前最优的橡皮擦算法
EnablePointPathEraser,
}

View File

@@ -0,0 +1,118 @@
using DotNetCampus.Inking.Primitive;
using SkiaSharp;
using Size = DotNetCampus.Numerics.Geometry.Size2D;
namespace DotNetCampus.Inking.Settings;
/// <summary>
/// 画板的配置
/// </summary>
/// <param name="AutoSoftPen">是否开启自动软笔模式</param>
record SkInkCanvasSettings(bool AutoSoftPen = true)
{
public InkCanvasEraserAlgorithmMode EraserMode { init; get; } =
InkCanvasEraserAlgorithmMode.EnableClippingEraserWithoutEraserPathCombine;
/// <summary>
/// 修改笔尖渲染部分配置 动态笔迹层
/// </summary>
public InkCanvasDynamicRenderTipStrokeType DynamicRenderType { init; get; } =
InkCanvasDynamicRenderTipStrokeType.RenderAllTouchingStrokeWithoutTipStroke;
/// <summary>
/// 是否应该在橡皮擦丢点进行收集,进行一次性处理。现在橡皮擦速度慢在画图 DrawBitmap 里,而对于几何组装来说,似乎不耗时。此属性可能会降低性能
/// </summary>
/// 在触摸屏测试,使用兆芯机器,开启之后性能大幅降低
public bool ShouldCollectDropErasePoint { init; get; } = true;
/// <summary>
/// 笔迹颜色
/// </summary>
public SKColor Color { get; init; } = SKColors.Red;
/// <summary>
/// 笔迹粗细
/// </summary>
public double InkThickness { get; init; } = 20;
/// <summary>
/// 橡皮擦尺寸,可以在业务层,在手势橡皮擦过程中更改
/// </summary>
public Size EraserSize { get; init; } = DefaultEraserSize;
/// <summary>
/// 将触摸尺寸当成橡皮擦尺寸,即橡皮擦大小不完全跟随 <see cref="EraserSize"/> 尺寸,而是会根据 <see cref="InkStylusPoint"/> 的触摸大小决定
/// </summary>
public bool EnableStylusSizeAsEraserSize { get; init; } = true;
/// <summary>
/// 橡皮擦是否可以一直按照触摸尺寸修改橡皮擦尺寸。属于演示效果较好,实际使用效果差。仅当 <see cref="EnableStylusSizeAsEraserSize"/> 为 true 时此属性才有效。为 false 时,将在超过 <see cref="EraserCanResizeDuringTimeSpan"/> 时间,设置为最后的触摸面积固定大小,即只允许在开始擦的时候根据触摸面积修改大小,之后将固定大小
/// </summary>
public bool CanEraserAlwaysFollowsTouchSize { init; get; } = false;
/// <summary>
/// 橡皮擦可以根据触摸面积尺寸修改橡皮擦大小的时间。如果 <see cref="CanEraserAlwaysFollowsTouchSize"/> 为 true 则此属性无效。仅当 <see cref="EnableStylusSizeAsEraserSize"/> 为 true 时此属性才有效
/// </summary>
public TimeSpan EraserCanResizeDuringTimeSpan { init; get; } = TimeSpan.FromMilliseconds(600);
/// <summary>
/// 默认的橡皮擦尺寸
/// </summary>
/// 在 Paint DefaultEraserSize 是 48x72 大小
public static Size DefaultEraserSize => new Size(30, 45);
/// <summary>
/// 是否锁定最小橡皮擦尺寸,即要求橡皮擦尺寸最小为 <see cref="MinEraserSize"/> 大小
/// </summary>
public bool LockMinEraserSize { init; get; } = true;
/// <summary>
/// 最小橡皮擦尺寸。仅当 <see cref="LockMinEraserSize"/> 为 true 时生效
/// </summary>
public Size MinEraserSize { init; get; } = new Size(48, 72);
/// <summary>
/// 橡皮擦丢点时间,在这个时间内的连续输入将会被丢掉
/// </summary>
public TimeSpan EraserDropPointTimeSpan { get; init; } = TimeSpan.FromMilliseconds(20);
/// <summary>
/// 最小的橡皮擦手势尺寸,用于判断是否进入手势模式
/// </summary>
/// 和 <see cref="MinEraserGesturePhysicalSizeCm"/> 不同的是,此属性是像素单位
public Size MinEraserGesturePixelSize { get; init; } = new Size(30, 45);
/// <summary>
/// 最小的橡皮擦手势尺寸,物理尺寸,单位厘米
/// </summary>
/// 据说大家的手都是 6 厘米,也不知道是谁说的
public double MinEraserGesturePhysicalSizeCm { get; init; } = 6;
/// <summary>
/// 在开始输入多久之后,就不能再进入橡皮擦了
/// </summary>
/// 这是一个弱约定,上层业务方可取此属性判断,也可以强行进入手势橡皮擦模式
public TimeSpan DisableEnterEraserGestureAfterInputDuring { get; init; } = TimeSpan.FromSeconds(1);
/// <summary>
/// 是否启用手势橡皮擦 默认不启用,由上层业务自己调用进入手势橡皮擦模式。因为在这一层不好进行计算
/// 此属性设置为 false 之后,需要上层业务自行决定什么时机进入手势橡皮擦模式,通过调用 EnterEraserMode 方法进入手势橡皮擦模式
/// 此属性设置为 true 将会在框架层,通过输入的 <see cref="InkStylusPoint"/> 的触摸尺寸,通过像素判断方法,判断是否大于 <see cref="MinEraserGesturePixelSize"/> 尺寸决定是否进入橡皮擦模式。由于通过像素方式判断不靠谱,因此推荐不要开启此属性。业务层自己决定更好
/// </summary>
public bool EnableEraserGesture { get; init; } = false;
/// <summary>
/// 是否忽略压感。
/// </summary>
public bool IgnorePressure { get; init; } = true;
/// <summary>
/// 是否在按下时需要调用 DrawStroke 方法,用于解决丢失按下的点
/// </summary>
public bool ShouldDrawStrokeOnDown { get; init; } = false;
/// <summary>
/// 清空笔迹的配置
/// </summary>
public CleanStrokeSettings CleanStrokeSettings { get; init; } = new CleanStrokeSettings();
}