2021-03-25 05:00:19 -07:00
|
|
|
#include "apps.h"
|
|
|
|
#include "ui_apps.h"
|
2021-04-29 20:36:25 -07:00
|
|
|
#include "mainwindow.h"
|
2021-03-25 05:00:19 -07:00
|
|
|
#include <QFile>
|
|
|
|
#include <QProcess>
|
|
|
|
|
|
|
|
apps::apps(QWidget *parent) :
|
|
|
|
QWidget(parent),
|
|
|
|
ui(new Ui::apps)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2021-04-29 20:36:25 -07:00
|
|
|
ui->koboxAppsOpenButton->setProperty("type", "borderless");
|
2021-03-25 05:00:19 -07:00
|
|
|
ui->scribbleLaunchBtn->setProperty("type", "borderless");
|
|
|
|
ui->lightmapsLaunchBtn->setProperty("type", "borderless");
|
|
|
|
ui->calendarLaunchBtn->setProperty("type", "borderless");
|
|
|
|
ui->savedWordsLaunchBtn->setProperty("type", "borderless");
|
2021-04-14 14:52:36 -07:00
|
|
|
ui->calculatorLaunchBtn->setProperty("type", "borderless");
|
2021-07-05 13:01:32 -07:00
|
|
|
ui->vncLaunchBtn->setProperty("type", "borderless");
|
2022-03-26 20:17:14 -07:00
|
|
|
ui->reversiLaunchBtn->setProperty("type", "borderless");
|
2022-03-27 20:17:02 -07:00
|
|
|
ui->g2048LaunchBtn->setProperty("type", "borderless");
|
2021-03-25 05:00:19 -07:00
|
|
|
|
2021-04-29 20:36:25 -07:00
|
|
|
ui->koboxAppsOpenButton->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
|
2021-03-26 15:53:02 -07:00
|
|
|
ui->scribbleLaunchBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
|
|
|
|
ui->lightmapsLaunchBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
|
|
|
|
ui->calendarLaunchBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
|
|
|
|
ui->savedWordsLaunchBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
|
2021-04-13 07:23:12 -07:00
|
|
|
ui->calculatorLaunchBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
|
2021-07-05 13:01:32 -07:00
|
|
|
ui->vncLaunchBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
|
2022-03-26 20:17:14 -07:00
|
|
|
ui->reversiLaunchBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
|
2022-03-27 20:17:02 -07:00
|
|
|
ui->g2048LaunchBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
|
2021-03-25 05:00:19 -07:00
|
|
|
|
2021-05-09 15:06:14 -07:00
|
|
|
// Hiding KoBox apps button and label if X11 isn't enabled/wasn't started
|
2021-09-29 14:50:02 -07:00
|
|
|
if(checkconfig("/external_root/boot/flags/X11_START") == false or checkconfig("/external_root/boot/flags/X11_STARTED") == false) {
|
2021-05-13 17:42:50 -07:00
|
|
|
ui->label_5->hide();
|
|
|
|
ui->koboxAppsOpenButton->hide();
|
2021-05-09 15:06:14 -07:00
|
|
|
ui->label_5->deleteLater();
|
|
|
|
ui->koboxAppsOpenButton->deleteLater();
|
2021-07-09 12:12:53 -07:00
|
|
|
}
|
2022-01-28 20:03:30 -08:00
|
|
|
// Hiding VNC viewer button and label if device is not rooted and doesn't have a working Wi-Fi adapter, or if X11 is not running
|
2021-08-25 11:12:45 -07:00
|
|
|
if(checkconfig("/external_root/opt/root/rooted") == false) {
|
2021-09-29 14:50:02 -07:00
|
|
|
if(global::device::isWifiAble == false or checkconfig("/external_root/boot/flags/X11_START") == false or checkconfig("/external_root/boot/flags/X11_STARTED") == false) {
|
2021-08-25 11:12:45 -07:00
|
|
|
ui->vncViewerLabel->hide();
|
|
|
|
ui->vncLaunchBtn->hide();
|
|
|
|
ui->vncViewerLabel->deleteLater();
|
|
|
|
ui->vncLaunchBtn->deleteLater();
|
|
|
|
}
|
2022-01-28 20:03:30 -08:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(checkconfig("/external_root/boot/flags/X11_START") == false or checkconfig("/external_root/boot/flags/X11_STARTED") == false) {
|
|
|
|
ui->vncViewerLabel->hide();
|
|
|
|
ui->vncLaunchBtn->hide();
|
|
|
|
ui->vncViewerLabel->deleteLater();
|
|
|
|
ui->vncLaunchBtn->deleteLater();
|
|
|
|
}
|
2021-05-09 15:06:14 -07:00
|
|
|
}
|
2022-01-26 08:56:43 -08:00
|
|
|
// Hiding Light Maps if device doesn't have a working Wi-Fi adapter
|
2022-04-02 13:49:18 -07:00
|
|
|
if(global::device::isWifiAble == false and global::deviceID != "emu\n") {
|
2022-01-26 08:56:43 -08:00
|
|
|
ui->label_2->hide();
|
|
|
|
ui->lightmapsLaunchBtn->hide();
|
|
|
|
ui->label_2->deleteLater();
|
|
|
|
ui->lightmapsLaunchBtn->deleteLater();
|
|
|
|
}
|
2021-05-09 15:06:14 -07:00
|
|
|
|
2022-04-03 20:26:15 -07:00
|
|
|
QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss");
|
2021-03-25 05:00:19 -07:00
|
|
|
stylesheetFile.open(QFile::ReadOnly);
|
|
|
|
this->setStyleSheet(stylesheetFile.readAll());
|
|
|
|
stylesheetFile.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
apps::~apps()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void apps::exitSlot() {
|
|
|
|
apps::close();
|
|
|
|
}
|
|
|
|
|
|
|
|
void apps::on_scribbleLaunchBtn_clicked()
|
|
|
|
{
|
2022-04-10 18:37:33 -07:00
|
|
|
log("Launching external Scribble app", className);
|
2021-03-25 05:00:19 -07:00
|
|
|
QProcess process;
|
|
|
|
process.startDetached("scribble", QStringList());
|
|
|
|
qApp->quit();
|
|
|
|
}
|
|
|
|
|
|
|
|
void apps::on_lightmapsLaunchBtn_clicked()
|
|
|
|
{
|
2022-04-10 18:37:33 -07:00
|
|
|
log("Launching external LightMaps app", className);
|
2021-03-25 05:00:19 -07:00
|
|
|
QProcess process;
|
|
|
|
process.startDetached("lightmaps", QStringList());
|
|
|
|
qApp->quit();
|
|
|
|
}
|
|
|
|
|
|
|
|
void apps::on_savedWordsLaunchBtn_clicked()
|
|
|
|
{
|
2022-04-10 18:37:33 -07:00
|
|
|
log("Launching Saved Words app", className);
|
2021-03-25 05:00:19 -07:00
|
|
|
savedWordsWindow = new savedwords();
|
|
|
|
savedWordsWindow->setAttribute(Qt::WA_DeleteOnClose);
|
|
|
|
savedWordsWindow->showFullScreen();
|
|
|
|
}
|
|
|
|
|
|
|
|
void apps::on_calendarLaunchBtn_clicked()
|
|
|
|
{
|
2022-04-10 18:37:33 -07:00
|
|
|
log("Launching Calendar app", className);
|
2021-03-25 05:00:19 -07:00
|
|
|
calendarWindow = new calendarApp();
|
|
|
|
calendarWindow->setAttribute(Qt::WA_DeleteOnClose);
|
|
|
|
calendarWindow->showFullScreen();
|
|
|
|
}
|
2021-04-13 07:23:12 -07:00
|
|
|
|
|
|
|
void apps::on_calculatorLaunchBtn_clicked()
|
|
|
|
{
|
2022-04-10 18:37:33 -07:00
|
|
|
log("Launching external Calculator app", className);
|
2021-04-13 07:23:12 -07:00
|
|
|
QProcess process;
|
|
|
|
process.startDetached("calculator", QStringList());
|
|
|
|
qApp->quit();
|
|
|
|
}
|
2021-04-29 20:36:25 -07:00
|
|
|
|
|
|
|
void apps::on_koboxAppsOpenButton_clicked()
|
|
|
|
{
|
2022-04-10 18:37:33 -07:00
|
|
|
log("Showing KoBox Apps Dialog", className);
|
2021-04-29 20:36:25 -07:00
|
|
|
koboxAppsDialogWindow = new koboxAppsDialog();
|
2022-04-04 21:47:15 -07:00
|
|
|
connect(koboxAppsDialogWindow, SIGNAL(showToast(QString)), SLOT(showToastNative(QString)));
|
2021-04-29 20:36:25 -07:00
|
|
|
koboxAppsDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
|
|
|
koboxAppsDialogWindow->show();
|
|
|
|
}
|
2021-07-05 13:01:32 -07:00
|
|
|
|
|
|
|
void apps::on_vncLaunchBtn_clicked()
|
|
|
|
{
|
2022-04-10 18:37:33 -07:00
|
|
|
log("Showing VNC dialog", className);
|
2021-07-05 21:13:11 -07:00
|
|
|
global::keyboard::keyboardDialog = true;
|
|
|
|
global::keyboard::vncDialog = true;
|
|
|
|
global::keyboard::keyboardText = "";
|
|
|
|
generalDialogWindow = new generalDialog();
|
|
|
|
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
|
|
|
connect(generalDialogWindow, SIGNAL(refreshScreen()), SLOT(refreshScreenNative()));
|
2022-03-03 20:38:03 -08:00
|
|
|
generalDialogWindow->show();
|
2021-07-05 21:13:11 -07:00
|
|
|
}
|
2021-07-05 13:01:32 -07:00
|
|
|
|
2021-07-05 21:13:11 -07:00
|
|
|
void apps::refreshScreenNative() {
|
|
|
|
emit refreshScreen();
|
2021-07-05 13:01:32 -07:00
|
|
|
}
|
2022-03-26 20:17:14 -07:00
|
|
|
|
|
|
|
void apps::on_reversiLaunchBtn_clicked()
|
|
|
|
{
|
2022-04-10 18:37:33 -07:00
|
|
|
log("Launching external Reversi app", className);
|
2022-03-26 20:17:14 -07:00
|
|
|
QProcess process;
|
|
|
|
process.startDetached("qreversi", QStringList());
|
|
|
|
qApp->quit();
|
|
|
|
}
|
2022-03-27 20:17:02 -07:00
|
|
|
|
|
|
|
void apps::on_g2048LaunchBtn_clicked()
|
|
|
|
{
|
2022-04-10 18:37:33 -07:00
|
|
|
log("Launching external 2048 app", className);
|
2022-03-27 20:17:02 -07:00
|
|
|
QProcess process;
|
|
|
|
process.startDetached("2048", QStringList());
|
|
|
|
qApp->quit();
|
|
|
|
}
|
2022-04-04 21:47:15 -07:00
|
|
|
|
|
|
|
void apps::showToastNative(QString messageToDisplay) {
|
|
|
|
emit showToast(messageToDisplay);
|
|
|
|
}
|