mirror of
https://github.com/Quill-OS/quill.git
synced 2024-10-31 21:33:22 -07:00
GUI user applications: More improvements
This commit is contained in:
parent
c5ec3f3560
commit
99a145d5ee
6 changed files with 115 additions and 105 deletions
42
apps.cpp
42
apps.cpp
|
@ -35,6 +35,8 @@ apps::apps(QWidget *parent) :
|
|||
ui->reversiLaunchBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
|
||||
ui->g2048LaunchBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
|
||||
|
||||
ui->noUserAppsAvailableLabel->hide();
|
||||
|
||||
// Hiding KoBox apps button and label if X11 isn't enabled/wasn't started
|
||||
if(checkconfig("/external_root/boot/flags/X11_START") == false or checkconfig("/external_root/boot/flags/X11_STARTED") == false) {
|
||||
ui->label_5->hide();
|
||||
|
@ -68,6 +70,7 @@ apps::apps(QWidget *parent) :
|
|||
}
|
||||
|
||||
ui->editUserAppsBtn->setProperty("type", "borderless");
|
||||
ui->editUserAppsBtn->setIcon(QIcon(":/resources/edit.png"));
|
||||
|
||||
// Refresh because Qt shows the scrollbar for one second then hides it, leaving a mark on the eInk screen
|
||||
QTimer::singleShot(1750, this, SLOT(refreshScreenNative()));
|
||||
|
@ -294,9 +297,12 @@ void apps::on_editUserAppsBtn_clicked()
|
|||
// Settings page
|
||||
showUserApps(userAppsSecondPage);
|
||||
emit showUserAppsEdit(userAppsSecondPage);
|
||||
|
||||
QTimer::singleShot(500, this, SLOT(refreshScreenNative()));
|
||||
}
|
||||
else {
|
||||
userAppsSecondPage = false;
|
||||
userAppsAvailable = false;
|
||||
// Launch page
|
||||
|
||||
// It changed via updateJsonFileSlot, and now it writes it only once
|
||||
|
@ -308,7 +314,7 @@ void apps::on_editUserAppsBtn_clicked()
|
|||
showUserApps(userAppsSecondPage);
|
||||
emit showUserAppsEdit(userAppsSecondPage);
|
||||
|
||||
QTimer::singleShot(1000, this, SLOT(refreshScreenNative()));
|
||||
QTimer::singleShot(500, this, SLOT(refreshScreenNative()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -319,20 +325,28 @@ void apps::showUserApps(bool showDisabledJson)
|
|||
if(jsonParseSuccess == true) {
|
||||
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();
|
||||
if(appInfo["Enabled"].toBool() == true or showDisabledJson == true) {
|
||||
userapps * newUserApp = new userapps;
|
||||
newUserApp->provideInfo(appInfo);
|
||||
connect(this, SIGNAL(clearAppsLayout()), newUserApp, SLOT(deleteLater()));
|
||||
connect(this, SIGNAL(showUserAppsEdit(bool)), newUserApp, SLOT(changePageEnabling(bool)));
|
||||
connect(this, SIGNAL(updateJsonFileSignal(QJsonDocument)), newUserApp, SLOT(updateJsonFileSlotUA(QJsonDocument)));
|
||||
connect(newUserApp, SIGNAL(updateJsonFileSignalUA(QJsonDocument)), this, SLOT(updateJsonFileSlot(QJsonDocument)));
|
||||
newUserApp->jsonDocument = jsonDocument;
|
||||
newUserApp->jsonFilePath = jsonFile.fileName();
|
||||
ui->verticalLayout_4UserApps->addWidget(newUserApp);
|
||||
}
|
||||
for(QJsonValueRef refJsonObject: jsonListArray) {
|
||||
QJsonObject appInfo = refJsonObject.toObject();
|
||||
if(appInfo["Enabled"].toBool() == true or showDisabledJson == true) {
|
||||
userAppsAvailable = true;
|
||||
userapps * newUserApp = new userapps;
|
||||
newUserApp->provideInfo(appInfo);
|
||||
connect(this, SIGNAL(clearAppsLayout()), newUserApp, SLOT(deleteLater()));
|
||||
connect(this, SIGNAL(showUserAppsEdit(bool)), newUserApp, SLOT(changePageEnabling(bool)));
|
||||
connect(this, SIGNAL(updateJsonFileSignal(QJsonDocument)), newUserApp, SLOT(updateJsonFileSlotUA(QJsonDocument)));
|
||||
connect(newUserApp, SIGNAL(updateJsonFileSignalUA(QJsonDocument)), this, SLOT(updateJsonFileSlot(QJsonDocument)));
|
||||
newUserApp->jsonDocument = jsonDocument;
|
||||
newUserApp->jsonFilePath = jsonFile.fileName();
|
||||
ui->verticalLayout_4->addWidget(newUserApp);
|
||||
}
|
||||
}
|
||||
|
||||
if(userAppsAvailable == false) {
|
||||
ui->noUserAppsAvailableLabel->show();
|
||||
}
|
||||
else {
|
||||
ui->noUserAppsAvailableLabel->hide();
|
||||
}
|
||||
}
|
||||
else {
|
||||
QString function = __func__; log(function + ": Main user applications' JSON file is invalid", className);
|
||||
|
|
1
apps.h
1
apps.h
|
@ -52,6 +52,7 @@ private:
|
|||
QJsonDocument jsonDocument;
|
||||
bool jsonParseSuccess = false;
|
||||
bool userAppsSecondPage = false;
|
||||
bool userAppsAvailable = false;
|
||||
|
||||
signals:
|
||||
void refreshScreen();
|
||||
|
|
157
apps.ui
157
apps.ui
|
@ -28,7 +28,10 @@
|
|||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="4" column="0">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="5" column="0">
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
|
@ -51,7 +54,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>428</width>
|
||||
<height>542</height>
|
||||
<height>510</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
|
@ -72,11 +75,14 @@
|
|||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="topMargin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
<number>15</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>10</number>
|
||||
|
@ -311,22 +317,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Built-in apps</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="calendarLabel">
|
||||
<property name="font">
|
||||
|
@ -340,19 +330,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="Line" name="line">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -373,6 +350,12 @@
|
|||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
|
@ -387,20 +370,30 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>User apps</string>
|
||||
<property name="rightMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>User apps</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
|
@ -420,31 +413,9 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="editUserAppsBtn">
|
||||
<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/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="://resources/edit.png">
|
||||
<normaloff>://resources/edit.png</normaloff>://resources/edit.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>34</width>
|
||||
<height>34</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -476,17 +447,26 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4UserApps">
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
<layout class="QGridLayout" name="gridLayout_4"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="noUserAppsAvailableLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Chivo</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
<property name="text">
|
||||
<string>
|
||||
No user apps currently available</string>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
|
@ -508,6 +488,35 @@
|
|||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Built-in apps</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="Line" name="line">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -274,7 +274,7 @@ void generalDialog::on_cancelBtn_clicked()
|
|||
global::userApps::launchApp = false;
|
||||
global::userApps::appCompatibilityLastContinueStatus = false;
|
||||
global::userApps::appCompatibilityText = "";
|
||||
global::userApps::appCompatibilityDialog = false;
|
||||
global::userApps::appCompatibilityDialog = false;
|
||||
}
|
||||
generalDialog::close();
|
||||
}
|
||||
|
|
|
@ -51,6 +51,8 @@ void userapps::provideInfo(QJsonObject jsonInfo)
|
|||
QString message = ": Warning: Icon not found: ";
|
||||
message.append(iconPath.fileName());
|
||||
log(function + message, className);
|
||||
ui->iconBtn->deleteLater();
|
||||
ui->gridLayout->deleteLater();
|
||||
}
|
||||
|
||||
execPath.setFileName("/" + jsonInfo["ExecPath"].toString());
|
||||
|
|
16
userapps.ui
16
userapps.ui
|
@ -166,22 +166,6 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="appNameLabel">
|
||||
<property name="sizePolicy">
|
||||
|
|
Loading…
Reference in a new issue