changeset 1187:306c24eeab10 levelpanwidget

Moving around some UI bits
author Chris Cannam
date Thu, 15 Dec 2016 10:36:41 +0000
parents 8665e0ffa0d8
children 9907be1c4f89
files widgets/LevelPanToolButton.cpp widgets/LevelPanToolButton.h widgets/PropertyBox.cpp
diffstat 3 files changed, 55 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/widgets/LevelPanToolButton.cpp	Wed Dec 14 14:28:41 2016 +0000
+++ b/widgets/LevelPanToolButton.cpp	Thu Dec 15 10:36:41 2016 +0000
@@ -110,6 +110,13 @@
 }
 
 void
+LevelPanToolButton::setMonitoringLevels(float left, float right)
+{
+    m_lpw->setMonitoringLevels(left, right);
+    update();
+}
+
+void
 LevelPanToolButton::setIncludeMute(bool include)
 {
     m_lpw->setIncludeMute(include);
--- a/widgets/LevelPanToolButton.h	Wed Dec 14 14:28:41 2016 +0000
+++ b/widgets/LevelPanToolButton.h	Thu Dec 15 10:36:41 2016 +0000
@@ -47,6 +47,9 @@
     /// Set pan in the range [-1,1] -- will be rounded
     void setPan(float);
 
+    /// Set left and right peak monitoring levels in the range [0,1]
+    void setMonitoringLevels(float, float);
+    
     /// Specify whether the level range should include muting or not
     void setIncludeMute(bool);
 
--- a/widgets/PropertyBox.cpp	Wed Dec 14 14:28:41 2016 +0000
+++ b/widgets/PropertyBox.cpp	Thu Dec 15 10:36:41 2016 +0000
@@ -158,41 +158,23 @@
 #ifdef DEBUG_PROPERTY_BOX
     SVDEBUG << "PropertyBox::populateViewPlayFrame: container " << m_container << " (name " << m_container->getPropertyContainerName() << ") params " << params << endl;
 #endif
-
-    if (layer) {
-	QLabel *showLabel = new QLabel(tr("Show"));
-	layout->addWidget(showLabel);
-	layout->setAlignment(showLabel, Qt::AlignVCenter);
-
-	m_showButton = new LEDButton(Qt::blue);
-	layout->addWidget(m_showButton);
-	connect(m_showButton, SIGNAL(stateChanged(bool)),
-		this, SIGNAL(showLayer(bool)));
-        connect(m_showButton, SIGNAL(mouseEntered()),
-                this, SLOT(mouseEnteredWidget()));
-        connect(m_showButton, SIGNAL(mouseLeft()),
-                this, SLOT(mouseLeftWidget()));
-	layout->setAlignment(m_showButton, Qt::AlignVCenter);
-    }
     
     if (params) {
 
-	layout->insertStretch(-1, 10);
-
-        if (params->getPlayClipId() != "") {
-            NotifyingPushButton *playParamButton = new NotifyingPushButton;
-            playParamButton->setObjectName("playParamButton");
-            playParamButton->setIcon(IconLoader().load("faders"));
-            playParamButton->setFixedWidth(WidgetScale::scalePixelSize(24));
-            playParamButton->setFixedHeight(WidgetScale::scalePixelSize(24));
-            layout->addWidget(playParamButton);
-            connect(playParamButton, SIGNAL(clicked()),
-                    this, SLOT(editPlayParameters()));
-            connect(playParamButton, SIGNAL(mouseEntered()),
-                    this, SLOT(mouseEnteredWidget()));
-            connect(playParamButton, SIGNAL(mouseLeft()),
-                    this, SLOT(mouseLeftWidget()));
-        }
+        m_playButton = new NotifyingPushButton;
+        m_playButton->setCheckable(true);
+        m_playButton->setIcon(IconLoader().load("speaker"));
+        m_playButton->setChecked(!params->isPlayMuted());
+	layout->addWidget(m_playButton);
+	connect(m_playButton, SIGNAL(toggled(bool)),
+		this, SLOT(playAudibleButtonChanged(bool)));
+        connect(m_playButton, SIGNAL(mouseEntered()),
+                this, SLOT(mouseEnteredWidget()));
+        connect(m_playButton, SIGNAL(mouseLeft()),
+                this, SLOT(mouseLeftWidget()));
+	connect(params, SIGNAL(playAudibleChanged(bool)),
+		this, SLOT(playAudibleChanged(bool)));
+	layout->setAlignment(m_playButton, Qt::AlignVCenter);
 
         LevelPanToolButton *levelPan = new LevelPanToolButton;
         layout->addWidget(levelPan);
@@ -209,24 +191,39 @@
         connect(levelPan, SIGNAL(mouseLeft()),
                 this, SLOT(mouseLeftWidget()));
 
-        m_playButton = new NotifyingPushButton;
-        m_playButton->setCheckable(true);
-        m_playButton->setIcon(IconLoader().load("speaker"));
-        m_playButton->setChecked(!params->isPlayMuted());
-	layout->addWidget(m_playButton);
-	connect(m_playButton, SIGNAL(toggled(bool)),
-		this, SLOT(playAudibleButtonChanged(bool)));
-        connect(m_playButton, SIGNAL(mouseEntered()),
+        if (params->getPlayClipId() != "") {
+            NotifyingPushButton *playParamButton = new NotifyingPushButton;
+            playParamButton->setObjectName("playParamButton");
+            playParamButton->setIcon(IconLoader().load("faders"));
+            playParamButton->setFixedWidth(WidgetScale::scalePixelSize(24));
+            playParamButton->setFixedHeight(WidgetScale::scalePixelSize(24));
+            layout->addWidget(playParamButton);
+            connect(playParamButton, SIGNAL(clicked()),
+                    this, SLOT(editPlayParameters()));
+            connect(playParamButton, SIGNAL(mouseEntered()),
+                    this, SLOT(mouseEnteredWidget()));
+            connect(playParamButton, SIGNAL(mouseLeft()),
+                    this, SLOT(mouseLeftWidget()));
+        }
+    }
+
+    layout->insertStretch(-1, 10);
+
+    if (layer) {
+
+	QLabel *showLabel = new QLabel(tr("Show"));
+	layout->addWidget(showLabel);
+	layout->setAlignment(showLabel, Qt::AlignVCenter);
+
+	m_showButton = new LEDButton(Qt::blue);
+	layout->addWidget(m_showButton);
+	connect(m_showButton, SIGNAL(stateChanged(bool)),
+		this, SIGNAL(showLayer(bool)));
+        connect(m_showButton, SIGNAL(mouseEntered()),
                 this, SLOT(mouseEnteredWidget()));
-        connect(m_playButton, SIGNAL(mouseLeft()),
+        connect(m_showButton, SIGNAL(mouseLeft()),
                 this, SLOT(mouseLeftWidget()));
-	connect(params, SIGNAL(playAudibleChanged(bool)),
-		this, SLOT(playAudibleChanged(bool)));
-	layout->setAlignment(m_playButton, Qt::AlignVCenter);
-
-    } else {
-
-	layout->insertStretch(-1, 10);
+	layout->setAlignment(m_showButton, Qt::AlignVCenter);
     }
 }