rebase XMLProperties_New (c0d9bf9) to master

This commit is contained in:
Martin Marmsoler
2020-10-16 11:43:45 +02:00
committed by Martin Marmsoler
parent 73b394527d
commit f3097fc537
59 changed files with 1493 additions and 725 deletions

View File

@@ -32,15 +32,7 @@
- 17 colonnes affichees de 60.0 px de large pour 20.0px de haut
- 8 lignes affichees de 80.0 px de haut pour 20.0px de large
*/
BorderProperties::BorderProperties() :
columns_count(17),
columns_width(60.0),
columns_header_height(20.0),
display_columns(true),
rows_count(8),
rows_height(80.0),
rows_header_width(20.0),
display_rows(true)
BorderProperties::BorderProperties()
{
}
@@ -96,17 +88,21 @@ bool BorderProperties::operator!=(const BorderProperties &bp) {
XML element to which attributes will be added
\~French Element XML auquel seront ajoutes des attributs
*/
void BorderProperties::toXml(QDomElement &e) const
{
e.setAttribute("cols", columns_count);
e.setAttribute("colsize", QString("%1").arg(columns_width));
e.setAttribute("rows", rows_count);
e.setAttribute("rowsize", QString("%1").arg(rows_height));
e.setAttribute("displaycols", display_columns ? "true" : "false");
e.setAttribute("displayrows", display_rows ? "true" : "false");
QDomElement BorderProperties::toXml(QDomDocument &dom_doc) const {
QDomElement e = dom_doc.createElement("border");
e.appendChild(createXmlProperty(dom_doc, "cols", columns_count));
e.appendChild(createXmlProperty(dom_doc, "colsize", columns_width));
e.appendChild(createXmlProperty(dom_doc, "rows", rows_count));
e.appendChild(createXmlProperty(dom_doc, "rowsize", rows_height));
e.appendChild(createXmlProperty(dom_doc, "displayrows", display_rows));
e.appendChild(createXmlProperty(dom_doc, "displaycols", display_columns));
return e;
}
/**
/**RETURNS True
@brief BorderProperties::fromXml
Import dimensions from XML attributes of element e
\~French Importe les dimensions a partir des attributs XML de l'element e
@@ -115,13 +111,29 @@ void BorderProperties::toXml(QDomElement &e) const
XML element whose attributes will be read
\~French Element XML dont les attributs seront lus
*/
void BorderProperties::fromXml(QDomElement &e) {
if (e.hasAttribute("cols")) columns_count = e.attribute("cols").toInt();
if (e.hasAttribute("colsize")) columns_width = e.attribute("colsize").toInt();
if (e.hasAttribute("rows")) rows_count = e.attribute("rows").toInt();
if (e.hasAttribute("rowsize")) rows_height = e.attribute("rowsize").toInt();
if (e.hasAttribute("displaycols")) display_columns = e.attribute("displaycols") == "true";
if (e.hasAttribute("displayrows")) display_rows = e.attribute("displayrows") == "true";
bool BorderProperties::fromXml(const QDomElement &e) {
if (propertyInteger(e, "cols", &columns_count) == PropertyFlags::NoValidConversion ||
propertyDouble(e, "colsize", &columns_width) == PropertyFlags::NoValidConversion ||
propertyInteger(e, "rows", &rows_count) == PropertyFlags::NoValidConversion ||
propertyDouble(e, "rowsize", &rows_height) == PropertyFlags::NoValidConversion ||
propertyBool(e, "displaycols", &display_columns) == PropertyFlags::NoValidConversion ||
propertyBool(e, "displayrows", &display_rows) == PropertyFlags::NoValidConversion)
return false;
return true;
}
bool BorderProperties::valideXml(QDomElement& e) {
if (propertyInteger(e, "cols") == PropertyFlags::Success ||
propertyDouble(e, "colsize") == PropertyFlags::Success ||
propertyInteger(e, "rows") == PropertyFlags::Success ||
propertyDouble(e, "rowsize") == PropertyFlags::Success ||
propertyBool(e, "displaycols") == PropertyFlags::Success ||
propertyBool(e, "displayrows") == PropertyFlags::Success)
return true;
return false;
}
/**
@@ -155,7 +167,7 @@ void BorderProperties::toSettings(QSettings &settings, const QString &prefix) co
\~ @param prefix : prefix to be added before the names of the parameters
\~French prefixe a ajouter devant les noms des parametres
*/
void BorderProperties::fromSettings(QSettings &settings, const QString &prefix) {
void BorderProperties::fromSettings(const QSettings &settings, const QString &prefix) {
columns_count = settings.value(prefix + "cols", columns_count).toInt();
columns_width = qRound(settings.value(prefix + "colsize", columns_width).toDouble());
display_columns = settings.value(prefix + "displaycols", display_columns).toBool();