Skip to content

feat(update):implement software update automatically#149

Open
finch04 wants to merge 1 commit into
OpenConverterLab:masterfrom
finch04:main
Open

feat(update):implement software update automatically#149
finch04 wants to merge 1 commit into
OpenConverterLab:masterfrom
finch04:main

Conversation

@finch04
Copy link
Copy Markdown
Collaborator

@finch04 finch04 commented May 30, 2026

feat(update):implement software update automatically. test it.

@sonarqubecloud
Copy link
Copy Markdown

@finch04
Copy link
Copy Markdown
Collaborator Author

finch04 commented May 30, 2026

OK,but the main branch name of your respository has been changed in recent times?It is master ,but my branch name is main @JackLau1222 @Jimmy385898

@JackLau1222
Copy link
Copy Markdown
Collaborator

Review: feat(update): implement software update automatically

Nice feature! Clean separation of concerns and good use of signals/slots. A few items to address before merge:

Issues Found

1. Silent mode still shows status bar message on every startup

In updater.cpp:75-76, when m_silent=true and no update is found, NoUpdateAvailable is emitted unconditionally, which triggers OnNoUpdateAvailable() showing "You are running the latest version" on the status bar for 3 seconds. The PR description says silent mode should "only pop up when there's an update." Every-startup status bar noise is mildly annoying. Consider either skipping the NoUpdateAvailable signal emission when m_silent is true, or making it intentional and brief.

2. License mismatch — new files use Apache 2.0, but the project is GPL-2.0

updater.h/updater.cpp carry an Apache 2.0 header. Apache 2.0 is compatible with GPLv3 but not GPLv2 (which is the project's declared license). This may create a licensing conflict. Align with the existing files in the same directory, or clarify the project's licensing policy.

3. Chinese comments reduce accessibility for non-Chinese-speaking contributors

Lines in updater.cpp:

  • // 根据平台匹配文件名关键字
  • // 优先匹配平台关键字,其次匹配通用安装包
  • // 回退
  • // 最后回退到 release 页面

The rest of the codebase uses English comments. Recommend translating these to English for consistency with the project's existing style.

4. releaseNotes.left(200) truncation is crude (open_converter.cpp:704)

200-char hard truncation can cut mid-character (for multi-byte UTF-8) or mid-word. Consider truncating at a newline boundary, or using a scrollable QTextEdit in the dialog for longer release notes.

5. Minor: include style inconsistency

updater.cpp:18 uses #include "updater.h" (bare filename, relying on CMake include path). The majority of common/src/*.cpp files use ../include/header.h relative style. Both work, but consistency is preferred.

6. Race condition on m_silent

If CheckForUpdates(false) is called manually while a silent startup check is still in-flight, m_silent gets overwritten, and the wrong signal gating applies to whichever request completes first. Unlikely in practice (network requests are fast), but could be hardened by tracking the mode per-request rather than as member state.

What's Good

  • Clean separation: Updater class in common/ is UI-agnostic, signals wired in open_converter.cpp
  • Platform-aware asset matching with a sensible fallback chain (ExtractPlatformDownloadUrl)
  • QVersionNumber for proper semantic version comparison
  • Settings persistence via the existing QSettings INI file pattern
  • Delayed startup check (QTimer::singleShot(2000, ...)) avoids blocking app launch

Verdict

Approvable with minor changes. None of these are blockers. The license header alignment is the most important to get right before merge.

@JackLau1222
Copy link
Copy Markdown
Collaborator

CI Build Failure: QNetworkAccessManager not found

The build error is because updater.cpp/updater.h were added to COMMON_SOURCES/COMMON_HEADERS, which compile into OpenConverterCore — a Qt-independent static library with no Qt include paths or linkage. But Updater uses QObject, QNetworkAccessManager, QNetworkReply, and QVersionNumber, which all require Qt.

Fix: In src/CMakeLists.txt, move the two entries:

  1. Remove from COMMON_SOURCES:

    ${CMAKE_SOURCE_DIR}/common/src/updater.cpp
  2. Remove from COMMON_HEADERS:

    ${CMAKE_SOURCE_DIR}/common/include/updater.h
  3. Add to GUI_SOURCES (inside the if(ENABLE_GUI) block, around line 275):

    ${CMAKE_SOURCE_DIR}/common/src/updater.cpp
  4. Add to GUI_HEADERS (inside the if(ENABLE_GUI) block, around line 308):

    ${CMAKE_SOURCE_DIR}/common/include/updater.h

This gives updater.cpp access to Qt${QT_VERSION_MAJOR}::Network and Qt include paths that are only linked to the GUI executable target.

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