comparison 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
comparison
equal deleted inserted replaced
10:8f5b812baaee 11:2d5005f2b3d9
1776 .arg(m_frequencyScale); 1776 .arg(m_frequencyScale);
1777 1777
1778 return Layer::toXmlString(indent, extraAttributes + " " + s); 1778 return Layer::toXmlString(indent, extraAttributes + " " + s);
1779 } 1779 }
1780 1780
1781 void
1782 SpectrogramLayer::setProperties(const QXmlAttributes &attributes)
1783 {
1784 bool ok = false;
1785
1786 int channel = attributes.value("channel").toInt(&ok);
1787 if (ok) setChannel(channel);
1788
1789 size_t windowSize = attributes.value("windowSize").toUInt(&ok);
1790 if (ok) setWindowSize(windowSize);
1791
1792 WindowType windowType = (WindowType)
1793 attributes.value("windowType").toInt(&ok);
1794 if (ok) setWindowType(windowType);
1795
1796 size_t windowOverlap = attributes.value("windowOverlap").toUInt(&ok);
1797 if (ok) setWindowOverlap(windowOverlap);
1798
1799 float gain = attributes.value("gain").toFloat(&ok);
1800 if (ok) setGain(gain);
1801
1802 size_t maxFrequency = attributes.value("maxFrequency").toUInt(&ok);
1803 if (ok) setMaxFrequency(maxFrequency);
1804
1805 ColourScale colourScale = (ColourScale)
1806 attributes.value("colourScale").toInt(&ok);
1807 if (ok) setColourScale(colourScale);
1808
1809 ColourScheme colourScheme = (ColourScheme)
1810 attributes.value("colourScheme").toInt(&ok);
1811 if (ok) setColourScheme(colourScheme);
1812
1813 FrequencyScale frequencyScale = (FrequencyScale)
1814 attributes.value("frequencyScale").toInt(&ok);
1815 if (ok) setFrequencyScale(frequencyScale);
1816 }
1817
1818
1781 #ifdef INCLUDE_MOCFILES 1819 #ifdef INCLUDE_MOCFILES
1782 #include "SpectrogramLayer.moc.cpp" 1820 #include "SpectrogramLayer.moc.cpp"
1783 #endif 1821 #endif
1784 1822