diff options
author | Benjamin Dobell <benjamin.dobell+git@glassechidna.com.au> | 2015-03-11 18:01:41 +0100 |
---|---|---|
committer | Benjamin Dobell <benjamin.dobell+git@glassechidna.com.au> | 2015-03-11 18:09:40 +0100 |
commit | 7c6ee7f1a24faeafc793414e877bf014743d9cfe (patch) | |
tree | 805b7839234bae16eeac75f33c471e7ee22f0c0f /heimdall-frontend/source/FirmwareInfo.cpp | |
parent | Lots of Frontend refactoring with a few bug fixes (diff) | |
download | Heimdall-7c6ee7f1a24faeafc793414e877bf014743d9cfe.tar Heimdall-7c6ee7f1a24faeafc793414e877bf014743d9cfe.tar.gz Heimdall-7c6ee7f1a24faeafc793414e877bf014743d9cfe.tar.bz2 Heimdall-7c6ee7f1a24faeafc793414e877bf014743d9cfe.tar.lz Heimdall-7c6ee7f1a24faeafc793414e877bf014743d9cfe.tar.xz Heimdall-7c6ee7f1a24faeafc793414e877bf014743d9cfe.tar.zst Heimdall-7c6ee7f1a24faeafc793414e877bf014743d9cfe.zip |
Diffstat (limited to 'heimdall-frontend/source/FirmwareInfo.cpp')
-rw-r--r-- | heimdall-frontend/source/FirmwareInfo.cpp | 43 |
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(); |