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(); emit clearAppsLayout();
if(jsonParseSuccess == true) { 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(); QJsonArray jsonListArray = jsonDocument.object()["list"].toArray();
for(QJsonValueRef refJsonObject: jsonListArray) { for(QJsonValueRef refJsonObject: jsonListArray) {
QJsonObject appInfo = refJsonObject.toObject(); QJsonObject appInfo = refJsonObject.toObject();
@ -335,7 +335,8 @@ void apps::showUserApps(bool showDisabledJson)
} }
} }
else { 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->editUserAppsBtn->deleteLater();
ui->label_6->deleteLater(); ui->label_6->deleteLater();
@ -350,3 +351,7 @@ void apps::updateJsonFileSlot(QJsonDocument jsonDocumentFunc)
jsonDocument = jsonDocumentFunc; jsonDocument = jsonDocumentFunc;
emit updateJsonFileSignal(jsonDocument); 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(); bool parseJson();
void showUserApps(bool showDisabledJson); void showUserApps(bool showDisabledJson);
void updateJsonFileSlot(QJsonDocument jsonDocument); void updateJsonFileSlot(QJsonDocument jsonDocument);
void showFailedToParseMainUserAppsJsonFile();
private: private:
Ui::apps *ui; Ui::apps *ui;

View file

@ -14,6 +14,8 @@ userapps::userapps(QWidget *parent) :
ui->launchBtn->setProperty("type", "borderless"); ui->launchBtn->setProperty("type", "borderless");
ui->iconBtn->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->infoBtn->setProperty("type", "borderless");
ui->statusBtn->setProperty("type", "borderless"); ui->statusBtn->setProperty("type", "borderless");
ui->statusBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px"); ui->statusBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");

View file

@ -138,6 +138,14 @@
<item row="1" column="0"> <item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <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"> <widget class="QPushButton" name="iconBtn">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -156,6 +164,8 @@
</property> </property>
</widget> </widget>
</item> </item>
</layout>
</item>
<item> <item>
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">