Local library: Some fixes

This commit is contained in:
Nicolas Mailloux 2022-08-12 17:49:22 -04:00
parent fc8c2ea8b6
commit 159ec42ef7
3 changed files with 14 additions and 10 deletions

View file

@ -10,6 +10,9 @@ bookInfoDialog::bookInfoDialog(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
// Preventing outside interaction
this->setModal(true);
// Stylesheet // Stylesheet
QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss"); QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss");
stylesheetFile.open(QFile::ReadOnly); stylesheetFile.open(QFile::ReadOnly);

View file

@ -36,12 +36,9 @@ bookOptionsDialog::bookOptionsDialog(QWidget *parent) :
bookChecksum = fileChecksum(bookPath, QCryptographicHash::Sha256); bookChecksum = fileChecksum(bookPath, QCryptographicHash::Sha256);
QDir localReadingSettingsPath("/mnt/onboard/onboard/." + bookChecksum); QDir localReadingSettingsPath("/mnt/onboard/onboard/." + bookChecksum);
if(!localReadingSettingsPath.exists()) { if(!localReadingSettingsPath.exists()) {
ui->wipeLocalReadingSettingsBtn->hide(); ui->wipeLocalReadingSettingsBtn->setEnabled(false);
ui->line_3->hide(); ui->wipeLocalReadingSettingsBtn->setStyleSheet(ui->wipeLocalReadingSettingsBtn->styleSheet() + "color: gray");
ui->wipeLocalReadingSettingsBtn->deleteLater();
ui->line_3->deleteLater();
} }
this->adjustSize(); this->adjustSize();
} }
@ -116,10 +113,12 @@ void bookOptionsDialog::pinBook(int bookID) {
} }
if(foundSpaceForBook == false && bookIsAlreadyPinned == false) { if(foundSpaceForBook == false && bookIsAlreadyPinned == false) {
global::localLibrary::bookOptionsDialog::bookPinAction = false; global::localLibrary::bookOptionsDialog::bookPinAction = false;
global::toast::delay = 3000;
emit showToast("No space left for pinning book"); emit showToast("No space left for pinning book");
} }
else if(bookIsAlreadyPinned == true) { else if(bookIsAlreadyPinned == true) {
global::localLibrary::bookOptionsDialog::bookPinAction = false; global::localLibrary::bookOptionsDialog::bookPinAction = false;
global::toast::delay = 3000;
emit showToast("Book is already pinned"); emit showToast("Book is already pinned");
} }
} }
@ -183,6 +182,7 @@ void bookOptionsDialog::unpinBook(int bookID) {
} }
} }
log(function + ": Unpinned book with ID " + bookID, className); log(function + ": Unpinned book with ID " + bookID, className);
global::toast::delay = 3000;
emit showToast("Book unpinned successfully"); emit showToast("Book unpinned successfully");
global::localLibrary::bookOptionsDialog::bookPinAction = true; 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); log("Removing local reading settings directory for book '" + bookPath + "' at '/mnt/onboard/onboard/." + bookChecksum + "'", className);
QDir dir("/mnt/onboard/onboard/." + bookChecksum); QDir dir("/mnt/onboard/onboard/." + bookChecksum);
dir.removeRecursively(); dir.removeRecursively();
bookOptionsDialog::close(); global::toast::delay = 3000;
emit showToast("Reading settings wiped successfully");
} }

View file

@ -37,7 +37,7 @@
</font> </font>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">padding-left: 80px; padding-right: 80px; padding-top: 10px; padding-bottom: 10px</string> <string notr="true">padding-left: 80px; padding-right: 80px; padding-top: 10px; padding-bottom: 10px;</string>
</property> </property>
<property name="text"> <property name="text">
<string>Delete</string> <string>Delete</string>
@ -79,7 +79,7 @@
</font> </font>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">padding-left: 80px; padding-right: 80px; padding-top: 10px; padding-bottom: 10px</string> <string notr="true">padding-left: 80px; padding-right: 80px; padding-top: 10px; padding-bottom: 10px;</string>
</property> </property>
<property name="text"> <property name="text">
<string>More info</string> <string>More info</string>
@ -95,7 +95,7 @@
</font> </font>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">padding-left: 80px; padding-right: 80px; padding-top: 10px; padding-bottom: 10px</string> <string notr="true">padding-left: 80px; padding-right: 80px; padding-top: 10px; padding-bottom: 10px;</string>
</property> </property>
<property name="text"> <property name="text">
<string>Pin</string> <string>Pin</string>
@ -111,7 +111,7 @@
</font> </font>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">padding-left: 80px; padding-right: 80px; padding-top: 10px; padding-bottom: 10px</string> <string notr="true">padding-left: 80px; padding-right: 80px; padding-top: 10px; padding-bottom: 10px;</string>
</property> </property>
<property name="text"> <property name="text">
<string>Wipe reading settings</string> <string>Wipe reading settings</string>