From 159ec42ef7bf2ced36f2b9011e27115e02359f70 Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Fri, 12 Aug 2022 17:49:22 -0400 Subject: [PATCH] Local library: Some fixes --- src/widgets/dialogs/library/bookinfodialog.cpp | 3 +++ src/widgets/dialogs/library/bookoptionsdialog.cpp | 13 +++++++------ src/widgets/dialogs/library/bookoptionsdialog.ui | 8 ++++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/widgets/dialogs/library/bookinfodialog.cpp b/src/widgets/dialogs/library/bookinfodialog.cpp index b13e5fb..9e177a1 100644 --- a/src/widgets/dialogs/library/bookinfodialog.cpp +++ b/src/widgets/dialogs/library/bookinfodialog.cpp @@ -10,6 +10,9 @@ bookInfoDialog::bookInfoDialog(QWidget *parent) : { ui->setupUi(this); + // Preventing outside interaction + this->setModal(true); + // Stylesheet QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss"); stylesheetFile.open(QFile::ReadOnly); diff --git a/src/widgets/dialogs/library/bookoptionsdialog.cpp b/src/widgets/dialogs/library/bookoptionsdialog.cpp index 46a0caa..657ecd0 100644 --- a/src/widgets/dialogs/library/bookoptionsdialog.cpp +++ b/src/widgets/dialogs/library/bookoptionsdialog.cpp @@ -36,12 +36,9 @@ bookOptionsDialog::bookOptionsDialog(QWidget *parent) : bookChecksum = fileChecksum(bookPath, QCryptographicHash::Sha256); QDir localReadingSettingsPath("/mnt/onboard/onboard/." + bookChecksum); if(!localReadingSettingsPath.exists()) { - ui->wipeLocalReadingSettingsBtn->hide(); - ui->line_3->hide(); - ui->wipeLocalReadingSettingsBtn->deleteLater(); - ui->line_3->deleteLater(); + ui->wipeLocalReadingSettingsBtn->setEnabled(false); + ui->wipeLocalReadingSettingsBtn->setStyleSheet(ui->wipeLocalReadingSettingsBtn->styleSheet() + "color: gray"); } - this->adjustSize(); } @@ -116,10 +113,12 @@ void bookOptionsDialog::pinBook(int bookID) { } if(foundSpaceForBook == false && bookIsAlreadyPinned == false) { global::localLibrary::bookOptionsDialog::bookPinAction = false; + global::toast::delay = 3000; emit showToast("No space left for pinning book"); } else if(bookIsAlreadyPinned == true) { global::localLibrary::bookOptionsDialog::bookPinAction = false; + global::toast::delay = 3000; emit showToast("Book is already pinned"); } } @@ -183,6 +182,7 @@ void bookOptionsDialog::unpinBook(int bookID) { } } log(function + ": Unpinned book with ID " + bookID, className); + global::toast::delay = 3000; emit showToast("Book unpinned successfully"); global::localLibrary::bookOptionsDialog::bookPinAction = true; @@ -225,5 +225,6 @@ void bookOptionsDialog::on_wipeLocalReadingSettingsBtn_clicked() log("Removing local reading settings directory for book '" + bookPath + "' at '/mnt/onboard/onboard/." + bookChecksum + "'", className); QDir dir("/mnt/onboard/onboard/." + bookChecksum); dir.removeRecursively(); - bookOptionsDialog::close(); + global::toast::delay = 3000; + emit showToast("Reading settings wiped successfully"); } diff --git a/src/widgets/dialogs/library/bookoptionsdialog.ui b/src/widgets/dialogs/library/bookoptionsdialog.ui index 9370a37..64172e5 100644 --- a/src/widgets/dialogs/library/bookoptionsdialog.ui +++ b/src/widgets/dialogs/library/bookoptionsdialog.ui @@ -37,7 +37,7 @@ - padding-left: 80px; padding-right: 80px; padding-top: 10px; padding-bottom: 10px + padding-left: 80px; padding-right: 80px; padding-top: 10px; padding-bottom: 10px; Delete @@ -79,7 +79,7 @@ - padding-left: 80px; padding-right: 80px; padding-top: 10px; padding-bottom: 10px + padding-left: 80px; padding-right: 80px; padding-top: 10px; padding-bottom: 10px; More info @@ -95,7 +95,7 @@ - padding-left: 80px; padding-right: 80px; padding-top: 10px; padding-bottom: 10px + padding-left: 80px; padding-right: 80px; padding-top: 10px; padding-bottom: 10px; Pin @@ -111,7 +111,7 @@ - padding-left: 80px; padding-right: 80px; padding-top: 10px; padding-bottom: 10px + padding-left: 80px; padding-right: 80px; padding-top: 10px; padding-bottom: 10px; Wipe reading settings