Skip to content

feat(crash-report): 支持收起错误报告并在独立窗口中查看 - #3614

Open
whitecat346 wants to merge 2 commits into
PCL-Community:devfrom
whitecat346:impl/report-window
Open

whitecat346 wants to merge 2 commits into
PCL-Community:devfrom
whitecat346:impl/report-window

Conversation

@whitecat346

@whitecat346 whitecat346 commented Sep 14, 2026

Copy link
Copy Markdown
Member
image image image

Closes #3612

Sourcery 摘要

为错误报告增加可配置的收起入口和独立窗口查看体验。

新功能:

  • 支持将错误报告收起到主界面入口,并通过独立窗口重新查看、复制、打开日志、修改实例设置或导出报告。

改进:

  • 为消息弹窗增加第四个按钮能力,并统一错误报告弹窗、收起入口与独立窗口的报告操作。
  • 新增错误报告收起开关,并在禁用错误分析时联动禁用该设置。
Original summary in English

Summary by Sourcery

为错误报告增加可配置的收起入口和独立窗口查看体验。

New Features:

  • 支持将错误报告收起到主界面入口,并通过独立窗口重新查看、复制、打开日志、修改实例设置或导出报告。

Enhancements:

  • 为消息弹窗增加第四个按钮能力,并统一错误报告弹窗、收起入口与独立窗口的报告操作。
  • 新增错误报告收起开关,并在禁用错误分析时联动禁用该设置。

@pcl-ce-automation pcl-ce-automation Bot added 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 size: L PR 大小评估:大型 labels Sep 14, 2026
@sourcery-ai

sourcery-ai Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

审查者指南

该 PR 通过扩展通用消息框的第四按钮能力,并重构崩溃报告展示为基于快照和会话的流程,实现报告弹窗可收起、在独立窗口中恢复查看,同时增加配置开关、设置页联动和多语言支持。

崩溃报告停靠与重新打开的时序图

sequenceDiagram
    participant CrashAnalysis as CrashAnalysis
    participant Presenter as CrashDialogPresenter
    participant Dialog as MsgBoxWrapper
    participant Session as CrashReportSession
    participant Window as CrashReportWindow

    CrashAnalysis->>Presenter: Output(isHandAnalyze, extraFiles)
    Presenter->>Session: CloseWindow()
    Presenter->>Dialog: ShowWithCustomButtons(report, Button1..Button4)
    Dialog-->>Presenter: selectedButton
    alt selectedButton is 1
        Presenter->>Session: Collapse(report)
    else selectedButton is 4
        Presenter->>Session: Collapse(report)
        Presenter->>Session: OpenWindow()
        Session->>Window: Show report snapshot
    end
Loading

文件级变更

变更 详细信息 文件
扩展消息框以支持第四个按钮,为错误报告提供“收起”和“在独立窗口中打开”操作。
  • 在文本和 Markdown 消息框中初始化、显示并处理第四个按钮。
  • 将第四按钮参数和回调贯穿通用消息框 API 与按钮分发逻辑。
Plain Craft Launcher 2/Controls/MyMsg/MyMsgMarkdown.xaml
Plain Craft Launcher 2/Controls/MyMsg/MyMsgMarkdown.xaml.cs
Plain Craft Launcher 2/Controls/MyMsg/MyMsgText.xaml
Plain Craft Launcher 2/Controls/MyMsg/MyMsgText.xaml.cs
Plain Craft Launcher 2/Modules/ModMain.cs
重构崩溃报告展示流程,引入报告快照和会话管理以支持收起后恢复。
  • 在弹窗显示前关闭已有独立报告窗口。
  • 根据配置动态显示收起与独立窗口按钮,并在弹窗返回后分发对应动作。
  • 将日志打开、实例设置跳转和报告导出逻辑委托给报告快照。
Plain Craft Launcher 2/Modules/Minecraft/CrashAnalysis/Presentation/CrashDialogPresenter.cs
增加崩溃报告收起功能的配置项和启动设置界面控制。
  • 新增默认启用的本地配置项。
  • 在启动高级设置中加载配置并在禁用崩溃分析时禁用该选项。
PCL.Core/App/Config.cs
Plain Craft Launcher 2/Pages/PageSetup/PageSetupLaunch.xaml
Plain Craft Launcher 2/Pages/PageSetup/PageSetupLaunch.xaml.cs
补充新功能所需的界面文本和布局资源。
  • 为四种语言增加收起、独立窗口入口及相关提示文本。
  • 调整主窗口和消息框布局以容纳新增控件。
PCL.Core/App/Localization/Languages/en-GB.xaml
PCL.Core/App/Localization/Languages/en-US.xaml
PCL.Core/App/Localization/Languages/zh-CN.xaml
PCL.Core/App/Localization/Languages/zh-TW.xaml
Plain Craft Launcher 2/FormMain.xaml
Plain Craft Launcher 2/Controls/MyMsg/MyMsgMarkdown.xaml
Plain Craft Launcher 2/Controls/MyMsg/MyMsgText.xaml
整理崩溃结果格式化代码。
  • 调整方法签名和辅助方法的代码格式,无明显行为变化。
