feat: 引入悬浮窗配置方案系统与自动化行动#4
Merged
Merged
Conversation
悬浮窗重构
Co-authored-by: traeagent <traeagent@users.noreply.github.com>
- Actions/ShowFloatingWindowAction.cs: 保留 HEAD 的空悬浮窗组件检查与 main 的 IsRevertable 状态快照 - Services/FloatingWindowService.cs: 保留 HEAD 基于 FloatingWindowProfile 的行规则集方案 Co-Authored-By: TRAE Agent <agent@trae.local>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Changes
1. 悬浮窗配置方案系统
FloatingWindowProfile: 引入独立的悬浮窗配置方案类,将布局和外观参数从主配置中分离,支持多套配置。FloatingWindowProfileManager: 实现方案的创建、读取、更新、删除 (CRUD) 功能,支持旧版配置迁移和文件存储管理。MainConfigData新增CurrentFloatingWindowProfile等属性,关联当前激活的悬浮窗方案。FloatingWindowEditorSettingsPageUI 大幅重构,支持方案选择、添加、删除,并提供组件库和规则集编辑功能。FloatingWindowService调整,其窗口属性现在从当前激活的配置方案中获取。2. 悬浮窗自动化行动
SwitchFloatingWindowThemeAction: 支持切换悬浮窗主题(跟随系统/浅色/深色或指定主题)。ToggleFloatingWindowLayerAction: 支持切换悬浮窗层级(置顶/置底或指定层级)。ToggleFloatingWindowProfileAction: 支持切换悬浮窗配置方案(下一个/指定方案)。3. 悬浮窗可见性规则集
ButtonRulesetConfig和RowRulesetConfig,支持基于规则集控制悬浮窗按钮和行的可见性。FloatingWindowService实现了规则集驱动的窗口、按钮、行可见性控制系统。FloatingWindowEditorSettingsPage增加了规则集 Drawer 系统,支持三级规则集编辑。4. 健壮性与空值安全改进
SetVolume.cs,ShowFloatingWindowAction.cs,ClipboardContentComponent.axaml.cs,Plugin.cs,AboutSettingsPage.axaml.cs等多处添加了空值检查,防止运行时崩溃。LyricsDisplayComponent.axaml.cs修复了位图未释放导致的内存泄漏。NetworkStatusComponent.axaml.cs为 HTTP 请求添加 try-catch 保护,确保秒表正确停止。FloatingWindowService.cs确保颜色解析失败时回退到默认值;DriveUtils.cs在pluginDir为空时回退到AppContext.BaseDirectory。5. 其他改进
BetterCarouselContainerComponent,LocalQuoteComponent,NextClassDisplayComponent等组件的依赖服务字段改为可空类型,并添加无参构造函数以支持设计时实例化。ScrollingTextComponent.axaml.cs将静默异常捕获改为输出调试信息。Plugin.cs注册FloatingWindowProfileManager到 DI 容器。💡 Technical Highlights
FloatingWindowProfile实现悬浮窗布局和外观配置的解耦,增强了系统的灵活性和可扩展性。