9 #include "DisplayProperties.h"
12 #include <QDataStream>
13 #include <QXmlStreamWriter>
17 #include "XmlStackedHandlerReader.h"
54 void DisplayProperties::fromPvl(
const PvlObject &pvl) {
57 QByteArray hexValues(pvl[
"Values"][0].toLatin1());
58 QDataStream valuesStream(QByteArray::fromHex(hexValues));
73 dataBuffer.open(QIODevice::ReadWrite);
75 QDataStream propsStream(&dataBuffer);
79 output +=
PvlKeyword(
"Values", QString(dataBuffer.data().toHex()));
111 emit supportAdded(property);
133 (*m_propertyValues)[property] = value;
136 emit propertyChanged(
this);
161 stream.writeStartElement(
"displayProperties");
163 stream.writeAttribute(
"displayName",
displayName());
167 dataBuffer.open(QIODevice::ReadWrite);
168 QDataStream propsStream(&dataBuffer);
172 stream.writeCharacters(dataBuffer.data().toHex());
174 stream.writeEndElement();
178 DisplayProperties::XmlHandler::XmlHandler(
DisplayProperties *displayProperties) {
179 m_displayProperties = displayProperties;
183 bool DisplayProperties::XmlHandler::startElement(
const QString &namespaceURI,
184 const QString &localName,
const QString &qName,
const QXmlAttributes &atts) {
185 if (XmlStackedHandler::startElement(namespaceURI, localName, qName, atts)) {
186 if (localName ==
"displayProperties") {
199 bool DisplayProperties::XmlHandler::characters(
const QString &ch) {
202 return XmlStackedHandler::characters(ch);
206 bool DisplayProperties::XmlHandler::endElement(
const QString &namespaceURI,
207 const QString &localName,
const QString &qName) {
208 if (localName ==
"displayProperties") {
209 QByteArray hexValues(m_hexData.toLatin1());
210 QDataStream valuesStream(QByteArray::fromHex(hexValues));
211 valuesStream >> *m_displayProperties->m_propertyValues;
214 return XmlStackedHandler::endElement(namespaceURI, localName, qName);