summaryrefslogtreecommitdiffstats
path: root/heimdall
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--heimdall-frontend/source/FirmwareInfo.cpp4
-rw-r--r--heimdall-frontend/source/FirmwareInfo.h63
-rw-r--r--heimdall-frontend/source/main.cpp1
3 files changed, 63 insertions, 5 deletions
diff --git a/heimdall-frontend/source/FirmwareInfo.cpp b/heimdall-frontend/source/FirmwareInfo.cpp
index 193091e..194f19e 100644
--- a/heimdall-frontend/source/FirmwareInfo.cpp
+++ b/heimdall-frontend/source/FirmwareInfo.cpp
@@ -353,6 +353,10 @@ void FileInfo::WriteXml(QXmlStreamWriter& xml, const QString& filename) const
}
+void FirmwareInfo::Register(void)
+{
+ qmlRegisterType<FirmwareInfo>("HeimdallFrontend", 1, 0, "FirmwareInfo");
+}
FirmwareInfo::FirmwareInfo()
{
diff --git a/heimdall-frontend/source/FirmwareInfo.h b/heimdall-frontend/source/FirmwareInfo.h
index ea9555f..64bf2bc 100644
--- a/heimdall-frontend/source/FirmwareInfo.h
+++ b/heimdall-frontend/source/FirmwareInfo.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2010-2014 Benjamin Dobell, Glass Echidna
-
+
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
-
+
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
-
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -23,6 +23,7 @@
// Qt
#include <QFile>
+#include <QQmlListProperty>
#include <QString>
#include <QXmlStreamReader>
@@ -183,14 +184,14 @@ namespace HeimdallFrontend
Q_PROPERTY(QString url READ GetUrl)
Q_PROPERTY(QString donateUrl READ GetDonateUrl)
- Q_PROPERTY(QList<HeimdallFrontend::DeviceInfo *> deviceInfos READ GetDeviceInfos)
+ Q_PROPERTY(QQmlListProperty<HeimdallFrontend::DeviceInfo> deviceInfos READ GetDeviceInfosListProperty)
Q_PROPERTY(QString pitFilename READ GetPitFilename)
Q_PROPERTY(bool repartition READ GetRepartition)
Q_PROPERTY(bool noReboot READ GetNoReboot)
- Q_PROPERTY(QList<HeimdallFrontend::FileInfo *> fileInfos READ GetFileInfos)
+ Q_PROPERTY(QQmlListProperty<HeimdallFrontend::FileInfo> fileInfos READ GetFileInfosListProperty)
public:
@@ -218,6 +219,46 @@ namespace HeimdallFrontend
QList<FileInfo *> fileInfos;
+ static void DeviceInfoAppend(QQmlListProperty<DeviceInfo> *property, DeviceInfo *deviceInfo)
+ {
+ qobject_cast<FirmwareInfo *>(property->object)->deviceInfos.append(deviceInfo);
+ }
+
+ static int DeviceInfoCount(QQmlListProperty<DeviceInfo> *property)
+ {
+ return qobject_cast<FirmwareInfo *>(property->object)->deviceInfos.length();
+ }
+
+ static DeviceInfo *DeviceInfoAtIndex(QQmlListProperty<DeviceInfo> *property, int index)
+ {
+ return qobject_cast<FirmwareInfo *>(property->object)->deviceInfos[index];
+ }
+
+ static void DeviceInfoClearAll(QQmlListProperty<DeviceInfo> *property)
+ {
+ qobject_cast<FirmwareInfo *>(property->object)->deviceInfos.clear();
+ }
+
+ static void FileInfoAppend(QQmlListProperty<FileInfo> *property, FileInfo *fileInfo)
+ {
+ qobject_cast<FirmwareInfo *>(property->object)->fileInfos.append(fileInfo);
+ }
+
+ static int FileInfoCount(QQmlListProperty<FileInfo> *property)
+ {
+ return qobject_cast<FirmwareInfo *>(property->object)->fileInfos.length();
+ }
+
+ static FileInfo *FileInfoAtIndex(QQmlListProperty<FileInfo> *property, int index)
+ {
+ return qobject_cast<FirmwareInfo *>(property->object)->fileInfos[index];
+ }
+
+ static void FileInfoClearAll(QQmlListProperty<FileInfo> *property)
+ {
+ qobject_cast<FirmwareInfo *>(property->object)->fileInfos.clear();
+ }
+
public:
static void Register(void);
@@ -301,6 +342,12 @@ namespace HeimdallFrontend
return (deviceInfos);
}
+ QQmlListProperty<DeviceInfo> GetDeviceInfosListProperty(void)
+ {
+ return QQmlListProperty<DeviceInfo>{this, nullptr, &FirmwareInfo::DeviceInfoAppend, &FirmwareInfo::DeviceInfoCount,
+ &FirmwareInfo::DeviceInfoAtIndex, &FirmwareInfo::DeviceInfoClearAll};
+ }
+
const QString& GetPitFilename(void) const
{
return (pitFilename);
@@ -340,6 +387,12 @@ namespace HeimdallFrontend
{
return (fileInfos);
}
+
+ QQmlListProperty<FileInfo> GetFileInfosListProperty(void)
+ {
+ return QQmlListProperty<FileInfo>{this, nullptr, &FirmwareInfo::FileInfoAppend, &FirmwareInfo::FileInfoCount,
+ &FirmwareInfo::FileInfoAtIndex, &FirmwareInfo::FileInfoClearAll};
+ }
};
}
diff --git a/heimdall-frontend/source/main.cpp b/heimdall-frontend/source/main.cpp
index b86631c..add98a6 100644
--- a/heimdall-frontend/source/main.cpp
+++ b/heimdall-frontend/source/main.cpp
@@ -45,6 +45,7 @@ void registerQmlTypes()
DeviceInfo::Register();
PlatformInfo::Register();
FileInfo::Register();
+ FirmwareInfo::Register();
PackageData::Register();
}