-
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?
Changes from 25 commits
ea5fe49
2a834cf
6929fb0
ce750e2
1287b4e
c87d96d
44b6157
49908d3
02dcaf8
56cbc37
c0c5b29
6478202
73cc4bd
ff29a97
678ab29
785b9e8
193d0fb
4c95acd
96a63b3
61c0deb
de811a9
9942c56
27ecda6
9244c7b
c5576b2
9064693
ec47821
f587511
4d31922
e6cf642
f406ee4
06dc187
1d73165
a07e479
c709a8e
3307583
3fbe7ea
83ad702
5097caa
83e5762
be44716
bf6a16d
c35e14e
9d05241
0606e8e
3934dff
e917bfe
57d327d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| ///////////////////////////////////////////////////////////////////////////////////////////////// | ||
| // | ||
| // Tencent is pleased to support the open source community by making libpag available. | ||
| // | ||
| // Copyright (C) 2025 Tencent. All rights reserved. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file | ||
| // except in compliance with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // unless required by applicable law or agreed to in writing, software distributed under the | ||
| // license is distributed on an "as is" basis, without warranties or conditions of any kind, | ||
| // either express or implied. see the license for the specific language governing permissions | ||
| // and limitations under the license. | ||
| // | ||
| ///////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
|
||
| #include "PluginInstallerModel.h" | ||
| #include "platform/PluginInstaller.h" | ||
|
|
||
| namespace pag { | ||
|
|
||
| PluginInstallerModel::PluginInstallerModel(QObject* parent) | ||
| : QObject(parent), installer(std::make_unique<PluginInstaller>(this)) { | ||
|
|
||
| connect(installer.get(), &PluginInstaller::updateChecked, this, | ||
| &PluginInstallerModel::updateCheckCompleted); | ||
| connect(installer.get(), &PluginInstaller::installCompleted, this, | ||
| &PluginInstallerModel::installationCompleted); | ||
| connect(installer.get(), &PluginInstaller::uninstallCompleted, this, | ||
| &PluginInstallerModel::uninstallationCompleted); | ||
| } | ||
|
|
||
| PluginInstallerModel::~PluginInstallerModel() = default; | ||
|
|
||
| bool PluginInstallerModel::hasUpdate() const { | ||
| return installer->hasUpdate(); | ||
| } | ||
|
|
||
| InstallResult PluginInstallerModel::installPlugins(bool force) { | ||
|
||
| return installer->installPlugins(force); | ||
| } | ||
|
|
||
| InstallResult PluginInstallerModel::uninstallPlugins() { | ||
| return installer->uninstallPlugins(); | ||
| } | ||
|
|
||
| QString PluginInstallerModel::getInstalledVersion() const { | ||
| return installer->getInstalledVersion(); | ||
| } | ||
|
|
||
| bool PluginInstallerModel::isPluginInstalled() const { | ||
| return installer->isPluginInstalled(); | ||
| } | ||
|
|
||
| } // namespace pag | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| ///////////////////////////////////////////////////////////////////////////////////////////////// | ||
| // | ||
| // Tencent is pleased to support the open source community by making libpag available. | ||
| // | ||
| // Copyright (C) 2025 Tencent. All rights reserved. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file | ||
| // except in compliance with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // unless required by applicable law or agreed to in writing, software distributed under the | ||
| // license is distributed on an "as is" basis, without warranties or conditions of any kind, | ||
| // either express or implied. see the license for the specific language governing permissions | ||
| // and limitations under the license. | ||
| // | ||
| ///////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
|
||
| #pragma once | ||
| #include <QObject> | ||
| #include <memory> | ||
| #include "platform/PluginInstaller.h" | ||
|
|
||
| namespace pag { | ||
|
|
||
| class PluginInstaller; | ||
|
|
||
| class PluginInstallerModel : public QObject { | ||
| Q_OBJECT | ||
|
|
||
| public: | ||
| explicit PluginInstallerModel(QObject* parent = nullptr); | ||
| ~PluginInstallerModel() override; | ||
|
|
||
| Q_INVOKABLE bool hasUpdate() const; | ||
|
|
||
| Q_INVOKABLE InstallResult installPlugins(bool force = false); | ||
|
|
||
| Q_INVOKABLE InstallResult uninstallPlugins(); | ||
|
|
||
| Q_INVOKABLE QString getInstalledVersion() const; | ||
|
|
||
| Q_INVOKABLE bool isPluginInstalled() const; | ||
|
|
||
| Q_SIGNALS: | ||
| void updateCheckCompleted(bool hasUpdate); | ||
| void installationCompleted(InstallResult result, const QString& message); | ||
| void uninstallationCompleted(InstallResult result, const QString& message); | ||
|
|
||
| private: | ||
| std::unique_ptr<PluginInstaller> installer; | ||
|
||
| }; | ||
|
|
||
| } // namespace pag | ||
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.
已修改