| 37 | } |
| 38 | |
| 39 | void PluginListView::display() |
| 40 | { |
| 41 | const QHash<QString, QQueue<PluginMetaObjectPointer>> &pluginCollections = |
| 42 | LifeCycle::getPluginManagerInstance()->pluginCollections(); |
| 43 | |
| 44 | model->clear(); |
| 45 | QList<QStandardItem*> result; |
| 46 | for (auto collection : pluginCollections) { |
| 47 | for (auto metaOBject : collection) { |
| 48 | QString pluginName = metaOBject->name(); |
| 49 | QString category = metaOBject->category(); |
| 50 | if (isCorePlugin(category) || isFilterdOut(pluginName)) |
| 51 | continue; |
| 52 | |
| 53 | QString description = metaOBject->description(); |
| 54 | QString vender = metaOBject->vendor(); |
| 55 | QString copyright = metaOBject->copyright(); |
| 56 | QStringList license = metaOBject->license(); |
| 57 | QString version = metaOBject->version(); |
| 58 | |
| 59 | QString pluginPath = CustomPaths::global(CustomPaths::Plugins); |
| 60 | QString pluginLogoPath = pluginPath + QDir::separator() + pluginName + ".svg"; |
| 61 | QIcon pluginLogo; |
| 62 | if (QFile::exists(pluginLogoPath)) { |
| 63 | pluginLogo = QIcon::fromTheme(pluginLogoPath); |
| 64 | } else { |
| 65 | pluginLogo = QIcon::fromTheme("default_plugin"); |
| 66 | } |
| 67 | |
| 68 | auto rowItem = new DStandardItem(pluginLogo, pluginName); |
| 69 | rowItem->setData(description, PluginListView::Description); |
| 70 | rowItem->setData(vender, PluginListView::Vender); |
| 71 | rowItem->setData(category, PluginListView::Category); |
| 72 | |
| 73 | QString toolTip; |
| 74 | QTextStream textStrem(&toolTip); |
| 75 | textStrem << "<html><body><b>" << pluginName << " </b><em>" << version << "</em></font><hr>" |
| 76 | << description << "<hr>" |
| 77 | << "<b>" << tr("Category") << "</b>" << " : " << category << "<br>" |
| 78 | << "<b>" << tr("License") << "</b>" << " : " << license.join("") << "<br>" |
| 79 | << "<b>" << tr("CopyRight") << "</b>" << " : " << copyright |
| 80 | << "</body></html>"; |
| 81 | rowItem->setToolTip(toolTip); |
| 82 | result << rowItem; |
| 83 | } |
| 84 | } |
| 85 | model->appendColumn(result); |
| 86 | } |
| 87 | |
| 88 | bool PluginListView::isFilterdOut(const QString &filteringText) |
| 89 | { |