# HG changeset patch # User Chris Cannam # Date 1527251948 -3600 # Node ID 41824255ddf261bf25c7469bdc17ebb2e5aada79 # Parent b5c71304286ea4feb794da1412c362f19c0905d0 Plugin review dialog diff -r b5c71304286e -r 41824255ddf2 files.pri --- a/files.pri Wed May 23 16:24:35 2018 +0100 +++ b/files.pri Fri May 25 13:39:08 2018 +0100 @@ -75,6 +75,7 @@ widgets/PluginParameterBox.h \ widgets/PluginParameterDialog.h \ widgets/PluginPathConfigurator.h \ + widgets/PluginReviewDialog.h \ widgets/ProgressDialog.h \ widgets/PropertyBox.h \ widgets/PropertyStack.h \ @@ -158,6 +159,7 @@ widgets/PluginParameterBox.cpp \ widgets/PluginParameterDialog.cpp \ widgets/PluginPathConfigurator.cpp \ + widgets/PluginReviewDialog.cpp \ widgets/ProgressDialog.cpp \ widgets/PropertyBox.cpp \ widgets/PropertyStack.cpp \ diff -r b5c71304286e -r 41824255ddf2 widgets/PluginPathConfigurator.cpp --- a/widgets/PluginPathConfigurator.cpp Wed May 23 16:24:35 2018 +0100 +++ b/widgets/PluginPathConfigurator.cpp Fri May 25 13:39:08 2018 +0100 @@ -13,6 +13,7 @@ */ #include "PluginPathConfigurator.h" +#include "PluginReviewDialog.h" #include #include @@ -30,7 +31,7 @@ { m_layout = new QGridLayout; setLayout(m_layout); - + QHBoxLayout *buttons = new QHBoxLayout; m_down = new QPushButton; @@ -84,7 +85,13 @@ this, SLOT(currentLocationChanged(int))); ++row; - m_layout->addLayout(buttons, row, 2); + m_layout->addLayout(buttons, row, 0, Qt::AlignLeft); + + m_seePlugins = new QPushButton; + m_seePlugins->setText(tr("Review plugins...")); + connect(m_seePlugins, SIGNAL(clicked()), this, SLOT(seePluginsClicked())); + m_layout->addWidget(m_seePlugins, row, 2); + ++row; m_envOverride = new QCheckBox; @@ -172,9 +179,17 @@ } void -PluginPathConfigurator::envOverrideChanged(int ) +PluginPathConfigurator::envOverrideChanged(int state) { - //!!! + bool useEnvVariable = (state == Qt::Checked); + + QString type = m_pluginTypeSelector->currentText(); + + auto newEntry = m_paths.at(type); + newEntry.useEnvVariable = useEnvVariable; + m_paths[type] = newEntry; + + emit pathsChanged(m_paths); } void @@ -202,6 +217,8 @@ m_paths[type] = newEntry; populateFor(type, current - 1); + + emit pathsChanged(m_paths); } void @@ -229,6 +246,8 @@ m_paths[type] = newEntry; populateFor(type, current + 1); + + emit pathsChanged(m_paths); } void @@ -246,6 +265,8 @@ m_paths[type] = newEntry; populateFor(type, newEntry.directories.size() - 1); + + emit pathsChanged(m_paths); } void @@ -269,6 +290,8 @@ m_paths[type] = newEntry; populateFor(type, current < newPath.size() ? current : current-1); + + emit pathsChanged(m_paths); } void @@ -277,4 +300,15 @@ QString type = m_pluginTypeSelector->currentText(); m_paths[type] = m_originalPaths[type]; populateFor(type, -1); + + emit pathsChanged(m_paths); } + +void +PluginPathConfigurator::seePluginsClicked() +{ + PluginReviewDialog dialog(this); + dialog.populate(); + dialog.exec(); +} + diff -r b5c71304286e -r 41824255ddf2 widgets/PluginPathConfigurator.h --- a/widgets/PluginPathConfigurator.h Wed May 23 16:24:35 2018 +0100 +++ b/widgets/PluginPathConfigurator.h Fri May 25 13:39:08 2018 +0100 @@ -61,12 +61,14 @@ void currentTypeChanged(QString); void currentLocationChanged(int); void envOverrideChanged(int); + void seePluginsClicked(); private: QGridLayout *m_layout; QLabel *m_header; QComboBox *m_pluginTypeSelector; QListWidget *m_list; + QPushButton *m_seePlugins; QPushButton *m_up; QPushButton *m_down; QPushButton *m_add; diff -r b5c71304286e -r 41824255ddf2 widgets/PluginReviewDialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgets/PluginReviewDialog.cpp Fri May 25 13:39:08 2018 +0100 @@ -0,0 +1,140 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ + +/* + Sonic Visualiser + An audio file viewer and annotation editor. + Centre for Digital Music, Queen Mary, University of London. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. See the file + COPYING included with this distribution for more information. +*/ + +#include "PluginReviewDialog.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "plugin/FeatureExtractionPluginFactory.h" +#include "plugin/RealTimePluginFactory.h" + +PluginReviewDialog::PluginReviewDialog(QWidget *parent) : + QDialog(parent) +{ + setWindowTitle(tr("Plugins Loaded")); + + QGridLayout *layout = new QGridLayout; + setLayout(layout); + + m_table = new QTableWidget; + layout->addWidget(m_table, 0, 1); + + QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok); + layout->addWidget(bb, 1, 1); + connect(bb, SIGNAL(accepted()), this, SLOT(accept())); +} + +PluginReviewDialog::~PluginReviewDialog() +{ +} + +void +PluginReviewDialog::populate() +{ + FeatureExtractionPluginFactory *feFactory = + FeatureExtractionPluginFactory::instance(); + QString err; + std::vector feIds = feFactory->getPluginIdentifiers(err); + + RealTimePluginFactory *dssiFactory = + RealTimePluginFactory::instance("dssi"); + std::vector dssiIds = dssiFactory->getPluginIdentifiers(); + + RealTimePluginFactory *ladspaFactory = + RealTimePluginFactory::instance("ladspa"); + std::vector ladspaIds = ladspaFactory->getPluginIdentifiers(); + + m_table->setRowCount(int(feIds.size() + dssiIds.size() + ladspaIds.size())); + m_table->setColumnCount(5); + + QStringList headers; + int typeCol = 0, libCol = 1, nameCol = 2, idCol = 3, dirCol = 4; + headers << tr("Type") << tr("Library") << tr("Name") + << tr("Identifier") << tr("Location"); + m_table->setHorizontalHeaderLabels(headers); + + int row = 0; + + for (QString id: feIds) { + auto staticData = feFactory->getPluginStaticData(id); + m_table->setItem(row, typeCol, new QTableWidgetItem + (tr("Vamp"))); + m_table->setItem(row, idCol, new QTableWidgetItem + (QString::fromStdString(staticData.basic.identifier))); + m_table->setItem(row, nameCol, new QTableWidgetItem + (QString::fromStdString(staticData.basic.name))); + QString path = feFactory->getPluginLibraryPath(id); + m_table->setItem(row, libCol, new QTableWidgetItem + (QFileInfo(path).fileName())); + m_table->setItem(row, dirCol, new QTableWidgetItem + (QFileInfo(path).path())); + row++; + } + + for (QString id: dssiIds) { + auto descriptor = dssiFactory->getPluginDescriptor(id); + if (!descriptor) continue; + m_table->setItem(row, typeCol, new QTableWidgetItem + (tr("DSSI"))); + m_table->setItem(row, idCol, new QTableWidgetItem + (QString::fromStdString(descriptor->label))); + m_table->setItem(row, nameCol, new QTableWidgetItem + (QString::fromStdString(descriptor->name))); + QString path = dssiFactory->getPluginLibraryPath(id); + m_table->setItem(row, libCol, new QTableWidgetItem + (QFileInfo(path).fileName())); + m_table->setItem(row, dirCol, new QTableWidgetItem + (QFileInfo(path).path())); + row++; + } + + for (QString id: ladspaIds) { + auto descriptor = ladspaFactory->getPluginDescriptor(id); + if (!descriptor) continue; + m_table->setItem(row, typeCol, new QTableWidgetItem + (tr("LADSPA"))); + m_table->setItem(row, idCol, new QTableWidgetItem + (QString::fromStdString(descriptor->label))); + m_table->setItem(row, nameCol, new QTableWidgetItem + (QString::fromStdString(descriptor->name))); + QString path = ladspaFactory->getPluginLibraryPath(id); + m_table->setItem(row, libCol, new QTableWidgetItem + (QFileInfo(path).fileName())); + m_table->setItem(row, dirCol, new QTableWidgetItem + (QFileInfo(path).path())); + row++; + } + + m_table->setSortingEnabled(true); + m_table->setSelectionMode(QAbstractItemView::NoSelection); + m_table->resizeColumnsToContents(); + + int twidth = m_table->horizontalHeader()->length(); + int theight = m_table->verticalHeader()->length(); + + QDesktopWidget *desktop = QApplication::desktop(); + QRect available = desktop->availableGeometry(); + + int width = std::min(twidth + 30, (available.width() * 3) / 4); + int height = std::min(theight + 30, (available.height() * 3) / 4); + + resize(width, height); +} + diff -r b5c71304286e -r 41824255ddf2 widgets/PluginReviewDialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgets/PluginReviewDialog.h Fri May 25 13:39:08 2018 +0100 @@ -0,0 +1,37 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ + +/* + Sonic Visualiser + An audio file viewer and annotation editor. + Centre for Digital Music, Queen Mary, University of London. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. See the file + COPYING included with this distribution for more information. +*/ + +#ifndef SV_PLUGIN_REVIEW_DIALOG_H +#define SV_PLUGIN_REVIEW_DIALOG_H + +#include +#include + +class QEvent; + +class PluginReviewDialog : public QDialog +{ + Q_OBJECT + +public: + PluginReviewDialog(QWidget *parent = 0); + ~PluginReviewDialog(); + + void populate(); + +private: + QTableWidget *m_table; +}; + +#endif