summaryrefslogtreecommitdiffstats
path: root/heimdall-frontend/source/FirmwareInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'heimdall-frontend/source/FirmwareInfo.cpp')
-rw-r--r--heimdall-frontend/source/FirmwareInfo.cpp43
1 files changed, 35 insertions, 8 deletions
diff --git a/heimdall-frontend/source/FirmwareInfo.cpp b/heimdall-frontend/source/FirmwareInfo.cpp
index 7a1043c..193091e 100644
--- a/heimdall-frontend/source/FirmwareInfo.cpp
+++ b/heimdall-frontend/source/FirmwareInfo.cpp
@@ -19,7 +19,7 @@
THE SOFTWARE.*/
// Qt
-#include "QRegExp"
+#include <QtQml>
// Heimdall Frontend
#include "Alerts.h"
@@ -28,6 +28,11 @@
using namespace HeimdallFrontend;
+void DeviceInfo::Register(void)
+{
+ qmlRegisterType<DeviceInfo>("HeimdallFrontend", 1, 0, "DeviceInfo");
+}
+
DeviceInfo::DeviceInfo()
{
}
@@ -141,6 +146,10 @@ void DeviceInfo::WriteXml(QXmlStreamWriter& xml) const
}
+void PlatformInfo::Register(void)
+{
+ qmlRegisterType<PlatformInfo>("HeimdallFrontend", 1, 0, "PlatformInfo");
+}
PlatformInfo::PlatformInfo()
{
@@ -244,6 +253,10 @@ void PlatformInfo::WriteXml(QXmlStreamWriter& xml) const
}
+void FileInfo::Register(void)
+{
+ qmlRegisterType<FileInfo>("HeimdallFrontend", 1, 0, "FileInfo");
+}
FileInfo::FileInfo()
{
@@ -347,6 +360,20 @@ FirmwareInfo::FirmwareInfo()
noReboot = false;
}
+
+FirmwareInfo::~FirmwareInfo()
+{
+ for (DeviceInfo *deviceInfo : deviceInfos)
+ {
+ delete deviceInfo;
+ }
+
+ for (FileInfo *fileInfo : fileInfos)
+ {
+ delete fileInfo;
+ }
+}
+
void FirmwareInfo::Clear(void)
{
name = "";
@@ -549,9 +576,9 @@ bool FirmwareInfo::ParseXml(QXmlStreamReader& xml)
{
if (xml.name() == "device")
{
- DeviceInfo deviceInfo;
+ DeviceInfo *deviceInfo = new DeviceInfo{};
- if (!deviceInfo.ParseXml(xml))
+ if (!deviceInfo->ParseXml(xml))
return (false);
deviceInfos.append(deviceInfo);
@@ -631,9 +658,9 @@ bool FirmwareInfo::ParseXml(QXmlStreamReader& xml)
{
if (xml.name() == "file")
{
- FileInfo fileInfo;
+ FileInfo *fileInfo = new FileInfo{};
- if (!fileInfo.ParseXml(xml))
+ if (!fileInfo->ParseXml(xml))
return (false);
fileInfos.append(fileInfo);
@@ -745,9 +772,9 @@ void FirmwareInfo::WriteXml(QXmlStreamWriter& xml) const
xml.writeStartElement("devices");
- for (const DeviceInfo& deviceInfo : deviceInfos)
+ for (const DeviceInfo *deviceInfo : deviceInfos)
{
- deviceInfo.WriteXml(xml);
+ deviceInfo->WriteXml(xml);
}
xml.writeEndElement();
@@ -775,7 +802,7 @@ void FirmwareInfo::WriteXml(QXmlStreamWriter& xml) const
for (int i = 0; i < fileInfos.length(); i++)
{
- fileInfos[i].WriteXml(xml, Packaging::ClashlessFilename(fileInfos, i));
+ fileInfos[i]->WriteXml(xml, Packaging::ClashlessFilename(fileInfos, i));
}
xml.writeEndElement();