Read terminal strip from xml

This commit is contained in:
joshua
2021-05-02 22:58:20 +02:00
parent 89f3ce1eb3
commit dbb21373e1
5 changed files with 135 additions and 10 deletions

View File

@@ -32,6 +32,7 @@
#include "ui/dialogwaiting.h"
#include "ui/importelementdialog.h"
#include "TerminalStrip/terminalstrip.h"
#include "qetxml.h"
#include <QHash>
#include <QStandardPaths>
@@ -1352,16 +1353,26 @@ void QETProject::readProjectXml(QDomDocument &xml_project)
}
m_data_base.blockSignals(true);
//Load the project-wide properties
readProjectPropertiesXml(xml_project);
//Load the default properties for the new diagrams
readDefaultPropertiesXml(xml_project);
//load the embedded titleblock templates
m_titleblocks_collection.fromXml(xml_project.documentElement());
//Load the embedded elements collection
readElementsCollectionXml(xml_project);
//Load the diagrams
readDiagramsXml(xml_project);
//Load the terminal strip
readTerminalStripXml(xml_project);
m_data_base.blockSignals(false);
m_data_base.updateDB();
@@ -1579,6 +1590,26 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
}
}
/**
* @brief QETProject::readTerminalStripXml
* Read the terminal strips of this project
* @param xml_project
*/
void QETProject::readTerminalStripXml(const QDomDocument &xml_project)
{
auto xml_elmt = xml_project.documentElement();
auto xml_strips = xml_elmt.firstChildElement(QStringLiteral("terminal_strips"));
if (!xml_strips.isNull())
{
for (auto xml_strip : QETXML::findInDomElement(xml_strips, TerminalStrip::xmlTagName()))
{
auto terminal_strip = new TerminalStrip(this);
terminal_strip->fromXml(xml_strip);
addTerminalStrip(terminal_strip);
}
}
}
/**
Export project properties under the \a xml_element XML element.
*/