mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 23:57:22 -08:00
Things are going well!
(and I'm strongly hoping that it will continue like that too ;p)
This commit is contained in:
parent
386832aca2
commit
351a375dfc
5 changed files with 262 additions and 137 deletions
13
functions.h
13
functions.h
|
@ -63,6 +63,8 @@ namespace {
|
|||
QString batt_level;
|
||||
QString kernelVersion;
|
||||
int batt_level_int;
|
||||
int defaultEpubPageWidth;
|
||||
int defaultEpubPageHeight;
|
||||
bool checked_box = false;
|
||||
bool checkconfig(QString file) {
|
||||
QFile config(file);
|
||||
|
@ -318,5 +320,16 @@ namespace {
|
|||
QString returnedMetadata = proc->readAllStandardOutput();
|
||||
return returnedMetadata;
|
||||
}
|
||||
void defineDefaultPageSize() {
|
||||
string_checkconfig_ro("/opt/inkbox_device");
|
||||
if(checkconfig_str_val == "n705\n") {
|
||||
defaultEpubPageWidth = 425;
|
||||
defaultEpubPageHeight = 425;
|
||||
}
|
||||
if(checkconfig_str_val == "n905\n") {
|
||||
defaultEpubPageHeight = 425;
|
||||
defaultEpubPageWidth = 425;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // FUNCTIONS_H
|
||||
|
|
63
reader.cpp
63
reader.cpp
|
@ -89,7 +89,7 @@ reader::reader(QWidget *parent) :
|
|||
string_checkconfig(".config/04-book/font");
|
||||
if(checkconfig_str_val == "") {
|
||||
ui->fontChooser->setCurrentText(checkconfig_str_val);
|
||||
ui->text->setFont(QFont("Inter"));
|
||||
ui->text->setFont(QFont("Source Serif Pro"));
|
||||
}
|
||||
else {
|
||||
if(checkconfig_str_val == "Crimson Pro") {
|
||||
|
@ -1225,9 +1225,8 @@ void reader::openCriticalBatteryAlertWindow() {
|
|||
}
|
||||
|
||||
void reader::convertMuPdfVars() {
|
||||
setPageStyle();
|
||||
mupdf::fontSize = 12;
|
||||
mupdf::width = 400;
|
||||
mupdf::height = 460;
|
||||
mupdf::fontSize_qstr = QString::number(mupdf::fontSize);
|
||||
mupdf::width_qstr = QString::number(mupdf::width);
|
||||
mupdf::height_qstr = QString::number(mupdf::height);
|
||||
|
@ -1236,29 +1235,38 @@ void reader::convertMuPdfVars() {
|
|||
|
||||
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;
|
||||
}
|
||||
defineDefaultPageSize();
|
||||
|
||||
string_checkconfig_ro(".config/13-epub_page_size/width");
|
||||
if(checkconfig_str_val != "") {
|
||||
;
|
||||
}
|
||||
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;
|
||||
}
|
||||
else {
|
||||
std::string pageWidth = std::to_string(defaultEpubPageWidth);
|
||||
string_writeconfig(".config/13-epub_page_size/width", pageWidth);
|
||||
string_writeconfig(".config/13-epub_page_size/set", "true");
|
||||
string_checkconfig_ro(".config/13-epub_page_size/width");
|
||||
}
|
||||
mupdf::width = checkconfig_str_val.toInt();
|
||||
|
||||
string_checkconfig_ro(".config/13-epub_page_size/height");
|
||||
if(checkconfig_str_val != "") {
|
||||
;
|
||||
}
|
||||
else {
|
||||
std::string pageHeight = std::to_string(defaultEpubPageHeight);
|
||||
string_writeconfig(".config/13-epub_page_size/height", pageHeight);
|
||||
string_writeconfig(".config/13-epub_page_size/set", "true");
|
||||
string_checkconfig_ro(".config/13-epub_page_size/height");
|
||||
}
|
||||
mupdf::height = checkconfig_str_val.toInt();
|
||||
}
|
||||
|
||||
void reader::delay(int seconds) {
|
||||
// https://stackoverflow.com/questions/3752742/how-do-i-create-a-pause-wait-function-using-qt
|
||||
QTime dieTime= QTime::currentTime().addSecs(seconds);
|
||||
while (QTime::currentTime() < dieTime)
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
|
||||
}
|
||||
|
||||
void reader::on_text_selectionChanged() {
|
||||
|
@ -1296,10 +1304,3 @@ void reader::on_text_selectionChanged() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void reader::delay(int seconds) {
|
||||
// https://stackoverflow.com/questions/3752742/how-do-i-create-a-pause-wait-function-using-qt
|
||||
QTime dieTime= QTime::currentTime().addSecs(seconds);
|
||||
while (QTime::currentTime() < dieTime)
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
|
||||
}
|
||||
|
|
43
settings.cpp
43
settings.cpp
|
@ -66,6 +66,9 @@ settings::settings(QWidget *parent) :
|
|||
ui->uiScalingSlider->hide();
|
||||
ui->uiScalingLabel->hide();
|
||||
|
||||
// Variables
|
||||
defineDefaultPageSize();
|
||||
|
||||
// Settings tweaking + enabling specific features whether it's running on the provided integrated OS or Kobo firmware
|
||||
if(checkconfig(".config/01-demo/config") == true) {
|
||||
ui->demoCheckBox->click();
|
||||
|
@ -90,6 +93,32 @@ settings::settings(QWidget *parent) :
|
|||
ui->wordsNumber->setValue(words_number);
|
||||
}
|
||||
|
||||
// ePUB page size
|
||||
if(checkconfig(".config/13-epub_page_size/set") == true) {
|
||||
string_checkconfig_ro(".config/13-epub_page_size/width");
|
||||
if(checkconfig_str_val != "") {
|
||||
int pageWidth = checkconfig_str_val.toInt();
|
||||
ui->pageSizeWidthSpinBox->setValue(pageWidth);
|
||||
}
|
||||
else {
|
||||
// Failsafe: setting default
|
||||
ui->pageSizeWidthSpinBox->setValue(defaultEpubPageWidth);
|
||||
}
|
||||
string_checkconfig_ro(".config/13-epub_page_size/height");
|
||||
if(checkconfig_str_val != "") {
|
||||
int pageHeight = checkconfig_str_val.toInt();
|
||||
ui->pageSizeHeightSpinBox->setValue(pageHeight);
|
||||
}
|
||||
else {
|
||||
// Failsafe: setting default
|
||||
ui->pageSizeHeightSpinBox->setValue(defaultEpubPageHeight);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ui->pageSizeWidthSpinBox->setValue(defaultEpubPageWidth);
|
||||
ui->pageSizeHeightSpinBox->setValue(defaultEpubPageHeight);
|
||||
}
|
||||
|
||||
// Sticky menubar
|
||||
if(checkconfig(".config/11-menubar/sticky") == true) {
|
||||
ui->menuBarCheckBox->click();
|
||||
|
@ -660,3 +689,17 @@ void settings::on_showSystemInfoBtn_clicked()
|
|||
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||
generalDialogWindow->show();
|
||||
}
|
||||
|
||||
void settings::on_pageSizeWidthSpinBox_valueChanged(int arg1)
|
||||
{
|
||||
std::string value = std::to_string(arg1);
|
||||
string_writeconfig(".config/13-epub_page_size/width", value);
|
||||
string_writeconfig(".config/13-epub_page_size/set", "true");
|
||||
}
|
||||
|
||||
void settings::on_pageSizeHeightSpinBox_valueChanged(int arg1)
|
||||
{
|
||||
std::string value = std::to_string(arg1);
|
||||
string_writeconfig(".config/13-epub_page_size/height", value);
|
||||
string_writeconfig(".config/13-epub_page_size/set", "true");
|
||||
}
|
||||
|
|
|
@ -46,8 +46,9 @@ private slots:
|
|||
void on_setPasscodeBtn_clicked();
|
||||
void on_enableLockscreenCheckBox_toggled(bool checked);
|
||||
void on_enableUiScalingCheckBox_toggled(bool checked);
|
||||
|
||||
void on_showSystemInfoBtn_clicked();
|
||||
void on_pageSizeWidthSpinBox_valueChanged(int arg1);
|
||||
void on_pageSizeHeightSpinBox_valueChanged(int arg1);
|
||||
|
||||
private:
|
||||
Ui::settings *ui;
|
||||
|
|
277
settings.ui
277
settings.ui
|
@ -191,14 +191,7 @@ OK
|
|||
<number>0</number>
|
||||
</property>
|
||||
<item row="7" column="0">
|
||||
<widget class="QCheckBox" name="clockCheckBox">
|
||||
<property name="text">
|
||||
<string>Clock: Show seconds</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="0">
|
||||
<widget class="Line" name="line_7">
|
||||
<widget class="Line" name="line_6">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
|
@ -208,6 +201,26 @@ OK
|
|||
</widget>
|
||||
</item>
|
||||
<item row="16" column="0">
|
||||
<widget class="Line" name="line_7">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="19" column="0">
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
|
@ -247,27 +260,114 @@ OK
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="Line" name="line_6">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
<item row="18" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Chivo</family>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<property name="text">
|
||||
<string>Networking</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="Line" name="line_8">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<item row="9" column="0">
|
||||
<widget class="QCheckBox" name="quoteCheckBox">
|
||||
<property name="text">
|
||||
<string>Disable authors quotes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="10" column="0">
|
||||
<widget class="QCheckBox" name="demoCheckBox">
|
||||
<property name="text">
|
||||
<string>Disable "Welcome to InkBox" message</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="20" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Request DHCP lease</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<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="requestLeaseBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Request</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="menuBarCheckBox">
|
||||
<property name="text">
|
||||
<string>Always show status bar</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Chivo</family>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reading</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QCheckBox" name="clockCheckBox">
|
||||
<property name="text">
|
||||
<string>Clock: Show seconds</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Chivo</family>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Storage</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_9">
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
|
@ -338,43 +438,6 @@ OK
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="18" column="0">
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QCheckBox" name="quoteCheckBox">
|
||||
<property name="text">
|
||||
<string>Disable authors quotes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="menuBarCheckBox">
|
||||
<property name="text">
|
||||
<string>Always show status bar</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Chivo</family>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reading</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<property name="bottomMargin">
|
||||
|
@ -396,7 +459,7 @@ OK
|
|||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="wordsNumberLabel">
|
||||
<property name="text">
|
||||
<string>Words number per page (plain text files)</string>
|
||||
<string>Words number/page (plain text files)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -418,7 +481,7 @@ OK
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
|
@ -431,53 +494,57 @@ OK
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Chivo</family>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
<item row="1" column="0">
|
||||
<widget class="Line" name="line_8">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Storage</string>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Chivo</family>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Networking</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QCheckBox" name="demoCheckBox">
|
||||
<property name="text">
|
||||
<string>Disable "Welcome to InkBox" message</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="19" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="3" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_15">
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<item row="0" column="4">
|
||||
<widget class="QLabel" name="pageSizeHeightLabel">
|
||||
<property name="text">
|
||||
<string>Request DHCP lease</string>
|
||||
<string>Height:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="pageSizeWidthLabel">
|
||||
<property name="text">
|
||||
<string>Width:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QSpinBox" name="pageSizeWidthSpinBox">
|
||||
<property name="minimum">
|
||||
<number>300</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>700</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>25</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="epubPageSizeLabel">
|
||||
<property name="text">
|
||||
<string>ePUB page size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<spacer name="horizontalSpacer_11">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
|
@ -489,16 +556,16 @@ OK
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="requestLeaseBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
<item row="0" column="5">
|
||||
<widget class="QSpinBox" name="pageSizeHeightSpinBox">
|
||||
<property name="minimum">
|
||||
<number>300</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Request</string>
|
||||
<property name="maximum">
|
||||
<number>700</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>25</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Loading…
Reference in a new issue