save/load conductor text for the 3 kinds of conductor

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2820 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun 2014-02-07 14:45:43 +00:00
parent 7a5bcb14ba
commit b51d71f897

View File

@ -233,13 +233,15 @@ ConductorProperties::ConductorProperties() :
ConductorProperties::~ConductorProperties() { ConductorProperties::~ConductorProperties() {
} }
/** /**
Exporte les parametres du conducteur sous formes d'attributs XML * @brief ConductorProperties::toXml
ajoutes a l'element e. * Export conductor propertie, in the XML element 'e'
@param e Element XML auquel seront ajoutes des attributs * @param e the xml element
*/ */
void ConductorProperties::toXml(QDomElement &e) const { void ConductorProperties::toXml(QDomElement &e) const {
e.setAttribute("type", typeToString(type)); e.setAttribute("type", typeToString(type));
e.setAttribute("num", text);
if (color != QColor(Qt::black)) { if (color != QColor(Qt::black)) {
e.setAttribute("color", color.name()); e.setAttribute("color", color.name());
@ -248,7 +250,6 @@ void ConductorProperties::toXml(QDomElement &e) const {
if (type == Single) { if (type == Single) {
singleLineProperties.toXml(e); singleLineProperties.toXml(e);
} else if (type == Multi) { } else if (type == Multi) {
e.setAttribute("num", text);
e.setAttribute("numsize", text_size); e.setAttribute("numsize", text_size);
e.setAttribute("vertirotatetext", verti_rotate_text); e.setAttribute("vertirotatetext", verti_rotate_text);
e.setAttribute("horizrotatetext", horiz_rotate_text); e.setAttribute("horizrotatetext", horiz_rotate_text);
@ -260,13 +261,14 @@ void ConductorProperties::toXml(QDomElement &e) const {
} }
} }
/** /**
Importe les parametres du conducteur unifilaire a partir des attributs XML * @brief ConductorProperties::fromXml
de l'element e * Import conductor propertie, from the attribute of the xml element 'e'
@param e Element XML dont les attributs seront lus * @param e the xml document
*/ */
void ConductorProperties::fromXml(QDomElement &e) { void ConductorProperties::fromXml(QDomElement &e) {
// recupere la couleur du conducteur // get conductor color
QColor xml_color= QColor(e.attribute("color")); QColor xml_color= QColor(e.attribute("color"));
if (xml_color.isValid()) { if (xml_color.isValid()) {
color = xml_color; color = xml_color;
@ -274,18 +276,18 @@ void ConductorProperties::fromXml(QDomElement &e) {
color = QColor(Qt::black); color = QColor(Qt::black);
} }
// lit le style du conducteur // read style of conductor
readStyle(e.attribute("style")); readStyle(e.attribute("style"));
// qet text field
text = e.attribute("num");
if (e.attribute("type") == typeToString(Single)) { if (e.attribute("type") == typeToString(Single)) {
// recupere les parametres specifiques a un conducteur unifilaire // get specific properties for single conductor
singleLineProperties.fromXml(e); singleLineProperties.fromXml(e);
type = Single; type = Single;
} else if (e.attribute("type") == typeToString(Simple)) { } else if (e.attribute("type") == typeToString(Simple)) {
type = Simple; type = Simple;
} else { } else {
// recupere le champ de texte
text = e.attribute("num");
text_size = e.attribute("numsize", QString::number(9)).toInt(); text_size = e.attribute("numsize", QString::number(9)).toInt();
verti_rotate_text = e.attribute("vertirotatetext").toDouble(); verti_rotate_text = e.attribute("vertirotatetext").toDouble();
horiz_rotate_text = e.attribute("horizrotatetext").toDouble(); horiz_rotate_text = e.attribute("horizrotatetext").toDouble();