comparison widgets/PropertyBox.cpp @ 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 42118892f428
children 5b7472db612b
comparison
equal deleted inserted replaced
184:3a6fea0abf56 185:dd932fe5f3ff
43 #include <cmath> 43 #include <cmath>
44 44
45 //#define DEBUG_PROPERTY_BOX 1 45 //#define DEBUG_PROPERTY_BOX 1
46 46
47 PropertyBox::PropertyBox(PropertyContainer *container) : 47 PropertyBox::PropertyBox(PropertyContainer *container) :
48 m_container(container) 48 m_container(container),
49 m_showButton(0)
49 { 50 {
50 #ifdef DEBUG_PROPERTY_BOX 51 #ifdef DEBUG_PROPERTY_BOX
51 std::cerr << "PropertyBox[" << this << "(\"" << 52 std::cerr << "PropertyBox[" << this << "(\"" <<
52 container->getPropertyContainerName().toStdString() << "\")]::PropertyBox" << std::endl; 53 container->getPropertyContainerName().toStdString() << "\")]::PropertyBox" << std::endl;
53 #endif 54 #endif
138 if (layer) { 139 if (layer) {
139 QLabel *showLabel = new QLabel(tr("Show")); 140 QLabel *showLabel = new QLabel(tr("Show"));
140 layout->addWidget(showLabel); 141 layout->addWidget(showLabel);
141 layout->setAlignment(showLabel, Qt::AlignVCenter); 142 layout->setAlignment(showLabel, Qt::AlignVCenter);
142 143
143 LEDButton *showButton = new LEDButton(Qt::blue); 144 m_showButton = new LEDButton(Qt::blue);
144 layout->addWidget(showButton); 145 layout->addWidget(m_showButton);
145 connect(showButton, SIGNAL(stateChanged(bool)), 146 connect(m_showButton, SIGNAL(stateChanged(bool)),
146 this, SIGNAL(showLayer(bool))); 147 this, SIGNAL(showLayer(bool)));
147 layout->setAlignment(showButton, Qt::AlignVCenter); 148 layout->setAlignment(m_showButton, Qt::AlignVCenter);
148 } 149 }
149 150
150 if (params) { 151 if (params) {
151 152
152 QLabel *playLabel = new QLabel(tr("Play")); 153 QLabel *playLabel = new QLabel(tr("Play"));
153 layout->addWidget(playLabel); 154 layout->addWidget(playLabel);
154 layout->setAlignment(playLabel, Qt::AlignVCenter); 155 layout->setAlignment(playLabel, Qt::AlignVCenter);
155 156
156 LEDButton *playButton = new LEDButton(Qt::darkGreen); 157 LEDButton *playButton = new LEDButton(Qt::darkGreen);
158 playButton->setState(!params->isPlayMuted());
157 layout->addWidget(playButton); 159 layout->addWidget(playButton);
158 connect(playButton, SIGNAL(stateChanged(bool)), 160 connect(playButton, SIGNAL(stateChanged(bool)),
159 params, SLOT(setPlayAudible(bool))); 161 params, SLOT(setPlayAudible(bool)));
160 connect(params, SIGNAL(playAudibleChanged(bool)), 162 connect(params, SIGNAL(playAudibleChanged(bool)),
161 playButton, SLOT(setState(bool))); 163 playButton, SLOT(setState(bool)));
572 PlayParameters *params = m_container->getPlayParameters(); 574 PlayParameters *params = m_container->getPlayParameters();
573 if (!params) return; 575 if (!params) return;
574 576
575 params->setPlayPluginConfiguration(configurationXml); 577 params->setPlayPluginConfiguration(configurationXml);
576 } 578 }
577 579
580 void
581 PropertyBox::layerVisibilityChanged(bool visible)
582 {
583 if (m_showButton) m_showButton->setState(visible);
584 }
578 585
579 586
580 #ifdef INCLUDE_MOCFILES 587 #ifdef INCLUDE_MOCFILES
581 #include "PropertyBox.moc.cpp" 588 #include "PropertyBox.moc.cpp"
582 #endif 589 #endif