changeset 208:8495187c13ce

* Further fixes for Vamp API change, and update to support API versioning * Add plugin, output and parameter descriptions to GUI * Avoid squished panner in heads-up-display on pane when time-value or note layer is on top
author Chris Cannam
date Tue, 27 Feb 2007 12:51:38 +0000
parents a5b3c9f580c1
children b6af2eb00780
files view/Pane.cpp widgets/PluginParameterBox.cpp widgets/PluginParameterDialog.cpp widgets/PluginParameterDialog.h
diffstat 4 files changed, 95 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/view/Pane.cpp	Mon Feb 26 20:08:51 2007 +0000
+++ b/view/Pane.cpp	Tue Feb 27 12:51:38 2007 +0000
@@ -256,6 +256,23 @@
 {
     if (!m_vpan || !m_manager || !m_manager->getZoomWheelsEnabled()) return;
 
+    // In principle we should show or hide the panner on the basis of
+    // whether the top layer has adjustable display extents, and we do
+    // that below.  However, we have no basis for layout of the panner
+    // if the vertical scroll wheel is not also present.  So if we
+    // have no vertical scroll wheel, we should remove the panner as
+    // well.  Ideally any layer that implements display extents should
+    // implement vertical zoom steps as well, but they don't all at
+    // the moment.
+
+    Layer *layer = 0;
+    if (getLayerCount() > 0) layer = getLayer(getLayerCount() - 1);
+    int discard;
+    if (layer && layer->getVerticalZoomSteps(discard) == 0) {
+        m_vpan->hide();
+        return;
+    }
+
     float vmin, vmax, dmin, dmax;
     if (getTopLayerDisplayExtents(vmin, vmax, dmin, dmax) && vmax != vmin) {
         float y0 = (dmin - vmin) / (vmax - vmin);
--- a/widgets/PluginParameterBox.cpp	Mon Feb 26 20:08:51 2007 +0000
+++ b/widgets/PluginParameterBox.cpp	Tue Feb 27 12:51:38 2007 +0000
@@ -115,6 +115,9 @@
         // an integer!
 
         QLabel *label = new QLabel(name);
+        if (params[i].description != "") {
+            label->setToolTip(params[i].description.c_str());
+        }
         m_layout->addWidget(label, i + offset, 0);
 
         ParamRec rec;
--- a/widgets/PluginParameterDialog.cpp	Mon Feb 26 20:08:51 2007 +0000
+++ b/widgets/PluginParameterDialog.cpp	Tue Feb 27 12:51:38 2007 +0000
@@ -48,7 +48,7 @@
     setLayout(grid);
 
     QGroupBox *pluginBox = new QGroupBox;
-    pluginBox->setTitle(tr("Plugin"));
+    pluginBox->setTitle(plugin->getType().c_str());
     grid->addWidget(pluginBox, 0, 0);
 
     QGridLayout *subgrid = new QGridLayout;
@@ -57,12 +57,15 @@
     subgrid->setSpacing(0);
     subgrid->setMargin(10);
 
-    QFont font(pluginBox->font());
-    font.setBold(true);
+    QFont boldFont(pluginBox->font());
+    boldFont.setBold(true);
+
+    QFont italicFont(pluginBox->font());
+    italicFont.setItalic(true);
 
     QLabel *nameLabel = new QLabel(plugin->getName().c_str());
     nameLabel->setWordWrap(true);
-    nameLabel->setFont(font);
+    nameLabel->setFont(boldFont);
 
     QLabel *makerLabel = new QLabel(plugin->getMaker().c_str());
     makerLabel->setWordWrap(true);
@@ -74,9 +77,16 @@
     QLabel *copyrightLabel = new QLabel(plugin->getCopyright().c_str());
     copyrightLabel->setWordWrap(true);
 
-    QLabel *typeLabel = new QLabel(plugin->getType().c_str());
-    typeLabel->setWordWrap(true);
-    typeLabel->setFont(font);
+//    QLabel *typeLabel = new QLabel(plugin->getType().c_str());
+//    typeLabel->setWordWrap(true);
+//    typeLabel->setFont(boldFont);
+
+    QLabel *descriptionLabel = 0;
+    if (plugin->getDescription() != "") {
+        descriptionLabel = new QLabel(plugin->getDescription().c_str());
+        descriptionLabel->setWordWrap(true);
+        descriptionLabel->setFont(italicFont);
+    }
 
     int row = 0;
 
@@ -86,20 +96,30 @@
     subgrid->addWidget(nameLabel, row, 1);
     row++;
 
-    label = new QLabel(tr("Type:"));
-    label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
-    subgrid->addWidget(label, row, 0);
-    subgrid->addWidget(typeLabel, row, 1);
-    row++;
-    
-    m_outputLabel = new QLabel(tr("Output:"));
-    m_outputLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
-    subgrid->addWidget(m_outputLabel, row, 0);
-    m_outputValue = new QLabel;
-    subgrid->addWidget(m_outputValue, row, 1);
-    m_outputLabel->hide();
-    m_outputValue->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);
+        row++;
+    }
+
+    Vamp::PluginHostAdapter *fePlugin =
+        dynamic_cast<Vamp::PluginHostAdapter *>(m_plugin);
+
+    if (fePlugin) {
+        label = new QLabel(tr("Version:"));
+        label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
+        subgrid->addWidget(label, row, 0);
+        subgrid->addWidget(versionLabel, row, 1);
+        row++;
+    }
+
+//    label = new QLabel(tr("Type:"));
+//    label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
+//    subgrid->addWidget(label, row, 0);
+//    subgrid->addWidget(typeLabel, row, 1);
+//    row++;
 
     label = new QLabel(tr("Maker:"));
     label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
