1 #include "DisplayProperties.h" 5 #include <QXmlStreamWriter> 9 #include "XmlStackedHandlerReader.h" 46 void DisplayProperties::fromPvl(
const PvlObject &pvl) {
49 QByteArray hexValues(pvl[
"Values"][0].toLatin1());
50 QDataStream valuesStream(QByteArray::fromHex(hexValues));
65 dataBuffer.open(QIODevice::ReadWrite);
67 QDataStream propsStream(&dataBuffer);
71 output +=
PvlKeyword(
"Values", QString(dataBuffer.data().toHex()));
103 emit supportAdded(property);
125 (*m_propertyValues)[property] = value;
128 emit propertyChanged(
this);
153 stream.writeStartElement(
"displayProperties");
155 stream.writeAttribute(
"displayName",
displayName());
159 dataBuffer.open(QIODevice::ReadWrite);
160 QDataStream propsStream(&dataBuffer);
164 stream.writeCharacters(dataBuffer.data().toHex());
166 stream.writeEndElement();
170 DisplayProperties::XmlHandler::XmlHandler(
DisplayProperties *displayProperties) {
171 m_displayProperties = displayProperties;
175 bool DisplayProperties::XmlHandler::startElement(
const QString &namespaceURI,
176 const QString &localName,
const QString &qName,
const QXmlAttributes &atts) {
177 if (XmlStackedHandler::startElement(namespaceURI, localName, qName, atts)) {
178 if (localName ==
"displayProperties") {
191 bool DisplayProperties::XmlHandler::characters(
const QString &ch) {
194 return XmlStackedHandler::characters(ch);
198 bool DisplayProperties::XmlHandler::endElement(
const QString &namespaceURI,
199 const QString &localName,
const QString &qName) {
200 if (localName ==
"displayProperties") {
201 QByteArray hexValues(m_hexData.toLatin1());
202 QDataStream valuesStream(QByteArray::fromHex(hexValues));
203 valuesStream >> *m_displayProperties->m_propertyValues;
206 return XmlStackedHandler::endElement(namespaceURI, localName, qName);
bool supports(int property)
Support may come later, please make sure you are connected to the supportAdded signal.
The main project for ipce.
File name manipulation and expansion.
QString m_displayName
This is the display name.
PvlObject toPvl() const
Convert to Pvl for project files.
QVariant getValue(int property) const
Get a property's associated data.
QString displayName() const
Returns the display name.
void setDisplayName(QString displayName)
Sets display name.
virtual ~DisplayProperties()
destructor
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Output format:
QMap< int, QVariant > * m_propertyValues
This is a map from Property to value – the reason I use an int is so Qt knows how to serialize this ...
A single keyword-value pair.
virtual void pushContentHandler(XmlStackedHandler *newHandler)
Push a contentHandler and maybe continue parsing...
void setValue(int prop, QVariant value)
This is the generic mutator for properties.
DisplayProperties(QString displayName, QObject *parent=NULL)
DisplayProperties constructor.
void addSupport(int property)
Call this with every property you support, otherwise they will not communicate properly between widge...
int m_propertiesUsed
This indicated whether any widgets with this DisplayProperties is using a particulay property...
Adds specific functionality to C++ strings.
Namespace for ISIS/Bullet specific routines.
Contains Pvl Groups and Pvl Objects.
Manage a stack of content handlers for reading XML files.