Basic working ePUB reader with mutool convert

I still need to do some work, but it's ready to be merged into master.
This commit is contained in:
Nicolas Mailloux 2021-06-19 19:05:13 -04:00
parent dbd23cb33a
commit c36e7e2ac2
4 changed files with 197 additions and 188 deletions

View file

@ -16,31 +16,7 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="headerLabel">
<property name="font">
<font>
<family>Inter</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Header</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="8" column="0">
<item row="6" column="0">
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>0</number>
@ -135,20 +111,31 @@
</widget>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<property name="bottomMargin">
<number>0</number>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
<item row="0" column="0">
<widget class="QLabel" name="headerLabel">
<property name="font">
<font>
<family>Inter</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
</spacer>
<property name="text">
<string>Header</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="6" column="0">
</layout>
</item>
<item row="5" column="0">
<widget class="QStackedWidget" name="mainStackedWidget">
<property name="currentIndex">
<number>0</number>
@ -237,19 +224,6 @@
</widget>
</widget>
</item>
<item row="7" column="0">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>

View file

@ -361,7 +361,6 @@ reader::reader(QWidget *parent) :
// Retrieve split_total from tmpfs
string_checkconfig("/tmp/inkboxPageNumber");
split_total = checkconfig_str_val.toInt();
qDebug() << "been there too";
setup_book(book_file, 0, true);
}
@ -1156,12 +1155,40 @@ void reader::openCriticalBatteryAlertWindow() {
alertWindow->setGeometry(QRect(QPoint(0,0), screen()->geometry ().size()));
alertWindow->show();
}
void reader::convertMuPdfVars() {
mupdf::fontSize = 12;
mupdf::width = 400;
mupdf::height = 500;
mupdf::height = 460;
mupdf::fontSize_qstr = QString::number(mupdf::fontSize);
mupdf::width_qstr = QString::number(mupdf::width);
mupdf::height_qstr = QString::number(mupdf::height);
mupdf::epubPageNumber_qstr = QString::number(mupdf::epubPageNumber);
}
void reader::setPageStyle() {
// General page size
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val == "n705\n") {
string_checkconfig_ro(".config/04-book/font");
if(checkconfig_str_val == "Crimson Pro") {
mupdf::width = 415;
mupdf::height = 490;
}
else {
mupdf::width = 400;
mupdf::height = 460;
}
}
else if(checkconfig_str_val == "n905\n") {
string_checkconfig_ro(".config/04-book/font");
if(checkconfig_str_val == "Crimson Pro") {
mupdf::width = 415;
mupdf::height = 490;
}
else {
mupdf::width = 400;
mupdf::height = 460;
}
}
}

View file

@ -85,6 +85,7 @@ public:
void openCriticalBatteryAlertWindow();
void convertMuPdfVars();
void refreshScreen();
void setPageStyle();
private slots:
void on_nextBtn_clicked();

View file

@ -524,13 +524,128 @@ OK
</property>
<item>
<layout class="QGridLayout" name="gridLayout_10">
<item row="8" column="0">
<widget class="QCheckBox" name="enableUiScalingCheckBox">
<item row="17" column="0">
<widget class="QLabel" name="securityLabel">
<property name="font">
<font>
<family>Chivo</family>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Enable UI scaling</string>
<string>Security</string>
</property>
</widget>
</item>
<item row="21" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="18" column="0">
<widget class="Line" name="line_2">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="12" column="0">
<layout class="QGridLayout" name="gridLayout_7">
<property name="bottomMargin">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>System info</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="showSystemInfoBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Show</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="16" column="0">
<layout class="QGridLayout" name="gridLayout_14">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="1">
<spacer name="horizontalSpacer_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="updateLabel">
<property name="text">
<string>Update InkBox</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="updateBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Update</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="7" column="0">
<widget class="Line" name="line_9">
<property name="frameShadow">
@ -581,19 +696,6 @@ OK
</item>
</layout>
</item>
<item row="6" column="0">
<widget class="QLabel" name="softwareLabel">
<property name="font">
<font>
<family>Chivo</family>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>System</string>
</property>
</widget>
</item>
<item row="9" column="0">
<layout class="QGridLayout" name="gridLayout_8">
<property name="bottomMargin">
@ -646,7 +748,27 @@ OK
</item>
</layout>
</item>
<item row="16" column="0">
<item row="6" column="0">
<widget class="QLabel" name="softwareLabel">
<property name="font">
<font>
<family>Chivo</family>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>System</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QCheckBox" name="darkModeCheckBox">
<property name="text">
<string>Enable night mode</string>
</property>
</widget>
</item>
<item row="20" column="0">
<layout class="QGridLayout" name="gridLayout_13">
<property name="bottomMargin">
<number>0</number>
@ -686,132 +808,17 @@ OK
</item>
</layout>
</item>
<item row="10" column="0">
<widget class="QCheckBox" name="darkModeCheckBox">
<property name="text">
<string>Enable night mode</string>
</property>
</widget>
</item>
<item row="17" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="14" column="0">
<widget class="Line" name="line_2">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="15" column="0">
<item row="19" column="0">
<widget class="QCheckBox" name="enableLockscreenCheckBox">
<property name="text">
<string>Enable lock screen and passcode</string>
</property>
</widget>
</item>
<item row="12" column="0">
<layout class="QGridLayout" name="gridLayout_7">
<property name="bottomMargin">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="1" column="2">
<widget class="QPushButton" name="updateBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<item row="8" column="0">
<widget class="QCheckBox" name="enableUiScalingCheckBox">
<property name="text">
<string>Update</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>System info</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="updateLabel">
<property name="text">
<string>Update InkBox</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="showSystemInfoBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Show</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="13" column="0">
<widget class="QLabel" name="securityLabel">
<property name="font">
<font>
<family>Chivo</family>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Security</string>
<string>Enable UI scaling</string>
</property>
</widget>
</item>