-
Notifications
You must be signed in to change notification settings - Fork 497
Added plugin installation and uninstallation functionality to the PAGViewer application, added plugin version management and update checking capabilities. #3011
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
…ects installation paths and improve path sorting
…taller # Conflicts: # viewer/CMakeLists.txt
…ng command execution flow
…ng command execution flow
…ng command execution flow
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 adds plugin installation and uninstallation functionality to the PAGViewer application. The implementation includes cross-platform support for Windows and macOS, with platform-specific installers that handle Adobe After Effects plugin management.
Key changes:
- Added complete plugin installer infrastructure with platform-specific implementations
- Integrated installation/uninstallation UI controls in the application menu
- Added plugin version management and update checking capabilities
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| viewer/src/rendering/PAGView.cpp | Added flush call to render thread in else branch |
| viewer/src/platform/win/PluginInstaller.cpp | Windows-specific plugin installer implementation with registry scanning and privileged execution |
| viewer/src/platform/mac/PluginInstaller.mm | macOS-specific plugin installer using Objective-C APIs and AppleScript for privilege escalation |
| viewer/src/platform/PluginInstaller.h | Plugin installer interface defining common functionality across platforms |
| viewer/src/platform/PluginInstaller.cpp | Cross-platform plugin installer base implementation with version management |
| viewer/src/maintenance/PluginInstallerModel.h | Qt model wrapper for exposing plugin installer to QML |
| viewer/src/maintenance/PluginInstallerModel.cpp | Implementation of Qt model wrapper with signal forwarding |
| viewer/src/main.cpp | Registered new QML types and added missing include |
| viewer/assets/qml/Menu.qml | Added install/uninstall plugin menu items |
| viewer/assets/qml/Main.qml | Added plugin installer instance and command handlers |
| viewer/CMakeLists.txt | Disabled PAG_BUILD_TESTS option |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
viewer/src/rendering/PAGView.cpp
Outdated
| } | ||
| setProgress(progress); | ||
| } | ||
| }else { |
Copilot
AI
Sep 26, 2025
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.
Missing space after 'else' keyword. Should be } else { following C++ style conventions.
| }else { | |
| } else { |
|
|
||
| if (!QFile::exists(source)) { | ||
| return false; | ||
| } else { |
Copilot
AI
Sep 26, 2025
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.
Empty else block should be removed as it serves no purpose and reduces code clarity.
| } else { |
|
|
||
| args << "-e" << appleScriptCommand; | ||
|
|
||
| process.start("osascript", args); |
Copilot
AI
Sep 26, 2025
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.
Checking exitCode() immediately after start() without waiting for the process to finish. Should call waitForFinished() before checking the exit code.
| process.start("osascript", args); | |
| process.start("osascript", args); | |
| process.waitForFinished(300000); |
| } | ||
| } | ||
| } | ||
| paths.removeDuplicates(); |
Copilot
AI
Sep 26, 2025
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.
Using removeDuplicates() after already checking for duplicates with !paths.contains() at line 99-101 is inefficient. Either remove the contains check or the removeDuplicates call.
| char qtResourceCmd[4096] = {0}; | ||
| CopyQtResource(qtResourceCmd, sizeof(qtResourceCmd)); |
Copilot
AI
Sep 26, 2025
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.
Magic number 4096 is used multiple times for buffer size. Consider defining a named constant for better maintainability.
| char deleteQtResourceCmd[4096] = {0}; | ||
| DeleteQtResource(deleteQtResourceCmd, sizeof(deleteQtResourceCmd)); |
Copilot
AI
Sep 26, 2025
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.
Magic number 4096 is used multiple times for buffer size. Consider defining a named constant for better maintainability.
|
|
||
|
|
||
| QString fallbackCommand = command; | ||
| fallbackCommand.replace("cp -r ", "cp -r "); |
Copilot
AI
Sep 26, 2025
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.
This replace operation does nothing as it replaces 'cp -r ' with the same string 'cp -r '. This appears to be dead code that should be removed.
| fallbackCommand.replace("cp -r ", "cp -r "); |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3011 +/- ##
==========================================
- Coverage 76.95% 76.91% -0.05%
==========================================
Files 413 413
Lines 21992 21992
Branches 6278 6278
==========================================
- Hits 16924 16915 -9
- Misses 3822 3823 +1
- Partials 1246 1254 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| } | ||
| } | ||
|
|
||
| QString PluginInstaller::getPluginVersionString(const QString& pluginPath) const { |
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 paths; | ||
| } | ||
|
|
||
| QString PluginInstaller::getPluginSourcePath(const QString& pluginName) const { |
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.
加一个getPluginFullName用于获取PluginName+后缀,不然后续维护比较麻烦
| &PluginInstallerModel::uninstallationCompleted); | ||
| } | ||
|
|
||
| PluginInstallerModel::~PluginInstallerModel() = 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.
没有任何实现的析构函数可以不写
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 installer->hasUpdate(); | ||
| } | ||
|
|
||
| InstallResult PluginInstallerModel::installPlugins(bool force) { |
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.
应该只有一个插件要安装卸载吧,用单数,去掉s
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.
done
| void uninstallationCompleted(InstallResult result, const QString& message); | ||
|
|
||
| private: | ||
| std::unique_ptr<PluginInstaller> installer; |
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.
初始化下
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.
done
| PluginInstaller::PluginInstaller(QObject* parent) : QObject(parent) { | ||
| } | ||
|
|
||
| PluginInstaller::~PluginInstaller() = 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.
删掉
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.
done
| return false; | ||
| } | ||
|
|
||
| int64_t sourceVersion = getPluginVersion(sourcePath); |
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.
用auto就可以了
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.
done
| QStringList PluginInstaller::getAeInstallPaths() { | ||
| QStringList paths; | ||
| int currentYear = QDate::currentDate().year(); | ||
| int startYear = qMax(minSupportedYear, currentYear - 10); |
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.
这里为什么需要 -10和+2
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.
这里去匹配一个范围,历史版本与新版本
|
|
||
| args << "-e" << appleScriptCommand; | ||
|
|
||
| process.start("osascript", args); |
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.
看下AI提的这条评论是否合理
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.
这里是合理的,已更改
| } | ||
|
|
||
| minSupportedYear = qMax(2010, minYear); | ||
| maxSupportedYear = qMin(2050, maxYear); |
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.
这里的取值和默认最大最小值不一样,统一起来吧
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.
done
| } | ||
| } | ||
|
|
||
| QString PluginInstaller::getPluginVersionString(const QString& pluginPath) const { |
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.
这个是还没实现吗
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.
漏掉了,已补上
|
|
||
| QString targetDir = QFileInfo(target).absolutePath(); | ||
| QString mkdirCmd = QString("mkdir -p '%1'").arg(targetDir); | ||
| QString rmCmd = QString("rm -rf '%1'").arg(target); |
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.
这些调用命令行执行相关逻辑的操作,缓存调用C++ API实现更合适一些
…Qt resource management for PAGExporter
在PAGViewer中添加安装插件以及卸载插件功能