17 #include <QGridLayout> 18 #include <QTableWidget> 19 #include <QDialogButtonBox> 21 #include <QHeaderView> 23 #include <QApplication> 25 #include "plugin/FeatureExtractionPluginFactory.h" 26 #include "plugin/RealTimePluginFactory.h" 31 setWindowTitle(tr(
"Plugins Loaded"));
33 QGridLayout *layout =
new QGridLayout;
37 layout->addWidget(
m_table, 0, 1);
39 QDialogButtonBox *bb =
new QDialogButtonBox(QDialogButtonBox::Close);
40 layout->addWidget(bb, 1, 1);
41 connect(bb, SIGNAL(rejected()),
this, SLOT(close()));
51 FeatureExtractionPluginFactory *feFactory =
52 FeatureExtractionPluginFactory::instance();
54 std::vector<QString> feIds = feFactory->getPluginIdentifiers(err);
56 RealTimePluginFactory *dssiFactory =
57 RealTimePluginFactory::instance(
"dssi");
58 std::vector<QString> dssiIds = dssiFactory->getPluginIdentifiers();
60 RealTimePluginFactory *ladspaFactory =
61 RealTimePluginFactory::instance(
"ladspa");
62 std::vector<QString> ladspaIds = ladspaFactory->getPluginIdentifiers();
64 m_table->setRowCount(
int(feIds.size() + dssiIds.size() + ladspaIds.size()));
68 int typeCol = 0, libCol = 1, idCol = 2, dirCol = 3, nameCol = 4;
69 headers << tr(
"Type") << tr(
"Library")
70 << tr(
"Identifier") << tr(
"Found in") << tr(
"Name");
71 m_table->setHorizontalHeaderLabels(headers);
75 for (QString
id: feIds) {
76 auto staticData = feFactory->getPluginStaticData(
id);
77 m_table->setItem(row, typeCol,
new QTableWidgetItem
79 m_table->setItem(row, idCol,
new QTableWidgetItem
80 (QString::fromStdString(staticData.basic.identifier)));
81 m_table->setItem(row, nameCol,
new QTableWidgetItem
82 (QString::fromStdString(staticData.basic.name)));
83 QString path = feFactory->getPluginLibraryPath(
id);
84 m_table->setItem(row, libCol,
new QTableWidgetItem
85 (QFileInfo(path).fileName()));
86 m_table->setItem(row, dirCol,
new QTableWidgetItem
87 (QFileInfo(path).path()));
91 for (QString
id: dssiIds) {
92 auto descriptor = dssiFactory->getPluginDescriptor(
id);
93 if (descriptor.name ==
"")
continue;
94 m_table->setItem(row, typeCol,
new QTableWidgetItem
96 m_table->setItem(row, idCol,
new QTableWidgetItem
97 (QString::fromStdString(descriptor.label)));
98 m_table->setItem(row, nameCol,
new QTableWidgetItem
99 (QString::fromStdString(descriptor.name)));
100 QString path = dssiFactory->getPluginLibraryPath(
id);
101 m_table->setItem(row, libCol,
new QTableWidgetItem
102 (QFileInfo(path).fileName()));
103 m_table->setItem(row, dirCol,
new QTableWidgetItem
104 (QFileInfo(path).path()));
108 for (QString
id: ladspaIds) {
109 auto descriptor = ladspaFactory->getPluginDescriptor(
id);
110 if (descriptor.name ==
"")
continue;
111 m_table->setItem(row, typeCol,
new QTableWidgetItem
113 m_table->setItem(row, idCol,
new QTableWidgetItem
114 (QString::fromStdString(descriptor.label)));
115 m_table->setItem(row, nameCol,
new QTableWidgetItem
116 (QString::fromStdString(descriptor.name)));
117 QString path = ladspaFactory->getPluginLibraryPath(
id);
118 m_table->setItem(row, libCol,
new QTableWidgetItem
119 (QFileInfo(path).fileName()));
120 m_table->setItem(row, dirCol,
new QTableWidgetItem
121 (QFileInfo(path).path()));
125 m_table->setSortingEnabled(
true);
126 m_table->setSelectionMode(QAbstractItemView::NoSelection);
127 m_table->resizeColumnsToContents();
129 int twidth =
m_table->horizontalHeader()->length();
130 int theight =
m_table->verticalHeader()->length();
132 QScreen *screen = QGuiApplication::primaryScreen();
133 QRect available = screen->availableGeometry();
135 int width = std::min(twidth + 30, (available.width() * 3) / 4);
136 int height = std::min(theight + 30, (available.height() * 3) / 4);
138 resize(width, height);
PluginReviewDialog(QWidget *parent=0)