mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 23:57:22 -08:00
Give something to say to logger; implement local settings brightness
This commit is contained in:
parent
55bddcdbf6
commit
8589ee36eb
9 changed files with 87 additions and 15 deletions
9
apps.cpp
9
apps.cpp
|
@ -78,6 +78,7 @@ void apps::exitSlot() {
|
||||||
|
|
||||||
void apps::on_scribbleLaunchBtn_clicked()
|
void apps::on_scribbleLaunchBtn_clicked()
|
||||||
{
|
{
|
||||||
|
log("Launching external Scribble app ...", className);
|
||||||
QProcess process;
|
QProcess process;
|
||||||
process.startDetached("scribble", QStringList());
|
process.startDetached("scribble", QStringList());
|
||||||
qApp->quit();
|
qApp->quit();
|
||||||
|
@ -85,6 +86,7 @@ void apps::on_scribbleLaunchBtn_clicked()
|
||||||
|
|
||||||
void apps::on_lightmapsLaunchBtn_clicked()
|
void apps::on_lightmapsLaunchBtn_clicked()
|
||||||
{
|
{
|
||||||
|
log("Launching external LightMaps app ...", className);
|
||||||
QProcess process;
|
QProcess process;
|
||||||
process.startDetached("lightmaps", QStringList());
|
process.startDetached("lightmaps", QStringList());
|
||||||
qApp->quit();
|
qApp->quit();
|
||||||
|
@ -92,6 +94,7 @@ void apps::on_lightmapsLaunchBtn_clicked()
|
||||||
|
|
||||||
void apps::on_savedWordsLaunchBtn_clicked()
|
void apps::on_savedWordsLaunchBtn_clicked()
|
||||||
{
|
{
|
||||||
|
log("Launching Saved Words app ...", className);
|
||||||
savedWordsWindow = new savedwords();
|
savedWordsWindow = new savedwords();
|
||||||
savedWordsWindow->setAttribute(Qt::WA_DeleteOnClose);
|
savedWordsWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
savedWordsWindow->showFullScreen();
|
savedWordsWindow->showFullScreen();
|
||||||
|
@ -99,6 +102,7 @@ void apps::on_savedWordsLaunchBtn_clicked()
|
||||||
|
|
||||||
void apps::on_calendarLaunchBtn_clicked()
|
void apps::on_calendarLaunchBtn_clicked()
|
||||||
{
|
{
|
||||||
|
log("Launching Calendar app ...", className);
|
||||||
calendarWindow = new calendarApp();
|
calendarWindow = new calendarApp();
|
||||||
calendarWindow->setAttribute(Qt::WA_DeleteOnClose);
|
calendarWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
calendarWindow->showFullScreen();
|
calendarWindow->showFullScreen();
|
||||||
|
@ -106,6 +110,7 @@ void apps::on_calendarLaunchBtn_clicked()
|
||||||
|
|
||||||
void apps::on_calculatorLaunchBtn_clicked()
|
void apps::on_calculatorLaunchBtn_clicked()
|
||||||
{
|
{
|
||||||
|
log("Launching external Calculator app ...", className);
|
||||||
QProcess process;
|
QProcess process;
|
||||||
process.startDetached("calculator", QStringList());
|
process.startDetached("calculator", QStringList());
|
||||||
qApp->quit();
|
qApp->quit();
|
||||||
|
@ -113,6 +118,7 @@ void apps::on_calculatorLaunchBtn_clicked()
|
||||||
|
|
||||||
void apps::on_koboxAppsOpenButton_clicked()
|
void apps::on_koboxAppsOpenButton_clicked()
|
||||||
{
|
{
|
||||||
|
log("Showing KoBox Apps Dialog ...", className);
|
||||||
koboxAppsDialogWindow = new koboxAppsDialog();
|
koboxAppsDialogWindow = new koboxAppsDialog();
|
||||||
connect(koboxAppsDialogWindow, SIGNAL(showToast(QString)), SLOT(showToastNative(QString)));
|
connect(koboxAppsDialogWindow, SIGNAL(showToast(QString)), SLOT(showToastNative(QString)));
|
||||||
koboxAppsDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
koboxAppsDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
@ -121,6 +127,7 @@ void apps::on_koboxAppsOpenButton_clicked()
|
||||||
|
|
||||||
void apps::on_vncLaunchBtn_clicked()
|
void apps::on_vncLaunchBtn_clicked()
|
||||||
{
|
{
|
||||||
|
log("Showing VNC dialog ...", className);
|
||||||
global::keyboard::keyboardDialog = true;
|
global::keyboard::keyboardDialog = true;
|
||||||
global::keyboard::vncDialog = true;
|
global::keyboard::vncDialog = true;
|
||||||
global::keyboard::keyboardText = "";
|
global::keyboard::keyboardText = "";
|
||||||
|
@ -136,6 +143,7 @@ void apps::refreshScreenNative() {
|
||||||
|
|
||||||
void apps::on_reversiLaunchBtn_clicked()
|
void apps::on_reversiLaunchBtn_clicked()
|
||||||
{
|
{
|
||||||
|
log("Launching external Reversi app ...", className);
|
||||||
QProcess process;
|
QProcess process;
|
||||||
process.startDetached("qreversi", QStringList());
|
process.startDetached("qreversi", QStringList());
|
||||||
qApp->quit();
|
qApp->quit();
|
||||||
|
@ -143,6 +151,7 @@ void apps::on_reversiLaunchBtn_clicked()
|
||||||
|
|
||||||
void apps::on_g2048LaunchBtn_clicked()
|
void apps::on_g2048LaunchBtn_clicked()
|
||||||
{
|
{
|
||||||
|
log("Launching external 2048 app ...", className);
|
||||||
QProcess process;
|
QProcess process;
|
||||||
process.startDetached("2048", QStringList());
|
process.startDetached("2048", QStringList());
|
||||||
qApp->quit();
|
qApp->quit();
|
||||||
|
|
42
functions.h
42
functions.h
|
@ -213,10 +213,12 @@ namespace {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
void set_brightness(int value) {
|
void set_brightness(int value) {
|
||||||
std::ofstream fhandler;
|
if(QFile::exists("/var/run/brightness")) {
|
||||||
fhandler.open("/var/run/brightness");
|
std::ofstream fhandler;
|
||||||
fhandler << value;
|
fhandler.open("/var/run/brightness");
|
||||||
fhandler.close();
|
fhandler << value;
|
||||||
|
fhandler.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void set_brightness_ntxio(int value) {
|
void set_brightness_ntxio(int value) {
|
||||||
// Thanks to Kevin Short for this (GloLight)
|
// Thanks to Kevin Short for this (GloLight)
|
||||||
|
@ -315,12 +317,17 @@ namespace {
|
||||||
return brightness;
|
return brightness;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QFile brightness("/var/run/brightness");
|
if(QFile::exists("/var/run/brightness")) {
|
||||||
brightness.open(QIODevice::ReadOnly);
|
QFile brightness("/var/run/brightness");
|
||||||
QString valuestr = brightness.readAll();
|
brightness.open(QIODevice::ReadOnly);
|
||||||
int value = valuestr.toInt();
|
QString valuestr = brightness.readAll();
|
||||||
brightness.close();
|
int value = valuestr.toInt();
|
||||||
return value;
|
brightness.close();
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -380,6 +387,7 @@ namespace {
|
||||||
// Checks if the battery level is critical (i.e. <= 5%)
|
// Checks if the battery level is critical (i.e. <= 5%)
|
||||||
get_battery_level();
|
get_battery_level();
|
||||||
if(batt_level_int <= 5) {
|
if(batt_level_int <= 5) {
|
||||||
|
QString function = __func__; log(function + ": Battery is at a critical charge level!", "functions");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -396,6 +404,7 @@ namespace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void poweroff(bool splash) {
|
void poweroff(bool splash) {
|
||||||
|
log("Powering off ...", "functions");
|
||||||
if(splash == true) {
|
if(splash == true) {
|
||||||
QString prog ("/sbin/poweroff");
|
QString prog ("/sbin/poweroff");
|
||||||
QStringList args;
|
QStringList args;
|
||||||
|
@ -415,6 +424,7 @@ namespace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void reboot(bool splash) {
|
void reboot(bool splash) {
|
||||||
|
log("Rebooting ...", "functions");
|
||||||
if(splash == true) {
|
if(splash == true) {
|
||||||
QString prog ("/sbin/reboot");
|
QString prog ("/sbin/reboot");
|
||||||
QStringList args;
|
QStringList args;
|
||||||
|
@ -526,10 +536,12 @@ namespace {
|
||||||
|
|
||||||
}
|
}
|
||||||
void resetKoboxUserData() {
|
void resetKoboxUserData() {
|
||||||
|
log("Resetting KoBox user data ...", "functions");
|
||||||
global::kobox::resetKoboxUserDataBool = true;
|
global::kobox::resetKoboxUserDataBool = true;
|
||||||
reboot(true);
|
reboot(true);
|
||||||
}
|
}
|
||||||
QString findEpubMetadata(QString book_file, QString metadata) {
|
QString findEpubMetadata(QString book_file, QString metadata) {
|
||||||
|
log("Finding ePUB metadata ...", "functions");
|
||||||
setDefaultWorkDir();
|
setDefaultWorkDir();
|
||||||
QString prog ("sh");
|
QString prog ("sh");
|
||||||
QStringList args;
|
QStringList args;
|
||||||
|
@ -539,6 +551,7 @@ namespace {
|
||||||
proc->waitForFinished();
|
proc->waitForFinished();
|
||||||
|
|
||||||
QString returnedMetadata = proc->readAllStandardOutput();
|
QString returnedMetadata = proc->readAllStandardOutput();
|
||||||
|
QString function = __func__; log(function + ": ePUB metadata is: " + returnedMetadata, "functions");
|
||||||
return returnedMetadata;
|
return returnedMetadata;
|
||||||
}
|
}
|
||||||
void defineDefaultPageSize(int fileType) {
|
void defineDefaultPageSize(int fileType) {
|
||||||
|
@ -563,6 +576,9 @@ namespace {
|
||||||
defaultEpubPageHeight = 525;
|
defaultEpubPageHeight = 525;
|
||||||
defaultEpubPageWidth = 525;
|
defaultEpubPageWidth = 525;
|
||||||
}
|
}
|
||||||
|
QString function = __func__;
|
||||||
|
log(function + ": Defined default ePUB page height to " + QString::number(defaultEpubPageHeight), "functions");
|
||||||
|
log(function + ": Defined default ePUB page width to " + QString::number(defaultEpubPageWidth), "functions");
|
||||||
}
|
}
|
||||||
else if(fileType == 1) {
|
else if(fileType == 1) {
|
||||||
if(global::deviceID == "n705\n" or global::deviceID == "n905\n") {
|
if(global::deviceID == "n705\n" or global::deviceID == "n905\n") {
|
||||||
|
@ -581,6 +597,9 @@ namespace {
|
||||||
defaultPdfPageHeight = 1630;
|
defaultPdfPageHeight = 1630;
|
||||||
defaultPdfPageWidth = 1214;
|
defaultPdfPageWidth = 1214;
|
||||||
}
|
}
|
||||||
|
QString function = __func__;
|
||||||
|
log(function + "Defined default PDF page height to " + QString::number(defaultPdfPageHeight), "functions");
|
||||||
|
log(function + "Defined default PDF page width to " + QString::number(defaultPdfPageWidth), "functions");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void pre_set_brightness(int brightnessValue) {
|
void pre_set_brightness(int brightnessValue) {
|
||||||
|
@ -617,6 +636,7 @@ namespace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool connectToNetwork(QString essid, QString passphrase) {
|
bool connectToNetwork(QString essid, QString passphrase) {
|
||||||
|
log("Connecting to network " + essid + " ...", "functions");
|
||||||
std::string essid_str = essid.toStdString();
|
std::string essid_str = essid.toStdString();
|
||||||
std::string passphrase_str = passphrase.toStdString();
|
std::string passphrase_str = passphrase.toStdString();
|
||||||
string_writeconfig("/run/wifi_network_essid", essid_str);
|
string_writeconfig("/run/wifi_network_essid", essid_str);
|
||||||
|
@ -634,12 +654,14 @@ namespace {
|
||||||
setDefaultWorkDir();
|
setDefaultWorkDir();
|
||||||
string_writeconfig(".config/17-wifi_connection_information/essid", essid_str);
|
string_writeconfig(".config/17-wifi_connection_information/essid", essid_str);
|
||||||
string_writeconfig(".config/17-wifi_connection_information/passphrase", passphrase_str);
|
string_writeconfig(".config/17-wifi_connection_information/passphrase", passphrase_str);
|
||||||
|
QString function = __func__; log(function + ": Connection successful", "functions");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QFile::remove("/run/wifi_connected_successfully");
|
QFile::remove("/run/wifi_connected_successfully");
|
||||||
connectionSuccessful = 0;
|
connectionSuccessful = 0;
|
||||||
global::network::isConnected = false;
|
global::network::isConnected = false;
|
||||||
|
QString function = __func__; log(function + ": Connection failed", "functions");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
5
main.cpp
5
main.cpp
|
@ -25,19 +25,18 @@
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QDebug>
|
|
||||||
#include <QRect>
|
#include <QRect>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
global::deviceID = readFile("/opt/inkbox_device");
|
|
||||||
|
|
||||||
if(char * debug = std::getenv("DEBUG")) {
|
if(char * debug = std::getenv("DEBUG")) {
|
||||||
if(std::atoi(debug) == 1) {
|
if(std::atoi(debug) == 1) {
|
||||||
global::logger::status = true;
|
global::logger::status = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
global::deviceID = readFile("/opt/inkbox_device");
|
||||||
|
log("Running on device " + global::deviceID, "main");
|
||||||
|
|
||||||
setDefaultWorkDir();
|
setDefaultWorkDir();
|
||||||
if(checkconfig(".config/18-encrypted_storage/status") == true and checkconfig("/external_root/run/encfs_mounted") == false) {
|
if(checkconfig(".config/18-encrypted_storage/status") == true and checkconfig("/external_root/run/encfs_mounted") == false) {
|
||||||
|
|
|
@ -506,6 +506,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
string_checkconfig_ro("/external_root/opt/isa/changelog");
|
string_checkconfig_ro("/external_root/opt/isa/changelog");
|
||||||
updatemsg = updatemsg.append(checkconfig_str_val);
|
updatemsg = updatemsg.append(checkconfig_str_val);
|
||||||
updatemsg = updatemsg.append("</font>");
|
updatemsg = updatemsg.append("</font>");
|
||||||
|
log("Showing update changelog ...", className);
|
||||||
QMessageBox::information(this, tr("Information"), updatemsg);
|
QMessageBox::information(this, tr("Information"), updatemsg);
|
||||||
string_writeconfig("/external_root/opt/update/inkbox_updated", "false");
|
string_writeconfig("/external_root/opt/update/inkbox_updated", "false");
|
||||||
|
|
||||||
|
@ -584,6 +585,7 @@ MainWindow::~MainWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::openUpdateDialog() {
|
void MainWindow::openUpdateDialog() {
|
||||||
|
log("Showing Update dialog ...", className);
|
||||||
global::mainwindow::updateDialog = true;
|
global::mainwindow::updateDialog = true;
|
||||||
// Write to a temporary file to show an "Update" prompt
|
// Write to a temporary file to show an "Update" prompt
|
||||||
string_writeconfig("/inkbox/updateDialog", "true");
|
string_writeconfig("/inkbox/updateDialog", "true");
|
||||||
|
@ -597,6 +599,7 @@ void MainWindow::openUpdateDialog() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::openLowBatteryDialog() {
|
void MainWindow::openLowBatteryDialog() {
|
||||||
|
log("Showing Low Battery Dialog ...", className);
|
||||||
global::mainwindow::lowBatteryDialog = true;
|
global::mainwindow::lowBatteryDialog = true;
|
||||||
global::battery::batteryAlertLock = true;
|
global::battery::batteryAlertLock = true;
|
||||||
|
|
||||||
|
@ -606,6 +609,7 @@ void MainWindow::openLowBatteryDialog() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::openUsbmsDialog() {
|
void MainWindow::openUsbmsDialog() {
|
||||||
|
log("Showing USB Mass Storage dialog ...", className);
|
||||||
global::usbms::showUsbmsDialog = false;
|
global::usbms::showUsbmsDialog = false;
|
||||||
global::usbms::usbmsDialog = true;
|
global::usbms::usbmsDialog = true;
|
||||||
|
|
||||||
|
@ -626,6 +630,7 @@ void MainWindow::openCriticalBatteryAlertWindow() {
|
||||||
|
|
||||||
void MainWindow::on_settingsBtn_clicked()
|
void MainWindow::on_settingsBtn_clicked()
|
||||||
{
|
{
|
||||||
|
log("Opening Settings Chooser widget ...", className);
|
||||||
resetFullWindowException = true;
|
resetFullWindowException = true;
|
||||||
resetWindow(false);
|
resetWindow(false);
|
||||||
if(global::mainwindow::tabSwitcher::settingsChooserWidgetSelected != true) {
|
if(global::mainwindow::tabSwitcher::settingsChooserWidgetSelected != true) {
|
||||||
|
@ -653,6 +658,7 @@ void MainWindow::on_settingsBtn_clicked()
|
||||||
|
|
||||||
void MainWindow::on_appsBtn_clicked()
|
void MainWindow::on_appsBtn_clicked()
|
||||||
{
|
{
|
||||||
|
log("Opening Apps widget ...", className);
|
||||||
resetFullWindowException = true;
|
resetFullWindowException = true;
|
||||||
resetWindow(false);
|
resetWindow(false);
|
||||||
if(global::mainwindow::tabSwitcher::appsWidgetSelected != true) {
|
if(global::mainwindow::tabSwitcher::appsWidgetSelected != true) {
|
||||||
|
@ -691,6 +697,7 @@ void MainWindow::on_searchBtn_clicked()
|
||||||
|
|
||||||
void MainWindow::on_quitBtn_clicked()
|
void MainWindow::on_quitBtn_clicked()
|
||||||
{
|
{
|
||||||
|
log("Opening Quit widget ...", className);
|
||||||
quitWindow = new quit();
|
quitWindow = new quit();
|
||||||
quitWindow->setAttribute(Qt::WA_DeleteOnClose);
|
quitWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
quitWindow->showFullScreen();
|
quitWindow->showFullScreen();
|
||||||
|
@ -730,6 +737,7 @@ void MainWindow::on_book4Btn_clicked()
|
||||||
|
|
||||||
void MainWindow::on_brightnessBtn_clicked()
|
void MainWindow::on_brightnessBtn_clicked()
|
||||||
{
|
{
|
||||||
|
log("Showing Brightness Dialog ...", className);
|
||||||
brightnessDialogWindow = new brightnessDialog();
|
brightnessDialogWindow = new brightnessDialog();
|
||||||
brightnessDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
brightnessDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
brightnessDialogWindow->show();
|
brightnessDialogWindow->show();
|
||||||
|
@ -737,6 +745,7 @@ void MainWindow::on_brightnessBtn_clicked()
|
||||||
|
|
||||||
void MainWindow::on_homeBtn_clicked()
|
void MainWindow::on_homeBtn_clicked()
|
||||||
{
|
{
|
||||||
|
log("Showing home screen ...", className);
|
||||||
global::mainwindow::tabSwitcher::repaint = true;
|
global::mainwindow::tabSwitcher::repaint = true;
|
||||||
resetFullWindowException = true;
|
resetFullWindowException = true;
|
||||||
resetWindow(true);
|
resetWindow(true);
|
||||||
|
@ -867,6 +876,9 @@ void MainWindow::setInitialBrightness() {
|
||||||
set_warmth(warmth);
|
set_warmth(warmth);
|
||||||
}
|
}
|
||||||
int brightness_value = brightness_checkconfig(".config/03-brightness/config");
|
int brightness_value = brightness_checkconfig(".config/03-brightness/config");
|
||||||
|
if(global::deviceID != "n705\n" and global::deviceID != "n905\n") {
|
||||||
|
log("Setting initial brightness to " + QString::number(brightness_value), className);
|
||||||
|
}
|
||||||
if(checkconfig("/tmp/oobe-inkbox_completed") == true or checkconfig("/tmp/inkbox-cinematicBrightness_ran") == true) {
|
if(checkconfig("/tmp/oobe-inkbox_completed") == true or checkconfig("/tmp/inkbox-cinematicBrightness_ran") == true) {
|
||||||
// Coming from OOBE setup; not doing that fancy stuff again ;p
|
// Coming from OOBE setup; not doing that fancy stuff again ;p
|
||||||
QFile::remove("/tmp/oobe-inkbox_completed");
|
QFile::remove("/tmp/oobe-inkbox_completed");
|
||||||
|
@ -884,6 +896,7 @@ void MainWindow::refreshScreen() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setupSearchDialog() {
|
void MainWindow::setupSearchDialog() {
|
||||||
|
log("Launching Search dialog ...", className);
|
||||||
if(global::forbidOpenSearchDialog == false) {
|
if(global::forbidOpenSearchDialog == false) {
|
||||||
global::keyboard::keyboardDialog = true;
|
global::keyboard::keyboardDialog = true;
|
||||||
global::keyboard::searchDialog = true;
|
global::keyboard::searchDialog = true;
|
||||||
|
@ -988,6 +1001,7 @@ void MainWindow::setWifiIcon() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::openWifiDialog() {
|
void MainWindow::openWifiDialog() {
|
||||||
|
log("Opening Wi-Fi connection interface ...", className);
|
||||||
if(checkconfig("/external_root/run/was_connected_to_wifi") == true and wifiIconClickedWhileReconnecting == false) {
|
if(checkconfig("/external_root/run/was_connected_to_wifi") == true and wifiIconClickedWhileReconnecting == false) {
|
||||||
showToast("Reconnection in progress\nTap again to cancel");
|
showToast("Reconnection in progress\nTap again to cancel");
|
||||||
wifiIconClickedWhileReconnecting = true;
|
wifiIconClickedWhileReconnecting = true;
|
||||||
|
@ -1039,6 +1053,7 @@ void MainWindow::closeIndefiniteToast() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::openUpdateDialogOTA(bool open) {
|
void MainWindow::openUpdateDialogOTA(bool open) {
|
||||||
|
QString function = __func__; log(function + ": Showing update dialog (OTA)", className);
|
||||||
if(open == true) {
|
if(open == true) {
|
||||||
global::otaUpdate::isUpdateOta = true;
|
global::otaUpdate::isUpdateOta = true;
|
||||||
openUpdateDialog();
|
openUpdateDialog();
|
||||||
|
@ -1049,6 +1064,7 @@ void MainWindow::openUpdateDialogOTA(bool open) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::launchOtaUpdater() {
|
void MainWindow::launchOtaUpdater() {
|
||||||
|
log("Launching OTA updater ...", className);
|
||||||
otaManagerWindow = new otaManager(this);
|
otaManagerWindow = new otaManager(this);
|
||||||
connect(otaManagerWindow, SIGNAL(canOtaUpdate(bool)), SLOT(openUpdateDialogOTA(bool)));
|
connect(otaManagerWindow, SIGNAL(canOtaUpdate(bool)), SLOT(openUpdateDialogOTA(bool)));
|
||||||
otaManagerWindow->setAttribute(Qt::WA_DeleteOnClose);
|
otaManagerWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
@ -1070,6 +1086,7 @@ void MainWindow::openBookFile(QString book, bool relativePath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::openReaderFramework() {
|
void MainWindow::openReaderFramework() {
|
||||||
|
log("Launching Reader Framework ...", className);
|
||||||
readerWindow = new reader();
|
readerWindow = new reader();
|
||||||
readerWindow->setAttribute(Qt::WA_DeleteOnClose);
|
readerWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
connect(readerWindow, SIGNAL(openBookFile(QString, bool)), SLOT(openBookFile(QString, bool)));
|
connect(readerWindow, SIGNAL(openBookFile(QString, bool)), SLOT(openBookFile(QString, bool)));
|
||||||
|
@ -1077,19 +1094,24 @@ void MainWindow::openReaderFramework() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::checkForUpdate() {
|
void MainWindow::checkForUpdate() {
|
||||||
|
log("Checking for available updates ...", className);
|
||||||
if(checkconfig("/mnt/onboard/onboard/.inkbox/can_update") == true) {
|
if(checkconfig("/mnt/onboard/onboard/.inkbox/can_update") == true) {
|
||||||
if(checkconfig("/tmp/cancelUpdateDialog") == false) {
|
if(checkconfig("/tmp/cancelUpdateDialog") == false) {
|
||||||
// I'm sorry.
|
// I'm sorry.
|
||||||
log("An update is available.", className);
|
QString function = __func__; log(function + ": An update is available.", className);
|
||||||
QTimer::singleShot(2000, this, SLOT(openUpdateDialog()));
|
QTimer::singleShot(2000, this, SLOT(openUpdateDialog()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log("Not showing update dialog, user dismissed it ...", className);
|
QString function = __func__; log(function + ": Not showing update dialog, user dismissed it ...", className);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
QString function = __func__; log(function + ": No update available.", className);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::openEncfsRepackDialog() {
|
void MainWindow::openEncfsRepackDialog() {
|
||||||
|
log("Showing encrypted storage repack dialog ...", className);
|
||||||
global::encfs::repackDialog = true;
|
global::encfs::repackDialog = true;
|
||||||
global::usbms::showUsbmsDialog = false;
|
global::usbms::showUsbmsDialog = false;
|
||||||
global::usbms::usbmsDialog = false;
|
global::usbms::usbmsDialog = false;
|
||||||
|
@ -1099,6 +1121,7 @@ void MainWindow::openEncfsRepackDialog() {
|
||||||
|
|
||||||
void MainWindow::on_libraryButton_clicked()
|
void MainWindow::on_libraryButton_clicked()
|
||||||
{
|
{
|
||||||
|
log("Launching Online Library ...", className);
|
||||||
if(testPing() == 0 or global::deviceID == "emu\n") {
|
if(testPing() == 0 or global::deviceID == "emu\n") {
|
||||||
resetFullWindowException = false;
|
resetFullWindowException = false;
|
||||||
resetWindow(false);
|
resetWindow(false);
|
||||||
|
|
2
quit.cpp
2
quit.cpp
|
@ -66,6 +66,7 @@ void quit::on_pushButton_2_clicked()
|
||||||
|
|
||||||
void quit::on_pushButton_4_clicked()
|
void quit::on_pushButton_4_clicked()
|
||||||
{
|
{
|
||||||
|
log("Restarting InkBox ...", className);
|
||||||
QProcess process;
|
QProcess process;
|
||||||
process.startDetached("inkbox", QStringList());
|
process.startDetached("inkbox", QStringList());
|
||||||
qApp->quit();
|
qApp->quit();
|
||||||
|
@ -78,6 +79,7 @@ void quit::on_backBtn_clicked()
|
||||||
|
|
||||||
void quit::on_pushButton_3_clicked()
|
void quit::on_pushButton_3_clicked()
|
||||||
{
|
{
|
||||||
|
log("Suspending ...", className);
|
||||||
// inotifywait waits for a MODIFY event, so we just do it instead of evtest and the power button
|
// inotifywait waits for a MODIFY event, so we just do it instead of evtest and the power button
|
||||||
string_writeconfig("/external_root/tmp/power", "KEY_POWER");
|
string_writeconfig("/external_root/tmp/power", "KEY_POWER");
|
||||||
}
|
}
|
||||||
|
|
13
reader.cpp
13
reader.cpp
|
@ -245,6 +245,14 @@ reader::reader(QWidget *parent) :
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom settings
|
// Custom settings
|
||||||
|
// Brightness
|
||||||
|
if(global::reader::globalReadingSettings == false) {
|
||||||
|
if(global::deviceID != "n705\n" and global::deviceID != "n905\n") {
|
||||||
|
int brightness_value = brightness_checkconfig(".config/03-brightness/config");
|
||||||
|
log("Local Reading Settings: setting brightness to " + QString::number(brightness_value), className);
|
||||||
|
pre_set_brightness(brightness_value);
|
||||||
|
}
|
||||||
|
}
|
||||||
// Font
|
// Font
|
||||||
string_checkconfig(".config/04-book/font");
|
string_checkconfig(".config/04-book/font");
|
||||||
if(checkconfig_str_val == "") {
|
if(checkconfig_str_val == "") {
|
||||||
|
@ -2222,3 +2230,8 @@ void reader::on_quitBtn_clicked()
|
||||||
quitWindow->setAttribute(Qt::WA_DeleteOnClose);
|
quitWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
quitWindow->showFullScreen();
|
quitWindow->showFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reader::closeIndefiniteToast() {
|
||||||
|
// Warning: use with caution
|
||||||
|
toastWindow->close();
|
||||||
|
}
|
||||||
|
|
1
reader.h
1
reader.h
|
@ -161,6 +161,7 @@ private slots:
|
||||||
void openBookFileNative(QString book, bool relativePath);
|
void openBookFileNative(QString book, bool relativePath);
|
||||||
void showToast(QString messageToDisplay);
|
void showToast(QString messageToDisplay);
|
||||||
void on_quitBtn_clicked();
|
void on_quitBtn_clicked();
|
||||||
|
void closeIndefiniteToast();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void openBookFile(QString book, bool relativePath);
|
void openBookFile(QString book, bool relativePath);
|
||||||
|
|
|
@ -69,6 +69,7 @@ settingsChooser::~settingsChooser()
|
||||||
|
|
||||||
void settingsChooser::on_inkboxSettingsBtn_clicked()
|
void settingsChooser::on_inkboxSettingsBtn_clicked()
|
||||||
{
|
{
|
||||||
|
log("Launching InkBox Settings ...", className);
|
||||||
settingsWindow = new settings();
|
settingsWindow = new settings();
|
||||||
settingsWindow->setAttribute(Qt::WA_DeleteOnClose);
|
settingsWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
connect(settingsWindow, SIGNAL(showToast(QString)), SLOT(showToastNative(QString)));
|
connect(settingsWindow, SIGNAL(showToast(QString)), SLOT(showToastNative(QString)));
|
||||||
|
@ -78,6 +79,7 @@ void settingsChooser::on_inkboxSettingsBtn_clicked()
|
||||||
|
|
||||||
void settingsChooser::on_koboxSettingsBtn_clicked()
|
void settingsChooser::on_koboxSettingsBtn_clicked()
|
||||||
{
|
{
|
||||||
|
log("Launching KoBox Settings ...", className);
|
||||||
koboxSettingsWindow = new koboxSettings();
|
koboxSettingsWindow = new koboxSettings();
|
||||||
koboxSettingsWindow->setAttribute(Qt::WA_DeleteOnClose);
|
koboxSettingsWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
koboxSettingsWindow->showFullScreen();
|
koboxSettingsWindow->showFullScreen();
|
||||||
|
|
|
@ -11,6 +11,7 @@ toast::toast(QWidget *parent) :
|
||||||
ui(new Ui::toast)
|
ui(new Ui::toast)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
log("Displaying message " + global::toast::message, className);
|
||||||
|
|
||||||
if(global::toast::modalToast == true) {
|
if(global::toast::modalToast == true) {
|
||||||
global::toast::modalToast = false;
|
global::toast::modalToast = false;
|
||||||
|
|
Loading…
Reference in a new issue