comparison layer/WaveformLayer.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
766 .arg(m_aggressive); 766 .arg(m_aggressive);
767 767
768 return Layer::toXmlString(indent, extraAttributes + " " + s); 768 return Layer::toXmlString(indent, extraAttributes + " " + s);
769 } 769 }
770 770
771 void
772 WaveformLayer::setProperties(const QXmlAttributes &attributes)
773 {
774 bool ok = false;
775
776 float gain = attributes.value("gain").toFloat(&ok);
777 if (ok) setGain(gain);
778
779 QString colourSpec = attributes.value("colour");
780 if (colourSpec != "") {
781 QColor colour(colourSpec);
782 if (colour.isValid()) {
783 setBaseColour(QColor(colourSpec));
784 }
785 }
786
787 bool showMeans = (attributes.value("showMeans") == "1" ||
788 attributes.value("showMeans") == "true");
789 setShowMeans(showMeans);
790
791 bool greyscale = (attributes.value("greyscale") == "1" ||
792 attributes.value("greyscale") == "true");
793 setUseGreyscale(greyscale);
794
795 ChannelMode channelMode = (ChannelMode)
796 attributes.value("channelMode").toInt(&ok);
797 if (ok) setChannelMode(channelMode);
798
799 int channel = attributes.value("channel").toInt(&ok);
800 if (ok) setChannel(channel);
801
802 Scale scale = (Scale)
803 attributes.value("scale").toInt(&ok);
804 if (ok) setScale(scale);
805
806 bool aggressive = (attributes.value("aggressive") == "1" ||
807 attributes.value("aggressive") == "true");
808 setUseGreyscale(aggressive);
809 }
810
771 #ifdef INCLUDE_MOCFILES 811 #ifdef INCLUDE_MOCFILES
772 #include "WaveformLayer.moc.cpp" 812 #include "WaveformLayer.moc.cpp"
773 #endif 813 #endif
774 814