From a6db457599358212b408ebf561755c6d9331a159 Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Sat, 26 Jun 2021 19:29:51 -0400 Subject: [PATCH] More Glo-related new things --- functions.h | 16 ++++++++++++---- koboxappsdialog.cpp | 22 ++++++++++++++++++++-- reader.cpp | 6 ++++++ settingschooser.cpp | 4 ++++ 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/functions.h b/functions.h index 05410d9..264a640 100644 --- a/functions.h +++ b/functions.h @@ -106,6 +106,9 @@ namespace { config.close(); return 0; }; + void setDefaultWorkDir() { + QDir::setCurrent("/mnt/onboard/.adds/inkbox"); + } int brightness_checkconfig(QString file) { QFile config(file); config.open(QIODevice::ReadWrite); @@ -306,8 +309,16 @@ namespace { kernelVersion = proc->readAllStandardOutput(); kernelVersion = kernelVersion.trimmed(); - string_writeconfig("get_kernel_build_id", "/external_root/run/initrd-fifo"); + + setDefaultWorkDir(); + QString fifo_prog("sh"); + QStringList fifo_args; + fifo_args << "get_kernel_build_id.sh"; + QProcess *fifo_proc = new QProcess(); + fifo_proc->start(fifo_prog, fifo_args); + fifo_proc->waitForFinished(); QThread::msleep(100); + string_checkconfig_ro("/external_root/run/build_id"); QString kernelBuildID = checkconfig_str_val.trimmed(); kernelVersion.append(", build "); @@ -333,9 +344,6 @@ namespace { global::kobox::resetKoboxUserDataBool = true; reboot(true); } - void setDefaultWorkDir() { - QDir::setCurrent("/mnt/onboard/.adds/inkbox"); - } QString findEpubMetadata(QString book_file, QString metadata) { setDefaultWorkDir(); QString prog ("sh"); diff --git a/koboxappsdialog.cpp b/koboxappsdialog.cpp index 6fdc120..1cfc1f1 100644 --- a/koboxappsdialog.cpp +++ b/koboxappsdialog.cpp @@ -97,7 +97,17 @@ void koboxAppsDialog::on_launchBtn_clicked() // DPI setting string_checkconfig(".config/00-kobox/dpiSetting"); if(checkconfig_str_val == "") { - dpiSetting = "125"; + string_checkconfig_ro("/opt/inkbox_device\n"); + if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") { + dpiSetting = "125"; + } + else if(checkconfig_str_val == "n613\n") { + dpiSetting = "175"; + } + else { + dpiSetting = "125"; + } + } else { dpiSetting = checkconfig_str_val.toStdString(); @@ -114,7 +124,15 @@ void koboxAppsDialog::on_launchBtn_clicked() else if(itemText == "KTerm") { string_writeconfig("/external_root/tmp/X_program", "/usr/local/bin/kterm -l /usr/local/share/kterm/layouts/keyboard-kt.xml -k 1"); dpModeSetting = "fullscreen"; - dpiSetting = "175"; + string_checkconfig_ro("/opt/inkbox_device"); + if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") { + dpiSetting = "175"; + } + else if(checkconfig_str_val == "n613\n") + dpiSetting = "225"; + else { + dpiSetting = "175"; + } } else if(itemText == "Geany") { string_writeconfig("/external_root/tmp/X_program", "geany"); diff --git a/reader.cpp b/reader.cpp index 4f00301..dbb9077 100644 --- a/reader.cpp +++ b/reader.cpp @@ -832,6 +832,9 @@ void reader::on_brightnessDecBtn_clicked() ; } int set_bval = bval - 1; + if(set_bval < 0) { + set_bval = 0; + } pre_set_brightness(set_bval); brightness_writeconfig(set_bval); @@ -853,6 +856,9 @@ void reader::on_brightnessIncBtn_clicked() ; } int set_bval = bval + 1; + if(set_bval > 100) { + set_bval = 100; + } pre_set_brightness(set_bval); brightness_writeconfig(set_bval); diff --git a/settingschooser.cpp b/settingschooser.cpp index f4f508a..ee47b31 100644 --- a/settingschooser.cpp +++ b/settingschooser.cpp @@ -46,6 +46,10 @@ settingsChooser::settingsChooser(QWidget *parent) : ui->inkboxSettingsBtn->setStyleSheet("padding: 20px; Text-align: left"); ui->koboxSettingsBtn->setStyleSheet("padding: 20px; Text-align: left"); } + else if(checkconfig_str_val == "n613\n") { + ui->inkboxSettingsBtn->setStyleSheet("padding: 25px; Text-align: left"); + ui->koboxSettingsBtn->setStyleSheet("padding:25px; Text-align: left"); + } else { ui->inkboxSettingsBtn->setStyleSheet("padding: 40px; Text-align: left"); ui->koboxSettingsBtn->setStyleSheet("padding: 40px; Text-align: left");