Skip to content

[202_112] 增加版本更新的提示#3043

Merged
GatsbyUSTC merged 9 commits intomainfrom
hongwei/202_112/add_log_info
Apr 1, 2026
Merged

[202_112] 增加版本更新的提示#3043
GatsbyUSTC merged 9 commits intomainfrom
hongwei/202_112/add_log_info

Conversation

@GatsbyUSTC
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Contributor

@MoonL79 MoonL79 left a comment

Choose a reason for hiding this comment

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

PR #3043 Review - [202_112]增加版本更新的提示

功能完整,实现清晰,文档详细。代码质量整体良好。

已在对应行留了具体意见,主要关注点:

  1. version-update.scm 第90行有 debug 用的 (display ...) 未移除
  2. hasMock 布尔判断逻辑有问题(永远为 true)
  3. C++ 内存管理建议更明确
  4. zh_CN.scm 文件末尾缺换行符

Scheme 代码风格规范,右括号标记清晰。

@da-liii da-liii changed the title [202_112]增加版本更新的提示 [202_112] 增加版本更新的提示 Mar 30, 2026
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Apr 1, 2026

Greptile Summary

本 PR 实现了版本更新提示功能:应用启动 10 秒后自动检查远端版本,若有新版本则在窗口顶部显示提示条,支持"立即更新"(跳转官网)、"稍后提醒"(3天后再提示)和"关闭"三种操作。

主要变更:

  • 新增 UpdateNotificationBar 控件(横向布局,与 GuestNotificationBar 垂直堆叠显示)
  • 新增 version-update.scm Scheme 模块,封装 mock 控制、稍后提醒和下载 URL 获取逻辑
  • qt_tm_widget_rep 新增 checkVersionUpdate / parseVersionFromTM / isVersionNewer 三个方法,实现完整的版本检查流程
  • 社区版与商业版使用不同的版本号接口及下载落地页
  • 亮色与暗色主题均已补充对应样式

遗留的小问题(均为 P2,不影响功能):

  • version-update.scmLAST-CHECK-KEY 常量被定义但从未使用,且三个常量的定义顺序晚于使用它们的函数,建议调整
  • qt_tm_widget_repm_remoteVersion 字段被赋值但从未被读取,属于多余成员
  • 网络回调中的日志逻辑可合并为更清晰的 if/else 链

Confidence Score: 5/5

本 PR 可以安全合并,之前反馈的所有 P0/P1 问题均已修复

之前审查中发现的所有严重问题(mock 值未还原、头文件声明无实现、链接错误)均已得到修复;剩余问题为 P2 级别的代码整洁性建议,不影响功能正确性和可构建性

TeXmacs/progs/utils/misc/version-update.scm(死代码常量)和 src/Plugins/Qt/qt_tm_widget.cpp(m_remoteVersion 冗余字段)值得关注,但不阻碍合并

Important Files Changed

Filename Overview
TeXmacs/progs/utils/misc/version-update.scm 新增 Scheme 模块,提供版本更新检查的核心逻辑;MOCK-REMOTE-VERSION 已还原为 #f,但 LAST-CHECK-KEY 仍为未使用的死代码,常量定义顺序也晚于使用它们的函数
src/Plugins/Qt/qt_tm_widget.cpp 新增版本检查流程及通知容器布局;存在 m_remoteVersion 只写不读的冗余字段,以及网络回调中日志逻辑结构略显重复
src/Plugins/QWindowKit/updatenotificationbar.cpp 新增版本更新提示条控件实现,UI 布局清晰,三个信号正确连接,无明显问题
src/Plugins/QWindowKit/updatenotificationbar.hpp 新增 UpdateNotificationBar 头文件,声明清晰,与 .cpp 实现一致,无遗漏函数声明
src/Plugins/Qt/qt_tm_widget.hpp 新增 updateNotificationBar 成员指针、m_remoteVersion 字段及三个私有方法声明,与 .cpp 实现对应
TeXmacs/misc/themes/liii.css 为亮色主题新增版本更新提示条的完整样式规则,颜色与主题协调一致
TeXmacs/misc/themes/liii-night.css 为暗色主题新增版本更新提示条的完整样式规则,深色背景配色合理
TeXmacs/plugins/lang/dic/en_US/zh_CN.scm 新增四条中文翻译条目,并修正文件末尾缺少换行的问题

Sequence Diagram

sequenceDiagram
    participant App as 应用启动
    participant Timer as QTimer (10s)
    participant Widget as qt_tm_widget_rep
    participant Scheme as version-update.scm
    participant Net as QNetworkAccessManager
    participant Bar as UpdateNotificationBar

    App->>Timer: singleShot(10000)
    Timer->>Widget: checkVersionUpdate()
    Widget->>Scheme: should-check-version-update?
    Scheme-->>Widget: true / false
    alt 处于稍后提醒期间
        Widget-->>App: 返回,不显示
    else 可以检查
        Widget->>Scheme: get-mock-remote-version
        Scheme-->>Widget: #f 或 mock版本字符串
        alt 有 mock 版本
            Widget->>Widget: isVersionNewer(mock, local)
            Widget->>Bar: setVersionInfo() + show()
        else 无 mock,发起网络请求
            Widget->>Net: GET /mogan_latest_version.tm 或 /latest_version.tm
            Net-->>Widget: 响应数据
            Widget->>Widget: parseVersionFromTM(data)
            Widget->>Widget: isVersionNewer(remote, local)
            Widget->>Bar: setVersionInfo() + show()
        end
    end
    Bar-->>Widget: updateNowRequested
    Widget->>Scheme: get-update-download-url
    Scheme-->>Widget: mogan.app 或 liiistem.cn URL
    Widget->>App: open_url(url)
    Bar-->>Widget: snoozeRequested
    Widget->>Scheme: snooze-version-update
    Widget->>Bar: hide()
    Bar-->>Widget: closeRequested
    Widget->>Bar: hide()
Loading

Reviews (8): Last reviewed commit: "翻译按照字母排序" | Re-trigger Greptile

Copy link
Copy Markdown
Contributor

@Yuki-Nagori Yuki-Nagori left a comment

Choose a reason for hiding this comment

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

LGTM

@GatsbyUSTC GatsbyUSTC merged commit 11f0f01 into main Apr 1, 2026
5 checks passed
@GatsbyUSTC GatsbyUSTC deleted the hongwei/202_112/add_log_info branch April 1, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants