GlosSIConfig: Try looking into enumerating UWP-Apps; Use dummy entry as error display

pull/169/head
Peter Repukat 2 years ago
parent b23d32052e
commit 2044f05a69

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <QVariant>
#include <QProcess> #include <QProcess>
#include <QVariant>
#include <QVariantMap> #include <QVariantMap>
#include <VersionHelpers.h> #include <VersionHelpers.h>
@ -31,13 +31,14 @@ QVariantList UWPAppList()
QProcess proc; QProcess proc;
proc.setProgram("powershell.exe"); proc.setProgram("powershell.exe");
QStringList args; QStringList args;
args.push_back("-noprofile");
args.push_back("-ExecutionPolicy"); args.push_back("-ExecutionPolicy");
args.push_back("Unrestricted"); args.push_back("Bypass");
args.push_back("-File"); args.push_back("-File");
args.push_back(".\\GetAUMIDs.ps1"); args.push_back(".\\GetAUMIDs.ps1");
proc.setArguments(args); proc.setArguments(args);
proc.start(); proc.start();
proc.waitForFinished(300000000); proc.waitForFinished(60000);
const auto baseList = QString(proc.readAllStandardOutput()).split(";"); const auto baseList = QString(proc.readAllStandardOutput()).split(";");
QVariantList list; QVariantList list;
for (const auto& entry : baseList) { for (const auto& entry : baseList) {
@ -52,7 +53,6 @@ QVariantList UWPAppList()
uwpPair.insert("Path", subList[1]); uwpPair.insert("Path", subList[1]);
uwpPair.insert("AppUMId", subList[3]); uwpPair.insert("AppUMId", subList[3]);
QString icoFName = subList[2]; QString icoFName = subList[2];
std::filesystem::path icoPath(icoFName.toStdString()); std::filesystem::path icoPath(icoFName.toStdString());
@ -72,6 +72,15 @@ QVariantList UWPAppList()
list.push_back(uwpPair); 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; return list;
} }

@ -168,11 +168,11 @@ Dialog {
delegate: Item { delegate: Item {
width: listview.width width: listview.width
height: 72 height: textcolumn.implicitHeight > 72 ? 500 : 72
Image { Image {
id: maybeIcon id: maybeIcon
width: 56 width: textcolumn.implicitHeight > 72 ? 0 : 56
height: 56 height: 56
anchors.left: parent.left anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -182,6 +182,7 @@ Dialog {
} }
Column { Column {
id: textcolumn
anchors.left: maybeIcon.right anchors.left: maybeIcon.right
anchors.right: parent.right anchors.right: parent.right
anchors.leftMargin: 16 anchors.leftMargin: 16
@ -193,8 +194,11 @@ Dialog {
font.bold: true font.bold: true
} }
Label { Label {
id: umidLabel
text: modelData.AppUMId text: modelData.AppUMId
font.pixelSize: 12 font.pixelSize: 12
wrapMode: Text.WordWrap
width: parent.width
} }
} }

Loading…
Cancel
Save