From 48f97fa5e647d7fbd257395f54cb85e61b8aa771 Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Thu, 27 Jan 2022 15:16:48 -0500 Subject: [PATCH] N236 support --- functions.h | 7 ++++--- koboxappsdialog.cpp | 5 +++-- koboxsettings.cpp | 2 +- librarywidget.cpp | 1 + main.cpp | 25 +++++++++++++++++++++++++ mainwindow.cpp | 10 +++++----- reader.cpp | 4 ++-- settings.cpp | 12 ++++++------ settingschooser.cpp | 2 +- 9 files changed, 48 insertions(+), 20 deletions(-) diff --git a/functions.h b/functions.h index 5d46eea..7c7f5b5 100644 --- a/functions.h +++ b/functions.h @@ -117,6 +117,7 @@ namespace global { inline bool isN905C; inline bool isN613; inline bool isN873; + inline bool isN236; inline bool runningInstanceIsReaderOnly; } @@ -537,7 +538,7 @@ namespace { defaultEpubPageHeight = 425; defaultEpubPageWidth = 425; } - if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "emu\n") { + if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "emu\n") { defaultEpubPageHeight = 450; defaultEpubPageWidth = 450; } @@ -552,7 +553,7 @@ namespace { defaultPdfPageHeight = 750; defaultPdfPageWidth = 550; } - else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "emu\n") { + else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "emu\n") { defaultPdfPageHeight = 974; defaultPdfPageWidth = 708; } @@ -565,7 +566,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") { + if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n" or checkconfig_str_val == "n873\n" or checkconfig_str_val == "n236\n") { set_brightness(brightnessValue); } else if(checkconfig_str_val == "n613\n") { diff --git a/koboxappsdialog.cpp b/koboxappsdialog.cpp index 94a0298..188e246 100644 --- a/koboxappsdialog.cpp +++ b/koboxappsdialog.cpp @@ -101,7 +101,7 @@ void koboxAppsDialog::on_launchBtn_clicked() if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") { dpiSetting = "125"; } - else if(checkconfig_str_val == "n613\n") { + else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n") { dpiSetting = "175"; } else if(checkconfig_str_val == "n873\n") { @@ -131,8 +131,9 @@ void koboxAppsDialog::on_launchBtn_clicked() if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") { dpiSetting = "175"; } - else if(checkconfig_str_val == "n613\n") + else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n") { dpiSetting = "225"; + } else if(checkconfig_str_val == "n873\n") { dpiSetting = "300"; } diff --git a/koboxsettings.cpp b/koboxsettings.cpp index cf2a053..a71cebc 100644 --- a/koboxsettings.cpp +++ b/koboxsettings.cpp @@ -41,7 +41,7 @@ koboxSettings::koboxSettings(QWidget *parent) : if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") { dpiSetting = "125"; } - else if(checkconfig_str_val == "n613\n") { + else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n") { dpiSetting = "175"; } else if(checkconfig_str_val == "n873\n") { diff --git a/librarywidget.cpp b/librarywidget.cpp index e477dbc..5e312b5 100644 --- a/librarywidget.cpp +++ b/librarywidget.cpp @@ -207,6 +207,7 @@ void libraryWidget::syncCatalog() { qDebug() << "Gutenberg sync encountered an error"; toastWindow->close(); showToast("Error"); + QFile::remove("/external_root/opt/storage/gutenberg/last_sync"); QTimer::singleShot(5000, this, SLOT(close())); } QFile::remove("/inkbox/gutenbergSyncDone"); diff --git a/main.cpp b/main.cpp index 5ffaa8b..483cf3c 100644 --- a/main.cpp +++ b/main.cpp @@ -103,24 +103,35 @@ int main(int argc, char *argv[]) global::isN905C = false; global::isN613 = false; global::isN873 = false; + global::isN236 = false; } else if(checkconfig_str_val == "n905\n") { global::isN705 = false; global::isN905C = true; global::isN613 = false; global::isN873 = false; + global::isN236 = false; } else if(checkconfig_str_val == "n613\n") { global::isN705 = false; global::isN905C = false; global::isN613 = true; global::isN873 = false; + global::isN236 = false; } else if(checkconfig_str_val == "n873\n") { global::isN705 = false; global::isN905C = false; global::isN613 = false; global::isN873 = true; + global::isN236 = false; + } + else if(checkconfig_str_val == "n236\n") { + global::isN705 = false; + global::isN905C = false; + global::isN613 = false; + global::isN873 = false; + global::isN236 = true; } else { ; @@ -157,22 +168,36 @@ int main(int argc, char *argv[]) global::isN705 = true; global::isN905C = false; global::isN613 = false; + global::isN873 = false; + global::isN236 = false; } else if(checkconfig_str_val == "n905\n") { global::isN705 = false; global::isN905C = true; global::isN613 = false; + global::isN873 = false; + global::isN236 = false; } else if(checkconfig_str_val == "n613\n") { global::isN705 = false; global::isN905C = false; global::isN613 = true; + global::isN873 = false; + global::isN236 = false; } else if(checkconfig_str_val == "n873\n") { global::isN705 = false; global::isN905C = false; global::isN613 = false; global::isN873 = true; + global::isN236 = false; + } + else if(checkconfig_str_val == "n236\n") { + global::isN705 = false; + global::isN905C = false; + global::isN613 = false; + global::isN873 = false; + global::isN236 = true; } else { ; diff --git a/mainwindow.cpp b/mainwindow.cpp index ca31540..db005da 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -89,7 +89,7 @@ MainWindow::MainWindow(QWidget *parent) wifiIconWidth = sW / 22.5; wifiIconHeight = sH / 22.5; } - else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "emu\n") { + else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "emu\n") { stdIconWidth = sW / 12.5; stdIconHeight = sH / 12.5; brightnessIconWidth = sW / 24.5; @@ -157,7 +157,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") { + else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\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") { @@ -768,8 +768,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") { - // Hide brightness controls; they won't be very useful there anyway (for anything but the Glo) ... + 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") { ui->brightnessBtn->hide(); ui->line_7->hide(); @@ -1093,7 +1093,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"){ + else if(readFile("/opt/inkbox_device") == "n613\n" or readFile("/opt/inkbox_device") == "n873\n" or readFile("/opt/inkbox_device") == "n236\n"){ truncateTreshold = 20; } else { diff --git a/reader.cpp b/reader.cpp index 0804018..cfb9f09 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") { + 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(".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 == "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 == "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 9033c10..badcfc9 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") { + 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(".config/10-dark_mode/config") == true) { ui->darkModeCheckBox->click(); } @@ -174,7 +174,7 @@ settings::settings(QWidget *parent) : ui->uiScalingSlider->setValue(2); } } - else if(checkconfig_str_val == "n613\n") { + else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n") { if(dpi_number == 195) { ui->uiScalingSlider->setValue(0); } @@ -572,7 +572,7 @@ void settings::on_uiScalingSlider_valueChanged(int value) if(checkconfig_str_val == "n905\n") { string_writeconfig(".config/09-dpi/config", "160"); } - if(checkconfig_str_val == "n613\n") { + if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n") { string_writeconfig(".config/09-dpi/config", "195"); } if(checkconfig_str_val == "n873\n") { @@ -587,7 +587,7 @@ void settings::on_uiScalingSlider_valueChanged(int value) if(checkconfig_str_val == "n905\n") { string_writeconfig(".config/09-dpi/config", "187"); } - if(checkconfig_str_val == "n613\n") { + if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n") { string_writeconfig(".config/09-dpi/config", "210"); } if(checkconfig_str_val == "n873\n") { @@ -602,7 +602,7 @@ void settings::on_uiScalingSlider_valueChanged(int value) if(checkconfig_str_val == "n905\n") { string_writeconfig(".config/09-dpi/config", "200"); } - if(checkconfig_str_val == "n613\n") { + if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n") { string_writeconfig(".config/09-dpi/config", "225"); } if(checkconfig_str_val == "n873\n") { @@ -706,7 +706,7 @@ void settings::on_enableUiScalingCheckBox_toggled(bool checked) else if(checkconfig_str_val == "n905\n") { string_writeconfig(".config/09-dpi/config", "160"); } - else if(checkconfig_str_val == "n613\n") { + 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 == "n873\n") { diff --git a/settingschooser.cpp b/settingschooser.cpp index f7f7c23..34a5b88 100644 --- a/settingschooser.cpp +++ b/settingschooser.cpp @@ -46,7 +46,7 @@ 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") { + else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n") { ui->inkboxSettingsBtn->setStyleSheet("padding: 25px; Text-align: left"); ui->koboxSettingsBtn->setStyleSheet("padding:25px; Text-align: left"); }