Plain Craft Launcher 2/Modules/Minecraft/CrashAnalysis/Presentation/CrashResultFormatter.cs

提示与命令

与 Sourcery 交互

  • 触发新的审查: 在拉取请求中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 根据审查评论生成 GitHub issue: 回复某条审查评论,请 Sourcery 根据该评论创建 issue。你也可以回复 @sourcery-ai issue,根据该评论创建 issue。
  • 生成拉取请求标题: 在拉取请求标题的任意位置写入 @sourcery-ai,即可随时生成标题。你也可以在拉取请求中评论 @sourcery-ai title,以随时生成或重新生成标题。
  • 生成拉取请求摘要: 在拉取请求正文的任意位置写入 @sourcery-ai summary,即可在指定位置随时生成 PR 摘要。你也可以在拉取请求中评论 @sourcery-ai summary,以随时生成或重新生成摘要。
  • 生成审查者指南: 在拉取请求中评论 @sourcery-ai guide,以随时生成或重新生成审查者指南。
  • 解决所有 Sourcery 评论: 在拉取请求中评论 @sourcery-ai resolve,以解决所有 Sourcery 评论。如果你已经处理完所有评论且不想再看到它们,这项功能会很有用。
  • 忽略所有 Sourcery 审查: 在拉取请求中评论 @sourcery-ai dismiss,以忽略所有现有的 Sourcery 审查。如果你想从头开始一次新的审查,这项功能尤其有用——别忘了评论 @sourcery-ai review 来触发新的审查!

自定义使用体验

访问你的控制面板以:

  • 启用或禁用审查功能,例如 Sourcery 生成的拉取请求摘要、审查者指南等。
  • 更改审查语言。
  • 添加、删除或编辑自定义审查说明。
  • 调整其他审查设置。

获取帮助

Original review guide in English

Reviewer's Guide

该 PR 通过扩展通用消息框的第四按钮能力,并重构崩溃报告展示为基于快照和会话的流程,实现报告弹窗可收起、在独立窗口中恢复查看,同时增加配置开关、设置页联动和多语言支持。

Sequence diagram for docking and reopening a crash report

sequenceDiagram
    participant CrashAnalysis as CrashAnalysis
    participant Presenter as CrashDialogPresenter
    participant Dialog as MsgBoxWrapper
    participant Session as CrashReportSession
    participant Window as CrashReportWindow

    CrashAnalysis->>Presenter: Output(isHandAnalyze, extraFiles)
    Presenter->>Session: CloseWindow()
    Presenter->>Dialog: ShowWithCustomButtons(report, Button1..Button4)
    Dialog-->>Presenter: selectedButton
    alt selectedButton is 1
        Presenter->>Session: Collapse(report)
    else selectedButton is 4
        Presenter->>Session: Collapse(report)
        Presenter->>Session: OpenWindow()
        Session->>Window: Show report snapshot
    end
Loading

File-Level Changes

Change Details Files
扩展消息框以支持第四个按钮,为错误报告提供“收起”和“在独立窗口中打开”操作。
  • 在文本和 Markdown 消息框中初始化、显示并处理第四个按钮。
  • 将第四按钮参数和回调贯穿通用消息框 API 与按钮分发逻辑。
Plain Craft Launcher 2/Controls/MyMsg/MyMsgMarkdown.xaml
Plain Craft Launcher 2/Controls/MyMsg/MyMsgMarkdown.xaml.cs
Plain Craft Launcher 2/Controls/MyMsg/MyMsgText.xaml
Plain Craft Launcher 2/Controls/MyMsg/MyMsgText.xaml.cs
Plain Craft Launcher 2/Modules/ModMain.cs
重构崩溃报告展示流程,引入报告快照和会话管理以支持收起后恢复。
  • 在弹窗显示前关闭已有独立报告窗口。
  • 根据配置动态显示收起与独立窗口按钮,并在弹窗返回后分发对应动作。
  • 将日志打开、实例设置跳转和报告导出逻辑委托给报告快照。
Plain Craft Launcher 2/Modules/Minecraft/CrashAnalysis/Presentation/CrashDialogPresenter.cs
增加崩溃报告收起功能的配置项和启动设置界面控制。
  • 新增默认启用的本地配置项。
  • 在启动高级设置中加载配置并在禁用崩溃分析时禁用该选项。
PCL.Core/App/Config.cs
Plain Craft Launcher 2/Pages/PageSetup/PageSetupLaunch.xaml
Plain Craft Launcher 2/Pages/PageSetup/PageSetupLaunch.xaml.cs
补充新功能所需的界面文本和布局资源。
  • 为四种语言增加收起、独立窗口入口及相关提示文本。
  • 调整主窗口和消息框布局以容纳新增控件。
