mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 07:55:21 +01:00
Update main.qml
This commit is contained in:
parent
9d7aa12be8
commit
f5aa8a7f89
1 changed files with 28 additions and 1 deletions
29
src/main.qml
29
src/main.qml
|
@ -502,7 +502,7 @@ ApplicationWindow {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: qsTr("Raspberry Pi Device")
|
text: qsTr("Retro Handheld Device")
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.topMargin: 10
|
anchors.topMargin: 10
|
||||||
|
@ -553,6 +553,33 @@ ApplicationWindow {
|
||||||
matching_type: "exclusive"
|
matching_type: "exclusive"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Function to populate the model
|
||||||
|
Component.onCompleted: {
|
||||||
|
loadDevices();
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadDevices() {
|
||||||
|
deviceModel.clear(); // Clear existing entries if any
|
||||||
|
|
||||||
|
// Sample structure for accessing JSON data. Assuming jsonData is your loaded JSON.
|
||||||
|
var manufacturers = jsonData.imager.manufacturers;
|
||||||
|
|
||||||
|
// Iterate through each manufacturer and add its devices
|
||||||
|
for (var i = 0; i < manufacturers.length; i++) {
|
||||||
|
var manufacturer = manufacturers[i];
|
||||||
|
for (var j = 0; j < manufacturer.devices.length; j++) {
|
||||||
|
var device = manufacturer.devices[j];
|
||||||
|
deviceModel.append({
|
||||||
|
"name": device.name,
|
||||||
|
"tags": device.tags,
|
||||||
|
"icon": device.icon,
|
||||||
|
"description": manufacturer.name // Use manufacturer name if needed
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
currentIndex: -1
|
currentIndex: -1
|
||||||
delegate: hwdelegate
|
delegate: hwdelegate
|
||||||
anchors.top: hwpopup_title_separator.bottom
|
anchors.top: hwpopup_title_separator.bottom
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue