From 2044f05a69edfb8ff785b5d816bcb7f2742060b5 Mon Sep 17 00:00:00 2001 From: Peter Repukat Date: Fri, 11 Mar 2022 23:10:14 +0100 Subject: [PATCH] GlosSIConfig: Try looking into enumerating UWP-Apps; Use dummy entry as error display --- GlosSIConfig/UWPFetch.h | 17 +++++++++++++---- GlosSIConfig/qml/UWPSelectDialog.qml | 8 ++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/GlosSIConfig/UWPFetch.h b/GlosSIConfig/UWPFetch.h index 7399851..feddd63 100644 --- a/GlosSIConfig/UWPFetch.h +++ b/GlosSIConfig/UWPFetch.h @@ -1,7 +1,7 @@ #pragma once -#include #include +#include #include #include @@ -31,13 +31,14 @@ QVariantList UWPAppList() QProcess proc; proc.setProgram("powershell.exe"); QStringList args; + args.push_back("-noprofile"); args.push_back("-ExecutionPolicy"); - args.push_back("Unrestricted"); + args.push_back("Bypass"); args.push_back("-File"); args.push_back(".\\GetAUMIDs.ps1"); proc.setArguments(args); proc.start(); - proc.waitForFinished(300000000); + proc.waitForFinished(60000); const auto baseList = QString(proc.readAllStandardOutput()).split(";"); QVariantList list; for (const auto& entry : baseList) { @@ -52,7 +53,6 @@ QVariantList UWPAppList() uwpPair.insert("Path", subList[1]); uwpPair.insert("AppUMId", subList[3]); - QString icoFName = subList[2]; std::filesystem::path icoPath(icoFName.toStdString()); @@ -72,6 +72,15 @@ QVariantList UWPAppList() list.push_back(uwpPair); } + if (list.empty()) { + auto stderrstr = proc.readAllStandardError(); + auto stdoutstr = proc.readAllStandardOutput(); + list.emplaceBack(QVariantMap{ + {"AppName", "Error executing \"GetAUMIDs.ps1\""}, + {"Path", ""}, + {"AppUMId", QString::number(proc.error()) + ":" + stderrstr}, + }); + } return list; } diff --git a/GlosSIConfig/qml/UWPSelectDialog.qml b/GlosSIConfig/qml/UWPSelectDialog.qml index 9f6fcdb..d450b04 100644 --- a/GlosSIConfig/qml/UWPSelectDialog.qml +++ b/GlosSIConfig/qml/UWPSelectDialog.qml @@ -168,11 +168,11 @@ Dialog { delegate: Item { width: listview.width - height: 72 + height: textcolumn.implicitHeight > 72 ? 500 : 72 Image { id: maybeIcon - width: 56 + width: textcolumn.implicitHeight > 72 ? 0 : 56 height: 56 anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter @@ -182,6 +182,7 @@ Dialog { } Column { + id: textcolumn anchors.left: maybeIcon.right anchors.right: parent.right anchors.leftMargin: 16 @@ -193,8 +194,11 @@ Dialog { font.bold: true } Label { + id: umidLabel text: modelData.AppUMId font.pixelSize: 12 + wrapMode: Text.WordWrap + width: parent.width } }