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="); 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) { if(checkconfig(".config/05-quote/config") == false) {
int quote_value = display_quote(); int quote_value = display_quote();
if(quote_value == 1) { if(quote_value == 1) {

View file

@ -173,7 +173,7 @@ reader::reader(QWidget *parent) :
string_writeconfig("/tmp/inkboxBookPath", book_file_str); string_writeconfig("/tmp/inkboxBookPath", book_file_str);
// Calling InkBox daemon (ibxd) via FIFO interface to run bookconfig_mount // 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"); string_writeconfig("/opt/ibxd", "bookconfig_mount\n");
// Callback handler to wait until bookconfig_mount has finished execution // Callback handler to wait until bookconfig_mount has finished execution
while(true) { while(true) {

View file

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

View file

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