Improvements

This commit is contained in:
Nicolas Mailloux 2022-12-30 18:04:55 -05:00
parent 4f104c6ca3
commit 23e20d6419
5 changed files with 348 additions and 368 deletions

View file

@ -340,13 +340,12 @@ MainWindow::MainWindow(QWidget *parent)
}
}
// OTA updates
QString checkConfigPath = ".config/23-updates/check-updates";
if(QFile(checkConfigPath).exists() == false) {
string_writeconfig(checkConfigPath.toStdString(), "true");
// OTA update
if(!QFile(updatesCheckConfigPath).exists()) {
writeFile(updatesCheckConfigPath, "true");
}
if(checkconfig(checkConfigPath) == true) {
if(checkconfig(updatesCheckConfigPath) == true) {
// Check for an update and ask if the user wants to install it
checkForUpdate();
// Check for an OTA update
@ -354,9 +353,8 @@ MainWindow::MainWindow(QWidget *parent)
}
// USB mass storage prompt
QString usbConfigPath = ".config/22-usb/show-dialog";
if(QFile(usbConfigPath).exists() == false) {
string_writeconfig(usbConfigPath.toStdString(), "true");
if(!QFile(usbConfigPath).exists()) {
writeFile(usbConfigPath, "true");
}
if(checkconfig(usbConfigPath) == true) {

View file

@ -66,6 +66,9 @@ public:
void resetIcons();
void setBatteryIcon();
QString updatesCheckConfigPath = ".config/23-updates/check-updates";
QString usbConfigPath = ".config/22-usb/show-dialog";
public slots:
void showToast(QString messageToDisplay);
void closeIndefiniteToast();

View file

@ -60,8 +60,6 @@ settings::settings(QWidget *parent) :
ui->repackBtn->setStyleSheet("font-size: 9pt");
ui->exportHighlightsBtn->setStyleSheet("font-size: 9pt");
ui->uiScaleNumberLabel->setStyleSheet("font-size: 9pt; font-weight: bold");
ui->autoCheckUpdatesBox->setStyleSheet("font-size: 9pt");
ui->usbMsDialogBox->setStyleSheet("font-size: 9pt");
if(global::deviceID == "n705\n" or global::deviceID == "n905\n" or global::deviceID == "kt\n") {
ui->previousBtn->setStyleSheet("padding: 7.5px;");
@ -348,7 +346,7 @@ settings::settings(QWidget *parent) :
// USB show dialog
if(checkconfig(".config/22-usb/show-dialog") == true) {
ui->usbMsDialogBox->click();
ui->usbmsDialogBox->click();
}
// Automatic updates
@ -1124,9 +1122,9 @@ void settings::on_localLibraryShowFoldersCheckBox_toggled(bool checked)
}
void settings::on_usbMsDialogBox_clicked(bool checked)
void settings::on_usbmsDialogBox_clicked(bool checked)
{
QString settingString = "Show USB Mass storage dialog";
QString settingString = "USB Mass Storage dialog display";
if(checked == true) {
logEnabled(settingString, className);
string_writeconfig(".config/22-usb/show-dialog", "true");
@ -1139,7 +1137,7 @@ void settings::on_usbMsDialogBox_clicked(bool checked)
void settings::on_autoCheckUpdatesBox_clicked(bool checked)
{
QString settingString = "Automatically check updates";
QString settingString = "automatic updates checking";
if(checked == true) {
logEnabled(settingString, className);
string_writeconfig(".config/23-updates/check-updates", "true");

View file

@ -75,11 +75,8 @@ private slots:
void on_pageSizeHeightIncBtn_clicked();
void on_pageSizeWidthDecBtn_clicked();
void on_pageSizeWidthIncBtn_clicked();
void on_localLibraryShowFoldersCheckBox_toggled(bool checked);
void on_usbMsDialogBox_clicked(bool checked);
void on_usbmsDialogBox_clicked(bool checked);
void on_autoCheckUpdatesBox_clicked(bool checked);
signals:

View file

@ -69,7 +69,7 @@
<x>0</x>
<y>0</y>
<width>457</width>
<height>667</height>
<height>650</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
@ -118,340 +118,6 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="11" column="0">
<widget class="QCheckBox" name="clockCheckBox">
<property name="text">
<string>Clock: Show seconds</string>
</property>
</widget>
</item>
<item row="26" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</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="5" column="0">
<widget class="QCheckBox" name="globalReadingSettingsCheckBox">
<property name="text">
<string>Global reading settings</string>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QCheckBox" name="quoteCheckBox">
<property name="text">
<string>Disable authors quotes</string>
</property>
</widget>
</item>
<item row="8" column="0">
<layout class="QGridLayout" name="gridLayout_16">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="exportHighlightsLabel">
<property name="text">
<string>Export highlights</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="exportHighlightsBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Export</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="readerScrollBarCheckBox">
<property name="text">
<string>Show scroll bar if needed</string>
</property>
</widget>
</item>
<item row="20" column="0">
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<family>Chivo</family>
<weight>50</weight>
<italic>true</italic>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Storage</string>
</property>
</widget>
</item>
<item row="2" column="0">
<layout class="QGridLayout" name="gridLayout_6">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="1" column="4">
<widget class="QPushButton" name="wordsNumberIncBtn">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../eink.qrc">
<normaloff>:/resources/plus.png</normaloff>:/resources/plus.png</iconset>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="wordsNumberValueLabel">
<property name="text">
<string>30</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_5">
<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="wordsNumberLabel">
<property name="text">
<string>Words number/page (plain text files)</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="wordsNumberDecBtn">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../eink.qrc">
<normaloff>:/resources/minus.png</normaloff>:/resources/minus.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="21" 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="10" 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="14" column="0">
<widget class="QLabel" name="label_14">
<property name="font">
<font>
<family>Chivo</family>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Local library</string>
</property>
</widget>
</item>
<item row="15" column="0">
<widget class="Line" name="line_11">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="16" column="0">
<widget class="QCheckBox" name="localLibraryShowFoldersCheckBox">
<property name="text">
<string>Show folders</string>
</property>
</widget>
</item>
<item row="22" column="0">
<layout class="QGridLayout" name="gridLayout_4">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="1">
<spacer name="horizontalSpacer_2">
<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_6">
<property name="text">
<string>Enter USB Mass Storage session</string>
</property>
</widget>
</item>
<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="1" column="0">
<widget class="QCheckBox" name="usbMsDialogBox">
<property name="text">
<string>Show USB Mass Storage dialog</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<family>Chivo</family>
<weight>50</weight>
<italic>true</italic>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Home</string>
</property>
</widget>
</item>
<item row="25" 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="24" 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="7" column="0">
<widget class="QCheckBox" name="menuBarCheckBox">
<property name="text">
<string>Always show status bar</string>
</property>
</widget>
</item>
<item row="4" column="0">
<layout class="QGridLayout" name="gridLayout_9">
<property name="bottomMargin">
@ -523,6 +189,60 @@
</item>
</layout>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="menuBarCheckBox">
<property name="text">
<string>Always show status bar</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>
</property>
</widget>
</item>
<item row="10" 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="14" column="0">
<widget class="QLabel" name="label_14">
<property name="font">
<font>
<family>Chivo</family>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Local library</string>
</property>
</widget>
</item>
<item row="16" column="0">
<widget class="QCheckBox" name="localLibraryShowFoldersCheckBox">
<property name="text">
<string>Show folders</string>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QCheckBox" name="quoteCheckBox">
<property name="text">
<string>Disable authors quotes</string>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QCheckBox" name="demoCheckBox">
<property name="text">
@ -530,6 +250,232 @@
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="readerScrollBarCheckBox">
<property name="text">
<string>Show scroll bar if needed</string>
</property>
</widget>
</item>
<item row="27" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="25" 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">
<layout class="QGridLayout" name="gridLayout_16">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="exportHighlightsLabel">
<property name="text">
<string>Export highlights</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="exportHighlightsBtn">
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Export</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="0">
<layout class="QGridLayout" name="gridLayout_6">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="1" column="4">
<widget class="QPushButton" name="wordsNumberIncBtn">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../eink.qrc">
<normaloff>:/resources/plus.png</normaloff>:/resources/plus.png</iconset>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="wordsNumberValueLabel">
<property name="text">
<string>30</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_5">
<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="wordsNumberLabel">
<property name="text">
<string>Words number/page (plain text files)</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="wordsNumberDecBtn">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../eink.qrc">
<normaloff>:/resources/minus.png</normaloff>:/resources/minus.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="22" column="0">
<layout class="QGridLayout" name="gridLayout_4">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="1">
<spacer name="horizontalSpacer_2">
<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_6">
<property name="text">
<string>Enter USB Mass Storage session</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="usbmsBtn">
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Go</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="24" column="0">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<family>Chivo</family>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>USB networking</string>
</property>
</widget>
</item>
<item row="26" 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>
<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="globalReadingSettingsCheckBox">
<property name="text">
<string>Global reading settings</string>
</property>
</widget>
</item>
<item row="3" column="0">
<layout class="QGridLayout" name="gridLayout_15">
<property name="bottomMargin">
@ -647,7 +593,6 @@
<property name="font">
<font>
<family>Chivo</family>
<weight>50</weight>
<italic>true</italic>
<bold>false</bold>
</font>
@ -657,16 +602,65 @@
</property>
</widget>
</item>
<item row="23" column="0">
<widget class="QLabel" name="label_3">
<item row="21" 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="9" column="0">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<family>Chivo</family>
<italic>true</italic>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>USB networking</string>
<string>Home</string>
</property>
</widget>
</item>
<item row="11" 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_11">
<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="QLabel" name="label_5">
<property name="font">
<font>
<family>Chivo</family>
<italic>true</italic>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Storage</string>
</property>
</widget>
</item>
<item row="23" column="0">
<widget class="QCheckBox" name="usbmsDialogBox">
<property name="text">
<string>Show USB Mass Storage dialog</string>
</property>
</widget>
</item>
@ -725,7 +719,6 @@
<widget class="QPushButton" name="setPasscodeBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -792,7 +785,6 @@
<widget class="QPushButton" name="generateSystemReportBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -862,7 +854,6 @@
<widget class="QPushButton" name="checkOtaUpdateBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -905,7 +896,6 @@
<widget class="QPushButton" name="showSystemInfoBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -932,7 +922,6 @@
<widget class="QPushButton" name="resetBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -995,7 +984,6 @@
<widget class="QPushButton" name="repackBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -1052,7 +1040,6 @@
<widget class="QLabel" name="uiScaleNumberLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -1160,7 +1147,6 @@
<widget class="QPushButton" name="updateBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -1180,7 +1166,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Check for updates automatically</string>
<string>Automatically check for updates</string>
</property>
</widget>
</item>
@ -1203,7 +1189,6 @@
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -1266,7 +1251,6 @@
<widget class="QPushButton" name="okBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>