PCL.Core/App/Localization/Languages/en-GB.xaml
PCL.Core/App/Localization/Languages/en-US.xaml
PCL.Core/App/Localization/Languages/zh-CN.xaml
PCL.Core/App/Localization/Languages/zh-TW.xaml
Plain Craft Launcher 2/FormMain.xaml
Plain Craft Launcher 2/Controls/MyMsg/MyMsgMarkdown.xaml
Plain Craft Launcher 2/Controls/MyMsg/MyMsgText.xaml
整理崩溃结果格式化代码。
  • 调整方法签名和辅助方法的代码格式,无明显行为变化。
Plain Craft Launcher 2/Modules/Minecraft/CrashAnalysis/Presentation/CrashResultFormatter.cs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@whitecat346 whitecat346 self-assigned this Sep 14, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你好——我发现了 1 个问题

面向 AI 代理的提示
请处理本次代码审查中的评论:

## 单独评论

### 评论 1
<location path="Plain Craft Launcher 2/Modules/Minecraft/CrashAnalysis/Presentation/CrashDialogPresenter.cs" line_range="26" />
<code_context>
-        var thirdButtonText = isHandAnalyze
-            ? ""
-            : Lang.Text("Crash.Dialog.Button.ExportReport");
+        var report = new CrashReportSnapshot(context, crashContent, title, isHandAnalyze, extraFiles);

-        var secondButtonAction = _GetSecondButtonAction(
</code_context>
<issue_to_address>
**需要处理的问题(bug_risk):** 该 presenter 实例化了 `CrashReportSnapshot` 并调用了 `CrashReportSession`,但仓库中的任何位置都不存在这两种类型。因此,项目会因无法解析类型名称而编译失败。

**建议修复方案:**`CrashReportSnapshot``CrashReportSession` 的实现添加到项目中,或者将这些引用替换为现有的报告管理类型。
</issue_to_address>

Sourcery 对开源项目免费——如果您喜欢我们的审查结果,欢迎分享 ✨
Original comment in English

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="Plain Craft Launcher 2/Modules/Minecraft/CrashAnalysis/Presentation/CrashDialogPresenter.cs" line_range="26" />
<code_context>
-        var thirdButtonText = isHandAnalyze
-            ? ""
-            : Lang.Text("Crash.Dialog.Button.ExportReport");
+        var report = new CrashReportSnapshot(context, crashContent, title, isHandAnalyze, extraFiles);

-        var secondButtonAction = _GetSecondButtonAction(
</code_context>
<issue_to_address>
**issue (bug_risk):** The presenter instantiates `CrashReportSnapshot` and calls `CrashReportSession`, but neither type is present anywhere in the repository. The project therefore fails to compile with unresolved type-name errors.

**Suggested fix:** Add the `CrashReportSnapshot` and `CrashReportSession` implementations to the project, or replace these references with existing report-management types.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bf5555c3a8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Plain Craft Launcher 2/FormMain.xaml

@Hill23333 Hill23333 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

希望将"Button1"等按钮的名字改为具有实际意义的名字
已废弃

@pcl-ce-automation pcl-ce-automation Bot added size: XL PR 大小评估:超大型 and removed size: L PR 大小评估:大型 labels Sep 14, 2026

@Hill23333 Hill23333 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码通过,翻译部分转接 @Chiloven945 审查

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0640330473

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

private void BtnExport_Click(object sender, ModBase.RouteEventArgs e)
{
// 打包压缩包可能耗时较久,放到后台线程,避免卡住界面
ModBase.RunInThread(() => _report.ExportReport());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Serialize exports from the report window

If the user clicks Export again after dismissing the first save dialog but before packaging finishes, this starts another background export for the same snapshot. Both calls use the same context.TempFolder/Report workspace in CrashReportExporter, where each invocation deletes and recreates that directory, so the exports can delete files out from under each other and fail or produce incomplete archives. Disable the button while an export is active or otherwise serialize exports for a snapshot.

Useful? React with 👍 / 👎.

@Chiloven945 Chiloven945 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i18n 没有问题,and 不是 en-US 和 zh-CN 的语言可以不用翻译。这两个是需要严格审查的,其他交由 Weblate 翻译即可。

@Chiloven945 Chiloven945 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image 强烈反对以多窗口的形式进行呈现并引入新的控件表达方式。image 倾向支持复用媒体控制和任务管理的按钮,点击后重新弹出上一次崩溃信息。原因如下:

  1. PCL 的整体 UI 语言设计风格就不适合多窗口的表现形式,引入新的表现形式风险开销过大。我们并没有对 Crash Report 本身的内容进行增加,因此复用 MyMsgBox 没有大的问题,引入新的反而一会 MyMsgBox 一会窗口……(除此之外插一嘴,之前尝试重构崩溃分析的时候做过单独页面的崩溃报告……)
  2. 完全可以复用已有的任务管理和媒体播放的按钮,现在引入的新控件设计和 Toast 雷同,但两种有不同功能,容易混淆。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: XL PR 大小评估:超大型 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查

Projects

None yet

Development

Successfully merging this pull request may close these issues.

可以在不关闭错误报告的情况下处理模组冲突

3 participants