GUI user applications: small fixes

This commit is contained in:
Nicolas Mailloux 2022-06-18 10:05:03 -04:00
parent 0cf2bca0d3
commit c5ec3f3560
4 changed files with 35 additions and 17 deletions

View file

@ -317,7 +317,7 @@ void apps::showUserApps(bool showDisabledJson)
emit clearAppsLayout();
if(jsonParseSuccess == true) {
QString function = __func__; log(function + ": JSON is valid", className);
QString function = __func__; log(function + ": Main user applications' JSON is valid", className);
QJsonArray jsonListArray = jsonDocument.object()["list"].toArray();
for(QJsonValueRef refJsonObject: jsonListArray) {
QJsonObject appInfo = refJsonObject.toObject();
@ -335,7 +335,8 @@ void apps::showUserApps(bool showDisabledJson)
}
}
else {
QString function = __func__; log(function + ": JSON is invalid", className);
QString function = __func__; log(function + ": Main user applications' JSON file is invalid", className);
QTimer::singleShot(500, this, SLOT(showFailedToParseMainUserAppsJsonFile()));
ui->editUserAppsBtn->deleteLater();
ui->label_6->deleteLater();
@ -350,3 +351,7 @@ void apps::updateJsonFileSlot(QJsonDocument jsonDocumentFunc)
jsonDocument = jsonDocumentFunc;
emit updateJsonFileSignal(jsonDocument);
}
void apps::showFailedToParseMainUserAppsJsonFile() {
emit showToast("Failed to parse 'apps.json'");
}

1
apps.h
View file

@ -39,6 +39,7 @@ private slots:
bool parseJson();
void showUserApps(bool showDisabledJson);
void updateJsonFileSlot(QJsonDocument jsonDocument);
void showFailedToParseMainUserAppsJsonFile();
private:
Ui::apps *ui;

View file

@ -14,6 +14,8 @@ userapps::userapps(QWidget *parent) :
ui->launchBtn->setProperty("type", "borderless");
ui->iconBtn->setProperty("type", "borderless");
ui->iconBtn->setStyleSheet("QPushButton[type='borderless']:pressed { background: white; color: white; border: none; }");
ui->infoBtn->setProperty("type", "borderless");
ui->statusBtn->setProperty("type", "borderless");
ui->statusBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");

View file

@ -138,6 +138,14 @@
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<item row="0" column="0">
<widget class="QPushButton" name="iconBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -156,6 +164,8 @@
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">