changeset 441:f8fcfbe13c8f

* Avoid waiting on uninstalled transforms mutex in TransformFactory:: getTransformInstallStatus -- we can return TransformUnknown * Don't follow link in SelectableLabel when clicking to select it * Restore lost version number in plugin param dialog
author Chris Cannam
date Tue, 28 Oct 2008 18:06:06 +0000
parents 08d6bc698d16
children c803eb18ebba
files widgets/PluginParameterDialog.cpp widgets/SelectableLabel.cpp widgets/SelectableLabel.h widgets/TransformFinder.cpp
diffstat 4 files changed, 20 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/widgets/PluginParameterDialog.cpp	Tue Oct 28 12:39:53 2008 +0000
+++ b/widgets/PluginParameterDialog.cpp	Tue Oct 28 18:06:06 2008 +0000
@@ -79,8 +79,8 @@
     QLabel *makerLabel = new QLabel(plugin->getMaker().c_str());
     makerLabel->setWordWrap(true);
 
-    QLabel *versionLabel = new QLabel(QString("%1")
-                                      .arg(plugin->getPluginVersion()));
+    int version = plugin->getPluginVersion();
+    QLabel *versionLabel = new QLabel(QString("%1").arg(version));
     versionLabel->setWordWrap(true);
 
     QLabel *copyrightLabel = new QLabel(plugin->getCopyright().c_str());
@@ -121,16 +121,12 @@
         row++;
     }
 
-    Vamp::Plugin *fePlugin = dynamic_cast<Vamp::Plugin *>(m_plugin);
-
-    if (fePlugin) {
+    if (version >= 0) {
         label = new QLabel(tr("Version:"));
         label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
         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:"));
--- a/widgets/SelectableLabel.cpp	Tue Oct 28 12:39:53 2008 +0000
+++ b/widgets/SelectableLabel.cpp	Tue Oct 28 18:06:06 2008 +0000
@@ -26,6 +26,7 @@
 //    setLineWidth(2);
 //    setFixedWidth(480);
     setupStyle();
+    setOpenExternalLinks(true);
 }
 
 SelectableLabel::~SelectableLabel()
@@ -59,6 +60,10 @@
 {
     QPalette palette = QApplication::palette();
 
+    setTextInteractionFlags(Qt::LinksAccessibleByKeyboard |
+                            Qt::LinksAccessibleByMouse |
+                            Qt::TextSelectableByMouse);
+
     if (m_selected) {
         setWordWrap(true);
         setStyleSheet
@@ -77,8 +82,6 @@
              .arg(palette.button().color().name())
              .arg(palette.light().color().name())
              .arg(palette.text().color().name()));
-
-//        setStyleSheet("QLabel:hover { background: #e0e0e0; color: black; } QLabel:!hover { background: white; color: black } QLabel { padding: 7px }");
     }
 }    
 
@@ -105,18 +108,27 @@
 void
 SelectableLabel::mousePressEvent(QMouseEvent *e)
 {
+    m_swallowRelease = !m_selected;
     setSelected(true);
+    QLabel::mousePressEvent(e);
     emit selectionChanged();
 }
 
 void
 SelectableLabel::mouseDoubleClickEvent(QMouseEvent *e)
 {
-    std::cerr << "mouseDoubleClickEvent" << std::endl;
+    QLabel::mouseDoubleClickEvent(e);
     emit doubleClicked();
 }
 
 void
+SelectableLabel::mouseReleaseEvent(QMouseEvent *e)
+{
+    if (!m_swallowRelease) QLabel::mouseReleaseEvent(e);
+    m_swallowRelease = false;
+}
+
+void
 SelectableLabel::enterEvent(QEvent *)
 {
 //    std::cerr << "enterEvent" << std::endl;
--- a/widgets/SelectableLabel.h	Tue Oct 28 12:39:53 2008 +0000
+++ b/widgets/SelectableLabel.h	Tue Oct 28 18:06:06 2008 +0000
@@ -41,6 +41,7 @@
 
 protected:
     virtual void mousePressEvent(QMouseEvent *e);
+    virtual void mouseReleaseEvent(QMouseEvent *e);
     virtual void mouseDoubleClickEvent(QMouseEvent *e);
     virtual void enterEvent(QEvent *);
     virtual void leaveEvent(QEvent *);
@@ -48,6 +49,7 @@
     QString m_selectedText;
     QString m_unselectedText;
     bool m_selected;
+    bool m_swallowRelease;
 };
 
 #endif
--- a/widgets/TransformFinder.cpp	Tue Oct 28 12:39:53 2008 +0000
+++ b/widgets/TransformFinder.cpp	Tue Oct 28 18:06:06 2008 +0000
@@ -234,10 +234,6 @@
                     SLOT(accept()));
             QPalette palette = label->palette();
             label->setPalette(palette);
-            label->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard |
-                                           Qt::LinksAccessibleByMouse |
-                                           Qt::TextSelectableByMouse);
-            label->setOpenExternalLinks(true);
             m_labels.push_back(label);
         }