| 84 | } |
| 85 | |
| 86 | void DetailsView::update(const dpf::PluginMetaObjectPointer &metaInfo) |
| 87 | { |
| 88 | pluginMetaInfo = metaInfo; |
| 89 | |
| 90 | if (metaInfo.isNull()) |
| 91 | return; |
| 92 | |
| 93 | QString dependencies; |
| 94 | for (auto depend : metaInfo->depends()) { |
| 95 | dependencies += depend.toString(); |
| 96 | if (depend.name() != metaInfo->depends().back().name()) { |
| 97 | dependencies += "、"; |
| 98 | } |
| 99 | } |
| 100 | QString licenses; |
| 101 | for (QString &text : metaInfo->license()) { |
| 102 | licenses += text.simplified(); |
| 103 | if (text != metaInfo->license().back()) { |
| 104 | licenses += "、"; |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | name->setText(metaInfo->name()); |
| 109 | version->setText(metaInfo->version()); |
| 110 | category->setText(metaInfo->category()); |
| 111 | vendor->setText(metaInfo->vendor()); |
| 112 | description->setText(tr("Description") + ": " + metaInfo->description()); |
| 113 | dependency->setText(tr("Dependency") + ": " + dependencies); |
| 114 | |
| 115 | bool pluginIsEnabled = pluginMetaInfo->isEnabledBySettings(); |
| 116 | updateLoadBtnDisplay(pluginIsEnabled); |
| 117 | |
| 118 | QString pluginPath = CustomPaths::global(CustomPaths::Plugins); |
| 119 | QString pluginLogoPath = pluginPath + QDir::separator() + pluginMetaInfo->name() + ".svg"; |
| 120 | QIcon pluginLogo; |
| 121 | if (QFile::exists(pluginLogoPath)) { |
| 122 | pluginLogo = QIcon::fromTheme(pluginLogoPath); |
| 123 | } else { |
| 124 | pluginLogo = QIcon::fromTheme("default_plugin"); |
| 125 | } |
| 126 | |
| 127 | logoLabel->setPixmap(pluginLogo.pixmap(QSize(96, 96))); |
| 128 | |
| 129 | #ifndef NOT_USE_WEBENGINE |
| 130 | webView->load(QUrl(metaInfo->urlLink())); |
| 131 | #endif |
| 132 | } |
| 133 | |
| 134 | bool DetailsView::eventFilter(QObject *obj, QEvent *e) |
| 135 | { |