Kobo Nia (N306) support

This commit is contained in:
Nicolas Mailloux 2022-02-19 19:21:09 -05:00
parent bd40cd22c6
commit 035ab14e5f
8 changed files with 48 additions and 19 deletions

View file

@ -120,6 +120,7 @@ namespace global {
inline bool isN873;
inline bool isN236;
inline bool isN437;
inline bool isN306;
inline bool runningInstanceIsReaderOnly;
}
@ -548,7 +549,7 @@ namespace {
defaultEpubPageHeight = 425;
defaultEpubPageWidth = 425;
}
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") {
else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n437\n" or checkconfig_str_val == "n306\n" or checkconfig_str_val == "emu\n") {
defaultEpubPageHeight = 450;
defaultEpubPageWidth = 450;
}
@ -563,7 +564,7 @@ namespace {
defaultPdfPageHeight = 750;
defaultPdfPageWidth = 550;
}
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 == "n306\n" or checkconfig_str_val == "emu\n") {
defaultPdfPageHeight = 974;
defaultPdfPageWidth = 708;
}
@ -580,7 +581,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" or checkconfig_str_val == "n437\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" or checkconfig_str_val == "n306\n") {
set_brightness(brightnessValue);
}
else if(checkconfig_str_val == "n613\n") {

View file

@ -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" or checkconfig_str_val == "n236\n") {
else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n306\n") {
dpiSetting = "175";
}
else if(checkconfig_str_val == "n437\n") {
@ -134,7 +134,7 @@ 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" or checkconfig_str_val == "n236\n") {
else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n306\n") {
dpiSetting = "225";
}
else if(checkconfig_str_val == "n437\n") {

View file

@ -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" or checkconfig_str_val == "n236\n") {
else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n306\n") {
dpiSetting = "175";
}
else if(checkconfig_str_val == "n437\n") {

View file

@ -105,6 +105,7 @@ int main(int argc, char *argv[])
global::isN873 = false;
global::isN236 = false;
global::isN437 = false;
global::isN306 = false;
}
else if(checkconfig_str_val == "n905\n") {
global::isN705 = false;
@ -113,6 +114,7 @@ int main(int argc, char *argv[])
global::isN873 = false;
global::isN236 = false;
global::isN437 = false;
global::isN306 = false;
}
else if(checkconfig_str_val == "n613\n") {
global::isN705 = false;
@ -137,6 +139,7 @@ int main(int argc, char *argv[])
global::isN873 = false;
global::isN236 = true;
global::isN437 = false;
global::isN306 = false;
}
else if(checkconfig_str_val == "n437\n") {
global::isN705 = false;
@ -145,6 +148,16 @@ int main(int argc, char *argv[])
global::isN873 = false;
global::isN236 = false;
global::isN437 = true;
global::isN306 = false;
}
else if(checkconfig_str_val == "n306\n") {
global::isN705 = false;
global::isN905C = false;
global::isN613 = false;
global::isN873 = false;
global::isN236 = false;
global::isN437 = false;
global::isN306 = true;
}
else {
;
@ -184,6 +197,7 @@ int main(int argc, char *argv[])
global::isN873 = false;
global::isN236 = false;
global::isN437 = false;
global::isN306 = false;
}
else if(checkconfig_str_val == "n905\n") {
global::isN705 = false;
@ -192,6 +206,7 @@ int main(int argc, char *argv[])
global::isN873 = false;
global::isN236 = false;
global::isN437 = false;
global::isN306 = false;
}
else if(checkconfig_str_val == "n613\n") {
global::isN705 = false;
@ -200,6 +215,7 @@ int main(int argc, char *argv[])
global::isN873 = false;
global::isN236 = false;
global::isN437 = false;
global::isN306 = false;
}
else if(checkconfig_str_val == "n873\n") {
global::isN705 = false;
@ -208,6 +224,7 @@ int main(int argc, char *argv[])
global::isN873 = true;
global::isN236 = false;
global::isN437 = false;
global::isN306 = false;
}
else if(checkconfig_str_val == "n236\n") {
global::isN705 = false;
@ -216,6 +233,7 @@ int main(int argc, char *argv[])
global::isN873 = false;
global::isN236 = true;
global::isN437 = false;
global::isN306 = false;
}
else if(checkconfig_str_val == "n437\n") {
global::isN705 = false;
@ -224,6 +242,16 @@ int main(int argc, char *argv[])
global::isN873 = false;
global::isN236 = false;
global::isN437 = true;
global::isN306 = false;
}
else if(checkconfig_str_val == "n306\n") {
global::isN705 = false;
global::isN905C = false;
global::isN613 = false;
global::isN873 = false;
global::isN236 = false;
global::isN437 = false;
global::isN306 = true;
}
else {
;

View file

@ -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 == "n437\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 == "n306\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 == "n437\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 == "n306\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") {
@ -776,7 +776,7 @@ 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" or checkconfig_str_val == "n437\n") {
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" or checkconfig_str_val == "n306\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();
@ -1114,7 +1114,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" or readFile("/opt/inkbox_device") == "n437\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" or readFile("/opt/inkbox_device") == "n306\n"){
truncateTreshold = 20;
}
else {

View file

@ -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" or checkconfig_str_val == "n437\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 == "n306\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 == "n437\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 == "n306\n" or checkconfig_str_val == "emu\n") {
float stdIconWidth = sW / 16;
float stdIconHeight = sW / 16;
QPixmap chargingPixmap(":/resources/battery_charging.png");

View file

@ -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" or checkconfig_str_val == "n437\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 == "n306\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" or checkconfig_str_val == "n236\n") {
else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n306\n") {
if(dpi_number == 195) {
ui->uiScalingSlider->setValue(0);
}
@ -583,7 +583,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" or checkconfig_str_val == "n236\n") {
if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n306\n") {
string_writeconfig(".config/09-dpi/config", "195");
}
if(checkconfig_str_val == "n437\n") {
@ -601,7 +601,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" or checkconfig_str_val == "n236\n") {
if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n306\n") {
string_writeconfig(".config/09-dpi/config", "210");
}
if(checkconfig_str_val == "n437\n") {
@ -619,7 +619,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" or checkconfig_str_val == "n236\n") {
if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n306\n") {
string_writeconfig(".config/09-dpi/config", "225");
}
if(checkconfig_str_val == "n437\n") {
@ -726,7 +726,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" or checkconfig_str_val == "n236\n") {
else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n306\n") {
string_writeconfig(".config/09-dpi/config", "195");
}
else if(checkconfig_str_val == "n437\n") {

View file

@ -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" or checkconfig_str_val == "n236\n") {
else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n306\n") {
ui->inkboxSettingsBtn->setStyleSheet("padding: 25px; Text-align: left");
ui->koboxSettingsBtn->setStyleSheet("padding:25px; Text-align: left");
}