11#include <QXmlStreamWriter>
15#include "XmlStackedHandlerReader.h"
50 xmlReader->pushContentHandler(
new XmlHandler(
this));
101 emit supportAdded(prop);
139 while(red + green + blue < 300) {
141 green = rand() % 256;
145 return QColor(red, green, blue, 60);
157 stream.writeStartElement(
"displayProperties");
159 stream.writeAttribute(
"displayName",
displayName());
163 dataBuffer.open(QIODevice::ReadWrite);
164 QDataStream propsStream(&dataBuffer);
168 stream.writeCharacters(dataBuffer.data().toHex());
170 stream.writeEndElement();
207 QList<GuiCameraDisplayProperties *> displays =
senderToData(sender());
213 foreach(display, displays) {
244 const QString &localName,
const QString &qName,
const QXmlAttributes &atts) {
245 if (XmlStackedHandler::startElement(namespaceURI, localName, qName, atts)) {
246 if (localName ==
"displayProperties") {
272 return XmlStackedHandler::characters(ch);
288 const QString &localName,
const QString &qName) {
289 if (localName ==
"displayProperties") {
290 QByteArray hexValues(m_hexData.toLatin1());
291 QDataStream valuesStream(QByteArray::fromHex(hexValues));
292 valuesStream >> *m_displayProperties->m_propertyValues;
295 return XmlStackedHandler::endElement(namespaceURI, localName, qName);
309 (*m_propertyValues)[prop] = value;
312 emit propertyChanged(
this);
325 QList<GuiCameraDisplayProperties *> data;
329 QVariant callerData = caller->data();
331 if (callerData.canConvert< QList<GuiCameraDisplayProperties *> >() ) {
332 data = callerData.value< QList<GuiCameraDisplayProperties *> >();
This class is designed to serialize QColor in a human-readable form.
QString displayName() const
Returns the display name.
File name manipulation and expansion.
Process a GuiCameraDisplayProperties in a stack-oriented way.
virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
The XML reader invokes this method at the end of every element in the XML document.
GuiCameraDisplayProperties * m_displayProperties
An internal pointer to GuiCameraDisplayProperties object.
XmlHandler(GuiCameraDisplayProperties *displayProperties)
Sets the GuiCameraDisplayProperties variable pointer.
virtual bool characters(const QString &ch)
This implementation of a virtual function calls QXmlDefaultHandler::characters(QString &ch) which in ...
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
The XML reader invokes this method at the start of every element in the XML document.
The GUI communication mechanism for target body objects.
static QColor randomColor()
Creates and returns a random color for the intial color of the footprint polygon.
void setColor(QColor newColor)
Change the color associated with this target.
void setValue(Property prop, QVariant value)
This is the generic mutator for properties.
void toggleShowLabel()
Change the visibility of the display name.
Property
This is a list of properties and actions that are possible.
@ None
Null display property for bit-flag purposes.
@ ShowLabel
True if the control net should show its display name (bool)
@ Selected
The selection state of this control net (bool)
void setSelected(bool)
Change the selected state associated with this target.
bool supports(Property prop)
Support may come later, please make sure you are connected to the supportAdded signal.
static QList< GuiCameraDisplayProperties * > senderToData(QObject *sender)
This is for the slots that have a list of display properties as associated data.
Property m_propertiesUsed
This indicates whether any widgets with this DisplayProperties is using a particular property.
void addSupport(Property prop)
Call this with every property you support, otherwise they will not communicate properly between widge...
void setShowLabel(bool)
Change the visibility of the display name associated with this target.
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 Q...
virtual ~GuiCameraDisplayProperties()
destructor
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Write the Gui Camera Display Properties out to an XML file.
GuiCameraDisplayProperties(QString displayName, QObject *parent=NULL)
GuiCameraDisplayProperties constructor.
QVariant getValue(Property prop) const
Get a property's associated data.
The main project for ipce.
Manage a stack of content handlers for reading XML files.
This is free and unencumbered software released into the public domain.