Don't show KoBox apps button if X11 isn't running

This commit is contained in:
Nicolas Mailloux 2021-05-09 18:06:14 -04:00
parent d295a07eac
commit 4d391801aa
2 changed files with 19 additions and 0 deletions

View file

@ -23,6 +23,18 @@ apps::apps(QWidget *parent) :
ui->savedWordsLaunchBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
ui->calculatorLaunchBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
// Hiding KoBox apps button and label if X11 isn't enabled/wasn't started
string_checkconfig_ro("/external_root/boot/flags/X11_START");
if(checkconfig_str_val != "true") {
ui->label_5->deleteLater();
ui->koboxAppsOpenButton->deleteLater();
}
string_checkconfig_ro("/external_root/boot/flags/X11_STARTED");
if(checkconfig_str_val != "true") {
ui->label_5->deleteLater();
ui->koboxAppsOpenButton->deleteLater();
}
QFile stylesheetFile(":/resources/eink.qss");
stylesheetFile.open(QFile::ReadOnly);
this->setStyleSheet(stylesheetFile.readAll());

View file

@ -25,6 +25,12 @@ koboxAppsDialog::koboxAppsDialog(QWidget *parent) :
this->setStyleSheet(stylesheetFile.readAll());
stylesheetFile.close();
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") {
// If we don't do this, the text will clip out of the display.
ui->definitionLabel->setText("Please select an application.\nClick on 'Launch' to start it.");
}
ui->launchBtn->setProperty("type", "borderless");
ui->cancelBtn->setProperty("type", "borderless");
ui->launchBtn->setStyleSheet("font-size: 9pt; padding: 10px; font-weight: bold; background: lightGrey");
@ -39,6 +45,7 @@ koboxAppsDialog::koboxAppsDialog(QWidget *parent) :
ui->definitionLabel->setFont(QFont(crimson));
this->adjustSize();
// Centering dialog
QRect screenGeometry = QGuiApplication::screens()[0]->geometry();
int x = (screenGeometry.width() - this->width()) / 2;