comparison widgets/PluginParameterDialog.cpp @ 106:551d7ae05526

* 1492866: Plugin parameter window info display
author Chris Cannam
date Mon, 19 Jun 2006 16:02:41 +0000
parents 45ba0b381c5d
children 71992cee2ece
comparison
equal deleted inserted replaced
105:571805759a66 106:551d7ae05526
15 15
16 #include "PluginParameterDialog.h" 16 #include "PluginParameterDialog.h"
17 17
18 #include "PluginParameterBox.h" 18 #include "PluginParameterBox.h"
19 19
20 #include "vamp-sdk/Plugin.h"
21
20 #include <QGridLayout> 22 #include <QGridLayout>
21 #include <QLabel> 23 #include <QLabel>
22 #include <QGroupBox> 24 #include <QGroupBox>
23 #include <QHBoxLayout> 25 #include <QHBoxLayout>
24 #include <QPushButton> 26 #include <QPushButton>
27 29
28 PluginParameterDialog::PluginParameterDialog(Vamp::PluginBase *plugin, 30 PluginParameterDialog::PluginParameterDialog(Vamp::PluginBase *plugin,
29 int sourceChannels, 31 int sourceChannels,
30 int targetChannels, 32 int targetChannels,
31 int defaultChannel, 33 int defaultChannel,
34 QString output,
32 QWidget *parent) : 35 QWidget *parent) :
33 QDialog(parent), 36 QDialog(parent),
34 m_plugin(plugin), 37 m_plugin(plugin),
35 m_channel(defaultChannel), 38 m_channel(defaultChannel),
36 m_parameterBox(0) 39 m_parameterBox(0)
54 QLabel *nameLabel = new QLabel(plugin->getDescription().c_str()); 57 QLabel *nameLabel = new QLabel(plugin->getDescription().c_str());
55 nameLabel->setFont(font); 58 nameLabel->setFont(font);
56 59
57 QLabel *makerLabel = new QLabel(plugin->getMaker().c_str()); 60 QLabel *makerLabel = new QLabel(plugin->getMaker().c_str());
58 61
62 QLabel *outputLabel = 0;
63
64 if (output != "") {
65
66 Vamp::Plugin *fePlugin = dynamic_cast<Vamp::Plugin *>(plugin);
67
68 if (fePlugin) {
69
70 std::vector<Vamp::Plugin::OutputDescriptor> od =
71 fePlugin->getOutputDescriptors();
72
73 if (od.size() > 1) {
74
75 for (size_t i = 0; i < od.size(); ++i) {
76 if (od[i].name == output.toStdString()) {
77 outputLabel = new QLabel(od[i].description.c_str());
78 break;
79 }
80 }
81 }
82 }
83 }
84
59 QLabel *versionLabel = new QLabel(QString("%1") 85 QLabel *versionLabel = new QLabel(QString("%1")
60 .arg(plugin->getPluginVersion())); 86 .arg(plugin->getPluginVersion()));
61 87
62 QLabel *copyrightLabel = new QLabel(plugin->getCopyright().c_str()); 88 QLabel *copyrightLabel = new QLabel(plugin->getCopyright().c_str());
63 89
68 subgrid->addWidget(nameLabel, 0, 1); 94 subgrid->addWidget(nameLabel, 0, 1);
69 95
70 subgrid->addWidget(new QLabel(tr("Type:")), 1, 0); 96 subgrid->addWidget(new QLabel(tr("Type:")), 1, 0);
71 subgrid->addWidget(typeLabel, 1, 1); 97 subgrid->addWidget(typeLabel, 1, 1);
72 98
73 subgrid->addWidget(new QLabel(tr("Maker:")), 2, 0); 99 int outputOffset = 0;
74 subgrid->addWidget(makerLabel, 2, 1); 100 if (outputLabel) {
75 101 subgrid->addWidget(new QLabel(tr("Output:")), 2, 0);
76 subgrid->addWidget(new QLabel(tr("Copyright: ")), 3, 0); 102 subgrid->addWidget(outputLabel, 2, 1);
77 subgrid->addWidget(copyrightLabel, 3, 1); 103 outputOffset = 1;
78 104 }
79 subgrid->addWidget(new QLabel(tr("Version:")), 4, 0); 105
80 subgrid->addWidget(versionLabel, 4, 1); 106 subgrid->addWidget(new QLabel(tr("Maker:")), 2 + outputOffset, 0);
107 subgrid->addWidget(makerLabel, 2 + outputOffset, 1);
108
109 subgrid->addWidget(new QLabel(tr("Copyright: ")), 3 + outputOffset, 0);
110 subgrid->addWidget(copyrightLabel, 3 + outputOffset, 1);
111
112 subgrid->addWidget(new QLabel(tr("Version:")), 4 + outputOffset, 0);
113 subgrid->addWidget(versionLabel, 4 + outputOffset, 1);
81 114
82 subgrid->setColumnStretch(1, 2); 115 subgrid->setColumnStretch(1, 2);
83 116
84 QGroupBox *paramBox = new QGroupBox; 117 QGroupBox *paramBox = new QGroupBox;
85 paramBox->setTitle(tr("Plugin Parameters")); 118 paramBox->setTitle(tr("Plugin Parameters"));