From 49e6a7167f68ebd0c866c2bcbc50aaa2a79aa19b Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Sat, 8 May 2021 01:03:25 -0400 Subject: [PATCH] USBMS prompt --- functions.h | 1 + mainwindow.cpp | 20 ++++++++++++++++++++ usbms_splash.cpp | 3 ++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/functions.h b/functions.h index f05290c..c1cee86 100644 --- a/functions.h +++ b/functions.h @@ -37,6 +37,7 @@ namespace global { } inline bool updateDialog; inline bool lowBatteryDialog; + inline bool usbmsDialog; } namespace settings { inline bool settingsRebootDialog; diff --git a/mainwindow.cpp b/mainwindow.cpp index 884251d..79960a0 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -350,6 +350,26 @@ MainWindow::MainWindow(QWidget *parent) } ); batteryWatchdog->start(); + // USB mass storage prompt + QTimer *usbmsPrompt = new QTimer(this); + usbmsPrompt->setInterval(2000); + connect(usbmsPrompt, &QTimer::timeout, [&]() { + if(global::mainwindow::usbmsDialog != true) { + ; + } + else { + string_checkconfig_ro("/sys/devices/platform/fsl-usb2-udc/gadget/suspended"); + if(checkconfig_str_val != "0\n") { + // Loop again... + ; + } + else { + // An USB cable is connected! + + } + } + } ); + // We set the brightness level saved in the config file int brightness_value = brightness_checkconfig(".config/03-brightness/config"); set_brightness(brightness_value); diff --git a/usbms_splash.cpp b/usbms_splash.cpp index 518cba4..ce66103 100644 --- a/usbms_splash.cpp +++ b/usbms_splash.cpp @@ -28,8 +28,9 @@ usbms_splash::usbms_splash(QWidget *parent) : stylesheetFile.close(); ui->label->setText("Launching KoBox subsystem"); + ui->label->setStyleSheet("font-size: 14pt"); ui->label_3->setText("Please wait, this could take a while."); - ui->label_3->setStyleSheet("font-size: 9pt"); + ui->label_3->setStyleSheet("font-size: 10pt"); QPixmap pixmap(":/resources/kobox-icon.png"); QPixmap scaledPixmap = pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);