From 69327c53638d1a8bc13044effb9db6c5cf527f9a Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Sat, 27 Mar 2021 15:14:03 -0400 Subject: [PATCH] Laying down a path for ePUB support --- reader.h | 21 +++++++++++++++++++++ reader.ui | 14 +++++++------- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/reader.h b/reader.h index b3a8f3d..04c9ce8 100644 --- a/reader.h +++ b/reader.h @@ -79,6 +79,15 @@ public: mount_proc->start(mount_prog, mount_args); mount_proc->waitForFinished(); + if(epub_file_match(book) == true) { + // Parsing ePUB with epub2txt, thanks to GitHub:kevinboone + + } + else { + // This is likely not an ePUB. + ; + } + // Copying book specified in the function call QFile::copy(book, "/inkbox/book/book.txt"); @@ -187,6 +196,18 @@ public: } config.close(); }; + bool epub_file_match(QString file) { + QString fileExt = file.right(4); + + if(fileExt == "epub" or fileExt=="EPUB") { + qDebug() << "True."; + return true; + } + else { + qDebug() << "False."; + return false; + } + }; void string_writeconfig(string file, string config_option) { ofstream fhandler; fhandler.open(file); diff --git a/reader.ui b/reader.ui index 5485115..63366ee 100644 --- a/reader.ui +++ b/reader.ui @@ -16,7 +16,7 @@ - + Qt::Vertical @@ -143,7 +143,7 @@ - + QFrame::Plain @@ -156,7 +156,7 @@ - + @@ -521,7 +521,7 @@ - + @@ -540,7 +540,7 @@ - + @@ -616,7 +616,7 @@ - + Qt::Vertical @@ -662,7 +662,7 @@ 0 - + QFrame::Plain