comparison widgets/PluginParameterDialog.cpp @ 440:08d6bc698d16

* Add more info button to plugin dialog
author Chris Cannam
date Tue, 28 Oct 2008 12:39:53 +0000
parents e1a9e478b7f2
children f8fcfbe13c8f
comparison
equal deleted inserted replaced
439:681542f0c8c5 440:08d6bc698d16
17 17
18 #include "PluginParameterBox.h" 18 #include "PluginParameterBox.h"
19 #include "WindowTypeSelector.h" 19 #include "WindowTypeSelector.h"
20 20
21 #include "TextAbbrev.h" 21 #include "TextAbbrev.h"
22 #include "IconLoader.h"
22 23
23 #include "vamp-sdk/Plugin.h" 24 #include "vamp-sdk/Plugin.h"
24 #include "vamp-sdk/PluginHostAdapter.h" 25 #include "vamp-sdk/PluginHostAdapter.h"
25 #include "vamp-sdk/hostext/PluginWrapper.h" 26 #include "vamp-sdk/hostext/PluginWrapper.h"
26 27
34 #include <QMessageBox> 35 #include <QMessageBox>
35 #include <QComboBox> 36 #include <QComboBox>
36 #include <QCheckBox> 37 #include <QCheckBox>
37 #include <QSettings> 38 #include <QSettings>
38 #include <QDialogButtonBox> 39 #include <QDialogButtonBox>
40 #include <QDesktopServices>
41 #include <QUrl>
39 42
40 PluginParameterDialog::PluginParameterDialog(Vamp::PluginBase *plugin, 43 PluginParameterDialog::PluginParameterDialog(Vamp::PluginBase *plugin,
41 QWidget *parent) : 44 QWidget *parent) :
42 QDialog(parent), 45 QDialog(parent),
43 m_plugin(plugin), 46 m_plugin(plugin),
98 101
99 QLabel *label = new QLabel(tr("Name:")); 102 QLabel *label = new QLabel(tr("Name:"));
100 label->setAlignment(Qt::AlignTop | Qt::AlignLeft); 103 label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
101 subgrid->addWidget(label, row, 0); 104 subgrid->addWidget(label, row, 0);
102 subgrid->addWidget(nameLabel, row, 1); 105 subgrid->addWidget(nameLabel, row, 1);
106
107 m_moreInfo = new QPushButton;
108 m_moreInfo->setIcon(IconLoader().load("info"));
109 m_moreInfo->setFixedSize(QSize(16, 16));
110 connect(m_moreInfo, SIGNAL(clicked()), this, SLOT(moreInfo()));
111 subgrid->addWidget(m_moreInfo, row, 2, Qt::AlignTop | Qt::AlignRight);
112 m_moreInfo->hide();
113
103 row++; 114 row++;
104 115
105 if (descriptionLabel) { 116 if (descriptionLabel) {
106 // label = new QLabel(tr("Description:")); 117 // label = new QLabel(tr("Description:"));
107 // label->setAlignment(Qt::AlignTop | Qt::AlignLeft); 118 // label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
108 // subgrid->addWidget(label, row, 0); 119 // subgrid->addWidget(label, row, 0);
109 subgrid->addWidget(descriptionLabel, row, 1); 120 subgrid->addWidget(descriptionLabel, row, 1, 1, 2);
110 row++; 121 row++;
111 } 122 }
112 123
113 Vamp::PluginHostAdapter *fePlugin = 124 Vamp::Plugin *fePlugin = dynamic_cast<Vamp::Plugin *>(m_plugin);
114 dynamic_cast<Vamp::PluginHostAdapter *>(m_plugin);
115 125
116 if (fePlugin) { 126 if (fePlugin) {
117 label = new QLabel(tr("Version:")); 127 label = new QLabel(tr("Version:"));
118 label->setAlignment(Qt::AlignTop | Qt::AlignLeft); 128 label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
119 subgrid->addWidget(label, row, 0); 129 subgrid->addWidget(label, row, 0);
120 subgrid->addWidget(versionLabel, row, 1); 130 subgrid->addWidget(versionLabel, row, 1);
121 row++; 131 row++;
132 } else {
133 std::cerr << "PluginParameterDialog: Note: not a feature extraction plugin (type is " << typeid(*m_plugin).name() << ")" << std::endl;
122 } 134 }
123 135
124 // label = new QLabel(tr("Type:")); 136 // label = new QLabel(tr("Type:"));
125 // label->setAlignment(Qt::AlignTop | Qt::AlignLeft); 137 // label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
126 // subgrid->addWidget(label, row, 0); 138 // subgrid->addWidget(label, row, 0);
274 } 286 }
275 } 287 }
276 } 288 }
277 289
278 void 290 void
291 PluginParameterDialog::setMoreInfoUrl(QString moreInfoUrl)
292 {
293 m_moreInfoUrl = moreInfoUrl;
294 if (m_moreInfoUrl != "") {
295 m_moreInfo->show();
296 } else {
297 m_moreInfo->hide();
298 }
299 }
300
301 void
279 PluginParameterDialog::setChannelArrangement(int sourceChannels, 302 PluginParameterDialog::setChannelArrangement(int sourceChannels,
280 int targetChannels, 303 int targetChannels,
281 int defaultChannel) 304 int defaultChannel)
282 { 305 {
283 m_channel = defaultChannel; 306 m_channel = defaultChannel;
547 { 570 {
548 m_windowType = type; 571 m_windowType = type;
549 } 572 }
550 573
551 void 574 void
575 PluginParameterDialog::moreInfo()
576 {
577 if (m_moreInfoUrl != "") {
578 QDesktopServices::openUrl(QUrl(m_moreInfoUrl));
579 }
580 }
581
582 void
552 PluginParameterDialog::advancedToggled() 583 PluginParameterDialog::advancedToggled()
553 { 584 {
554 setAdvancedVisible(!m_advancedVisible); 585 setAdvancedVisible(!m_advancedVisible);
555 } 586 }
556 587