mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 23:57:22 -08:00
Auto-suspend feature implemented :check:
This commit is contained in:
parent
347abf85dc
commit
19f31e1d44
5 changed files with 327 additions and 193 deletions
|
@ -344,17 +344,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
// **** FEATURE WARNING ****
|
||||
|
||||
// We set the brightness level saved in the config file
|
||||
int brightness_value = brightness_checkconfig(".config/03-brightness/config");
|
||||
if(checkconfig("/tmp/oobe-inkbox_completed") == true or checkconfig("/tmp/inkbox-cinematicBrightness_ran") == true) {
|
||||
// Coming from OOBE setup; not doing that fancy stuff again ;p
|
||||
QFile::remove("/tmp/oobe-inkbox_completed");
|
||||
pre_set_brightness(brightness_value);
|
||||
}
|
||||
else {
|
||||
// Fancy brightness fade-in
|
||||
string_writeconfig("/tmp/inkbox-cinematicBrightness_ran", "true");
|
||||
cinematicBrightness(brightness_value, 0);
|
||||
}
|
||||
QTimer::singleShot(2000, this, SLOT(setInitialBrightness()));
|
||||
|
||||
// Display quote if requested; otherwise, display recent books
|
||||
string_checkconfig(".config/05-quote/config");
|
||||
|
@ -795,3 +785,17 @@ void MainWindow::setBatteryIcon() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::setInitialBrightness() {
|
||||
int brightness_value = brightness_checkconfig(".config/03-brightness/config");
|
||||
if(checkconfig("/tmp/oobe-inkbox_completed") == true or checkconfig("/tmp/inkbox-cinematicBrightness_ran") == true) {
|
||||
// Coming from OOBE setup; not doing that fancy stuff again ;p
|
||||
QFile::remove("/tmp/oobe-inkbox_completed");
|
||||
pre_set_brightness(brightness_value);
|
||||
}
|
||||
else {
|
||||
// Fancy brightness fade-in
|
||||
string_writeconfig("/tmp/inkbox-cinematicBrightness_ran", "true");
|
||||
cinematicBrightness(brightness_value, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ private slots:
|
|||
void on_book4Btn_clicked();
|
||||
void on_brightnessBtn_clicked();
|
||||
void openUpdateDialog();
|
||||
void setInitialBrightness();
|
||||
void on_homeBtn_clicked();
|
||||
|
||||
private:
|
||||
|
|
63
settings.cpp
63
settings.cpp
|
@ -40,6 +40,7 @@ settings::settings(QWidget *parent) :
|
|||
ui->resetBtn->setStyleSheet("font-size: 9pt");
|
||||
ui->showSystemInfoBtn->setStyleSheet("font-size: 9pt");
|
||||
ui->comboBox->setStyleSheet("font-size: 9pt");
|
||||
ui->sleepTimeoutComboBox->setStyleSheet("font-size: 9pt");
|
||||
ui->setPasscodeBtn->setStyleSheet("font-size: 9pt");
|
||||
|
||||
ui->previousBtn->setText("");
|
||||
|
@ -185,11 +186,10 @@ settings::settings(QWidget *parent) :
|
|||
}
|
||||
|
||||
// Refresh
|
||||
string_checkconfig(".config/04-book/refresh");
|
||||
string_checkconfig_ro(".config/04-book/refresh");
|
||||
if(checkconfig_str_val == "") {
|
||||
// Set default option, 3
|
||||
string_writeconfig(".config/04-book/refresh", "3");
|
||||
string_checkconfig(".config/04-book/refresh");
|
||||
ui->comboBox->setCurrentText("3 pages");
|
||||
}
|
||||
else {
|
||||
|
@ -218,8 +218,37 @@ settings::settings(QWidget *parent) :
|
|||
if(refreshInt == 6) {
|
||||
ui->comboBox->setCurrentText("6 pages");
|
||||
}
|
||||
else {
|
||||
// Something bad (or not ;p) has happened
|
||||
}
|
||||
|
||||
// Sleep mode timeout
|
||||
string_checkconfig_ro(".config/15-sleep_timeout/config");
|
||||
if(checkconfig_str_val == "") {
|
||||
// Set default option, '15 minutes'
|
||||
string_writeconfig(".config/15-sleep_timeout/config", "15");
|
||||
ui->sleepTimeoutComboBox->setCurrentText("15 minutes");
|
||||
}
|
||||
else {
|
||||
int sleepTimeoutInt = checkconfig_str_val.toInt();
|
||||
if(sleepTimeoutInt == -1) {
|
||||
ui->sleepTimeoutComboBox->setCurrentText("Never");
|
||||
}
|
||||
if(sleepTimeoutInt == 2) {
|
||||
ui->sleepTimeoutComboBox->setCurrentText("2 minutes");
|
||||
}
|
||||
if(sleepTimeoutInt == 5) {
|
||||
ui->sleepTimeoutComboBox->setCurrentText("5 minutes");
|
||||
}
|
||||
if(sleepTimeoutInt == 10) {
|
||||
ui->sleepTimeoutComboBox->setCurrentText("10 minutes");
|
||||
}
|
||||
if(sleepTimeoutInt == 15) {
|
||||
ui->sleepTimeoutComboBox->setCurrentText("15 minutes");
|
||||
}
|
||||
if(sleepTimeoutInt == 30) {
|
||||
ui->sleepTimeoutComboBox->setCurrentText("30 minutes");
|
||||
}
|
||||
if(sleepTimeoutInt == 60) {
|
||||
ui->sleepTimeoutComboBox->setCurrentText("60 minutes");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -741,3 +770,29 @@ void settings::on_readerScrollBarCheckBox_toggled(bool checked)
|
|||
string_writeconfig(".config/14-reader_scrollbar/config", "false");
|
||||
}
|
||||
}
|
||||
|
||||
void settings::on_sleepTimeoutComboBox_currentIndexChanged(const QString &arg1)
|
||||
{
|
||||
setDefaultWorkDir();
|
||||
if(arg1 == "Never") {
|
||||
string_writeconfig(".config/15-sleep_timeout/config", "-1");
|
||||
}
|
||||
if(arg1 == "2 minutes") {
|
||||
string_writeconfig(".config/15-sleep_timeout/config", "2");
|
||||
}
|
||||
if(arg1 == "5 minutes") {
|
||||
string_writeconfig(".config/15-sleep_timeout/config", "5");
|
||||
}
|
||||
if(arg1 == "10 minutes") {
|
||||
string_writeconfig(".config/15-sleep_timeout/config", "10");
|
||||
}
|
||||
if(arg1 == "15 minutes") {
|
||||
string_writeconfig(".config/15-sleep_timeout/config", "15");
|
||||
}
|
||||
if(arg1 == "30 minutes") {
|
||||
string_writeconfig(".config/15-sleep_timeout/config", "30");
|
||||
}
|
||||
if(arg1 == "60 minutes") {
|
||||
string_writeconfig(".config/15-sleep_timeout/config", "60");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,8 @@ private slots:
|
|||
void on_pageSizeHeightSpinBox_valueChanged(int arg1);
|
||||
void on_readerScrollBarCheckBox_toggled(bool checked);
|
||||
|
||||
void on_sleepTimeoutComboBox_currentIndexChanged(const QString &arg1);
|
||||
|
||||
private:
|
||||
Ui::settings *ui;
|
||||
usbms_splash *usbmsWindow;
|
||||
|
|
428
settings.ui
428
settings.ui
|
@ -47,7 +47,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-105</y>
|
||||
<y>0</y>
|
||||
<width>442</width>
|
||||
<height>474</height>
|
||||
</rect>
|
||||
|
@ -59,6 +59,9 @@
|
|||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
@ -516,178 +519,6 @@
|
|||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_10">
|
||||
<item row="17" 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="21" column="0">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<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="18" 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="12" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>System info</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<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="QPushButton" name="showSystemInfoBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="16" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_14">
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_10">
|
||||
<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="updateLabel">
|
||||
<property name="text">
|
||||
<string>Update InkBox</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="updateBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Update</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="11" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_12">
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Reset this device</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="resetBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<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="9" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_8">
|
||||
<property name="bottomMargin">
|
||||
|
@ -740,6 +571,56 @@
|
|||
</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="17" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_14">
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_10">
|
||||
<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="updateLabel">
|
||||
<property name="text">
|
||||
<string>Update InkBox</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="updateBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Update</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="softwareLabel">
|
||||
<property name="font">
|
||||
|
@ -753,14 +634,33 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QCheckBox" name="darkModeCheckBox">
|
||||
<item row="22" column="0">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<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="18" column="0">
|
||||
<widget class="QLabel" name="securityLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Chivo</family>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable night mode</string>
|
||||
<string>Security</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="20" column="0">
|
||||
<item row="21" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_13">
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
|
@ -800,13 +700,66 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="19" column="0">
|
||||
<item row="13" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>System info</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<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="QPushButton" name="showSystemInfoBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="20" column="0">
|
||||
<widget class="QCheckBox" name="enableLockscreenCheckBox">
|
||||
<property name="text">
|
||||
<string>Enable lock screen and passcode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="19" 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="8" column="0">
|
||||
<widget class="QCheckBox" name="enableUiScalingCheckBox">
|
||||
<property name="text">
|
||||
|
@ -814,6 +767,125 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_12">
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Reset this device</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="resetBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<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="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="11" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_16">
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<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>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="sleepTimeoutLabel">
|
||||
<property name="text">
|
||||
<string>Sleep when idle</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="sleepTimeoutComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Never</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2 minutes</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>5 minutes</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>10 minutes</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>15 minutes</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>30 minutes</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>60 minutes</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
Loading…
Reference in a new issue