Global/separate reading settings implementation

This commit is contained in:
Nicolas Mailloux 2021-08-06 00:50:28 -04:00
parent 01f59f1f31
commit eab27fabd9
5 changed files with 203 additions and 169 deletions

View file

@ -375,6 +375,14 @@ MainWindow::MainWindow(QWidget *parent)
writeconfig(".config/05-quote/config", "DisableQuote=");
}
}
// Global reading settings
string_checkconfig(".config/16-global_reading_settings/config");
if(checkconfig_str_val == "") {
checked_box = true;
writeconfig(".config/16-global_reading_settings/config", "GlobalReadingSettings=");
}
if(checkconfig(".config/05-quote/config") == false) {
int quote_value = display_quote();
if(quote_value == 1) {

View file

@ -173,7 +173,7 @@ reader::reader(QWidget *parent) :
string_writeconfig("/tmp/inkboxBookPath", book_file_str);
// Calling InkBox daemon (ibxd) via FIFO interface to run bookconfig_mount
if(checkconfig(".config/16-global_reading_settings/config") == true) {
if(checkconfig(".config/16-global_reading_settings/config") == false) {
string_writeconfig("/opt/ibxd", "bookconfig_mount\n");
// Callback handler to wait until bookconfig_mount has finished execution
while(true) {

View file

@ -276,6 +276,11 @@ settings::settings(QWidget *parent) :
ui->enableLockscreenCheckBox->click();
}
// Global reading settings
if(checkconfig(".config/16-global_reading_settings/config") == true) {
ui->globalReadingSettingsCheckBox->click();
}
// DPI checkbox
string_checkconfig(".config/09-dpi/config");
// Check if the string is a number; else, we don't check the check box
@ -835,3 +840,16 @@ void settings::on_sleepTimeoutComboBox_currentIndexChanged(const QString &arg1)
void settings::brightnessDown() {
cinematicBrightness(0, 1);
}
void settings::on_globalReadingSettingsCheckBox_toggled(bool checked)
{
if(checked == true) {
checked_box = true;
writeconfig(".config/16-global_reading_settings/config", "GlobalReadingSettings=");
}
else {
checked_box = false;
writeconfig(".config/16-global_reading_settings/config", "GlobalReadingSettings=");
}
}

View file

@ -52,6 +52,7 @@ private slots:
void on_readerScrollBarCheckBox_toggled(bool checked);
void on_sleepTimeoutComboBox_currentIndexChanged(const QString &arg1);
void brightnessDown();
void on_globalReadingSettingsCheckBox_toggled(bool checked);
private:
Ui::settings *ui;

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>477</width>
<height>564</height>
<height>757</height>
</rect>
</property>
<property name="windowTitle">
@ -48,8 +48,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>442</width>
<height>474</height>
<width>560</width>
<height>818</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
@ -98,26 +98,13 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="18" column="0">
<layout class="QGridLayout" name="gridLayout_4">
<item row="2" column="0">
<layout class="QGridLayout" name="gridLayout_6">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="2">
<widget class="QPushButton" name="usbmsBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Go</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_2">
<item row="1" column="1">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -129,64 +116,33 @@
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<item row="1" column="0">
<widget class="QLabel" name="wordsNumberLabel">
<property name="text">
<string>Enter USB Mass Storage session</string>
<string>Words number/page (plain text files)</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="wordsNumber">
<property name="minimum">
<number>20</number>
</property>
<property name="maximum">
<number>300</number>
</property>
<property name="singleStep">
<number>20</number>
</property>
<property name="value">
<number>20</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="21" column="0">
<layout class="QGridLayout" name="gridLayout_3">
<property name="bottomMargin">
<number>0</number>
</property>
<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="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Request DHCP lease</string>
</property>
</widget>
</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="6" column="0">
<widget class="QCheckBox" name="menuBarCheckBox">
<property name="text">
<string>Always show status bar</string>
</property>
</widget>
</item>
<item row="17" column="0">
<widget class="Line" name="line_7">
<item row="1" column="0">
<widget class="Line" name="line_8">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
@ -195,24 +151,26 @@
</property>
</widget>
</item>
<item row="20" 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="clockCheckBox">
<property name="text">
<string>Clock: Show seconds</string>
<widget class="Line" name="line_6">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="readerScrollBarCheckBox">
<property name="text">
<string>Show scroll bar if needed</string>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QCheckBox" name="demoCheckBox">
<property name="text">
<string>Disable &quot;Welcome to InkBox&quot; message</string>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
@ -287,38 +245,55 @@
</item>
</layout>
</item>
<item row="16" column="0">
<widget class="QLabel" name="label_5">
<item row="18" 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="22" column="0">
<layout class="QGridLayout" name="gridLayout_3">
<property name="bottomMargin">
<number>0</number>
</property>
<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="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Request DHCP lease</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="requestLeaseBtn">
<property name="font">
<font>
<family>Chivo</family>
<italic>true</italic>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Storage</string>
<string>Request</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="Line" name="line_6">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="20" 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>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_7">
@ -333,13 +308,39 @@
</property>
</widget>
</item>
<item row="2" column="0">
<layout class="QGridLayout" name="gridLayout_6">
<item row="17" 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="19" column="0">
<layout class="QGridLayout" name="gridLayout_4">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="1" column="1">
<spacer name="horizontalSpacer_5">
<item row="0" column="2">
<widget class="QPushButton" name="usbmsBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Go</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -351,33 +352,24 @@
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="wordsNumberLabel">
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Words number/page (plain text files)</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="wordsNumber">
<property name="minimum">
<number>20</number>
</property>
<property name="maximum">
<number>300</number>
</property>
<property name="singleStep">
<number>20</number>
</property>
<property name="value">
<number>20</number>
<string>Enter USB Mass Storage session</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="19" column="0">
<widget class="QLabel" name="label_3">
<item row="10" column="0">
<widget class="QCheckBox" name="clockCheckBox">
<property name="text">
<string>Clock: Show seconds</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<family>Chivo</family>
@ -385,14 +377,37 @@
</font>
</property>
<property name="text">
<string>Networking</string>
<string>Home</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QCheckBox" name="quoteCheckBox">
<item row="23" column="0">
<spacer name="verticalSpacer">
<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="6" column="0">
<widget class="QCheckBox" name="readerScrollBarCheckBox">
<property name="text">
<string>Disable authors quotes</string>
<string>Show scroll bar if needed</string>
</property>
</widget>
</item>
<item row="21" 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>
@ -463,41 +478,33 @@
</item>
</layout>
</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>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<family>Chivo</family>
<italic>true</italic>
</font>
</property>
<widget class="QCheckBox" name="menuBarCheckBox">
<property name="text">
<string>Home</string>
<string>Always show status bar</string>
</property>
</widget>
</item>
<item row="22" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item row="11" column="0">
<widget class="QCheckBox" name="quoteCheckBox">
<property name="text">
<string>Disable authors quotes</string>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</widget>
</item>
<item row="12" column="0">
<widget class="QCheckBox" name="demoCheckBox">
<property name="text">
<string>Disable &quot;Welcome to InkBox&quot; message</string>
</property>
</spacer>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="globalReadingSettingsCheckBox">
<property name="text">
<string>Global reading settings</string>
</property>
</widget>
</item>
</layout>
</item>