changeset 440:08d6bc698d16

* Add more info button to plugin dialog
author Chris Cannam
date Tue, 28 Oct 2008 12:39:53 +0000
parents 681542f0c8c5
children f8fcfbe13c8f
files widgets/PluginParameterDialog.cpp widgets/PluginParameterDialog.h
diffstat 2 files changed, 40 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/widgets/PluginParameterDialog.cpp	Fri Oct 24 16:43:59 2008 +0000
+++ b/widgets/PluginParameterDialog.cpp	Tue Oct 28 12:39:53 2008 +0000
@@ -19,6 +19,7 @@
 #include "WindowTypeSelector.h"
 
 #include "TextAbbrev.h"
+#include "IconLoader.h"
 
 #include "vamp-sdk/Plugin.h"
 #include "vamp-sdk/PluginHostAdapter.h"
@@ -36,6 +37,8 @@
 #include <QCheckBox>
 #include <QSettings>
 #include <QDialogButtonBox>
+#include <QDesktopServices>
+#include <QUrl>
 
 PluginParameterDialog::PluginParameterDialog(Vamp::PluginBase *plugin,
 					     QWidget *parent) :
@@ -100,18 +103,25 @@
     label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
     subgrid->addWidget(label, row, 0);
     subgrid->addWidget(nameLabel, row, 1);
+
+    m_moreInfo = new QPushButton;
+    m_moreInfo->setIcon(IconLoader().load("info"));
+    m_moreInfo->setFixedSize(QSize(16, 16));
+    connect(m_moreInfo, SIGNAL(clicked()), this, SLOT(moreInfo()));
+    subgrid->addWidget(m_moreInfo, row, 2, Qt::AlignTop | Qt::AlignRight);
+    m_moreInfo->hide();
+
     row++;
 
     if (descriptionLabel) {
 //        label = new QLabel(tr("Description:"));
 //        label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
 //        subgrid->addWidget(label, row, 0);
-        subgrid->addWidget(descriptionLabel, row, 1);
+        subgrid->addWidget(descriptionLabel, row, 1, 1, 2);
         row++;
     }
 
-    Vamp::PluginHostAdapter *fePlugin =
-        dynamic_cast<Vamp::PluginHostAdapter *>(m_plugin);
+    Vamp::Plugin *fePlugin = dynamic_cast<Vamp::Plugin *>(m_plugin);
 
     if (fePlugin) {
         label = new QLabel(tr("Version:"));
@@ -119,6 +129,8 @@
         subgrid->addWidget(label, row, 0);
         subgrid->addWidget(versionLabel, row, 1);
         row++;
+    } else {
+        std::cerr << "PluginParameterDialog: Note: not a feature extraction plugin (type is " << typeid(*m_plugin).name() << ")" << std::endl;
     }
 
 //    label = new QLabel(tr("Type:"));
@@ -276,6 +288,17 @@
 }
 
 void
+PluginParameterDialog::setMoreInfoUrl(QString moreInfoUrl)
+{
+    m_moreInfoUrl = moreInfoUrl;
+    if (m_moreInfoUrl != "") {
+        m_moreInfo->show();
+    } else {
+        m_moreInfo->hide();
+    }
+}
+
+void
 PluginParameterDialog::setChannelArrangement(int sourceChannels,
                                              int targetChannels,
                                              int defaultChannel)
@@ -549,6 +572,14 @@
 }
 
 void
+PluginParameterDialog::moreInfo()
+{
+    if (m_moreInfoUrl != "") {
+        QDesktopServices::openUrl(QUrl(m_moreInfoUrl));
+    }
+}
+
+void
 PluginParameterDialog::advancedToggled()
 {
     setAdvancedVisible(!m_advancedVisible);
--- a/widgets/PluginParameterDialog.h	Fri Oct 24 16:43:59 2008 +0000
+++ b/widgets/PluginParameterDialog.h	Tue Oct 28 12:39:53 2008 +0000
@@ -51,6 +51,8 @@
 
     void setOutputLabel(QString output, QString description);
 
+    void setMoreInfoUrl(QString url);
+
     void setShowProcessingOptions(bool showWindowSize,
                                   bool showFrequencyDomainOptions);
 
@@ -81,6 +83,7 @@
     void incrementComboChanged(const QString &);
     void windowTypeChanged(WindowType type);
     void advancedToggled();
+    void moreInfo();
     void setAdvancedVisible(bool);
     void inputModelComboChanged(int);
     void selectionOnlyChanged(int);
@@ -101,6 +104,9 @@
     QLabel *m_outputDescription;
     QLabel *m_outputSpacer;
 
+    QPushButton *m_moreInfo;
+    QString m_moreInfoUrl;
+
     QGroupBox *m_channelBox;
     bool m_haveChannelBoxData;