Overridden properties of terminal elements are now saved/loaded from project

The overridden properties of terminal elements made in the terminal
strip dialog are now saved and loaded from/to the project file.
This commit is contained in:
joshua
2021-09-20 18:34:48 +02:00
parent 67dbc798aa
commit 377f8b1521
10 changed files with 125 additions and 29 deletions

View File

@@ -584,6 +584,50 @@ QVector<QDomElement> QETXML::findInDomElement(const QDomElement &dom_elmt, const
namespace QETXML {
/**
* @brief boolToString
* @param value
* @return \p value converted to string
*/
QString boolToString(bool value)
{
return value ? QStringLiteral("true") :
QStringLiteral("false");
}
/**
* @brief boolFromString return \p value converted to bool
* @param value : value to convert
* @param default_value : default value
* @param conv_ok : true if \p value is successfully converted
* @return
*/
bool boolFromString(const QString &value, bool default_value, bool *conv_ok)
{
if (value == QStringLiteral("true") ||
value == QStringLiteral("1")) {
if (conv_ok) {
*conv_ok = true;
}
return true;
}
if (value == QStringLiteral("false") ||
value == QStringLiteral("0")) {
if (conv_ok) {
*conv_ok = true;
}
return false;
}
if(conv_ok) {
*conv_ok = false;
}
return default_value;
}
PropertyFlags debugReadXml(PropertyFlags flag, const QDomElement &e, const QString& attribute_name, const QString& attr, const QString& type)
{
if (flag == QETXML::PropertyFlags::NoValidConversion)
@@ -873,7 +917,7 @@ bool validXmlProperty(const QDomElement& e) {
if (!e.hasAttribute("value"))
return false;
return true;
return true;
}
}