Reader framework: Fixes for bookconfig_mount

This commit is contained in:
Nicolas Mailloux 2022-03-11 13:45:42 -05:00
parent 7ec8e3afb2
commit ae25446924
2 changed files with 8 additions and 30 deletions

View file

@ -35,6 +35,7 @@ reader::reader(QWidget *parent) :
} }
mupdf::convertRelativeValues = false; mupdf::convertRelativeValues = false;
wordwidgetLock = false; wordwidgetLock = false;
goToSavedPageDone = false;
ui->setupUi(this); ui->setupUi(this);
ui->brightnessStatus->setFont(QFont("u001")); ui->brightnessStatus->setFont(QFont("u001"));
@ -423,7 +424,7 @@ reader::reader(QWidget *parent) :
t->start(); t->start();
} }
// Checking if we're waking from sleep; if so, do nothing there because the book should already have been parsed // Checking if we're waking from sleep and have lockscreen enabled; if so, do nothing there because the book should already have been parsed
if(wakeFromSleep != true) { if(wakeFromSleep != true) {
// Remount tmpfs // Remount tmpfs
string_writeconfig("/inkbox/remount", "true"); string_writeconfig("/inkbox/remount", "true");
@ -723,12 +724,10 @@ reader::reader(QWidget *parent) :
} }
// Pages number info label // Pages number info label
if(is_epub == true) { if(is_pdf == true) {
getTotalEpubPagesNumber();
}
else if(is_pdf == true) {
getTotalPdfPagesNumber(); getTotalPdfPagesNumber();
} }
// The total pages number is already known for ePUBs at this point
setupPageWidget(); setupPageWidget();
// Reading settings auto-save timer // Reading settings auto-save timer
@ -773,15 +772,7 @@ int reader::setup_book(QString book, int i, bool run_parser) {
QFile::remove("/run/book.epub"); QFile::remove("/run/book.epub");
QFile::copy(book, "/run/book.epub"); QFile::copy(book, "/run/book.epub");
// Parsing ePUBs with `mutool' getTotalEpubPagesNumber();
QString epubProg ("sh");
QStringList epubArgs;
convertMuPdfVars(0, false);
epubArgs << "/mnt/onboard/.adds/inkbox/epub.sh" << "0" << "0" << "0" << mupdf::epub::epubPageNumber_qstr;
QProcess * epubProc = new QProcess();
epubProc->start(epubProg, epubArgs);
epubProc->waitForFinished();
epubProc->deleteLater();
filematch_ran = true; filematch_ran = true;
is_epub = true; is_epub = true;
@ -862,12 +853,6 @@ int reader::setup_book(QString book, int i, bool run_parser) {
epubProc->waitForFinished(); epubProc->waitForFinished();
epubProc->deleteLater(); epubProc->deleteLater();
} }
else {
;
}
}
else {
;
} }
} }
else if(is_pdf == true) { else if(is_pdf == true) {
@ -882,12 +867,6 @@ int reader::setup_book(QString book, int i, bool run_parser) {
pdfProc->waitForFinished(); pdfProc->waitForFinished();
pdfProc->deleteLater(); pdfProc->deleteLater();
} }
else {
;
}
}
else {
;
} }
} }
else if(is_image == true) { else if(is_image == true) {
@ -1693,8 +1672,7 @@ void reader::convertMuPdfVars(int fileType, bool convertAll) {
} }
if(global::reader::globalReadingSettings == false) { if(global::reader::globalReadingSettings == false) {
if(goToSavedPageDone == false) { if(goToSavedPageDone == false) {
string_checkconfig_ro(".config/A-page_number/config"); mupdf::epub::epubPageNumber = readFile(".config/A-page_number/config").toInt();
mupdf::epub::epubPageNumber = checkconfig_str_val.toInt();
goToSavedPageDone = true; goToSavedPageDone = true;
} }
} }

View file

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>630</width> <width>644</width>
<height>851</height> <height>851</height>
</rect> </rect>
</property> </property>
@ -914,7 +914,7 @@
<enum>QFrame::Plain</enum> <enum>QFrame::Plain</enum>
</property> </property>
<property name="lineWidth"> <property name="lineWidth">
<number>4</number> <number>2</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>