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();
}
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) {
// Enforcing security policy if the user has not rooted the device
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/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
if(launch_sh == true) {
if(ui_enable_changed == true) {
@ -771,8 +784,6 @@ void settings::on_enableLockscreenCheckBox_toggled(bool checked)
logDisabled(settingString, className);
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)
@ -1149,3 +1160,19 @@ void settings::on_autoCheckUpdatesBox_clicked(bool checked)
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_usbmsDialogBox_clicked(bool checked);
void on_autoCheckUpdatesBox_clicked(bool checked);
void on_lockscreenBackgroundComboBox_currentTextChanged(const QString &arg1);
signals:
void showToast(QString messageToDisplay);

View file

@ -687,17 +687,76 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="27" column="0">
<widget class="Line" name="line_10">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
<item row="6" column="0">
<widget class="QLabel" name="softwareLabel">
<property name="font">
<font>
<family>Chivo</family>
<italic>true</italic>
</font>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<property name="text">
<string>System</string>
</property>
</widget>
</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">
<property name="bottomMargin">
<number>0</number>
@ -736,129 +795,52 @@
</item>
</layout>
</item>
<item row="28" column="0">
<widget class="QCheckBox" name="enableEncryptedStorageCheckBox">
<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">
<item row="9" column="0">
<layout class="QGridLayout" name="gridLayout_8">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="2">
<widget class="QPushButton" name="generateSystemReportBtn">
<item row="1" column="2">
<widget class="QLabel" name="uiScaleNumberLabel">
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Generate</string>
<string>1</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_15">
<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>
<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="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">
<item row="1" column="0">
<widget class="QLabel" name="uiScalingLabel">
<property name="text">
<string>Check for updates</string>
<string>UI scaling factor</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 name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
@ -945,8 +927,61 @@
</item>
</layout>
</item>
<item row="23" column="0">
<widget class="Line" name="line_2">
<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">
<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">
<enum>QFrame::Plain</enum>
</property>
@ -955,7 +990,7 @@
</property>
</widget>
</item>
<item row="29" column="0">
<item row="32" column="0">
<layout class="QGridLayout" name="gridLayout_17">
<property name="bottomMargin">
<number>0</number>
@ -994,108 +1029,17 @@
</item>
</layout>
</item>
<item row="24" column="0">
<widget class="QCheckBox" name="enableLockscreenCheckBox">
<property name="text">
<string>Enable lock screen and passcode</string>
<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="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="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">
<item row="33" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -1108,13 +1052,52 @@
</property>
</spacer>
</item>
<item row="10" column="0">
<widget class="QCheckBox" name="darkModeCheckBox">
<item row="31" column="0">
<widget class="QCheckBox" name="enableEncryptedStorageCheckBox">
<property name="text">
<string>Enable night mode</string>
<string>Enable</string>
</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">
<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">
<layout class="QGridLayout" name="gridLayout_14">
<property name="bottomMargin">
@ -1157,19 +1140,82 @@
</item>
</layout>
</item>
<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>
<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>Automatically check for updates</string>
<string>Security</string>
</property>
</widget>
</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>
</item>
</layout>