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