Speed optimization with deviceID; various fixes/improvements

This commit is contained in:
Nicolas Mailloux 2022-04-02 16:49:18 -04:00
parent 4a4b4bb3ad
commit f683d70f1c
15 changed files with 119 additions and 152 deletions

View file

@ -54,7 +54,7 @@ apps::apps(QWidget *parent) :
}
}
// Hiding Light Maps if device doesn't have a working Wi-Fi adapter
if(global::device::isWifiAble == false and readFile("/opt/inkbox_device") != "emu\n") {
if(global::device::isWifiAble == false and global::deviceID != "emu\n") {
ui->label_2->hide();
ui->lightmapsLaunchBtn->hide();
ui->label_2->deleteLater();

View file

@ -125,6 +125,7 @@ namespace global {
inline bool isN437;
inline bool isN306;
inline bool runningInstanceIsReaderOnly;
inline QString deviceID;
}
// https://stackoverflow.com/questions/6080853/c-multiple-definition-error-for-global-functions-in-the-header-file/20679534#20679534
@ -299,8 +300,7 @@ namespace {
fhandler.close();
}
int get_brightness() {
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n613\n") {
if(global::deviceID == "n613\n") {
string_checkconfig_ro(".config/03-brightness/config");
int brightness;
if(checkconfig_str_val == "") {
@ -385,8 +385,7 @@ namespace {
return 0;
}
void zeroBrightness() {
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val != "n613\n") {
if(global::deviceID != "n613\n") {
set_brightness(0);
}
else {
@ -484,7 +483,7 @@ namespace {
QString getConnectionInformation() {
QString getIpProg ("sh");
QStringList getIpArgs;
if(readFile("/opt/inkbox_device") != "n437\n") {
if(global::deviceID != "n437\n") {
getIpArgs << "-c" << "/sbin/ifconfig eth0 | grep 'inet addr' | cut -d: -f2 | awk '{print $1}'";
}
else {
@ -516,8 +515,7 @@ namespace {
global::systemInfoText.append("<br><b>Kernel version:</b> ");
global::systemInfoText.append(kernelVersion);
global::systemInfoText.append("<br><b>Device:</b> ");
string_checkconfig_ro("/opt/inkbox_device");
QString device = checkconfig_str_val.trimmed();
QString device = global::deviceID.trimmed();
global::systemInfoText.append(device);
QString ipAddress = getConnectionInformation();
global::systemInfoText.append("<br><b>IP address: </b>");
@ -546,51 +544,47 @@ namespace {
* 1: PDF
*/
if(fileType == 0) {
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") {
if(global::deviceID == "n705\n") {
defaultEpubPageHeight = 365;
defaultEpubPageWidth = 365;
}
else if(checkconfig_str_val == "n905\n") {
else if(global::deviceID == "n905\n") {
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 == "n306\n" or checkconfig_str_val == "emu\n") {
else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n437\n" or global::deviceID == "n306\n" or checkconfig_str_val == "emu\n") {
defaultEpubPageHeight = 450;
defaultEpubPageWidth = 450;
}
else if(checkconfig_str_val == "n873\n") {
else if(global::deviceID == "n873\n") {
defaultEpubPageHeight = 525;
defaultEpubPageWidth = 525;
}
}
else if(fileType == 1) {
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") {
if(global::deviceID == "n705\n" or global::deviceID == "n905\n") {
defaultPdfPageHeight = 750;
defaultPdfPageWidth = 550;
}
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") {
else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n306\n" or checkconfig_str_val == "emu\n") {
defaultPdfPageHeight = 974;
defaultPdfPageWidth = 708;
}
else if(checkconfig_str_val == "n437\n") {
else if(global::deviceID == "n437\n") {
defaultPdfPageHeight = 1398;
defaultPdfPageWidth = 1022;
}
else if(checkconfig_str_val == "n873\n") {
else if(global::deviceID == "n873\n") {
defaultPdfPageHeight = 1630;
defaultPdfPageWidth = 1214;
}
}
}
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" or checkconfig_str_val == "n306\n") {
if(global::deviceID == "n705\n" or global::deviceID == "n905\n" or global::deviceID == "n873\n" or global::deviceID == "n236\n" or global::deviceID == "n437\n" or global::deviceID == "n306\n") {
set_brightness(brightnessValue);
}
else if(checkconfig_str_val == "n613\n") {
else if(global::deviceID == "n613\n") {
set_brightness_ntxio(brightnessValue);
}
else {
@ -653,8 +647,7 @@ namespace {
}
int get_warmth() {
QString sysfsWarmthPath;
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n873\n") {
if(global::deviceID == "n873\n") {
sysfsWarmthPath = "/sys/class/backlight/lm3630a_led/color";
}
string_checkconfig_ro(sysfsWarmthPath);
@ -667,8 +660,7 @@ namespace {
warmthValue = 10 - warmthValue;
std::string warmthValueStr = std::to_string(warmthValue);
std::string sysfsWarmthPath;
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n873\n") {
if(global::deviceID == "n873\n") {
sysfsWarmthPath = "/sys/class/backlight/lm3630a_led/color";
}
string_writeconfig(sysfsWarmthPath, warmthValueStr);

View file

@ -51,7 +51,7 @@ generalDialog::generalDialog(QWidget *parent) :
ui->searchComboBox->setStyleSheet("font-size: 9pt");
// Disabling "Online library" search if device doesn't have Wi-Fi
if(global::device::isWifiAble == false && readFile("/opt/inkbox_device") != "emu\n") {
if(global::device::isWifiAble == false && global::deviceID != "emu\n") {
ui->searchComboBox->removeItem(2);
}
@ -76,7 +76,7 @@ generalDialog::generalDialog(QWidget *parent) :
resetDialog = true;
ui->okBtn->setText("Proceed");
ui->cancelBtn->setText("Go back");
if(readFile("/opt/inkbox_device") != "n705\n") {
if(global::deviceID != "n705\n") {
ui->bodyLabel->setText("This will erase any books you have stored on the device.\nSettings will be reset.");
}
else {

View file

@ -26,8 +26,7 @@ koboxAppsDialog::koboxAppsDialog(QWidget *parent) :
this->setStyleSheet(stylesheetFile.readAll());
stylesheetFile.close();
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") {
if(global::deviceID == "n705\n") {
// If we don't do this, the text will clip out of the display.
ui->definitionLabel->setText("Please select an application.\nClick on 'Launch' to start it.");
}
@ -98,17 +97,16 @@ void koboxAppsDialog::on_launchBtn_clicked()
// DPI setting
string_checkconfig(".config/00-kobox/dpiSetting");
if(checkconfig_str_val == "") {
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") {
if(global::deviceID == "n705\n" or global::deviceID == "n905\n") {
dpiSetting = "125";
}
else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n306\n") {
else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n306\n") {
dpiSetting = "175";
}
else if(checkconfig_str_val == "n437\n") {
else if(global::deviceID == "n437\n") {
dpiSetting = "225";
}
else if(checkconfig_str_val == "n873\n") {
else if(global::deviceID == "n873\n") {
dpiSetting = "250";
}
else {
@ -131,17 +129,16 @@ 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";
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") {
if(global::deviceID == "n705\n" or global::deviceID == "n905\n") {
dpiSetting = "175";
}
else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n306\n") {
else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n306\n") {
dpiSetting = "225";
}
else if(checkconfig_str_val == "n437\n") {
else if(global::deviceID == "n437\n") {
dpiSetting = "275";
}
else if(checkconfig_str_val == "n873\n") {
else if(global::deviceID == "n873\n") {
dpiSetting = "300";
}
else {

View file

@ -42,17 +42,16 @@ koboxSettings::koboxSettings(QWidget *parent) :
QString dpiSetting;
string_checkconfig(".config/00-kobox/dpiSetting");
if(checkconfig_str_val == "") {
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") {
if(global::deviceID == "n705\n" or global::deviceID == "n905\n") {
dpiSetting = "125";
}
else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n306\n") {
else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n306\n") {
dpiSetting = "175";
}
else if(checkconfig_str_val == "n437\n") {
else if(global::deviceID == "n437\n") {
dpiSetting = "225";
}
else if(checkconfig_str_val == "n873\n") {
else if(global::deviceID == "n873\n") {
dpiSetting = "250";
}
else {

View file

@ -34,7 +34,7 @@ libraryWidget::libraryWidget(QWidget *parent) :
}
QFont crimson(family);
if(readFile("/opt/inkbox_device") != "n905\n") {
if(global::deviceID != "n905\n") {
ui->previousBtn->setText("");
ui->previousBtn->setProperty("type", "borderless");
ui->nextBtn->setText("");
@ -62,7 +62,7 @@ libraryWidget::libraryWidget(QWidget *parent) :
ui->book6Btn->setText("");
ui->book7Btn->setText("");
ui->book8Btn->setText("");
if(readFile("/opt/inkbox_device") != "n905\n") {
if(global::deviceID != "n905\n") {
ui->book9Btn->setText("");
ui->book10Btn->setText("");
ui->book11Btn->setText("");
@ -98,7 +98,7 @@ libraryWidget::libraryWidget(QWidget *parent) :
ui->book6Label->setStyleSheet("font-size: 8.5pt; font-style: italic");
ui->book7Label->setStyleSheet("font-size: 8.5pt; font-style: italic");
ui->book8Label->setStyleSheet("font-size: 8.5pt; font-style: italic");
if(readFile("/opt/inkbox_device") != "n905\n") {
if(global::deviceID != "n905\n") {
ui->book9Label->setStyleSheet("font-size: 8.5pt; font-style: italic");
ui->book10Label->setStyleSheet("font-size: 8.5pt; font-style: italic");
ui->book11Label->setStyleSheet("font-size: 8.5pt; font-style: italic");
@ -134,7 +134,7 @@ libraryWidget::libraryWidget(QWidget *parent) :
ui->book6Label->setFont(crimson);
ui->book7Label->setFont(crimson);
ui->book8Label->setFont(crimson);
if(readFile("/opt/inkbox_device") != "n905\n") {
if(global::deviceID != "n905\n") {
ui->book9Label->setFont(crimson);
ui->book10Label->setFont(crimson);
ui->book11Label->setFont(crimson);
@ -186,7 +186,7 @@ void libraryWidget::setupView() {
ui->book6Label->setText(readFile("/mnt/onboard/onboard/.inkbox/gutenberg-data/latest-books/6/title"));
ui->book7Label->setText(readFile("/mnt/onboard/onboard/.inkbox/gutenberg-data/latest-books/7/title"));
ui->book8Label->setText(readFile("/mnt/onboard/onboard/.inkbox/gutenberg-data/latest-books/8/title"));
if(readFile("/opt/inkbox_device") != "n905\n") {
if(global::deviceID != "n905\n") {
ui->book9Label->setText(readFile("/mnt/onboard/onboard/.inkbox/gutenberg-data/latest-books/9/title"));
ui->book10Label->setText(readFile("/mnt/onboard/onboard/.inkbox/gutenberg-data/latest-books/10/title"));
ui->book11Label->setText(readFile("/mnt/onboard/onboard/.inkbox/gutenberg-data/latest-books/11/title"));
@ -213,7 +213,7 @@ void libraryWidget::setupView() {
ui->book7Btn->setIconSize(QSize(stdIconWidth, stdIconHeight));
ui->book8Btn->setIcon(QIcon("/mnt/onboard/onboard/.inkbox/gutenberg-data/latest-books/8/cover.jpg"));
ui->book8Btn->setIconSize(QSize(stdIconWidth, stdIconHeight));
if(readFile("/opt/inkbox_device") != "n905\n") {
if(global::deviceID != "n905\n") {
ui->book9Btn->setIcon(QIcon("/mnt/onboard/onboard/.inkbox/gutenberg-data/latest-books/9/cover.jpg"));
ui->book9Btn->setIconSize(QSize(stdIconWidth, stdIconHeight));
ui->book10Btn->setIcon(QIcon("/mnt/onboard/onboard/.inkbox/gutenberg-data/latest-books/10/cover.jpg"));

View file

@ -31,6 +31,7 @@
int main(int argc, char *argv[])
{
global::deviceID = readFile("/opt/inkbox_device");
setDefaultWorkDir();
if(checkconfig(".config/18-encrypted_storage/status") == true and checkconfig("/external_root/run/encfs_mounted") == false) {
// Open Encryption Manager to unlock encrypted storage
@ -58,8 +59,7 @@ int main(int argc, char *argv[])
global::reader::startUsbmsPrompt = false;
// Checking if battery level is critical; if true (and if it is not charging), then display a "Please charge your eReader" splash and power off.
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val != "emu\n") {
if(global::deviceID != "emu\n") {
if(isBatteryCritical() == true) {
string_checkconfig_ro("/sys/devices/platform/pmic_battery.1/power_supply/mc13892_bat/status");
if(checkconfig_str_val == "Charging\n") {
@ -97,8 +97,7 @@ int main(int argc, char *argv[])
global::reader::skipOpenDialog = true;
string_writeconfig("/inkbox/skip_opendialog", "true");
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") {
if(global::deviceID == "n705\n") {
global::isN705 = true;
global::isN905C = false;
global::isN613 = false;
@ -107,7 +106,7 @@ int main(int argc, char *argv[])
global::isN437 = false;
global::isN306 = false;
}
else if(checkconfig_str_val == "n905\n") {
else if(global::deviceID == "n905\n") {
global::isN705 = false;
global::isN905C = true;
global::isN613 = false;
@ -116,7 +115,7 @@ int main(int argc, char *argv[])
global::isN437 = false;
global::isN306 = false;
}
else if(checkconfig_str_val == "n613\n") {
else if(global::deviceID == "n613\n") {
global::isN705 = false;
global::isN905C = false;
global::isN613 = true;
@ -124,7 +123,7 @@ int main(int argc, char *argv[])
global::isN236 = false;
global::isN437 = false;
}
else if(checkconfig_str_val == "n873\n") {
else if(global::deviceID == "n873\n") {
global::isN705 = false;
global::isN905C = false;
global::isN613 = false;
@ -132,7 +131,7 @@ int main(int argc, char *argv[])
global::isN236 = false;
global::isN437 = false;
}
else if(checkconfig_str_val == "n236\n") {
else if(global::deviceID == "n236\n") {
global::isN705 = false;
global::isN905C = false;
global::isN613 = false;
@ -141,7 +140,7 @@ int main(int argc, char *argv[])
global::isN437 = false;
global::isN306 = false;
}
else if(checkconfig_str_val == "n437\n") {
else if(global::deviceID == "n437\n") {
global::isN705 = false;
global::isN905C = false;
global::isN613 = false;
@ -150,7 +149,7 @@ int main(int argc, char *argv[])
global::isN437 = true;
global::isN306 = false;
}
else if(checkconfig_str_val == "n306\n") {
else if(global::deviceID == "n306\n") {
global::isN705 = false;
global::isN905C = false;
global::isN613 = false;
@ -184,8 +183,7 @@ int main(int argc, char *argv[])
w.setStyleSheet(stylesheetFile.readAll());
stylesheetFile.close();
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") {
if(global::deviceID == "n705\n") {
global::isN705 = true;
global::isN905C = false;
global::isN613 = false;
@ -194,7 +192,7 @@ int main(int argc, char *argv[])
global::isN437 = false;
global::isN306 = false;
}
else if(checkconfig_str_val == "n905\n") {
else if(global::deviceID == "n905\n") {
global::isN705 = false;
global::isN905C = true;
global::isN613 = false;
@ -203,7 +201,7 @@ int main(int argc, char *argv[])
global::isN437 = false;
global::isN306 = false;
}
else if(checkconfig_str_val == "n613\n") {
else if(global::deviceID == "n613\n") {
global::isN705 = false;
global::isN905C = false;
global::isN613 = true;
@ -212,7 +210,7 @@ int main(int argc, char *argv[])
global::isN437 = false;
global::isN306 = false;
}
else if(checkconfig_str_val == "n873\n") {
else if(global::deviceID == "n873\n") {
global::isN705 = false;
global::isN905C = false;
global::isN613 = false;
@ -221,7 +219,7 @@ int main(int argc, char *argv[])
global::isN437 = false;
global::isN306 = false;
}
else if(checkconfig_str_val == "n236\n") {
else if(global::deviceID == "n236\n") {
global::isN705 = false;
global::isN905C = false;
global::isN613 = false;
@ -230,7 +228,7 @@ int main(int argc, char *argv[])
global::isN437 = false;
global::isN306 = false;
}
else if(checkconfig_str_val == "n437\n") {
else if(global::deviceID == "n437\n") {
global::isN705 = false;
global::isN905C = false;
global::isN613 = false;
@ -239,7 +237,7 @@ int main(int argc, char *argv[])
global::isN437 = true;
global::isN306 = false;
}
else if(checkconfig_str_val == "n306\n") {
else if(global::deviceID == "n306\n") {
global::isN705 = false;
global::isN905C = false;
global::isN613 = false;

View file

@ -73,8 +73,7 @@ MainWindow::MainWindow(QWidget *parent)
sH = QGuiApplication::screens()[0]->size().height();
// Defining what the default icon size will be
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") {
if(global::deviceID == "n705\n") {
stdIconWidth = sW / 12;
stdIconHeight = sH / 12;
brightnessIconWidth = sW / 24;
@ -84,7 +83,7 @@ MainWindow::MainWindow(QWidget *parent)
wifiIconWidth = sW / 20.5;
wifiIconHeight = sH / 20.5;
}
else if(checkconfig_str_val == "n905\n") {
else if(global::deviceID == "n905\n") {
stdIconWidth = sW / 14;
stdIconHeight = sH / 14;
brightnessIconWidth = sW / 26;
@ -94,7 +93,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 == "n306\n" or checkconfig_str_val == "emu\n") {
else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n437\n" or global::deviceID == "n306\n" or global::deviceID == "emu\n") {
stdIconWidth = sW / 12.5;
stdIconHeight = sH / 12.5;
brightnessIconWidth = sW / 24.5;
@ -158,14 +157,13 @@ MainWindow::MainWindow(QWidget *parent)
ui->wifiBtn->setStyleSheet("font-size: 9pt; padding-bottom: 0px; padding-top: 0px; padding-left: 8px; padding-right: 8px");
// Checking if we have a Mini or Touch there
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") {
if(global::deviceID == "n705\n" or global::deviceID == "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 == "n306\n" or checkconfig_str_val == "emu\n") {
else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n437\n" or global::deviceID == "n306\n" or global::deviceID == "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") {
else if(global::deviceID == "n873\n") {
ui->batteryIcon->setStyleSheet("font-size: 5pt; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; padding-right: 0px;");
}
else {
@ -187,7 +185,7 @@ MainWindow::MainWindow(QWidget *parent)
// Deleting/Hiding "Library" button if device is not WiFi-able
// NOTE: Using deleteLater() on these elements causes a segmentation fault and aborts the whole program when the Settings, Apps or Home button is pressed. No idea why.
if(global::device::isWifiAble == false && readFile("/opt/inkbox_device") != "emu\n") {
if(global::device::isWifiAble == false && global::deviceID != "emu\n") {
ui->libraryButton->hide();
ui->line_10->hide();
}
@ -784,10 +782,9 @@ 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" or checkconfig_str_val == "n306\n") {
if(global::deviceID == "n705\n" or global::deviceID == "n905\n" or global::deviceID == "n613\n" or global::deviceID == "n873\n" or global::deviceID == "n236\n" or global::deviceID == "n437\n" or global::deviceID == "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") {
if(global::deviceID == "n705\n" or global::deviceID == "n905\n") {
ui->brightnessBtn->hide();
ui->line_7->hide();
}
@ -855,8 +852,7 @@ void MainWindow::setBatteryIcon() {
}
void MainWindow::setInitialBrightness() {
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n873\n") {
if(global::deviceID == "n873\n") {
int warmth;
string_checkconfig_ro(".config/03-brightness/config-warmth");
if(checkconfig_str_val == "") {
@ -939,7 +935,7 @@ bool MainWindow::checkWifiState() {
* true: interface UP
* false: interface DOWN
*/
if(readFile("/opt/inkbox_device") == "n437\n") {
if(global::deviceID == "n437\n") {
string_checkconfig_ro("/sys/class/net/wlan0/operstate");
}
else {
@ -1137,10 +1133,10 @@ void MainWindow::resetFullWindow() {
}
void MainWindow::setRecentBooksLabelsTruncateTreshold() {
if(readFile("/opt/inkbox_device") == "n705\n" or readFile("/opt/inkbox_device") == "n905b\n" or readFile("/opt/inkbox_device") == "n905c\n") {
if(global::deviceID == "n705\n" or global::deviceID == "n905b\n" or global::deviceID == "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" or readFile("/opt/inkbox_device") == "n306\n"){
else if(global::deviceID == "n613\n" or global::deviceID == "n873\n" or global::deviceID == "n236\n" or global::deviceID == "n437\n" or global::deviceID == "n306\n"){
truncateTreshold = 20;
}
else {

View file

@ -105,7 +105,7 @@ reader::reader(QWidget *parent) :
ui->quitBtn->setIcon(QIcon(":/resources/power.png"));
// On the Mini with QT_FONT_DPI set to 187 (default for this device), quitBtn makes the UI go beyond the limits of the screen when the menu bar is shown
if(readFile("/opt/inkbox_device") == "n705\n") {
if(global::deviceID == "n705\n") {
ui->quitBtn->hide();
ui->quitBtn->deleteLater();
ui->line_19->hide();
@ -268,8 +268,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" or checkconfig_str_val == "n306\n") {
if(global::deviceID == "n705\n" or global::deviceID == "n905\n" or global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n437\n" or global::deviceID == "n306\n") {
if(checkconfig(".config/10-dark_mode/config") == true) {
string_writeconfig("/tmp/invertScreen", "y");
ui->nightModeBtn->setText("");
@ -290,8 +289,7 @@ reader::reader(QWidget *parent) :
ui->nightModeBtn->deleteLater();
}
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n873\n") {
if(global::deviceID == "n873\n") {
ui->nextBtn->setStyleSheet("padding: 13.5px");
ui->previousBtn->setStyleSheet("padding: 13.5px");
ui->optionsBtn->setStyleSheet("padding: 13.5px");
@ -348,8 +346,7 @@ reader::reader(QWidget *parent) :
float sH = QGuiApplication::screens()[0]->size().height();
// 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 == "n306\n" or checkconfig_str_val == "emu\n") {
if(global::deviceID == "n705\n" or global::deviceID == "n905\n" or global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n437\n" or global::deviceID == "n306\n" or checkconfig_str_val == "emu\n") {
float stdIconWidth = sW / 16;
float stdIconHeight = sW / 16;
QPixmap chargingPixmap(":/resources/battery_charging.png");
@ -528,6 +525,8 @@ reader::reader(QWidget *parent) :
setupPng();
}
else {
ui->graphicsView->hide();
ui->graphicsView->deleteLater();
ui->text->setText(ittext);
}
@ -567,11 +566,10 @@ reader::reader(QWidget *parent) :
infoLabelContent.append(bookTitle);
int infoLabelLength = infoLabelContent.length();
int infoLabelDefinedLength;
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") {
if(global::deviceID == "n705\n") {
infoLabelDefinedLength = 35;
}
else if(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") {
else if(global::deviceID == "n905\n" or global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n437\n" or global::deviceID == "n306\n") {
infoLabelDefinedLength = 50;
}
else {
@ -597,10 +595,10 @@ reader::reader(QWidget *parent) :
}
int infoLabelDefinedLength;
if(checkconfig_str_val == "n705\n") {
if(global::deviceID == "n705\n") {
infoLabelDefinedLength = 35;
}
else if(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") {
else if(global::deviceID == "n905\n" or global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n437\n" or global::deviceID == "n306\n") {
infoLabelDefinedLength = 50;
}
else {
@ -725,8 +723,7 @@ reader::reader(QWidget *parent) :
}
}
} );
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val != "emu\n") {
if(global::deviceID != "emu\n") {
t->start();
}
}
@ -1126,7 +1123,7 @@ void reader::on_optionsBtn_clicked()
{
if(menubar_shown == true) {
menubar_hide();
if(readFile("/opt/inkbox_device") == "n873\n") {
if(global::deviceID == "n873\n") {
ui->optionsBtn->setStyleSheet("background: white; color: black; padding: 13.5px");
}
else {
@ -1137,7 +1134,7 @@ void reader::on_optionsBtn_clicked()
}
else {
menubar_show();
if(readFile("/opt/inkbox_device") == "n873\n") {
if(global::deviceID == "n873\n") {
ui->optionsBtn->setStyleSheet("background: black; color: white; padding: 13.5px");
}
else {
@ -1412,8 +1409,7 @@ void reader::menubar_show() {
ui->pageWidget->setVisible(true);
}
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") {
if(global::deviceID == "n705\n" or global::deviceID == "n905\n") {
;
}
else {
@ -1424,8 +1420,7 @@ void reader::menubar_show() {
}
void reader::menubar_hide() {
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") {
if(global::deviceID == "n705\n" or global::deviceID == "n905\n") {
ui->brightnessWidget->setVisible(false);
}
else {

View file

@ -347,10 +347,10 @@ border: 5px solid lightGrey;
}
QScrollBar:vertical {
width: 25px
width: 30px
}
QScrollBar:horizontal {
height: 25px
height: 30px
}
QScrollBar::handle {
background: black;

View file

@ -350,10 +350,10 @@ QScrollBar {
}
QScrollBar:vertical {
width: 25px
width: 30px
}
QScrollBar:horizontal {
height: 25px
height: 30px
}
QScrollBar::handle {
background: black;

View file

@ -98,8 +98,7 @@ settings::settings(QWidget *parent) :
ui->quoteCheckBox->click();
}
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 == "n306\n") {
if(global::deviceID == "n705\n" or global::deviceID == "n905\n" or global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n437\n" or global::deviceID == "n306\n") {
if(checkconfig(".config/10-dark_mode/config") == true) {
ui->darkModeCheckBox->click();
}
@ -163,8 +162,7 @@ settings::settings(QWidget *parent) :
else {
int dpi_number = checkconfig_str_val.toInt();
// Checking if it's a Mini, Touch or a Glo
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") {
if(global::deviceID == "n705\n") {
if(dpi_number == 187) {
ui->uiScalingSlider->setValue(0);
}
@ -175,7 +173,7 @@ settings::settings(QWidget *parent) :
ui->uiScalingSlider->setValue(2);
}
}
else if(checkconfig_str_val == "n905\n") {
else if(global::deviceID == "n905\n") {
if(dpi_number == 160) {
ui->uiScalingSlider->setValue(0);
}
@ -186,7 +184,7 @@ settings::settings(QWidget *parent) :
ui->uiScalingSlider->setValue(2);
}
}
else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n306\n") {
else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n306\n") {
if(dpi_number == 195) {
ui->uiScalingSlider->setValue(0);
}
@ -197,7 +195,7 @@ settings::settings(QWidget *parent) :
ui->uiScalingSlider->setValue(2);
}
}
else if(checkconfig_str_val == "n437\n") {
else if(global::deviceID == "n437\n") {
if(dpi_number == 275) {
ui->uiScalingSlider->setValue(0);
}
@ -208,7 +206,7 @@ settings::settings(QWidget *parent) :
ui->uiScalingSlider->setValue(2);
}
}
else if(checkconfig_str_val == "n873\n") {
else if(global::deviceID == "n873\n") {
if(dpi_number == 285) {
ui->uiScalingSlider->setValue(0);
}
@ -599,56 +597,53 @@ void settings::on_darkModeCheckBox_toggled(bool checked)
void settings::on_uiScalingSlider_valueChanged(int value)
{
if(value == 0) {
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") {
if(global::deviceID == "n705\n") {
string_writeconfig(".config/09-dpi/config", "187");
}
if(checkconfig_str_val == "n905\n") {
if(global::deviceID == "n905\n") {
string_writeconfig(".config/09-dpi/config", "160");
}
if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n306\n") {
if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n306\n") {
string_writeconfig(".config/09-dpi/config", "195");
}
if(checkconfig_str_val == "n437\n") {
if(global::deviceID == "n437\n") {
string_writeconfig(".config/09-dpi/config", "275");
}
if(checkconfig_str_val == "n873\n") {
if(global::deviceID == "n873\n") {
string_writeconfig(".config/09-dpi/config", "285");
}
}
if(value == 1) {
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") {
if(global::deviceID == "n705\n") {
string_writeconfig(".config/09-dpi/config", "214");
}
if(checkconfig_str_val == "n905\n") {
if(global::deviceID == "n905\n") {
string_writeconfig(".config/09-dpi/config", "187");
}
if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n306\n") {
if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n306\n") {
string_writeconfig(".config/09-dpi/config", "210");
}
if(checkconfig_str_val == "n437\n") {
if(global::deviceID == "n437\n") {
string_writeconfig(".config/09-dpi/config", "290");
}
if(checkconfig_str_val == "n873\n") {
if(global::deviceID == "n873\n") {
string_writeconfig(".config/09-dpi/config", "300");
}
}
if(value == 2) {
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") {
if(global::deviceID == "n705\n") {
string_writeconfig(".config/09-dpi/config", "227");
}
if(checkconfig_str_val == "n905\n") {
if(global::deviceID == "n905\n") {
string_writeconfig(".config/09-dpi/config", "200");
}
if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n306\n") {
if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n306\n") {
string_writeconfig(".config/09-dpi/config", "225");
}
if(checkconfig_str_val == "n437\n") {
if(global::deviceID == "n437\n") {
string_writeconfig(".config/09-dpi/config", "305");
}
if(checkconfig_str_val == "n873\n") {
if(global::deviceID == "n873\n") {
string_writeconfig(".config/09-dpi/config", "315");
}
}
@ -741,20 +736,19 @@ void settings::on_enableUiScalingCheckBox_toggled(bool checked)
{
if(checked == true) {
// Writing default value depending on the device
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") {
if(global::deviceID == "n705\n") {
string_writeconfig(".config/09-dpi/config", "187");
}
else if(checkconfig_str_val == "n905\n") {
else if(global::deviceID == "n905\n") {
string_writeconfig(".config/09-dpi/config", "160");
}
else if(checkconfig_str_val == "n613\n" or checkconfig_str_val == "n236\n" or checkconfig_str_val == "n306\n") {
else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n306\n") {
string_writeconfig(".config/09-dpi/config", "195");
}
else if(checkconfig_str_val == "n437\n") {
else if(global::deviceID == "n437\n") {
string_writeconfig(".config/09-dpi/config", "275");
}
else if(checkconfig_str_val == "n873\n") {
else if(global::deviceID == "n873\n") {
string_writeconfig(".config/09-dpi/config", "285");
}
else {

View file

@ -28,8 +28,7 @@ settingsChooser::settingsChooser(QWidget *parent) :
sH = QGuiApplication::screens()[0]->size().height();
// Defining what the default icon size will be
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") {
if(global::deviceID == "n705\n") {
homeIconWidth = sW / 18;
homeIconHeight = sW / 18;
}
@ -41,12 +40,11 @@ settingsChooser::settingsChooser(QWidget *parent) :
ui->inkboxSettingsBtn->setProperty("type", "borderless");
ui->koboxSettingsBtn->setProperty("type", "borderless");
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n" or checkconfig_str_val == "n905\n") {
if(global::deviceID == "n705\n" or global::deviceID == "n905\n") {
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" or checkconfig_str_val == "n306\n") {
else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n306\n") {
ui->inkboxSettingsBtn->setStyleSheet("padding: 25px; Text-align: left");
ui->koboxSettingsBtn->setStyleSheet("padding:25px; Text-align: left");
}

View file

@ -32,8 +32,7 @@ usbms_splash::usbms_splash(QWidget *parent) :
ui->label->setText("Launching KoBox subsystem");
ui->label->setStyleSheet("font-size: 14pt");
ui->label_3->setText("Please wait, this could take a while.");
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n905\n") {
if(global::deviceID == "n905\n") {
ui->label_3->setStyleSheet("font-size: 11pt");
}
else {
@ -83,7 +82,7 @@ void usbms_splash::usbms_launch()
string_writeconfig("/opt/ibxd", "usbnet_stop\n");
QThread::msleep(1000);
if(readFile("/opt/inkbox_device") == "n306\n" or readFile("/opt/inkbox_device") == "n873\n") {
if(global::deviceID == "n306\n" or global::deviceID == "n873\n") {
QProcess::execute("insmod", QStringList() << "/external_root/modules/fs/configfs/configfs.ko");
QProcess::execute("insmod", QStringList() << "/external_root/modules/drivers/usb/gadget/libcomposite.ko");
QProcess::execute("insmod", QStringList() << "/external_root/modules/drivers/usb/gadget/function/usb_f_mass_storage.ko");

View file

@ -54,8 +54,7 @@ virtualkeyboard::virtualkeyboard(QWidget *parent) :
ui->spt->setProperty("type", "borderless");
ui->sat->setProperty("type", "borderless");
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n873\n") {
if(global::deviceID == "n873\n") {
ui->n1->setStyleSheet("font-weight: bold; font-size: 9pt; padding: 27px");
ui->n2->setStyleSheet("font-weight: bold; font-size: 9pt; padding: 27px");
ui->n3->setStyleSheet("font-weight: bold; font-size: 9pt; padding: 27px");