mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-28 08:37:22 -08:00
Reader framework: Greatly improve page turning speed
This commit is contained in:
parent
139aa78738
commit
7ec8e3afb2
2 changed files with 17 additions and 15 deletions
20
reader.cpp
20
reader.cpp
|
@ -776,8 +776,8 @@ int reader::setup_book(QString book, int i, bool run_parser) {
|
||||||
// Parsing ePUBs with `mutool'
|
// Parsing ePUBs with `mutool'
|
||||||
QString epubProg ("sh");
|
QString epubProg ("sh");
|
||||||
QStringList epubArgs;
|
QStringList epubArgs;
|
||||||
convertMuPdfVars(0);
|
convertMuPdfVars(0, false);
|
||||||
epubArgs << "/mnt/onboard/.adds/inkbox/epub.sh" << mupdf::epub::fontSize_qstr << mupdf::epub::width_qstr << mupdf::epub::height_qstr << mupdf::epub::epubPageNumber_qstr;
|
epubArgs << "/mnt/onboard/.adds/inkbox/epub.sh" << "0" << "0" << "0" << mupdf::epub::epubPageNumber_qstr;
|
||||||
QProcess * epubProc = new QProcess();
|
QProcess * epubProc = new QProcess();
|
||||||
epubProc->start(epubProg, epubArgs);
|
epubProc->start(epubProg, epubArgs);
|
||||||
epubProc->waitForFinished();
|
epubProc->waitForFinished();
|
||||||
|
@ -789,7 +789,7 @@ int reader::setup_book(QString book, int i, bool run_parser) {
|
||||||
else if(pdf_file_match(book) == true) {
|
else if(pdf_file_match(book) == true) {
|
||||||
QString pdfProg("/usr/local/bin/mutool");
|
QString pdfProg("/usr/local/bin/mutool");
|
||||||
QStringList pdfArgs;
|
QStringList pdfArgs;
|
||||||
convertMuPdfVars(1);
|
convertMuPdfVars(1, true);
|
||||||
pdfArgs << "convert" << "-F" << "png" << "-O" << "width=" + mupdf::pdf::width_qstr + ",height=" + mupdf::pdf::height_qstr << "-o" << "/run/page.png" << book_file << mupdf::pdf::pdfPageNumber_qstr;
|
pdfArgs << "convert" << "-F" << "png" << "-O" << "width=" + mupdf::pdf::width_qstr + ",height=" + mupdf::pdf::height_qstr << "-o" << "/run/page.png" << book_file << mupdf::pdf::pdfPageNumber_qstr;
|
||||||
QProcess * pdfProc = new QProcess();
|
QProcess * pdfProc = new QProcess();
|
||||||
pdfProc->start(pdfProg, pdfArgs);
|
pdfProc->start(pdfProg, pdfArgs);
|
||||||
|
@ -855,8 +855,8 @@ int reader::setup_book(QString book, int i, bool run_parser) {
|
||||||
if(filematch_ran == true) {
|
if(filematch_ran == true) {
|
||||||
QString epubProg ("sh");
|
QString epubProg ("sh");
|
||||||
QStringList epubArgs;
|
QStringList epubArgs;
|
||||||
convertMuPdfVars(0);
|
convertMuPdfVars(0, false);
|
||||||
epubArgs << "/mnt/onboard/.adds/inkbox/epub.sh" << mupdf::epub::fontSize_qstr << mupdf::epub::width_qstr << mupdf::epub::height_qstr << mupdf::epub::epubPageNumber_qstr;
|
epubArgs << "/mnt/onboard/.adds/inkbox/epub.sh" << "0" << "0" << "0" << mupdf::epub::epubPageNumber_qstr;
|
||||||
QProcess * epubProc = new QProcess();
|
QProcess * epubProc = new QProcess();
|
||||||
epubProc->start(epubProg, epubArgs);
|
epubProc->start(epubProg, epubArgs);
|
||||||
epubProc->waitForFinished();
|
epubProc->waitForFinished();
|
||||||
|
@ -875,7 +875,7 @@ int reader::setup_book(QString book, int i, bool run_parser) {
|
||||||
if(filematch_ran == true) {
|
if(filematch_ran == true) {
|
||||||
QString pdfProg("/usr/local/bin/mutool");
|
QString pdfProg("/usr/local/bin/mutool");
|
||||||
QStringList pdfArgs;
|
QStringList pdfArgs;
|
||||||
convertMuPdfVars(1);
|
convertMuPdfVars(1, true);
|
||||||
pdfArgs << "convert" << "-F" << "png" << "-O" << "width=" + mupdf::pdf::width_qstr + ",height=" + mupdf::pdf::height_qstr << "-o" << "/run/page.png" << book_file << mupdf::pdf::pdfPageNumber_qstr;
|
pdfArgs << "convert" << "-F" << "png" << "-O" << "width=" + mupdf::pdf::width_qstr + ",height=" + mupdf::pdf::height_qstr << "-o" << "/run/page.png" << book_file << mupdf::pdf::pdfPageNumber_qstr;
|
||||||
QProcess * pdfProc = new QProcess();
|
QProcess * pdfProc = new QProcess();
|
||||||
pdfProc->start(pdfProg, pdfArgs);
|
pdfProc->start(pdfProg, pdfArgs);
|
||||||
|
@ -1677,18 +1677,20 @@ void reader::openCriticalBatteryAlertWindow() {
|
||||||
alertWindow->show();
|
alertWindow->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void reader::convertMuPdfVars(int fileType) {
|
void reader::convertMuPdfVars(int fileType, bool convertAll) {
|
||||||
/* fileType can be:
|
/* fileType can be:
|
||||||
* 0: ePUB
|
* 0: ePUB
|
||||||
* 1: PDF
|
* 1: PDF
|
||||||
* 2: Image
|
* 2: Image
|
||||||
*/
|
*/
|
||||||
if(fileType == 0) {
|
if(fileType == 0) {
|
||||||
|
if(convertAll == 1) {
|
||||||
setPageStyle(0);
|
setPageStyle(0);
|
||||||
mupdf::epub::fontSize = 12;
|
mupdf::epub::fontSize = 12;
|
||||||
mupdf::epub::fontSize_qstr = QString::number(mupdf::epub::fontSize);
|
mupdf::epub::fontSize_qstr = QString::number(mupdf::epub::fontSize);
|
||||||
mupdf::epub::width_qstr = QString::number(mupdf::epub::width);
|
mupdf::epub::width_qstr = QString::number(mupdf::epub::width);
|
||||||
mupdf::epub::height_qstr = QString::number(mupdf::epub::height);
|
mupdf::epub::height_qstr = QString::number(mupdf::epub::height);
|
||||||
|
}
|
||||||
if(global::reader::globalReadingSettings == false) {
|
if(global::reader::globalReadingSettings == false) {
|
||||||
if(goToSavedPageDone == false) {
|
if(goToSavedPageDone == false) {
|
||||||
string_checkconfig_ro(".config/A-page_number/config");
|
string_checkconfig_ro(".config/A-page_number/config");
|
||||||
|
@ -1891,7 +1893,7 @@ void reader::setupPageWidget() {
|
||||||
void reader::getTotalEpubPagesNumber() {
|
void reader::getTotalEpubPagesNumber() {
|
||||||
QString epubProg ("sh");
|
QString epubProg ("sh");
|
||||||
QStringList epubArgs;
|
QStringList epubArgs;
|
||||||
convertMuPdfVars(0);
|
convertMuPdfVars(0, true);
|
||||||
epubArgs << "/mnt/onboard/.adds/inkbox/epub.sh" << mupdf::epub::fontSize_qstr << mupdf::epub::width_qstr << mupdf::epub::height_qstr << mupdf::epub::epubPageNumber_qstr << "get_pages_number";
|
epubArgs << "/mnt/onboard/.adds/inkbox/epub.sh" << mupdf::epub::fontSize_qstr << mupdf::epub::width_qstr << mupdf::epub::height_qstr << mupdf::epub::epubPageNumber_qstr << "get_pages_number";
|
||||||
QProcess *epubProc = new QProcess();
|
QProcess *epubProc = new QProcess();
|
||||||
epubProc->start(epubProg, epubArgs);
|
epubProc->start(epubProg, epubArgs);
|
||||||
|
@ -2134,7 +2136,7 @@ bool reader::image_file_match(QString file) {
|
||||||
void reader::getTotalPdfPagesNumber() {
|
void reader::getTotalPdfPagesNumber() {
|
||||||
QString epubProg ("sh");
|
QString epubProg ("sh");
|
||||||
QStringList epubArgs;
|
QStringList epubArgs;
|
||||||
convertMuPdfVars(0);
|
convertMuPdfVars(0, true);
|
||||||
epubArgs << "/mnt/onboard/.adds/inkbox/pdf_get_total_pages_number.sh" << book_file;
|
epubArgs << "/mnt/onboard/.adds/inkbox/pdf_get_total_pages_number.sh" << book_file;
|
||||||
QProcess * epubProc = new QProcess();
|
QProcess * epubProc = new QProcess();
|
||||||
epubProc->start(epubProg, epubArgs);
|
epubProc->start(epubProg, epubArgs);
|
||||||
|
|
2
reader.h
2
reader.h
|
@ -108,7 +108,7 @@ public:
|
||||||
void wordwidget_hide();
|
void wordwidget_hide();
|
||||||
void openLowBatteryDialog();
|
void openLowBatteryDialog();
|
||||||
void openCriticalBatteryAlertWindow();
|
void openCriticalBatteryAlertWindow();
|
||||||
void convertMuPdfVars(int fileType);
|
void convertMuPdfVars(int fileType, bool convertAll);
|
||||||
void refreshScreen();
|
void refreshScreen();
|
||||||
void setPageStyle(int fileType);
|
void setPageStyle(int fileType);
|
||||||
void alignText(int alignment);
|
void alignText(int alignment);
|
||||||
|
|
Loading…
Reference in a new issue