Mercurial > hg > svgui
changeset 47:2e2ad8510e52
* Fix a crash in PortAudio output for mono data
* Don't construct a chromagram in TonalChangeDetect plugin ctor
* Update layer show/hide/dormancy for multi-view-capable layers -- the
dormancy concept doesn't really work with these constraints any more
author | Chris Cannam |
---|---|
date | Fri, 03 Mar 2006 17:52:21 +0000 |
parents | 2152e19d7db9 |
children | 97b0643bd799 |
files | layer/SpectrogramLayer.cpp layer/SpectrogramLayer.h widgets/PropertyBox.cpp widgets/PropertyBox.h widgets/PropertyStack.cpp widgets/PropertyStack.h |
diffstat | 6 files changed, 39 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp Fri Mar 03 17:23:27 2006 +0000 +++ b/layer/SpectrogramLayer.cpp Fri Mar 03 17:52:21 2006 +0000 @@ -798,14 +798,15 @@ } void -SpectrogramLayer::setLayerDormant(const bool dormant) +SpectrogramLayer::setLayerDormant(const View *v, bool dormant) { - if (dormant == m_dormant) return; + QMutexLocker locker(&m_mutex); + + if (dormant == m_dormancy[v]) return; if (dormant) { - m_mutex.lock(); - m_dormant = true; + m_dormancy[v] = true; // delete m_cache; // m_cache = 0; @@ -815,12 +816,9 @@ delete m_pixmapCache; m_pixmapCache = 0; - m_mutex.unlock(); - } else { - m_dormant = false; - fillCache(); + m_dormancy[v] = false; } } @@ -1272,8 +1270,13 @@ // std::cerr << "SpectrogramLayer::CacheFillThread::run in loop" << std::endl; - if (m_layer.m_dormant) { - +/*!!! Need a way of finding out whether this layer is dormant in + all the views that are currently visible... or not + + if (m_layer.m_dormancy[) { +*/ + if (0) { //!!! + if (m_layer.m_cacheInvalid) { delete m_layer.m_cache; m_layer.m_cache = 0; @@ -1695,7 +1698,7 @@ return; } - if (m_dormant) { + if (isLayerDormant(v)) { std::cerr << "SpectrogramLayer::paint(): Layer is dormant" << std::endl; return; }
--- a/layer/SpectrogramLayer.h Fri Mar 03 17:23:27 2006 +0000 +++ b/layer/SpectrogramLayer.h Fri Mar 03 17:52:21 2006 +0000 @@ -179,7 +179,7 @@ void setProperties(const QXmlAttributes &attributes); - virtual void setLayerDormant(const bool dormant); + virtual void setLayerDormant(const View *v, bool dormant); protected slots: void cacheInvalid();
--- a/widgets/PropertyBox.cpp Fri Mar 03 17:23:27 2006 +0000 +++ b/widgets/PropertyBox.cpp Fri Mar 03 17:52:21 2006 +0000 @@ -123,8 +123,8 @@ LEDButton *showButton = new LEDButton(Qt::blue); layout->addWidget(showButton); -//!!! connect(showButton, SIGNAL(stateChanged(bool)), -// layer, SLOT(showLayer(bool))); + connect(showButton, SIGNAL(stateChanged(bool)), + this, SIGNAL(showLayer(bool))); layout->setAlignment(showButton, Qt::AlignVCenter); }
--- a/widgets/PropertyBox.h Fri Mar 03 17:23:27 2006 +0000 +++ b/widgets/PropertyBox.h Fri Mar 03 17:52:21 2006 +0000 @@ -35,6 +35,7 @@ void changePlayGainDial(int); void changePlayPan(float); void changePlayPanDial(int); + void showLayer(bool); public slots: void propertyContainerPropertyChanged(PropertyContainer *);
--- a/widgets/PropertyStack.cpp Fri Mar 03 17:23:27 2006 +0000 +++ b/widgets/PropertyStack.cpp Fri Mar 03 17:52:21 2006 +0000 @@ -11,6 +11,7 @@ #include "PropertyBox.h" #include "base/PropertyContainer.h" #include "base/View.h" +#include "base/Layer.h" #include <QIcon> #include <QTabWidget> @@ -70,6 +71,8 @@ PropertyBox *box = new PropertyBox(container); + connect(box, SIGNAL(showLayer(bool)), this, SLOT(showLayer(bool))); + QIcon icon(QString(":/icons/%1.png").arg(iconName)); if (icon.isNull()) { addTab(box, name); @@ -138,6 +141,22 @@ } void +PropertyStack::showLayer(bool show) +{ + QObject *obj = sender(); + + for (unsigned int i = 0; i < m_boxes.size(); ++i) { + if (obj == m_boxes[i]) { + Layer *layer = dynamic_cast<Layer *>(m_boxes[i]->getContainer()); + if (layer) { + layer->showLayer(m_client, show); + return; + } + } + } +} + +void PropertyStack::selectedContainerChanged(int n) { if (n >= int(m_boxes.size())) return;
--- a/widgets/PropertyStack.h Fri Mar 03 17:23:27 2006 +0000 +++ b/widgets/PropertyStack.h Fri Mar 03 17:52:21 2006 +0000 @@ -38,6 +38,8 @@ void propertyContainerPropertyChanged(PropertyContainer *); void propertyContainerNameChanged(PropertyContainer *); + void showLayer(bool); + protected slots: void selectedContainerChanged(int);