Even more lockscreen configuration improvements and fixes

This commit is contained in:
Nicolas Mailloux 2022-12-30 22:52:20 -05:00
parent 1ea1712ba6
commit 9087a04a28
3 changed files with 300 additions and 226 deletions

View file

@ -354,6 +354,16 @@ settings::settings(QWidget *parent) :
ui->autoCheckUpdatesBox->click(); ui->autoCheckUpdatesBox->click();
} }
if(readFile(".config/12-lockscreen/background") == "blank") {
ui->lockscreenBackgroundComboBox->setCurrentIndex(0);
}
else if(readFile(".config/12-lockscreen/background") == "screenSaver") {
ui->lockscreenBackgroundComboBox->setCurrentIndex(1);
}
else if(readFile(".config/12-lockscreen/background") == "background") {
ui->lockscreenBackgroundComboBox->setCurrentIndex(2);
}
if(checkconfig("/opt/inkbox_genuine") == true) { if(checkconfig("/opt/inkbox_genuine") == true) {
// Enforcing security policy if the user has not rooted the device // Enforcing security policy if the user has not rooted the device
if(checkconfig("/external_root/opt/root/rooted") == true) { if(checkconfig("/external_root/opt/root/rooted") == true) {
@ -413,6 +423,9 @@ void settings::on_okBtn_clicked() {
writeFile(".config/13-epub_page_size/height", QString::number(pageSizeHeightSaved)); writeFile(".config/13-epub_page_size/height", QString::number(pageSizeHeightSaved));
writeFile(".config/13-epub_page_size/set", "true"); writeFile(".config/13-epub_page_size/set", "true");
// Notify power daemon of a potential configuration update
writeFile("/mnt/onboard/.adds/inkbox/.config/20-sleep_daemon/updateConfig", "true");
// Prevent potential unknown damage launching via shell script this could do // Prevent potential unknown damage launching via shell script this could do
if(launch_sh == true) { if(launch_sh == true) {
if(ui_enable_changed == true) { if(ui_enable_changed == true) {
@ -771,8 +784,6 @@ void settings::on_enableLockscreenCheckBox_toggled(bool checked)
logDisabled(settingString, className); logDisabled(settingString, className);
writeFile(".config/12-lockscreen/config", "false"); writeFile(".config/12-lockscreen/config", "false");
} }
// Notify power daemon of configuration update
writeFile("/mnt/onboard/.adds/inkbox/.config/20-sleep_daemon/updateConfig", "true");
} }
void settings::on_enableUiScalingCheckBox_toggled(bool checked) void settings::on_enableUiScalingCheckBox_toggled(bool checked)
@ -1149,3 +1160,19 @@ void settings::on_autoCheckUpdatesBox_clicked(bool checked)
string_writeconfig(".config/23-updates/check-updates", "false"); string_writeconfig(".config/23-updates/check-updates", "false");
} }
} }
void settings::on_lockscreenBackgroundComboBox_currentTextChanged(const QString &arg1)
{
if(arg1 == "Blank") {
writeFile(".config/12-lockscreen/background", "blank");
log("Set lockscreen background to 'blank'", className);
}
else if(arg1 == "Screensaver picture (if provided)") {
writeFile(".config/12-lockscreen/background", "screenSaver");
log("Set lockscreen background to 'screenSaver'", className);
}
else if(arg1 == "Device's screen") {
writeFile(".config/12-lockscreen/background", "background");
log("Set lockscreen background to 'background'", className);
}
}

View file

@ -78,6 +78,7 @@ private slots:
void on_localLibraryShowFoldersCheckBox_toggled(bool checked); void on_localLibraryShowFoldersCheckBox_toggled(bool checked);
void on_usbmsDialogBox_clicked(bool checked); void on_usbmsDialogBox_clicked(bool checked);
void on_autoCheckUpdatesBox_clicked(bool checked); void on_autoCheckUpdatesBox_clicked(bool checked);
void on_lockscreenBackgroundComboBox_currentTextChanged(const QString &arg1);
signals: signals:
void showToast(QString messageToDisplay); void showToast(QString messageToDisplay);

View file

@ -687,17 +687,76 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item row="27" column="0"> <item row="6" column="0">
<widget class="Line" name="line_10"> <widget class="QLabel" name="softwareLabel">
<property name="frameShadow"> <property name="font">
<enum>QFrame::Plain</enum> <font>
<family>Chivo</family>
<italic>true</italic>
</font>
</property> </property>
<property name="orientation"> <property name="text">
<enum>Qt::Horizontal</enum> <string>System</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="25" column="0"> <item row="21" column="0">
<widget class="QCheckBox" name="autoCheckUpdatesBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Automatically check for updates</string>
</property>
</widget>
</item>
<item row="14" column="0">
<layout class="QGridLayout" name="gridLayout_18">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Timezone</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_16">
<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="QComboBox" name="tzComboBox"/>
</item>
</layout>
</item>
<item row="29" column="0">
<widget class="QLabel" name="storageEncryptionLabel">
<property name="font">
<font>
<family>Chivo</family>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Storage encryption</string>
</property>
</widget>
</item>
<item row="26" column="0">
<layout class="QGridLayout" name="gridLayout_13"> <layout class="QGridLayout" name="gridLayout_13">
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
@ -736,129 +795,52 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="28" column="0"> <item row="9" column="0">
<widget class="QCheckBox" name="enableEncryptedStorageCheckBox"> <layout class="QGridLayout" name="gridLayout_8">
<property name="text">
<string>Enable</string>
</property>
</widget>
</item>
<item row="22" 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>
</property>
</widget>
</item>
<item row="26" column="0">
<widget class="QLabel" name="storageEncryptionLabel">
<property name="font">
<font>
<family>Chivo</family>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Storage encryption</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QCheckBox" name="enableUiScalingCheckBox">
<property name="text">
<string>Enable UI scaling</string>
</property>
</widget>
</item>
<item row="13" column="0">
<layout class="QGridLayout" name="gridLayout_19">
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="2"> <item row="1" column="2">
<widget class="QPushButton" name="generateSystemReportBtn"> <widget class="QLabel" name="uiScaleNumberLabel">
<property name="font"> <property name="font">
<font> <font>
<bold>true</bold> <bold>true</bold>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>Generate</string> <string>1</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="1" column="1">
<spacer name="horizontalSpacer_15"> <widget class="QSlider" name="uiScalingSlider">
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>2</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </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_10">
<property name="text">
<string>Generate system report</string>
</property>
</widget> </widget>
</item> </item>
</layout> <item row="1" column="0">
</item> <widget class="QLabel" name="uiScalingLabel">
<item row="7" column="0">
<widget class="Line" name="line_9">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="15" column="0">
<layout class="QGridLayout" name="checkOtaUpdateGridLayout">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="1">
<spacer name="horizontalSpacer_13">
<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="checkOtaUpdateLabel">
<property name="text"> <property name="text">
<string>Check for updates</string> <string>UI scaling factor</string>
</property> </property>
</widget> <property name="alignment">
</item> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
<item row="0" column="2">
<widget class="QPushButton" name="checkOtaUpdateBtn">
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Check</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -945,8 +927,61 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="23" column="0"> <item row="8" column="0">
<widget class="Line" name="line_2"> <widget class="QCheckBox" name="enableUiScalingCheckBox">
<property name="text">
<string>Enable UI scaling</string>
</property>
</widget>
</item>
<item row="13" column="0">
<layout class="QGridLayout" name="gridLayout_19">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="2">
<widget class="QPushButton" name="generateSystemReportBtn">
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Generate</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_15">
<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_10">
<property name="text">
<string>Generate system report</string>
</property>
</widget>
</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="30" column="0">
<widget class="Line" name="line_10">
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Plain</enum> <enum>QFrame::Plain</enum>
</property> </property>
@ -955,7 +990,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="29" column="0"> <item row="32" column="0">
<layout class="QGridLayout" name="gridLayout_17"> <layout class="QGridLayout" name="gridLayout_17">
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
@ -994,108 +1029,17 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="24" column="0"> <item row="7" column="0">
<widget class="QCheckBox" name="enableLockscreenCheckBox"> <widget class="Line" name="line_9">
<property name="text"> <property name="frameShadow">
<string>Enable lock screen and passcode</string> <enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="14" column="0"> <item row="33" column="0">
<layout class="QGridLayout" name="gridLayout_18">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Timezone</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_16">
<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="QComboBox" name="tzComboBox"/>
</item>
</layout>
</item>
<item row="9" column="0">
<layout class="QGridLayout" name="gridLayout_8">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="1" column="2">
<widget class="QLabel" name="uiScaleNumberLabel">
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>1</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSlider" name="uiScalingSlider">
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>2</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="uiScalingLabel">
<property name="text">
<string>UI scaling factor</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</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="30" column="0">
<spacer name="verticalSpacer_2"> <spacer name="verticalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -1108,13 +1052,52 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="10" column="0"> <item row="31" column="0">
<widget class="QCheckBox" name="darkModeCheckBox"> <widget class="QCheckBox" name="enableEncryptedStorageCheckBox">
<property name="text"> <property name="text">
<string>Enable night mode</string> <string>Enable</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="15" column="0">
<layout class="QGridLayout" name="checkOtaUpdateGridLayout">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="1">
<spacer name="horizontalSpacer_13">
<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="checkOtaUpdateLabel">
<property name="text">
<string>Check for updates</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="checkOtaUpdateBtn">
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Check</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="20" column="0"> <item row="20" column="0">
<layout class="QGridLayout" name="gridLayout_14"> <layout class="QGridLayout" name="gridLayout_14">
<property name="bottomMargin"> <property name="bottomMargin">
@ -1157,19 +1140,82 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="21" column="0"> <item row="22" column="0">
<widget class="QCheckBox" name="autoCheckUpdatesBox"> <widget class="QLabel" name="securityLabel">
<property name="sizePolicy"> <property name="font">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <font>
<horstretch>0</horstretch> <family>Chivo</family>
<verstretch>0</verstretch> <italic>true</italic>
</sizepolicy> </font>
</property> </property>
<property name="text"> <property name="text">
<string>Automatically check for updates</string> <string>Security</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="23" 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="24" column="0">
<widget class="QCheckBox" name="enableLockscreenCheckBox">
<property name="text">
<string>Enable lock screen and passcode</string>
</property>
</widget>
</item>
<item row="27" column="0">
<layout class="QGridLayout" name="gridLayout_20">
<property name="topMargin">
<number>0</number>
</property>
<item row="0" column="1">
<spacer name="horizontalSpacer_18">
<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_15">
<property name="text">
<string>Lockscreen background</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QComboBox" name="lockscreenBackgroundComboBox">
<item>
<property name="text">
<string>Blank</string>
</property>
</item>
<item>
<property name="text">
<string>Screensaver picture (if provided)</string>
</property>
</item>
<item>
<property name="text">
<string>Device's screen</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>