13 #include <QPluginLoader>
14 #include <QStringList>
18 #include <QGridLayout>
19 #include <QPushButton>
20 #include <QTreeWidget>
21 #include <QTreeWidgetItem>
22 #include <QHeaderView>
28 const QStringList &fileNames,
30 : QDialog(parent), label(new QLabel), treeWidget(new QTreeWidget),
31 okButton(new QPushButton(
tr(
"OK")))
34 treeWidget->setSelectionMode(QAbstractItemView::NoSelection);
40 connect(
okButton, SIGNAL(clicked()),
this, SLOT(close()));
42 QGridLayout *mainLayout =
new QGridLayout;
43 mainLayout->setColumnStretch(0, 1);
44 mainLayout->setColumnStretch(2, 1);
45 mainLayout->addWidget(
label, 0, 0, 1, 3);
47 mainLayout->addWidget(
okButton, 2, 1);
48 setLayout(mainLayout);
50 interfaceIcon.addPixmap(style()->standardPixmap(QStyle::SP_DirOpenIcon),
53 interfaceIcon.addPixmap(style()->standardPixmap(QStyle::SP_DirClosedIcon),
56 featureIcon.addPixmap(style()->standardPixmap(QStyle::SP_FileIcon));
58 setWindowTitle(
tr(
"Plugins information"));
65 const QStringList &fileNames)
67 label->setText(
tr(
"Found the following plugins\n"
69 .arg(QDir::toNativeSeparators(path)));
72 foreach(QObject *plugin, QPluginLoader::staticInstances())
75 tr(
"%1 (Static Plugin)").arg(plugin->metaObject()->className()));
77 foreach(QString fileName, fileNames)
79 std::cout << fileName.toStdString() << std::endl;
80 QPluginLoader loader(dir.absoluteFilePath(fileName));
81 QObject *plugin = loader.instance();
83 populateTreeWidget(plugin, fileName);
91 QTreeWidgetItem *pluginItem =
new QTreeWidgetItem(treeWidget);
92 pluginItem->setText(0, text);
94 pluginItem->setExpanded(
true);
96 QFont boldFont = pluginItem->font(0);
97 boldFont.setBold(
true);
98 pluginItem->setFont(0, boldFont);
103 qobject_cast< Generic_PluginInterface * >(plugin);
106 "Generic_PluginInterface",
114 const char *interfaceName,
115 const QStringList &features)
117 QTreeWidgetItem *interfaceItem =
new QTreeWidgetItem(pluginItem);
118 interfaceItem->setText(0, interfaceName);
119 interfaceItem->setIcon(0, interfaceIcon);
121 foreach(QString feature, features)
123 if(feature.endsWith(
"..."))
125 QTreeWidgetItem *featureItem =
new QTreeWidgetItem(interfaceItem);
126 featureItem->setText(0, feature);
127 featureItem->setIcon(0, featureIcon);