Laying down a path for ePUB support

This commit is contained in:
Nicolas Mailloux 2021-03-27 15:14:03 -04:00
parent 61e83d2596
commit 69327c5363
2 changed files with 28 additions and 7 deletions

View file

@ -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);

View file

@ -16,7 +16,7 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="10" column="0">
<item row="9" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -143,7 +143,7 @@
<widget class="QWidget" name="page_5"/>
</widget>
</item>
<item row="17" column="0">
<item row="16" column="0">
<widget class="Line" name="line_2">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
@ -156,7 +156,7 @@
</property>
</widget>
</item>
<item row="13" column="0">
<item row="12" column="0">
<widget class="QStackedWidget" name="wordWidget">
<widget class="QWidget" name="page_8">
<layout class="QVBoxLayout" name="verticalLayout_4">
@ -521,7 +521,7 @@
<widget class="QWidget" name="page_13"/>
</widget>
</item>
<item row="11" column="0">
<item row="10" column="0">
<widget class="QLabel" name="text">
<property name="font">
<font>
@ -540,7 +540,7 @@
</property>
</widget>
</item>
<item row="18" column="0">
<item row="17" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="4">
<widget class="Line" name="line_3">
@ -616,7 +616,7 @@
</item>
</layout>
</item>
<item row="12" column="0">
<item row="11" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -662,7 +662,7 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="4" column="0">
<item row="5" column="0">
<widget class="Line" name="line_4">
<property name="frameShadow">
<enum>QFrame::Plain</enum>