mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Revert "Merge branch 'XMLPropertiesNew'"
**Break a lot of thing.** This reverts commit1db1800572, reversing changes made to4c563821e8.
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "borderproperties.h"
|
||||
#include "qetxml.h"
|
||||
|
||||
/**
|
||||
@brief BorderProperties::BorderProperties
|
||||
@@ -26,14 +25,22 @@
|
||||
Initializes a BorderProperties object
|
||||
with the following default properties:
|
||||
- 17 columns of 60.0 px wide by 20.0px high
|
||||
- 8 lines of 80.0 px high by 20.0px wide
|
||||
- 8 lines of 80.0 px high by 20.0px wide
|
||||
|
||||
\~French Initialise un objet BorderProperties avec les proprietes par
|
||||
defaut suivantes :
|
||||
- 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
|
||||
- 8 lignes affichees de 80.0 px de haut pour 20.0px de large
|
||||
*/
|
||||
BorderProperties::BorderProperties(): PropertiesInterface("border")
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -81,7 +88,7 @@ bool BorderProperties::operator!=(const BorderProperties &bp) {
|
||||
}
|
||||
|
||||
/**
|
||||
@brief BorderProperties::toXmlPriv
|
||||
@brief BorderProperties::toXml
|
||||
Exports dimensions as XML attributes added to element e.
|
||||
\~French Exporte les dimensions sous formes d'attributs XML ajoutes a l'element e.
|
||||
|
||||
@@ -89,17 +96,18 @@ bool BorderProperties::operator!=(const BorderProperties &bp) {
|
||||
XML element to which attributes will be added
|
||||
\~French Element XML auquel seront ajoutes des attributs
|
||||
*/
|
||||
void BorderProperties::toXmlPriv(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");
|
||||
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");
|
||||
}
|
||||
|
||||
/*!RETURNS True
|
||||
@brief BorderProperties::fromXmlPriv
|
||||
/**
|
||||
@brief BorderProperties::fromXml
|
||||
Import dimensions from XML attributes of element e
|
||||
\~French Importe les dimensions a partir des attributs XML de l'element e
|
||||
|
||||
@@ -107,29 +115,13 @@ void BorderProperties::toXmlPriv(QDomElement& e) const {
|
||||
XML element whose attributes will be read
|
||||
\~French Element XML dont les attributs seront lus
|
||||
*/
|
||||
bool BorderProperties::fromXmlPriv(const QDomElement &e) {
|
||||
|
||||
if (QETXML::propertyInteger(e, "cols", &columns_count) == QETXML::PropertyFlags::NoValidConversion ||
|
||||
QETXML::propertyDouble(e, "colsize", &columns_width) == QETXML::PropertyFlags::NoValidConversion ||
|
||||
QETXML::propertyInteger(e, "rows", &rows_count) == QETXML::PropertyFlags::NoValidConversion ||
|
||||
QETXML::propertyDouble(e, "rowsize", &rows_height) == QETXML::PropertyFlags::NoValidConversion ||
|
||||
QETXML::propertyBool(e, "displaycols", &display_columns) == QETXML::PropertyFlags::NoValidConversion ||
|
||||
QETXML::propertyBool(e, "displayrows", &display_rows) == QETXML::PropertyFlags::NoValidConversion)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BorderProperties::valideXml(QDomElement& e) {
|
||||
|
||||
if (QETXML::propertyInteger(e, "cols") == QETXML::PropertyFlags::Success ||
|
||||
QETXML::propertyDouble(e, "colsize") == QETXML::PropertyFlags::Success ||
|
||||
QETXML::propertyInteger(e, "rows") == QETXML::PropertyFlags::Success ||
|
||||
QETXML::propertyDouble(e, "rowsize") == QETXML::PropertyFlags::Success ||
|
||||
QETXML::propertyBool(e, "displaycols") == QETXML::PropertyFlags::Success ||
|
||||
QETXML::propertyBool(e, "displayrows") == QETXML::PropertyFlags::Success)
|
||||
return true;
|
||||
return false;
|
||||
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";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,11 +138,11 @@ bool BorderProperties::valideXml(QDomElement& e) {
|
||||
*/
|
||||
void BorderProperties::toSettings(QSettings &settings, const QString &prefix) const
|
||||
{
|
||||
settings.setValue(prefix + "cols", columns_count);
|
||||
settings.setValue(prefix + "colsize", columns_width);
|
||||
settings.setValue(prefix + "cols", columns_count);
|
||||
settings.setValue(prefix + "colsize", columns_width);
|
||||
settings.setValue(prefix + "displaycols", display_columns);
|
||||
settings.setValue(prefix + "rows", rows_count);
|
||||
settings.setValue(prefix + "rowsize", rows_height);
|
||||
settings.setValue(prefix + "rows", rows_count);
|
||||
settings.setValue(prefix + "rowsize", rows_height);
|
||||
settings.setValue(prefix + "displayrows", display_rows);
|
||||
}
|
||||
|
||||
@@ -164,13 +156,13 @@ void BorderProperties::toSettings(QSettings &settings, const QString &prefix) co
|
||||
\~French prefixe a ajouter devant les noms des parametres
|
||||
*/
|
||||
void BorderProperties::fromSettings(QSettings &settings, const QString &prefix) {
|
||||
columns_count = settings.value(prefix + "cols", columns_count).toInt();
|
||||
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();
|
||||
display_columns = settings.value(prefix + "displaycols", display_columns).toBool();
|
||||
|
||||
rows_count = settings.value(prefix + "rows", rows_count).toInt();
|
||||
rows_height = qRound(settings.value(prefix + "rowsize", rows_height).toDouble());
|
||||
display_rows = settings.value(prefix + "displayrows", display_rows).toBool();
|
||||
rows_count = settings.value(prefix + "rows", rows_count).toInt();
|
||||
rows_height = qRound(settings.value(prefix + "rowsize", rows_height).toDouble());
|
||||
display_rows = settings.value(prefix + "displayrows", display_rows).toBool();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user