You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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:
Remove from COMMON_SOURCES:
${CMAKE_SOURCE_DIR}/common/src/updater.cpp
Remove from COMMON_HEADERS:
${CMAKE_SOURCE_DIR}/common/include/updater.h
Add to GUI_SOURCES (inside the if(ENABLE_GUI) block, around line 275):
${CMAKE_SOURCE_DIR}/common/src/updater.cpp
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.
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
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.
feat(update):implement software update automatically. test it.