Mercurial > hg > easaier-soundaccess
view sv/filter/Filter.cpp @ 224:d2dff2170c7a
correct bug: when creating a new session, the PropertyBox of the filters stayed.
author | lbajardsilogic |
---|---|
date | Tue, 12 Feb 2008 15:06:02 +0000 |
parents | c413e82a4812 |
children | 3200ed3fc957 |
line wrap: on
line source
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ /* Sound Access EASAIER client application. Silogic 2007. Laure Bajard. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See the file COPYING included with this distribution for more information. */ #include "Filter.h" Filter::Filter() : QObject(), m_sourceChannelCount(0), filterEnabled(false) {} Filter::~Filter() { while (!m_filterCollection.empty()) { std::vector<PropertyContainer*>::iterator iter = m_filterCollection.begin(); PropertyContainer* filterElt = *(iter); if (filterElt) { emit propertyContainerRemoved(filterElt->objectName()); delete filterElt; filterElt = 0; } m_filterCollection.erase(iter); } } bool Filter::isFilterEnabled() const { return filterEnabled; } void Filter::setFilterEnabled(bool b){ filterEnabled=b; } void Filter::setFilterEnabled(int b){ filterEnabled=(bool)b; } QString Filter::toEasaierXmlString(QString indent, QString extraAttributes) const { QString s; int enable = isFilterEnabled(); s += indent + QString("<filter name=\"%1\" enable=\"%2\" ").arg(objectName()).arg(enable); /* PropertyContainer::PropertyList propertyList = getProperties(); for(int i=0; i< ((int) propertyList.size());i++) { int min, max, deflt; int value = getPropertyRangeAndValue(propertyList[i], &min, &max, &deflt); s += propertyList[i] + QString("=\"%1\" ").arg(value); } */ s += QString(" %1 />\n").arg(extraAttributes); return s; } void Filter::setProperties(const QXmlAttributes &attributes) { int enable = attributes.value("enable").toInt(); setFilterEnabled(enable); emit filterEnableChange(enable); /* PropertyContainer::PropertyList propertyList = getProperties(); int value; for(int i=0; i< ((int) propertyList.size());i++) { value = attributes.value(propertyList[i]).toInt(); setProperty(propertyList[i], value); } emit propertiesChanged(this);*/ }