Touch N905C initial support

This commit is contained in:
Nicolas Mailloux 2021-04-09 20:54:20 -04:00
parent d948375d03
commit df716a2e62
3 changed files with 82 additions and 15 deletions

View file

@ -83,7 +83,7 @@ MainWindow::MainWindow(QWidget *parent)
// Battery // Battery
string_checkconfig_ro("/opt/inkbox_device"); string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") { if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") {
// Hide brightness controls; they won't be very useful there anyway... // Hide brightness controls; they won't be very useful there anyway...
ui->brightnessBtn->hide(); ui->brightnessBtn->hide();
ui->line_7->hide(); ui->line_7->hide();
@ -119,6 +119,7 @@ MainWindow::MainWindow(QWidget *parent)
} }
} }
else { else {
// Setting icons up
stdIconWidth = sW / 19; stdIconWidth = sW / 19;
stdIconHeight = sH / 19; stdIconHeight = sH / 19;
QPixmap chargingPixmap(":/resources/battery_charging.png"); QPixmap chargingPixmap(":/resources/battery_charging.png");
@ -164,9 +165,9 @@ MainWindow::MainWindow(QWidget *parent)
ui->brightnessBtn->setStyleSheet("font-size: 9pt; padding-bottom: 5px; padding-top: 5px; padding-left: 8px; padding-right: 8px;"); ui->brightnessBtn->setStyleSheet("font-size: 9pt; padding-bottom: 5px; padding-top: 5px; padding-left: 8px; padding-right: 8px;");
// Checking if we have a Mini there // Checking if we have a Mini or Touch there
string_checkconfig_ro("/opt/inkbox_device"); string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") { 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;"); ui->batteryIcon->setStyleSheet("font-size: 5pt; padding-bottom: 0px; padding-top: 0px; padding-left: 1px; padding-right: 1px;");
} }
else { else {

View file

@ -145,7 +145,7 @@ reader::reader(QWidget *parent) :
// Defining what the icons' size will be // Defining what the icons' size will be
if(checkconfig("/opt/inkbox_genuine") == true) { if(checkconfig("/opt/inkbox_genuine") == true) {
string_checkconfig_ro("/opt/inkbox_device"); string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") { if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") {
float stdIconWidth = sW / 16; float stdIconWidth = sW / 16;
float stdIconHeight = sW / 16; float stdIconHeight = sW / 16;
QPixmap chargingPixmap(":/resources/battery_charging.png"); QPixmap chargingPixmap(":/resources/battery_charging.png");
@ -657,7 +657,7 @@ void reader::menubar_show() {
ui->statusBarWidget->setVisible(true); ui->statusBarWidget->setVisible(true);
string_checkconfig("/opt/inkbox_device"); string_checkconfig("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") { if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") {
; ;
} }
else { else {
@ -676,7 +676,7 @@ void reader::menubar_show() {
void reader::menubar_hide() { void reader::menubar_hide() {
string_checkconfig("/opt/inkbox_device"); string_checkconfig("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") { if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") {
ui->brightnessWidget->setVisible(false); ui->brightnessWidget->setVisible(false);
} }
else { else {
@ -805,6 +805,28 @@ void reader::on_sizeSlider_valueChanged(int value)
ui->sizeValueLabel->setText("5"); ui->sizeValueLabel->setText("5");
} }
} }
if(checkconfig_match("/opt/inkbox_device", "n905\n") == true) {
if(value == 0) {
ui->text->setStyleSheet("font-size: 6pt");
ui->sizeValueLabel->setText("1");
}
if(value == 1) {
ui->text->setStyleSheet("font-size: 10pt");
ui->sizeValueLabel->setText("2");
}
if(value == 2) {
ui->text->setStyleSheet("font-size: 14pt");
ui->sizeValueLabel->setText("3");
}
if(value == 3) {
ui->text->setStyleSheet("font-size: 18pt");
ui->sizeValueLabel->setText("4");
}
if(value == 4) {
ui->text->setStyleSheet("font-size: 22pt");
ui->sizeValueLabel->setText("5");
}
}
else { else {
if(value == 0) { if(value == 0) {
ui->text->setStyleSheet("font-size: 6pt"); ui->text->setStyleSheet("font-size: 6pt");

View file

@ -99,6 +99,9 @@ settings::settings(QWidget *parent) :
} }
else { else {
int dpi_number = checkconfig_str_val.toInt(); int dpi_number = checkconfig_str_val.toInt();
// Checking if it's a Mini or a Touch
string_checkconfig("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") {
if(dpi_number == 187) { if(dpi_number == 187) {
ui->uiScalingSlider->setValue(0); ui->uiScalingSlider->setValue(0);
} }
@ -109,6 +112,29 @@ settings::settings(QWidget *parent) :
ui->uiScalingSlider->setValue(2); ui->uiScalingSlider->setValue(2);
} }
} }
if(checkconfig_str_val == "n905\n") {
if(dpi_number == 160) {
ui->uiScalingSlider->setValue(0);
}
if(dpi_number == 187) {
ui->uiScalingSlider->setValue(1);
}
if(dpi_number == 200) {
ui->uiScalingSlider->setValue(2);
}
}
else {
if(dpi_number == 187) {
ui->uiScalingSlider->setValue(0);
}
if(dpi_number == 214) {
ui->uiScalingSlider->setValue(1);
}
if(dpi_number == 227) {
ui->uiScalingSlider->setValue(2);
}
}
}
// Refresh // Refresh
string_checkconfig(".config/04-book/refresh"); string_checkconfig(".config/04-book/refresh");
@ -470,14 +496,32 @@ void settings::on_darkModeCheckBox_toggled(bool checked)
void settings::on_uiScalingSlider_valueChanged(int value) void settings::on_uiScalingSlider_valueChanged(int value)
{ {
if(value == 0) { if(value == 0) {
string_checkconfig("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") {
string_writeconfig(".config/09-dpi/config", "187"); string_writeconfig(".config/09-dpi/config", "187");
} }
if(checkconfig_str_val == "n905\n") {
string_writeconfig(".config/09-dpi/config", "160");
}
}
if(value == 1) { if(value == 1) {
string_checkconfig("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") {
string_writeconfig(".config/09-dpi/config", "214"); string_writeconfig(".config/09-dpi/config", "214");
} }
if(checkconfig_str_val == "n905\n") {
string_writeconfig(".config/09-dpi/config", "187");
}
}
if(value == 2) { if(value == 2) {
string_checkconfig("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") {
string_writeconfig(".config/09-dpi/config", "227"); string_writeconfig(".config/09-dpi/config", "227");
} }
if(checkconfig_str_val == "n905\n") {
string_writeconfig(".config/09-dpi/config", "200");
}
}
// Making sense for the user // Making sense for the user
value = value + 1; value = value + 1;