changeset 185:dd932fe5f3ff

* Fix failure to reload play mute state correctly from session file * Ensure Show and Play buttons in layer property box are initialised with the correct state
author Chris Cannam
date Fri, 05 Jan 2007 14:46:45 +0000
parents 3a6fea0abf56
children 8dd247c4c5f1
files widgets/PropertyBox.cpp widgets/PropertyBox.h widgets/PropertyStack.cpp
diffstat 3 files changed, 21 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/widgets/PropertyBox.cpp	Wed Dec 13 15:53:23 2006 +0000
+++ b/widgets/PropertyBox.cpp	Fri Jan 05 14:46:45 2007 +0000
@@ -45,7 +45,8 @@
 //#define DEBUG_PROPERTY_BOX 1
 
 PropertyBox::PropertyBox(PropertyContainer *container) :
-    m_container(container)
+    m_container(container),
+    m_showButton(0)
 {
 #ifdef DEBUG_PROPERTY_BOX
     std::cerr << "PropertyBox[" << this << "(\"" <<
@@ -140,11 +141,11 @@
 	layout->addWidget(showLabel);
 	layout->setAlignment(showLabel, Qt::AlignVCenter);
 
-	LEDButton *showButton = new LEDButton(Qt::blue);
-	layout->addWidget(showButton);
-	connect(showButton, SIGNAL(stateChanged(bool)),
+	m_showButton = new LEDButton(Qt::blue);
+	layout->addWidget(m_showButton);
+	connect(m_showButton, SIGNAL(stateChanged(bool)),
 		this, SIGNAL(showLayer(bool)));
-	layout->setAlignment(showButton, Qt::AlignVCenter);
+	layout->setAlignment(m_showButton, Qt::AlignVCenter);
     }
     
     if (params) {
@@ -154,6 +155,7 @@
 	layout->setAlignment(playLabel, Qt::AlignVCenter);
 
 	LEDButton *playButton = new LEDButton(Qt::darkGreen);
+        playButton->setState(!params->isPlayMuted());
 	layout->addWidget(playButton);
 	connect(playButton, SIGNAL(stateChanged(bool)),
 		params, SLOT(setPlayAudible(bool)));
@@ -574,7 +576,12 @@
 
     params->setPlayPluginConfiguration(configurationXml);
 }    
-    
+
+void
+PropertyBox::layerVisibilityChanged(bool visible)
+{
+    if (m_showButton) m_showButton->setState(visible);
+}
     
 
 #ifdef INCLUDE_MOCFILES
--- a/widgets/PropertyBox.h	Wed Dec 13 15:53:23 2006 +0000
+++ b/widgets/PropertyBox.h	Fri Jan 05 14:46:45 2007 +0000
@@ -26,6 +26,7 @@
 class QGridLayout;
 class QVBoxLayout;
 class QLabel;
+class LEDButton;
 
 class PropertyBox : public QFrame
 {
@@ -47,6 +48,7 @@
 public slots:
     void propertyContainerPropertyChanged(PropertyContainer *);
     void pluginConfigurationChanged(QString);
+    void layerVisibilityChanged(bool);
 
 protected slots:
     void propertyControllerChanged(int);
@@ -71,6 +73,7 @@
     PropertyContainer *m_container;
     QFrame *m_viewPlayFrame;
     QVBoxLayout *m_mainBox;
+    LEDButton *m_showButton;
     std::map<QString, QLayout *> m_groupLayouts;
     std::map<QString, QWidget *> m_propertyControllers;
 };
--- a/widgets/PropertyStack.cpp	Wed Dec 13 15:53:23 2006 +0000
+++ b/widgets/PropertyStack.cpp	Fri Jan 05 14:46:45 2007 +0000
@@ -79,6 +79,11 @@
 
 	connect(box, SIGNAL(showLayer(bool)), this, SLOT(showLayer(bool)));
 
+        Layer *layer = dynamic_cast<Layer *>(container);
+        if (layer) {
+            box->layerVisibilityChanged(!layer->isLayerDormant(m_client));
+        }
+
 	QIcon icon(QString(":/icons/%1.png").arg(iconName));
 	if (icon.isNull()) {
 	    addTab(box, name);