From 69e5b77f091e2b080dd1faea370567d4c6502076 Mon Sep 17 00:00:00 2001 From: uncor3 Date: Fri, 22 May 2026 11:50:33 +0000 Subject: [PATCH] refactor: replace PNG icons with SVGs in FileExplorer, FilesSection, and Toolbox --- src/ui/FileExplorer.qml | 54 ++++++++---------- src/ui/FilesSection.qml | 25 ++++---- src/ui/Toolbox.qml | 122 ++++++++++++++++++++++++++++------------ 3 files changed, 118 insertions(+), 83 deletions(-) diff --git a/src/ui/FileExplorer.qml b/src/ui/FileExplorer.qml index c035801..146aa9c 100644 --- a/src/ui/FileExplorer.qml +++ b/src/ui/FileExplorer.qml @@ -188,8 +188,8 @@ Item { var name = names[i] var isDir = !!entries[name] var iconSource = isDir - ? "qrc:/resources/icons/MaterialSymbolsFolder.png" - : "qrc:/resources/icons/IcBaselineInsertDriveFile.png" + ? "qrc:/resources/icons/material-symbols_folder.svg" + : "qrc:/resources/icons/ic_baseline-insert-drive-file.svg" var item = { "name": name, "isDir": isDir, "iconSource": iconSource } if (isDir) dirs.push(item); else files.push(item) } @@ -255,11 +255,10 @@ Item { contentItem: Item { anchors.fill: parent - IconImage { + Button { anchors.fill: parent - source: "qrc:/resources/icons/MaterialSymbolsArrowLeftAlt.png" + icon.source: "qrc:/resources/icons/material-symbols_arrow-left-alt.png" // FIXME:theming - color: "black" opacity: backBtn.enabled ? 1.0 : 0.7 } } @@ -279,11 +278,10 @@ Item { contentItem: Item { anchors.fill: parent - IconImage { + Button { anchors.fill: parent - source: "qrc:/resources/icons/MaterialSymbolsArrowRightAlt.png" + icon.source: "qrc:/resources/icons/material-symbols_arrow-right-alt.svg" // FIXME:theming - color: "black" opacity: forwardBtn.enabled ? 1.0 : 0.7 } } @@ -302,11 +300,10 @@ Item { contentItem: Item { anchors.fill: parent - IconImage { + Button { anchors.fill: parent - source: "qrc:/resources/icons/MaterialSymbolsLightHome.png" + icon.source: "qrc:/resources/icons/material-symbols_home.svg" // FIXME:theming - color: "black" opacity: homeBtn.enabled ? 1.0 : 0.7 } } @@ -326,11 +323,10 @@ Item { contentItem: Item { anchors.fill: parent - IconImage { + Button { anchors.fill: parent - source: "qrc:/resources/icons/MaterialSymbolsArrowUpwardAltRounded.png" + icon.source: "qrc:/resources/icons/material-symbols_arrow-upward-rounded.png" // FIXME:theming - color: "black" opacity: upBtn.enabled ? 1.0 : 0.7 } } @@ -358,11 +354,10 @@ Item { contentItem: Item { anchors.fill: parent - IconImage { + Button { anchors.fill: parent - source: "qrc:/resources/icons/LetsIconsImport.png" + icon.source: "qrc:/resources/icons/lets-icons:import.svg" // FIXME:theming - color: "black" opacity: importBtn.enabled ? 1.0 : 0.7 } } @@ -381,11 +376,10 @@ Item { contentItem: Item { anchors.fill: parent - IconImage { + Button { anchors.fill: parent - source: "qrc:/resources/icons/PhExport.png" + icon.source: "qrc:/resources/icons/ph_export.svg" // FIXME:theming - color: "black" opacity: exportBtn.enabled ? 1.0 : 0.7 } } @@ -405,11 +399,10 @@ Item { contentItem: Item { anchors.fill: parent - IconImage { + Button { anchors.fill: parent - source: "qrc:/resources/icons/MaterialSymbolsDelete.png" + icon.source: "qrc:/resources/icons/material-symbols_delete.svg" // FIXME:theming - color: "black" opacity: deleteBtn.enabled ? 1.0 : 0.7 } } @@ -430,11 +423,10 @@ Item { contentItem: Item { anchors.fill: parent - IconImage { + Button { anchors.fill: parent - source: "qrc:/resources/icons/MaterialSymbolsFavorite.png" + icon.source: "qrc:/resources/icons/material-symbols_favorite.svg" // FIXME:theming - color: "black" opacity: favBtn.enabled ? 1.0 : 0.7 } } @@ -453,11 +445,10 @@ Item { contentItem: Item { anchors.fill: parent - IconImage { + Button { anchors.fill: parent - source: "qrc:/resources/icons/MaterialSymbolsLightKeyboardReturn.png" + icon.source: "qrc:/resources/icons/material-symbols_keyboard-return.svg" // FIXME:theming - color: "black" opacity: enterBtn.enabled ? 1.0 : 0.7 } } @@ -512,12 +503,11 @@ Item { onClicked: root._toggleSelected(row.entryPath, row.entryIsDir) } - IconImage { - source: model.iconSource + Button { + icon.source: model.iconSource Layout.preferredHeight: 34 Layout.preferredWidth: 34 // FIXME:theming - color: "black" opacity: 1.0 } diff --git a/src/ui/FilesSection.qml b/src/ui/FilesSection.qml index 832c377..9ea8ecb 100644 --- a/src/ui/FilesSection.qml +++ b/src/ui/FilesSection.qml @@ -89,14 +89,14 @@ Item { model: ListModel { id: sidebarModel - ListElement { kind: "header"; title: "Explorer"; icon: "qrc:/resources/icons/MaterialSymbolsFolder.png" } - ListElement { kind: "explorer"; title: "Default"; icon: "qrc:/resources/icons/MaterialSymbolsFolder.png"; afc2: false } - ListElement { kind: "explorer"; title: "Jailbroken (AFC2)"; icon: "qrc:/resources/icons/MaterialSymbolsFolder.png"; afc2: true } + ListElement { kind: "header"; title: "Explorer"; icon: "qrc:/resources/icons/material-symbols_folder.svg" } + ListElement { kind: "explorer"; title: "Default"; icon: "qrc:/resources/icons/material-symbols_folder.svg"; afc2: false } + ListElement { kind: "explorer"; title: "Jailbroken (AFC2)"; icon: "qrc:/resources/icons/material-symbols_folder.svg"; afc2: true } - ListElement { kind: "header"; title: "Common Places"; icon: "qrc:/resources/icons/MaterialSymbolsFavorite.png" } - ListElement { kind: "place"; title: "Pictures"; icon: "qrc:/resources/icons/MaterialSymbolsFolder.png"; path: "/DCIM"; afc2: false } + ListElement { kind: "header"; title: "Common Places"; icon: "qrc:/resources/icons/material-symbols_favorite.svg" } + ListElement { kind: "place"; title: "Pictures"; icon: "qrc:/resources/icons/material-symbols_folder.svg"; path: "/DCIM"; afc2: false } - ListElement { kind: "header"; title: "Favorite Places"; icon: "qrc:/resources/icons/MaterialSymbolsFavorite.png" } + ListElement { kind: "header"; title: "Favorite Places"; icon: "qrc:/resources/icons/material-symbols_favorite.svg" } } delegate: Item { @@ -119,15 +119,14 @@ Item { anchors.rightMargin: 10 spacing: 10 - IconImage { - id: icon + Image { source: model.icon Layout.preferredHeight: 34 Layout.preferredWidth: 34 // FIXME:theming - color: "black" + // color: "black" opacity: 1.0 } @@ -136,7 +135,6 @@ Item { text: qsTr(model.title) font.bold: row.isHeader elide: Text.ElideRight - color: "#111" } Text { @@ -189,20 +187,17 @@ Item { anchors.rightMargin: 10 spacing: 10 - IconImage { - source: "qrc:/resources/icons/MaterialSymbolsFolder.png" + Image { + source: "qrc:/resources/icons/material-symbols_folder.svg" Layout.preferredHeight: 34 Layout.preferredWidth: 34 // FIXME:theming - color: "black" - opacity: 1.0 } Text { Layout.fillWidth: true text: alias elide: Text.ElideRight - color: "#111" } Text { diff --git a/src/ui/Toolbox.qml b/src/ui/Toolbox.qml index a65c3a8..1fd150c 100644 --- a/src/ui/Toolbox.qml +++ b/src/ui/Toolbox.qml @@ -5,7 +5,6 @@ import QtQuick.Controls.impl import QtQuick.Dialogs import "." as App -// FIXME: handle window creation logic Item { id: root anchors.fill: parent @@ -18,36 +17,78 @@ Item { property string currentDeviceUdid: "" readonly property bool hasDevice: App.DeviceContext.devices && App.DeviceContext.devices.count > 0 + + function createComp(loc, args = {}) { + const comp = Qt.createComponent(loc) + if (comp.status === Component.Ready) { + const win = comp.createObject(root,args) + if (win !== null) { + win.show() + } else { + console.error("createObject failed:", comp.errorString()) + } + + } else if (comp.status === Component.Error) { + console.error("Component failed to load:", comp.errorString()) + } + } // 0 Airplayer, 1 VirtualLocation, 2 LiveScreen, 3 QueryMobileGestalt, 4 DeveloperDiskImages, // 5 WirelessGalleryImport, 6 iFuse, 7 CableInfo, 8 NetworkDevices, 9 MountDevImage, // 10 Restart, 11 Shutdown, 12 RecoveryMode, 13 EnableWifiConnections // signal toolClicked(int toolId, bool requiresDevice) function toolClicked(toolId, requiresDevice) { + const device = App.DeviceContext.getDevice(currentDeviceUdid) + if (requiresDevice) { + if (!device) { + console.log("DEVICE DISAPPERED") + return + } + } + + const createCompWrapped = (loc) => { + return createComp(loc, { + device, + udid: currentDeviceUdid + }) + } + switch (toolId) { case 0: const gl_plugin_loaded = AirplayImp.load_gst_gl() if (!gl_plugin_loaded) { - errorDialog.text = "Failed to load gst gl plugin, make sure you have your GPU drivers installed" + switch (Qt.platform.os) { + case "linux": + errorDialog.text = qsTr("Failed to load gst gl plugin, make sure you are using QT_QPA_PLATFORM=xcb env") + break; + case "windows": + errorDialog.text = qsTr("Failed to load gst gl plugin, make sure you can use OpenGL") + break; + case "macos": + // FIXME: + errorDialog.text = qsTr("FIXME?") + break; + default: + errorDialog.text = qsTr("Failed to load gst gl plugin") + + } errorDialog.open() return; } - const comp = Qt.createComponent("./tools/Airplay.qml") - if (comp.status === Component.Ready) { - const win = comp.createObject(null,{ - }) - if (win !== null) { - win.show() - } else { - console.error("createObject failed:", comp.errorString()) - } - - } else if (comp.status === Component.Error) { - console.error("Component failed to load:", comp.errorString()) - } - break; + createCompWrapped("./tools/Airplay.qml") + break; + case 1: + createCompWrapped("./tools/VirtualLocation.qml") + break; + case 3: + // FIXME: doesnt work iOS 17 and above + createCompWrapped("./tools/QueryMobileGestalt.qml") + break; + case 7: + createCompWrapped("./tools/CableInfo.qml") + break; default: console.log(`No tool for id ${toolId}`) @@ -64,7 +105,7 @@ Item { title: "Airplayer", description: "Cast your device screen", requiresDevice: false, - iconSource: "qrc:/resources/icons/MaterialSymbolsLightAirplayOutline.png", + iconSource: "qrc:/resources/icons/material-symbols_airplay-outline-rounded.svg", visible: true }, { @@ -72,7 +113,7 @@ Item { title: "Virtual Location", description: "Simulate GPS location on your device", requiresDevice: true, - iconSource: "qrc:/resources/icons/MaterialSymbolsLocationOnOutline.png", + iconSource: "qrc:/resources/icons/material-symbols_location-on-outline.svg", visible: true }, { @@ -80,7 +121,7 @@ Item { title: "Live Screen", description: "View device screen in real-time", requiresDevice: true, - iconSource: "qrc:/resources/icons/PepiconsPrintCellphoneEye.png", + iconSource: "qrc:/resources/icons/pepicons-print_cellphone-eye.svg", visible: true }, { @@ -88,7 +129,7 @@ Item { title: "Query Mobile Gestalt", description: "Query device hardware information", requiresDevice: true, - iconSource: "qrc:/resources/icons/StreamlineProgrammingBrowserSearchSearchWindowGlassAppCodeProgrammingQueryFindMagnifyingApps.png", + iconSource: "qrc:/resources/icons/streamline_programming-browser-search-search-window-glass-app-code-programming-query-find-magnifying-apps.svg", visible: true }, { @@ -96,7 +137,7 @@ Item { title: "Dev Disk Images", description: "Manage developer disk images", requiresDevice: false, - iconSource: "qrc:/resources/icons/TablerDatabaseExport.png", + iconSource: "qrc:/resources/icons/tabler_database-export.svg", visible: true }, { @@ -104,7 +145,7 @@ Item { title: "Wireless Gallery Import", description: "Import photos wirelessly to your iDevice (requires Shortcuts app)", requiresDevice: false, - iconSource: "qrc:/resources/icons/MaterialSymbolsAndroidWifi3BarPlus.png", + iconSource: "qrc:/resources/icons/material-symbols_android-wifi-3-bar-plus.svg", visible: true }, { @@ -120,7 +161,7 @@ Item { title: "Cable Info", description: "View detailed cable and connection info", requiresDevice: true, - iconSource: "qrc:/resources/icons/MaterialSymbolsLightCableRounded.png", + iconSource: "qrc:/resources/icons/material-symbols_cable-rounded.svg", visible: true }, { @@ -128,7 +169,7 @@ Item { title: "Network Devices", description: "Discover and monitor devices on your network", requiresDevice: false, - iconSource: "qrc:/resources/icons/StreamlineUltimateMultipleUsersNetwork.png", + iconSource: "qrc:/resources/icons/streamline_ultimate-multiple-users-network.svg", visible: true } ]) @@ -139,7 +180,7 @@ Item { title: "Mount Dev Image", description: "Mount a compatible device image with a single click", requiresDevice: true, - iconSource: "qrc:/resources/icons/MdiDisk.png", + iconSource: "qrc:/resources/icons/mdi_disk.svg", visible: true }, { @@ -147,7 +188,7 @@ Item { title: "Restart", description: "Restart device services", requiresDevice: true, - iconSource: "qrc:/resources/icons/IcTwotoneRestartAlt.png", + iconSource: "qrc:/resources/icons/ic_twotone-restart-alt.svg", visible: true }, { @@ -155,7 +196,7 @@ Item { title: "Shutdown", description: "Shut down the device", requiresDevice: true, - iconSource: "qrc:/resources/icons/IcOutlinePowerSettingsNew.png", + iconSource: "qrc:/resources/icons/ic_outline-power-settings-new.svg", visible: true }, { @@ -163,7 +204,7 @@ Item { title: "Recovery Mode", description: "Enter device recovery mode", requiresDevice: true, - iconSource: "qrc:/resources/icons/HugeiconsWrench01.png", + iconSource: "qrc:/resources/icons/hugeicons_wrench-01.svg", visible: true }, { @@ -171,7 +212,7 @@ Item { title: "Enable Wi-Fi Connections", description: "Make device connectable via Wi-Fi", requiresDevice: true, - iconSource: "qrc:/resources/icons/StreamlineFreehandChargingFlashWireless.png", + iconSource: "qrc:/resources/icons/streamline-freehand_charging-flash-wireless.svg", visible: true } ]) @@ -202,10 +243,22 @@ Item { valueRole: "udid" onActivated: (index) => { + console.log("ComboBox activated") const udid = deviceCombo.currentValue || "" root.currentDeviceUdid = udid root.deviceSelectionChanged(udid) } + + /* workaround to avoid connecting to deviceocntext signal*/ + onCountChanged: { + if (count > 0) { + const lastIndex = count - 1 + currentIndex = lastIndex + const udid = deviceCombo.valueAt(lastIndex) || "" + root.currentDeviceUdid = udid + root.deviceSelectionChanged(udid) + } + } } Item { Layout.fillWidth: true } @@ -221,7 +274,7 @@ Item { spacing: 14 Layout.margins: 0 - // Section: Tools + /* Section: Tools */ Label { text: "Tools" font.bold: true @@ -248,18 +301,16 @@ Item { requiresDevice: modelData.requiresDevice iconSource: modelData.iconSource - // Disabled state (dull look) enabled: !requiresDevice || root.hasDevice onClicked: { - // FIXME(connection-logic): implement actual routing / navigation. root.toolClicked(toolId, requiresDevice) } } } } - // Section: More Tools + /* More Tools */ Label { text: "More Tools" font.bold: true @@ -290,7 +341,6 @@ Item { enabled: !requiresDevice || root.hasDevice onClicked: { - // FIXME(connection-logic): implement actual routing / navigation. root.toolClicked(toolId, requiresDevice) } } @@ -342,7 +392,7 @@ Item { anchors.margins: 12 spacing: 12 - IconImage { + Image { id: icon source: tile.iconSource @@ -350,7 +400,7 @@ Item { Layout.preferredWidth: 34 // FIXME:theming - color: "black" + // color: "black" opacity: tile.enabled ? 1.0 : 0.7 }