Skip to content

Commit

Permalink
GlosSIConfig: Try looking into enumerating UWP-Apps; Use dummy entry …
Browse files Browse the repository at this point in the history
…as error display
  • Loading branch information
Alia5 committed Apr 8, 2022
1 parent b23d320 commit 2044f05
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
17 changes: 13 additions & 4 deletions GlosSIConfig/UWPFetch.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <QVariant>
#include <QProcess>
#include <QVariant>
#include <QVariantMap>

#include <VersionHelpers.h>
Expand Down Expand Up @@ -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) {
Expand All @@ -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());

Expand All @@ -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;
}

Expand Down
8 changes: 6 additions & 2 deletions GlosSIConfig/qml/UWPSelectDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -182,6 +182,7 @@ Dialog {
}

Column {
id: textcolumn
anchors.left: maybeIcon.right
anchors.right: parent.right
anchors.leftMargin: 16
Expand All @@ -193,8 +194,11 @@ Dialog {
font.bold: true
}
Label {
id: umidLabel
text: modelData.AppUMId
font.pixelSize: 12
wrapMode: Text.WordWrap
width: parent.width
}
}

Expand Down

0 comments on commit 2044f05

Please sign in to comment.