Mercurial > hg > svgui
diff layer/SpectrogramLayer.cpp @ 11:2d5005f2b3d9
* Rework handling of layer properties in file I/O -- we now get the individual
layers to load and save them rather than doing it via generic property lists
in the base class, so as to ensure we read and write meaningful values rather
than generic int values requiring conversion.
author | Chris Cannam |
---|---|
date | Thu, 19 Jan 2006 12:54:38 +0000 |
parents | 8f5b812baaee |
children | 01849cd277e6 |
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp Tue Jan 17 17:45:55 2006 +0000 +++ b/layer/SpectrogramLayer.cpp Thu Jan 19 12:54:38 2006 +0000 @@ -1778,6 +1778,44 @@ return Layer::toXmlString(indent, extraAttributes + " " + s); } +void +SpectrogramLayer::setProperties(const QXmlAttributes &attributes) +{ + bool ok = false; + + int channel = attributes.value("channel").toInt(&ok); + if (ok) setChannel(channel); + + size_t windowSize = attributes.value("windowSize").toUInt(&ok); + if (ok) setWindowSize(windowSize); + + WindowType windowType = (WindowType) + attributes.value("windowType").toInt(&ok); + if (ok) setWindowType(windowType); + + size_t windowOverlap = attributes.value("windowOverlap").toUInt(&ok); + if (ok) setWindowOverlap(windowOverlap); + + float gain = attributes.value("gain").toFloat(&ok); + if (ok) setGain(gain); + + size_t maxFrequency = attributes.value("maxFrequency").toUInt(&ok); + if (ok) setMaxFrequency(maxFrequency); + + ColourScale colourScale = (ColourScale) + attributes.value("colourScale").toInt(&ok); + if (ok) setColourScale(colourScale); + + ColourScheme colourScheme = (ColourScheme) + attributes.value("colourScheme").toInt(&ok); + if (ok) setColourScheme(colourScheme); + + FrequencyScale frequencyScale = (FrequencyScale) + attributes.value("frequencyScale").toInt(&ok); + if (ok) setFrequencyScale(frequencyScale); +} + + #ifdef INCLUDE_MOCFILES #include "SpectrogramLayer.moc.cpp" #endif