Skip to content

Conversation

@YyZz-wy
Copy link
Collaborator

@YyZz-wy YyZz-wy commented Sep 26, 2025

在PAGViewer中添加安装插件以及卸载插件功能

YyZz-wy and others added 21 commits July 23, 2025 15:47
…ects installation paths and improve path sorting
Copilot AI review requested due to automatic review settings September 26, 2025 08:51
@YyZz-wy YyZz-wy requested a review from shlzxjp as a code owner September 26, 2025 08:51
Copy link
Contributor

Copilot AI left a 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.

}
setProgress(progress);
}
}else {
Copy link

Copilot AI Sep 26, 2025

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.

Suggested change
}else {
} else {

Copilot uses AI. Check for mistakes.

if (!QFile::exists(source)) {
return false;
} else {
Copy link

Copilot AI Sep 26, 2025

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.

Suggested change
} else {

Copilot uses AI. Check for mistakes.

args << "-e" << appleScriptCommand;

process.start("osascript", args);
Copy link

Copilot AI Sep 26, 2025

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.

Suggested change
process.start("osascript", args);
process.start("osascript", args);
process.waitForFinished(300000);

Copilot uses AI. Check for mistakes.
}
}
}
paths.removeDuplicates();
Copy link

Copilot AI Sep 26, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines 263 to 264
char qtResourceCmd[4096] = {0};
CopyQtResource(qtResourceCmd, sizeof(qtResourceCmd));
Copy link

Copilot AI Sep 26, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines 285 to 286
char deleteQtResourceCmd[4096] = {0};
DeleteQtResource(deleteQtResourceCmd, sizeof(deleteQtResourceCmd));
Copy link

Copilot AI Sep 26, 2025

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.

Copilot uses AI. Check for mistakes.


QString fallbackCommand = command;
fallbackCommand.replace("cp -r ", "cp -r ");
Copy link

Copilot AI Sep 26, 2025

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.

Suggested change
fallbackCommand.replace("cp -r ", "cp -r ");

Copilot uses AI. Check for mistakes.
@codecov-commenter
Copy link

codecov-commenter commented Sep 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.91%. Comparing base (eb92507) to head (83e5762).
⚠️ Report is 2 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

}
}

QString PluginInstaller::getPluginVersionString(const QString& pluginPath) const {
Copy link
Collaborator

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 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

加一个getPluginFullName用于获取PluginName+后缀,不然后续维护比较麻烦

@shlzxjp shlzxjp changed the title Added exporter install and uninstall function in PAGViewer Added plugin installation and uninstallation functionality to the PAGViewer application, added plugin version management and update checking capabilities. Oct 20, 2025
&PluginInstallerModel::uninstallationCompleted);
}

PluginInstallerModel::~PluginInstallerModel() = default;
Copy link
Collaborator

Choose a reason for hiding this comment

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

没有任何实现的析构函数可以不写

Copy link
Collaborator Author

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) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

应该只有一个插件要安装卸载吧,用单数,去掉s

Copy link
Collaborator Author

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;
Copy link
Collaborator

Choose a reason for hiding this comment

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

初始化下

Copy link
Collaborator Author

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;
Copy link
Collaborator

Choose a reason for hiding this comment

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

删掉

Copy link
Collaborator Author

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);
Copy link
Collaborator

Choose a reason for hiding this comment

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

用auto就可以了

Copy link
Collaborator Author

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);
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里为什么需要 -10和+2

Copy link
Collaborator Author

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);
Copy link
Collaborator

Choose a reason for hiding this comment

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

看下AI提的这条评论是否合理

Copy link
Collaborator Author

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);
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里的取值和默认最大最小值不一样,统一起来吧

Copy link
Collaborator Author

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 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个是还没实现吗

Copy link
Collaborator Author

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);
Copy link
Collaborator

Choose a reason for hiding this comment

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

这些调用命令行执行相关逻辑的操作,缓存调用C++ API实现更合适一些

@YyZz-wy YyZz-wy requested a review from kevingpqi123 as a code owner December 2, 2025 12:07
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.

5 participants