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,23 +138,33 @@
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="iconBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>5</number>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
<property name="rightMargin">
<number>5</number>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
<item row="0" column="0">
<widget class="QPushButton" name="iconBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_2">