From 2ba3b42599bc465eb6858c1194e60678dbb2ca67 Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Mon, 10 Jan 2022 21:10:57 -0500 Subject: [PATCH 1/7] Set optionsBtn to inactive state when closing wordWidget --- reader.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/reader.cpp b/reader.cpp index da51e69..f9c0466 100644 --- a/reader.cpp +++ b/reader.cpp @@ -1431,6 +1431,7 @@ void reader::wordwidget_show() { void reader::wordwidget_hide() { ui->wordWidget->setVisible(false); + ui->optionsBtn->setStyleSheet("background: white; color: black"); ui->optionsBtn->show(); ui->line->show(); wordwidgetLock = false; From a24b84acf40252430e4d0a9dbcafab214856ddce Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Tue, 11 Jan 2022 14:17:14 -0500 Subject: [PATCH 2/7] Implement auto-sync if user searchs in Online Library --- generaldialog.cpp | 135 ++++++++++++++++++++++++++++++---------- generaldialog.h | 5 ++ mainwindow.cpp | 2 + searchresultswidget.cpp | 1 - 4 files changed, 108 insertions(+), 35 deletions(-) diff --git a/generaldialog.cpp b/generaldialog.cpp index e273396..e5c9de1 100644 --- a/generaldialog.cpp +++ b/generaldialog.cpp @@ -13,6 +13,7 @@ #include #include #include +#include generalDialog::generalDialog(QWidget *parent) : QDialog(parent), @@ -39,6 +40,11 @@ generalDialog::generalDialog(QWidget *parent) : ui->bodyLabel->setStyleSheet("font-size: 9pt"); 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") { + ui->searchComboBox->removeItem(2); + } + if(QFile::exists("/inkbox/searchComboBoxFunction") == true) { string_checkconfig_ro("/inkbox/searchComboBoxFunction"); if(checkconfig_str_val == "Dictionary") { @@ -356,43 +362,69 @@ void generalDialog::on_okBtn_clicked() } else if(ui->searchComboBox->currentText() == "Online library") { string_writeconfig("/inkbox/searchComboBoxFunction", "Online library"); - string_writeconfig("/inkbox/gutenberg_search_request", global::keyboard::keyboardText.toStdString()); - string_writeconfig("/opt/ibxd", "gutenberg_search\n"); - while(true) { - if(QFile::exists("/inkbox/gutenberg-search/search_done")) { - if(checkconfig("/inkbox/gutenberg-search/search_done") == true) { - QStringList searchResults = readFile("/inkbox/gutenberg-search/search_results_titles").split("\n"); - global::library::libraryResults = true; - for(int i = ui->mainStackedWidget->count(); i >= 0; i--) { - QWidget * widget = ui->mainStackedWidget->widget(i); - ui->mainStackedWidget->removeWidget(widget); - widget->deleteLater(); - } - ui->topStackedWidget->setVisible(false); - ui->stackedWidget->setVisible(false); - searchResultsWidgetWindow = new searchResultsWidget(this); - searchResultsWidgetWindow->setAttribute(Qt::WA_DeleteOnClose); - global::forbidOpenSearchDialog = true; - connect(searchResultsWidgetWindow, SIGNAL(destroyed(QObject*)), SLOT(restartSearchDialog())); - connect(searchResultsWidgetWindow, SIGNAL(showToast(QString)), SLOT(showToastNative(QString))); - connect(searchResultsWidgetWindow, SIGNAL(closeIndefiniteToast()), SLOT(closeIndefiniteToastNative())); - connect(searchResultsWidgetWindow, SIGNAL(hideDialog()), SLOT(hide())); - searchResultsWidgetWindow->setListViewContents(searchResults); - ui->mainStackedWidget->insertWidget(1, searchResultsWidgetWindow); - QFile::remove("/inkbox/gutenberg-search/search_done"); - break; - } - else { - global::toast::delay = 3000; - emit showToast("No results found"); - keyboardWidget->clearLineEdit(); - global::keyboard::keyboardText = ""; - QFile::remove("/inkbox/gutenberg-search/search_done"); - break; - } + if(!readFile("/external_root/opt/storage/gutenberg/last_sync").isEmpty()) { + unsigned long currentEpoch = QDateTime::currentSecsSinceEpoch(); + unsigned long syncEpoch = readFile("/external_root/opt/storage/gutenberg/last_sync").toULong(); + unsigned long allowSyncEpoch = syncEpoch + 86400; + if(currentEpoch > allowSyncEpoch) { + syncCatalog(); + } + else { + noGutenbergSyncToDo = true; } } + else { + syncCatalog(); + } + + QTimer * syncTimer = new QTimer(this); + syncTimer->setInterval(100); + connect(syncTimer, &QTimer::timeout, [&]() { + if(noGutenbergSyncToDo == true or (gutenbergSyncDone == true && gutenbergSyncStatus == true)) { + if(syncTimerDone == false) { + syncTimerDone = true; + string_writeconfig("/inkbox/gutenberg_search_request", global::keyboard::keyboardText.toStdString()); + string_writeconfig("/opt/ibxd", "gutenberg_search\n"); + while(true) { + if(QFile::exists("/inkbox/gutenberg-search/search_done")) { + if(checkconfig("/inkbox/gutenberg-search/search_done") == true) { + QStringList searchResults = readFile("/inkbox/gutenberg-search/search_results_titles").split("\n"); + global::library::libraryResults = true; + + for(int i = ui->mainStackedWidget->count(); i >= 0; i--) { + QWidget * widget = ui->mainStackedWidget->widget(i); + ui->mainStackedWidget->removeWidget(widget); + widget->deleteLater(); + } + ui->topStackedWidget->setVisible(false); + ui->stackedWidget->setVisible(false); + searchResultsWidgetWindow = new searchResultsWidget(this); + searchResultsWidgetWindow->setAttribute(Qt::WA_DeleteOnClose); + global::forbidOpenSearchDialog = true; + connect(searchResultsWidgetWindow, SIGNAL(destroyed(QObject*)), SLOT(restartSearchDialog())); + connect(searchResultsWidgetWindow, SIGNAL(showToast(QString)), SLOT(showToastNative(QString))); + connect(searchResultsWidgetWindow, SIGNAL(closeIndefiniteToast()), SLOT(closeIndefiniteToastNative())); + connect(searchResultsWidgetWindow, SIGNAL(hideDialog()), SLOT(hide())); + searchResultsWidgetWindow->setListViewContents(searchResults); + ui->mainStackedWidget->insertWidget(1, searchResultsWidgetWindow); + QFile::remove("/inkbox/gutenberg-search/search_done"); + break; + } + else { + global::toast::delay = 3000; + emit showToast("No results found"); + keyboardWidget->clearLineEdit(); + global::keyboard::keyboardText = ""; + QFile::remove("/inkbox/gutenberg-search/search_done"); + break; + } + } + } + } + } + } ); + syncTimer->start(); } else { ; @@ -610,3 +642,38 @@ void generalDialog::quit_restart() { process.startDetached("inkbox", QStringList()); qApp->quit(); } + +void generalDialog::syncCatalog() { + global::toast::modalToast = true; + global::toast::indefiniteToast = true; + showToast("Sync in progress"); + + string_writeconfig("/opt/ibxd", "gutenberg_sync\n"); + QTimer * syncCheckTimer = new QTimer(this); + syncCheckTimer->setInterval(100); + connect(syncCheckTimer, &QTimer::timeout, [&]() { + if(QFile::exists("/inkbox/gutenbergSyncDone") == true) { + if(checkconfig("/inkbox/gutenbergSyncDone") == true) { + qDebug() << "Gutenberg sync successfully completed"; + gutenbergSyncDone = true; + gutenbergSyncStatus = true; + emit closeIndefiniteToast(); + } + else { + qDebug() << "Gutenberg sync encountered an error"; + gutenbergSyncDone = true; + gutenbergSyncStatus = false; + emit closeIndefiniteToast(); + showToast("Error"); + global::keyboard::searchDialog = false; + global::forbidOpenSearchDialog = true; + global::keyboard::keyboardDialog = false; + global::keyboard::keyboardText = ""; + global::library::librarySearchDialog = false; + QTimer::singleShot(5000, this, SLOT(close())); + } + QFile::remove("/inkbox/gutenbergSyncDone"); + } + } ); + syncCheckTimer->start(); +} diff --git a/generaldialog.h b/generaldialog.h index 4274592..1447a83 100644 --- a/generaldialog.h +++ b/generaldialog.h @@ -37,6 +37,10 @@ public: bool dictionaryResults = false; bool vncServerSet = false; bool vncPasswordSet = false; + bool gutenbergSyncDone = false; + bool gutenbergSyncStatus = false; + bool noGutenbergSyncToDo = false; + bool syncTimerDone = false; QString vncServerAddress; QString vncServerPassword; QString vncServerPort; @@ -58,6 +62,7 @@ private slots: void showToastNative(QString messageToDisplay); void closeIndefiniteToastNative(); void quit_restart(); + void syncCatalog(); private: Ui::generalDialog *ui; diff --git a/mainwindow.cpp b/mainwindow.cpp index 6775ae2..5486221 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -182,6 +182,8 @@ MainWindow::MainWindow(QWidget *parent) // Deleting/Hiding "Library" button if device is not WiFi-able if(global::device::isWifiAble == false && readFile("/opt/inkbox_device") != "emu\n") { + ui->libraryButton->hide(); + ui->line_10->hide(); ui->libraryButton->deleteLater(); ui->line_10->deleteLater(); } diff --git a/searchresultswidget.cpp b/searchresultswidget.cpp index 56e26d0..8499537 100644 --- a/searchresultswidget.cpp +++ b/searchresultswidget.cpp @@ -40,7 +40,6 @@ void searchResultsWidget::setListViewContents(QStringList searchResults) { void searchResultsWidget::on_openBtn_clicked() { if(libraryResults == true) { - qDebug() << "Got there"; index = ui->listView->currentIndex(); itemText = index.data(Qt::DisplayRole).toString(); if(!itemText.isEmpty()) { From 48a4a9e3e701774da75487c3674fc548491c57ca Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Wed, 12 Jan 2022 11:04:10 -0500 Subject: [PATCH 3/7] Improve Online Library search --- generaldialog.cpp | 89 ++++++++++++++++++++++++++--------------------- generaldialog.h | 3 +- 2 files changed, 51 insertions(+), 41 deletions(-) diff --git a/generaldialog.cpp b/generaldialog.cpp index e5c9de1..4c9eba0 100644 --- a/generaldialog.cpp +++ b/generaldialog.cpp @@ -368,14 +368,14 @@ void generalDialog::on_okBtn_clicked() unsigned long syncEpoch = readFile("/external_root/opt/storage/gutenberg/last_sync").toULong(); unsigned long allowSyncEpoch = syncEpoch + 86400; if(currentEpoch > allowSyncEpoch) { - syncCatalog(); + syncGutenbergCatalog(); } else { noGutenbergSyncToDo = true; } } else { - syncCatalog(); + syncGutenbergCatalog(); } QTimer * syncTimer = new QTimer(this); @@ -386,41 +386,10 @@ void generalDialog::on_okBtn_clicked() syncTimerDone = true; string_writeconfig("/inkbox/gutenberg_search_request", global::keyboard::keyboardText.toStdString()); string_writeconfig("/opt/ibxd", "gutenberg_search\n"); - while(true) { - if(QFile::exists("/inkbox/gutenberg-search/search_done")) { - if(checkconfig("/inkbox/gutenberg-search/search_done") == true) { - QStringList searchResults = readFile("/inkbox/gutenberg-search/search_results_titles").split("\n"); - global::library::libraryResults = true; - - for(int i = ui->mainStackedWidget->count(); i >= 0; i--) { - QWidget * widget = ui->mainStackedWidget->widget(i); - ui->mainStackedWidget->removeWidget(widget); - widget->deleteLater(); - } - ui->topStackedWidget->setVisible(false); - ui->stackedWidget->setVisible(false); - searchResultsWidgetWindow = new searchResultsWidget(this); - searchResultsWidgetWindow->setAttribute(Qt::WA_DeleteOnClose); - global::forbidOpenSearchDialog = true; - connect(searchResultsWidgetWindow, SIGNAL(destroyed(QObject*)), SLOT(restartSearchDialog())); - connect(searchResultsWidgetWindow, SIGNAL(showToast(QString)), SLOT(showToastNative(QString))); - connect(searchResultsWidgetWindow, SIGNAL(closeIndefiniteToast()), SLOT(closeIndefiniteToastNative())); - connect(searchResultsWidgetWindow, SIGNAL(hideDialog()), SLOT(hide())); - searchResultsWidgetWindow->setListViewContents(searchResults); - ui->mainStackedWidget->insertWidget(1, searchResultsWidgetWindow); - QFile::remove("/inkbox/gutenberg-search/search_done"); - break; - } - else { - global::toast::delay = 3000; - emit showToast("No results found"); - keyboardWidget->clearLineEdit(); - global::keyboard::keyboardText = ""; - QFile::remove("/inkbox/gutenberg-search/search_done"); - break; - } - } - } + global::toast::modalToast = true; + global::toast::indefiniteToast = true; + emit showToast("Searching"); + QTimer::singleShot(100, this, SLOT(waitForGutenbergSearchDone())); } } } ); @@ -643,10 +612,10 @@ void generalDialog::quit_restart() { qApp->quit(); } -void generalDialog::syncCatalog() { +void generalDialog::syncGutenbergCatalog() { global::toast::modalToast = true; global::toast::indefiniteToast = true; - showToast("Sync in progress"); + emit showToast("Sync in progress"); string_writeconfig("/opt/ibxd", "gutenberg_sync\n"); QTimer * syncCheckTimer = new QTimer(this); @@ -664,7 +633,7 @@ void generalDialog::syncCatalog() { gutenbergSyncDone = true; gutenbergSyncStatus = false; emit closeIndefiniteToast(); - showToast("Error"); + emit showToast("Error"); global::keyboard::searchDialog = false; global::forbidOpenSearchDialog = true; global::keyboard::keyboardDialog = false; @@ -677,3 +646,43 @@ void generalDialog::syncCatalog() { } ); syncCheckTimer->start(); } + +void generalDialog::waitForGutenbergSearchDone() { + while(true) { + if(QFile::exists("/inkbox/gutenberg-search/search_done")) { + if(checkconfig("/inkbox/gutenberg-search/search_done") == true) { + QStringList searchResults = readFile("/inkbox/gutenberg-search/search_results_titles").split("\n"); + global::library::libraryResults = true; + + for(int i = ui->mainStackedWidget->count(); i >= 0; i--) { + QWidget * widget = ui->mainStackedWidget->widget(i); + ui->mainStackedWidget->removeWidget(widget); + widget->deleteLater(); + } + ui->topStackedWidget->setVisible(false); + ui->stackedWidget->setVisible(false); + searchResultsWidgetWindow = new searchResultsWidget(this); + searchResultsWidgetWindow->setAttribute(Qt::WA_DeleteOnClose); + global::forbidOpenSearchDialog = true; + connect(searchResultsWidgetWindow, SIGNAL(destroyed(QObject*)), SLOT(restartSearchDialog())); + connect(searchResultsWidgetWindow, SIGNAL(showToast(QString)), SLOT(showToastNative(QString))); + connect(searchResultsWidgetWindow, SIGNAL(closeIndefiniteToast()), SLOT(closeIndefiniteToastNative())); + connect(searchResultsWidgetWindow, SIGNAL(hideDialog()), SLOT(hide())); + searchResultsWidgetWindow->setListViewContents(searchResults); + ui->mainStackedWidget->insertWidget(1, searchResultsWidgetWindow); + QFile::remove("/inkbox/gutenberg-search/search_done"); + emit closeIndefiniteToast(); + break; + } + else { + global::toast::delay = 3000; + emit showToast("No results found"); + keyboardWidget->clearLineEdit(); + global::keyboard::keyboardText = ""; + QFile::remove("/inkbox/gutenberg-search/search_done"); + emit closeIndefiniteToast(); + break; + } + } + } +} diff --git a/generaldialog.h b/generaldialog.h index 1447a83..54ee008 100644 --- a/generaldialog.h +++ b/generaldialog.h @@ -62,7 +62,8 @@ private slots: void showToastNative(QString messageToDisplay); void closeIndefiniteToastNative(); void quit_restart(); - void syncCatalog(); + void syncGutenbergCatalog(); + void waitForGutenbergSearchDone(); private: Ui::generalDialog *ui; From 69cc8c1b5ff857fd132c42e5d13c7f56d08c2d1b Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Wed, 12 Jan 2022 11:30:34 -0500 Subject: [PATCH 4/7] generalDialog: Rename "syncTimer" to "searchTimer" --- generaldialog.cpp | 12 ++++++------ generaldialog.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/generaldialog.cpp b/generaldialog.cpp index 4c9eba0..e96dc53 100644 --- a/generaldialog.cpp +++ b/generaldialog.cpp @@ -378,12 +378,12 @@ void generalDialog::on_okBtn_clicked() syncGutenbergCatalog(); } - QTimer * syncTimer = new QTimer(this); - syncTimer->setInterval(100); - connect(syncTimer, &QTimer::timeout, [&]() { + QTimer * searchTimer = new QTimer(this); + searchTimer->setInterval(100); + connect(searchTimer, &QTimer::timeout, [&]() { if(noGutenbergSyncToDo == true or (gutenbergSyncDone == true && gutenbergSyncStatus == true)) { - if(syncTimerDone == false) { - syncTimerDone = true; + if(searchTimerDone == false) { + searchTimerDone = true; string_writeconfig("/inkbox/gutenberg_search_request", global::keyboard::keyboardText.toStdString()); string_writeconfig("/opt/ibxd", "gutenberg_search\n"); global::toast::modalToast = true; @@ -393,7 +393,7 @@ void generalDialog::on_okBtn_clicked() } } } ); - syncTimer->start(); + searchTimer->start(); } else { ; diff --git a/generaldialog.h b/generaldialog.h index 54ee008..56abf72 100644 --- a/generaldialog.h +++ b/generaldialog.h @@ -40,7 +40,7 @@ public: bool gutenbergSyncDone = false; bool gutenbergSyncStatus = false; bool noGutenbergSyncToDo = false; - bool syncTimerDone = false; + bool searchTimerDone = false; QString vncServerAddress; QString vncServerPassword; QString vncServerPort; From 7af178f9e509d9c909b95d30be9aaca5254a7e1d Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Wed, 12 Jan 2022 14:48:22 -0500 Subject: [PATCH 5/7] Support more file types --- generaldialog.cpp | 2 +- reader.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/generaldialog.cpp b/generaldialog.cpp index e96dc53..6e68c06 100644 --- a/generaldialog.cpp +++ b/generaldialog.cpp @@ -330,7 +330,7 @@ void generalDialog::on_okBtn_clicked() dirIt.next(); if(QFileInfo(dirIt.filePath()).isFile()) { QString suffix = QFileInfo(dirIt.filePath()).suffix(); - if(suffix == "txt" or suffix == "TXT" or suffix == "epub" or suffix == "pdf" or suffix == "PDF") { + if(suffix == "txt" or suffix == "TXT" or suffix == "epub" or suffix == "EPUB" or suffix == "pdf" or suffix == "PDF" or suffix == "png" or suffix == "PNG" or suffix == "tif" or suffix == "TIF" or suffix == "bmp" or suffix == "BMP" or suffix == "tiff" or suffix == "TIFF" or suffix == "jpg" or suffix == "JPG" or suffix == "jpeg" or suffix == "JPEG") { if(dirIt.fileName().contains(global::keyboard::keyboardText) == true) { storageSearchResults.append(dirIt.fileName()); } diff --git a/reader.cpp b/reader.cpp index f9c0466..d089900 100644 --- a/reader.cpp +++ b/reader.cpp @@ -2071,11 +2071,11 @@ bool reader::pdf_file_match(QString file) { } bool reader::image_file_match(QString file) { - if(file.right(3) == "png" or file.right(3) == "jpg" or file.right(3) == "bmp" or file.right(3) == "tif") { + if(file.right(3) == "png" or file.right(3) == "PNG" or file.right(3) == "jpg" or file.right(3) == "JPG" or file.right(3) == "bmp" or file.right(3) == "BMP" or file.right(3) == "tif" or file.right(3) == "TIF") { string_writeconfig("/inkbox/bookIsImage", "true"); return true; } - else if(file.right(4) == "jpeg" or file.right(4) == "tiff") { + else if(file.right(4) == "jpeg" or file.right(4) == "JPEG" or file.right(4) == "tiff" or file.right(4) == "TIFF") { string_writeconfig("/inkbox/bookIsImage", "true"); return true; } From 8e29140fac6254356901c334b708d3414f1476fd Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Sun, 16 Jan 2022 19:31:04 -0500 Subject: [PATCH 6/7] Set truncate treshold for "Recent books" buttons Fixes https://github.com/Kobo-InkBox/inkbox/issues/11 --- mainwindow.cpp | 37 +++++++++++++++++++++++++++++-------- mainwindow.h | 2 ++ 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 5486221..ca31540 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -448,6 +448,7 @@ MainWindow::MainWindow(QWidget *parent) ui->book3Btn->show(); ui->book4Btn->show(); + setRecentBooksLabelsTruncateTreshold(); // Book 1 string_checkconfig(".config/08-recent_books/1"); if(checkconfig_str_val == "") { @@ -455,8 +456,10 @@ MainWindow::MainWindow(QWidget *parent) } else { relative_path = checkconfig_str_val.split("/").last(); - relative_path.prepend(" "); - relative_path.append(" "); + if(relative_path.length() > truncateTreshold) { + relative_path.truncate(truncateTreshold); + relative_path.append(" ..."); + } ui->book1Btn->setText(relative_path); existing_recent_books = true; } @@ -467,8 +470,10 @@ MainWindow::MainWindow(QWidget *parent) } else { relative_path = checkconfig_str_val.split("/").last(); - relative_path.prepend(" "); - relative_path.append(" "); + if(relative_path.length() > truncateTreshold) { + relative_path.truncate(truncateTreshold); + relative_path.append(" ..."); + } ui->book2Btn->setText(relative_path); existing_recent_books = true; } @@ -479,8 +484,10 @@ MainWindow::MainWindow(QWidget *parent) } else { relative_path = checkconfig_str_val.split("/").last(); - relative_path.prepend(" "); - relative_path.append(" "); + if(relative_path.length() > truncateTreshold) { + relative_path.truncate(truncateTreshold); + relative_path.append(" ..."); + } ui->book3Btn->setText(relative_path); existing_recent_books = true; } @@ -491,8 +498,10 @@ MainWindow::MainWindow(QWidget *parent) } else { relative_path = checkconfig_str_val.split("/").last(); - relative_path.prepend(" "); - relative_path.append(" "); + if(relative_path.length() > truncateTreshold) { + relative_path.truncate(truncateTreshold); + relative_path.append(" ..."); + } ui->book4Btn->setText(relative_path); existing_recent_books = true; } @@ -1079,3 +1088,15 @@ void MainWindow::on_libraryButton_clicked() void MainWindow::resetFullWindow() { resetWindow(true); } + +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"){ + truncateTreshold = 20; + } + else { + truncateTreshold = 12; + } +} diff --git a/mainwindow.h b/mainwindow.h index 42aa112..8e9ffc8 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -43,6 +43,7 @@ public: float wifiIconHeight; float sW; float sH; + int truncateTreshold; bool existing_recent_books = false; bool reboot_after_update = false; @@ -92,6 +93,7 @@ private slots: void on_libraryButton_clicked(); void resetWindow(bool resetStackedWidget); void resetFullWindow(); + void setRecentBooksLabelsTruncateTreshold(); private: Ui::MainWindow * ui; From fa81433f6c782adf000f06e928c3317548992890 Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Wed, 19 Jan 2022 20:55:45 -0500 Subject: [PATCH 7/7] Reader framework: Set correct stylesheet for Libra, too --- reader.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/reader.cpp b/reader.cpp index d089900..0804018 100644 --- a/reader.cpp +++ b/reader.cpp @@ -1093,13 +1093,23 @@ void reader::on_optionsBtn_clicked() { if(menubar_shown == true) { menubar_hide(); - ui->optionsBtn->setStyleSheet("background: white; color: black"); + if(readFile("/opt/inkbox_device") == "n873\n") { + ui->optionsBtn->setStyleSheet("background: white; color: black; padding: 13.5px"); + } + else { + ui->optionsBtn->setStyleSheet("background: white; color: black"); + } this->repaint(); menubar_shown = false; } else { menubar_show(); - ui->optionsBtn->setStyleSheet("background: black; color: white"); + if(readFile("/opt/inkbox_device") == "n873\n") { + ui->optionsBtn->setStyleSheet("background: black; color: white; padding: 13.5px"); + } + else { + ui->optionsBtn->setStyleSheet("background: black; color: white"); + } this->repaint(); menubar_shown = true; }