From 056d67e5a6e57a7a1c6a3bd413ce7c8e63f70659 Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Sun, 6 Feb 2022 22:49:06 -0500 Subject: [PATCH] N437 support --- functions.h | 13 +++++++++---- koboxappsdialog.cpp | 6 ++++++ koboxsettings.cpp | 3 +++ main.cpp | 26 ++++++++++++++++++++++++++ mainwindow.cpp | 10 +++++----- reader.cpp | 4 ++-- settings.cpp | 25 ++++++++++++++++++++++++- 7 files changed, 75 insertions(+), 12 deletions(-) diff --git a/functions.h b/functions.h index 7c7f5b5..2ecb4ae 100644 --- a/functions.h +++ b/functions.h @@ -118,6 +118,7 @@ namespace global { inline bool isN613; inline bool isN873; inline bool isN236; + inline bool isN437; inline bool runningInstanceIsReaderOnly; } @@ -534,15 +535,15 @@ namespace { defaultEpubPageHeight = 365; defaultEpubPageWidth = 365; } - if(checkconfig_str_val == "n905\n") { + else if(checkconfig_str_val == "n905\n") { defaultEpubPageHeight = 425; defaultEpubPageWidth = 425; } - if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "emu\n") { + else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n437\n" or checkconfig_str_val == "emu\n") { defaultEpubPageHeight = 450; defaultEpubPageWidth = 450; } - if(checkconfig_str_val == "n873\n") { + else if(checkconfig_str_val == "n873\n") { defaultEpubPageHeight = 525; defaultEpubPageWidth = 525; } @@ -557,6 +558,10 @@ namespace { defaultPdfPageHeight = 974; defaultPdfPageWidth = 708; } + else if(checkconfig_str_val == "n437\n") { + defaultPdfPageHeight = 1398; + defaultPdfPageWidth = 1022; + } else if(checkconfig_str_val == "n873\n") { defaultPdfPageHeight = 1630; defaultPdfPageWidth = 1214; @@ -566,7 +571,7 @@ namespace { void pre_set_brightness(int brightnessValue) { string_checkconfig_ro("/opt/inkbox_device"); - if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n" or checkconfig_str_val == "n873\n" or checkconfig_str_val == "n236\n") { + if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n" or checkconfig_str_val == "n873\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n437\n") { set_brightness(brightnessValue); } else if(checkconfig_str_val == "n613\n") { diff --git a/koboxappsdialog.cpp b/koboxappsdialog.cpp index 188e246..1b86507 100644 --- a/koboxappsdialog.cpp +++ b/koboxappsdialog.cpp @@ -104,6 +104,9 @@ void koboxAppsDialog::on_launchBtn_clicked() else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n") { dpiSetting = "175"; } + else if(checkconfig_str_val == "n437\n") { + dpiSetting = "225"; + } else if(checkconfig_str_val == "n873\n") { dpiSetting = "250"; } @@ -134,6 +137,9 @@ void koboxAppsDialog::on_launchBtn_clicked() else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n") { dpiSetting = "225"; } + else if(checkconfig_str_val == "n437\n") { + dpiSetting = "275"; + } else if(checkconfig_str_val == "n873\n") { dpiSetting = "300"; } diff --git a/koboxsettings.cpp b/koboxsettings.cpp index a71cebc..b6f391e 100644 --- a/koboxsettings.cpp +++ b/koboxsettings.cpp @@ -44,6 +44,9 @@ koboxSettings::koboxSettings(QWidget *parent) : else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n") { dpiSetting = "175"; } + else if(checkconfig_str_val == "n437\n") { + dpiSetting = "225"; + } else if(checkconfig_str_val == "n873\n") { dpiSetting = "250"; } diff --git a/main.cpp b/main.cpp index 483cf3c..5185e9d 100644 --- a/main.cpp +++ b/main.cpp @@ -104,6 +104,7 @@ int main(int argc, char *argv[]) global::isN613 = false; global::isN873 = false; global::isN236 = false; + global::isN437 = false; } else if(checkconfig_str_val == "n905\n") { global::isN705 = false; @@ -111,6 +112,7 @@ int main(int argc, char *argv[]) global::isN613 = false; global::isN873 = false; global::isN236 = false; + global::isN437 = false; } else if(checkconfig_str_val == "n613\n") { global::isN705 = false; @@ -118,6 +120,7 @@ int main(int argc, char *argv[]) global::isN613 = true; global::isN873 = false; global::isN236 = false; + global::isN437 = false; } else if(checkconfig_str_val == "n873\n") { global::isN705 = false; @@ -125,6 +128,7 @@ int main(int argc, char *argv[]) global::isN613 = false; global::isN873 = true; global::isN236 = false; + global::isN437 = false; } else if(checkconfig_str_val == "n236\n") { global::isN705 = false; @@ -132,6 +136,15 @@ int main(int argc, char *argv[]) global::isN613 = false; global::isN873 = false; global::isN236 = true; + global::isN437 = false; + } + else if(checkconfig_str_val == "n437\n") { + global::isN705 = false; + global::isN905C = false; + global::isN613 = false; + global::isN873 = false; + global::isN236 = false; + global::isN437 = true; } else { ; @@ -170,6 +183,7 @@ int main(int argc, char *argv[]) global::isN613 = false; global::isN873 = false; global::isN236 = false; + global::isN437 = false; } else if(checkconfig_str_val == "n905\n") { global::isN705 = false; @@ -177,6 +191,7 @@ int main(int argc, char *argv[]) global::isN613 = false; global::isN873 = false; global::isN236 = false; + global::isN437 = false; } else if(checkconfig_str_val == "n613\n") { global::isN705 = false; @@ -184,6 +199,7 @@ int main(int argc, char *argv[]) global::isN613 = true; global::isN873 = false; global::isN236 = false; + global::isN437 = false; } else if(checkconfig_str_val == "n873\n") { global::isN705 = false; @@ -191,6 +207,7 @@ int main(int argc, char *argv[]) global::isN613 = false; global::isN873 = true; global::isN236 = false; + global::isN437 = false; } else if(checkconfig_str_val == "n236\n") { global::isN705 = false; @@ -198,6 +215,15 @@ int main(int argc, char *argv[]) global::isN613 = false; global::isN873 = false; global::isN236 = true; + global::isN437 = false; + } + else if(checkconfig_str_val == "n437\n") { + global::isN705 = false; + global::isN905C = false; + global::isN613 = false; + global::isN873 = false; + global::isN236 = false; + global::isN437 = true; } else { ; diff --git a/mainwindow.cpp b/mainwindow.cpp index 0d77ee3..a00be7c 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -90,7 +90,7 @@ MainWindow::MainWindow(QWidget *parent) wifiIconWidth = sW / 22.5; wifiIconHeight = sH / 22.5; } - else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "emu\n") { + else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n437\n" or checkconfig_str_val == "emu\n") { stdIconWidth = sW / 12.5; stdIconHeight = sH / 12.5; brightnessIconWidth = sW / 24.5; @@ -158,7 +158,7 @@ MainWindow::MainWindow(QWidget *parent) if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") { ui->batteryIcon->setStyleSheet("font-size: 5pt; padding-bottom: 0px; padding-top: 0px; padding-left: 1px; padding-right: 1px;"); } - else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "emu\n") { + else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n437\n" or checkconfig_str_val == "emu\n") { ui->batteryIcon->setStyleSheet("font-size: 5pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; padding-right: 0px;"); } else if(checkconfig_str_val == "n873\n") { @@ -771,8 +771,8 @@ void MainWindow::resetIcons() { void MainWindow::setBatteryIcon() { // Battery string_checkconfig_ro("/opt/inkbox_device"); - if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n" or checkconfig_str_val == "n613\n" or checkconfig_str_val == "n873\n" or checkconfig_str_val == "n236\n") { - // Hide brightness controls; they won't be very useful there anyway (for anything but the Glo/Libra/Aura 2) ... + if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n" or checkconfig_str_val == "n613\n" or checkconfig_str_val == "n873\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n437\n") { + // Hide brightness controls; they won't be very useful there anyway (for anything but the Glo (HD)/Libra/Aura 2) ... if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") { ui->brightnessBtn->hide(); ui->line_7->hide(); @@ -1102,7 +1102,7 @@ void MainWindow::setRecentBooksLabelsTruncateTreshold() { if(readFile("/opt/inkbox_device") == "n705\n" or readFile("/opt/inkbox_device") == "n905b\n" or readFile("/opt/inkbox_device") == "n905c\n") { truncateTreshold = 12; } - else if(readFile("/opt/inkbox_device") == "n613\n" or readFile("/opt/inkbox_device") == "n873\n" or readFile("/opt/inkbox_device") == "n236\n"){ + else if(readFile("/opt/inkbox_device") == "n613\n" or readFile("/opt/inkbox_device") == "n873\n" or readFile("/opt/inkbox_device") == "n236\n" or readFile("/opt/inkbox_device") == "n437\n"){ truncateTreshold = 20; } else { diff --git a/reader.cpp b/reader.cpp index cfb9f09..46e5b51 100644 --- a/reader.cpp +++ b/reader.cpp @@ -242,7 +242,7 @@ reader::reader(QWidget *parent) : } // Night mode string_checkconfig_ro("/opt/inkbox_device"); - if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n" or checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n") { + if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n" or checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n437\n") { if(checkconfig(".config/10-dark_mode/config") == true) { string_writeconfig("/tmp/invertScreen", "y"); ui->nightModeBtn->setText(""); @@ -322,7 +322,7 @@ reader::reader(QWidget *parent) : // Defining what the icons' size will be if(checkconfig("/opt/inkbox_genuine") == true) { string_checkconfig_ro("/opt/inkbox_device"); - if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n" or checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "emu\n") { + if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n" or checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n437\n" or checkconfig_str_val == "emu\n") { float stdIconWidth = sW / 16; float stdIconHeight = sW / 16; QPixmap chargingPixmap(":/resources/battery_charging.png"); diff --git a/settings.cpp b/settings.cpp index badcfc9..d7741b2 100644 --- a/settings.cpp +++ b/settings.cpp @@ -87,7 +87,7 @@ settings::settings(QWidget *parent) : } string_checkconfig_ro("/opt/inkbox_device"); - if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n" or checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n") { + if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n" or checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n437\n") { if(checkconfig(".config/10-dark_mode/config") == true) { ui->darkModeCheckBox->click(); } @@ -185,6 +185,17 @@ settings::settings(QWidget *parent) : ui->uiScalingSlider->setValue(2); } } + else if(checkconfig_str_val == "n437\n") { + if(dpi_number == 275) { + ui->uiScalingSlider->setValue(0); + } + if(dpi_number == 290) { + ui->uiScalingSlider->setValue(1); + } + if(dpi_number == 305) { + ui->uiScalingSlider->setValue(2); + } + } else if(checkconfig_str_val == "n873\n") { if(dpi_number == 285) { ui->uiScalingSlider->setValue(0); @@ -575,6 +586,9 @@ void settings::on_uiScalingSlider_valueChanged(int value) if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n") { string_writeconfig(".config/09-dpi/config", "195"); } + if(checkconfig_str_val == "n437\n") { + string_writeconfig(".config/09-dpi/config", "275"); + } if(checkconfig_str_val == "n873\n") { string_writeconfig(".config/09-dpi/config", "285"); } @@ -590,6 +604,9 @@ void settings::on_uiScalingSlider_valueChanged(int value) if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n") { string_writeconfig(".config/09-dpi/config", "210"); } + if(checkconfig_str_val == "n437\n") { + string_writeconfig(".config/09-dpi/config", "290"); + } if(checkconfig_str_val == "n873\n") { string_writeconfig(".config/09-dpi/config", "300"); } @@ -605,6 +622,9 @@ void settings::on_uiScalingSlider_valueChanged(int value) if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n") { string_writeconfig(".config/09-dpi/config", "225"); } + if(checkconfig_str_val == "n437\n") { + string_writeconfig(".config/09-dpi/config", "305"); + } if(checkconfig_str_val == "n873\n") { string_writeconfig(".config/09-dpi/config", "315"); } @@ -709,6 +729,9 @@ void settings::on_enableUiScalingCheckBox_toggled(bool checked) else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n") { string_writeconfig(".config/09-dpi/config", "195"); } + else if(checkconfig_str_val == "n437\n") { + string_writeconfig(".config/09-dpi/config", "275"); + } else if(checkconfig_str_val == "n873\n") { string_writeconfig(".config/09-dpi/config", "285"); }