-
Notifications
You must be signed in to change notification settings - Fork 481
Add automatic download and installation for PAGViewer #2940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements automatic download and installation functionality for PAGViewer. When users click to preview PAG files, the system now detects whether PAGViewer is installed and automatically downloads and installs it if not found.
- Adds cross-platform PAGViewer detection and installation system
- Implements a Qt-based installation dialog with progress tracking
- Integrates installation workflow into the PAG file preview process
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.
Show a summary per file
File | Description |
---|---|
exporter/src/ui/PAGViewerInstallModel.h/.cpp | New Qt model for installation dialog UI and workflow management |
exporter/src/platform/win/PlatformHelper.cpp | Enhanced with download path utilities and preview integration |
exporter/src/platform/win/PAGViewerInstallerWin.cpp | Windows-specific PAGViewer installation logic |
exporter/src/platform/win/PAGViewerCheck.cpp | Windows registry-based PAGViewer detection |
exporter/src/platform/mac/PlatformHelper.mm | macOS implementation with NSWorkspace integration |
exporter/src/platform/mac/PAGViewerInstallerMac.mm | macOS-specific installation handling |
exporter/src/platform/mac/PAGViewerCheck.mm | macOS bundle-based application detection |
exporter/src/platform/PlatformHelper.h | Added new platform abstraction functions |
exporter/src/platform/PAGViewerInstaller.h/.cpp | Cross-platform installer with Qt networking |
exporter/src/platform/PAGViewerCheck.h | Common interfaces for application detection |
exporter/assets/qml/PAGViewerInstall.qml | Installation dialog UI implementation |
exporter/CMakeLists.txt | Added Qt6::Network dependency |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2940 +/- ##
==========================================
- Coverage 77.28% 77.27% -0.01%
==========================================
Files 419 419
Lines 22322 22322
Branches 6425 6425
==========================================
- Hits 17251 17250 -1
- Misses 3795 3796 +1
Partials 1276 1276 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
InstallResult result; | ||
std::string errorMessage; | ||
|
||
InstallStatus() = default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
默认构造方法可以不写
return executeInstaller(filePath); | ||
#else | ||
return extractAndInstall(filePath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感觉这两个函数也可以合并成一个,在不同的平台上有不同的实现,win上安装exe,mac上解压zip
QDir(tempDir).removeRecursively(); | ||
} | ||
|
||
void PAGViewerInstaller::onDownloadProgress(qint64 bytesReceived, qint64 bytesTotal) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看QT的api 文档,bytesTotal是有可能为0和-1的,这里对异常情况处理下
https://doc.qt.io/qt-6/qnetworkreply.html#downloadProgress
NSString* downloadsPath = [NSString stringWithUTF8String:downloadsPathStr.c_str()]; | ||
NSString* fullPath = [downloadsPath stringByAppendingPathComponent:@"PAGViewer.dmg"]; | ||
return [fullPath UTF8String]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里没必要转NSString,直接使用std::string就可以了
} | ||
|
||
void AppConfig::addConfig(const std::string& key, const std::string& value) { | ||
this->platformConfig[key] = value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key会空吗?如果key存在,预期的行为是覆盖吗
return info; | ||
} | ||
|
||
std::vector<PackageInfo> PAGViewerCheck::findSoftwareByName(const std::string& namePattern) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
函数名和返回值类型匹配起来,例如:findPackageInfoByName
} | ||
|
||
static void executePreviewLogic(const std::string& pagFilePath) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
去掉函数名中的Logic
|
||
static std::string wstringToString(const std::wstring& wstr) { | ||
if (wstr.empty()) { | ||
return std::string(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return "";
return results.empty() ? PackageInfo() : results[0]; | ||
} | ||
|
||
std::vector<PackageInfo> PAGViewerCheck::findSoftwareByName(const std::string& namePattern) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
findPackageInfoByName
return ""; | ||
} | ||
|
||
static void ExecutePreview(const std::string& pagFilePath) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好像叫StartPreview更合适点
点击预览PAG文件时,检测是否安装PAGViewer,如果未安装则自动下载与安装