@@ -112,11 +132,27 @@
     subgrid->addWidget(label, row, 0);
     subgrid->addWidget(copyrightLabel, row, 1);
     row++;
+    
+    m_outputSpacer = new QLabel;
+    subgrid->addWidget(m_outputSpacer, row, 0);
+    m_outputSpacer->setFixedHeight(7);
+    m_outputSpacer->hide();
+    row++;
 
-    label = new QLabel(tr("Version:"));
-    label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
-    subgrid->addWidget(label, row, 0);
-    subgrid->addWidget(versionLabel, row, 1);
+    m_outputLabel = new QLabel(tr("Output:"));
+    m_outputLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
+    subgrid->addWidget(m_outputLabel, row, 0);
+    m_outputValue = new QLabel;
+    m_outputValue->setFont(boldFont);
+    subgrid->addWidget(m_outputValue, row, 1);
+    m_outputLabel->hide();
+    m_outputValue->hide();
+    row++;
+
+    m_outputDescription = new QLabel;
+    m_outputDescription->setFont(italicFont);
+    subgrid->addWidget(m_outputDescription, row, 1);
+    m_outputDescription->hide();
     row++;
 
     subgrid->setColumnStretch(1, 2);
@@ -207,16 +243,26 @@
 
 
 void
-PluginParameterDialog::setOutputLabel(QString text)
+PluginParameterDialog::setOutputLabel(QString text,
+                                      QString description)
 {
     if (text == "") {
+        m_outputSpacer->hide();
         m_outputLabel->hide();
         m_outputValue->hide();
+        m_outputDescription->hide();
     } else {
+        m_outputSpacer->show();
         m_outputValue->setText(text);
         m_outputValue->setWordWrap(true);
+        m_outputDescription->setText(description);
         m_outputLabel->show();
         m_outputValue->show();
+        if (description != "") {
+            m_outputDescription->show();
+        } else {
+            m_outputDescription->hide();
+        }
     }
 }
 
--- a/widgets/PluginParameterDialog.h	Mon Feb 26 20:08:51 2007 +0000
+++ b/widgets/PluginParameterDialog.h	Tue Feb 27 12:51:38 2007 +0000
@@ -48,7 +48,7 @@
                                int targetChannels,
                                int defaultChannel);
 
-    void setOutputLabel(QString output);
+    void setOutputLabel(QString output, QString description);
 
     void setShowProcessingOptions(bool showWindowSize,
                                   bool showFrequencyDomainOptions);
@@ -91,6 +91,8 @@
 
     QLabel *m_outputLabel;
     QLabel *m_outputValue;
+    QLabel *m_outputDescription;
+    QLabel *m_outputSpacer;
 
     QGroupBox *m_channelBox;
     bool m_haveChannelBoxData;