mirror of
https://github.com/Quill-OS/quill.git
synced 2024-11-01 05:43:21 -07:00
Merge pull request #32 from Szybet/master
Better idle sleep time selection
This commit is contained in:
commit
9c085d1b2c
3 changed files with 170 additions and 79 deletions
|
@ -16,6 +16,7 @@ powerDaemonSettings::powerDaemonSettings(QWidget *parent) :
|
||||||
ui->CBSLabel->setFont(QFont("Noto Sans Mono"));
|
ui->CBSLabel->setFont(QFont("Noto Sans Mono"));
|
||||||
ui->idleSleepLabel->setFont(QFont("Noto Sans Mono"));
|
ui->idleSleepLabel->setFont(QFont("Noto Sans Mono"));
|
||||||
|
|
||||||
|
// Font tweaks
|
||||||
ui->label_2->setFont(QFont("Inter"));
|
ui->label_2->setFont(QFont("Inter"));
|
||||||
ui->exitBtn->setFont(QFont("Inter"));
|
ui->exitBtn->setFont(QFont("Inter"));
|
||||||
|
|
||||||
|
@ -37,29 +38,39 @@ powerDaemonSettings::powerDaemonSettings(QWidget *parent) :
|
||||||
ui->label_2->setStyleSheet("font-weight: bold");
|
ui->label_2->setStyleSheet("font-weight: bold");
|
||||||
|
|
||||||
// Icons
|
// Icons
|
||||||
int controlBtnFixedLength;
|
int controlBtnFixedWidth;
|
||||||
if(global::deviceID == "n705\n") {
|
if(global::deviceID == "n705\n") {
|
||||||
controlBtnFixedLength = 50;
|
controlBtnFixedWidth = 50;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
controlBtnFixedLength = 80;
|
controlBtnFixedWidth = 80;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->CBSDecreaseBtn->setIcon(QIcon(":/resources/minus.png"));
|
ui->CBSDecreaseBtn->setIcon(QIcon(":/resources/minus.png"));
|
||||||
ui->CBSDecreaseBtn->setFixedWidth(controlBtnFixedLength);
|
ui->CBSDecreaseBtn->setFixedWidth(controlBtnFixedWidth);
|
||||||
ui->CBSIncreaseBtn->setIcon(QIcon(":/resources/plus.png"));
|
ui->CBSIncreaseBtn->setIcon(QIcon(":/resources/plus.png"));
|
||||||
ui->CBSIncreaseBtn->setFixedWidth(controlBtnFixedLength);
|
ui->CBSIncreaseBtn->setFixedWidth(controlBtnFixedWidth);
|
||||||
|
|
||||||
ui->idleSleepDecreaseBtn->setIcon(QIcon(":/resources/minus.png"));
|
|
||||||
ui->idleSleepDecreaseBtn->setFixedWidth(controlBtnFixedLength);
|
int idleBtnsFixedWidth;
|
||||||
ui->idleSleepIncreaseBtn->setIcon(QIcon(":/resources/plus.png"));
|
if(global::deviceID == "n705\n") {
|
||||||
ui->idleSleepIncreaseBtn->setFixedWidth(controlBtnFixedLength);
|
idleBtnsFixedWidth = 80;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
idleBtnsFixedWidth = 100;
|
||||||
|
}
|
||||||
|
ui->idleSleepDecreaseBtn->setFixedWidth(idleBtnsFixedWidth);
|
||||||
|
ui->idleSleepIncreaseBtn->setFixedWidth(idleBtnsFixedWidth);
|
||||||
|
ui->idleSleepDecreaseMBtn->setFixedWidth(idleBtnsFixedWidth);
|
||||||
|
ui->idleSleepIncreaseMBtn->setFixedWidth(idleBtnsFixedWidth);
|
||||||
|
|
||||||
// Padding
|
// Padding
|
||||||
ui->CBSDecreaseBtn->setStyleSheet("padding: 10px");
|
ui->CBSDecreaseBtn->setStyleSheet("padding: 10px; font-size: 10pt");
|
||||||
ui->CBSIncreaseBtn->setStyleSheet("padding: 10px");
|
ui->CBSIncreaseBtn->setStyleSheet("padding: 10px; font-size: 10pt");
|
||||||
ui->idleSleepDecreaseBtn->setStyleSheet("padding: 10px");
|
ui->idleSleepDecreaseBtn->setStyleSheet("padding: 10px; font-size: 10pt");
|
||||||
ui->idleSleepIncreaseBtn->setStyleSheet("padding: 10px");
|
ui->idleSleepIncreaseBtn->setStyleSheet("padding: 10px; font-size: 10pt");
|
||||||
|
ui->idleSleepDecreaseMBtn->setStyleSheet("padding: 10px; font-size: 10pt");
|
||||||
|
ui->idleSleepIncreaseMBtn->setStyleSheet("padding: 10px; font-size: 10pt");
|
||||||
|
|
||||||
// Stylesheet
|
// Stylesheet
|
||||||
QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss");
|
QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss");
|
||||||
|
@ -87,6 +98,13 @@ powerDaemonSettings::powerDaemonSettings(QWidget *parent) :
|
||||||
ui->idleSleepIncreaseBtn->setAutoRepeatDelay(autoRepeatDelay);
|
ui->idleSleepIncreaseBtn->setAutoRepeatDelay(autoRepeatDelay);
|
||||||
ui->idleSleepIncreaseBtn->setAutoRepeatInterval(autoRepeatInterval);
|
ui->idleSleepIncreaseBtn->setAutoRepeatInterval(autoRepeatInterval);
|
||||||
|
|
||||||
|
ui->idleSleepDecreaseMBtn->setAutoRepeat(true);
|
||||||
|
ui->idleSleepDecreaseMBtn->setAutoRepeatDelay(autoRepeatDelay);
|
||||||
|
ui->idleSleepDecreaseMBtn->setAutoRepeatInterval(autoRepeatInterval);
|
||||||
|
|
||||||
|
ui->idleSleepIncreaseMBtn->setAutoRepeat(true);
|
||||||
|
ui->idleSleepIncreaseMBtn->setAutoRepeatDelay(autoRepeatDelay);
|
||||||
|
ui->idleSleepIncreaseMBtn->setAutoRepeatInterval(autoRepeatInterval);
|
||||||
|
|
||||||
// Hide items
|
// Hide items
|
||||||
ui->hLabel_3->hide();
|
ui->hLabel_3->hide();
|
||||||
|
@ -339,7 +357,7 @@ void powerDaemonSettings::convertIdleSleepInt()
|
||||||
ui->idleSleepLabel->setText("Never");
|
ui->idleSleepLabel->setText("Never");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while(copiedIdleSleepInt > 60) {
|
while(copiedIdleSleepInt >= 60) {
|
||||||
minutes = minutes + 1;
|
minutes = minutes + 1;
|
||||||
copiedIdleSleepInt = copiedIdleSleepInt - 60;
|
copiedIdleSleepInt = copiedIdleSleepInt - 60;
|
||||||
}
|
}
|
||||||
|
@ -347,9 +365,10 @@ void powerDaemonSettings::convertIdleSleepInt()
|
||||||
|
|
||||||
QString text;
|
QString text;
|
||||||
if(minutes != 0) {
|
if(minutes != 0) {
|
||||||
text.append(QString::number(minutes) + "m ");
|
text.append(QString::number(minutes) + "m");
|
||||||
}
|
}
|
||||||
if(seconds != 0) {
|
if(seconds != 0) {
|
||||||
|
text.append(" ");
|
||||||
text.append(QString::number(seconds) + "s");
|
text.append(QString::number(seconds) + "s");
|
||||||
}
|
}
|
||||||
ui->idleSleepLabel->setText(text);
|
ui->idleSleepLabel->setText(text);
|
||||||
|
@ -387,3 +406,29 @@ void powerDaemonSettings::convertCinematicInt() {
|
||||||
text.append("ms");
|
text.append("ms");
|
||||||
ui->CBSLabel->setText(text);
|
ui->CBSLabel->setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void powerDaemonSettings::on_idleSleepIncreaseMBtn_clicked()
|
||||||
|
{
|
||||||
|
if(idleSleepInt >= 15) {
|
||||||
|
idleSleepInt = idleSleepInt + 60;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
idleSleepInt = 60;
|
||||||
|
}
|
||||||
|
convertIdleSleepInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
void powerDaemonSettings::on_idleSleepDecreaseMBtn_clicked()
|
||||||
|
{
|
||||||
|
if(idleSleepInt >= 60) {
|
||||||
|
idleSleepInt = idleSleepInt - 60;
|
||||||
|
if(idleSleepInt < 14) {
|
||||||
|
idleSleepInt = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
idleSleepInt = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
convertIdleSleepInt();
|
||||||
|
}
|
||||||
|
|
|
@ -34,6 +34,10 @@ private slots:
|
||||||
void convertIdleSleepInt();
|
void convertIdleSleepInt();
|
||||||
void convertCinematicInt();
|
void convertCinematicInt();
|
||||||
|
|
||||||
|
void on_idleSleepIncreaseMBtn_clicked();
|
||||||
|
|
||||||
|
void on_idleSleepDecreaseMBtn_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::powerDaemonSettings * ui;
|
Ui::powerDaemonSettings * ui;
|
||||||
bool whenChargerSleepBool;
|
bool whenChargerSleepBool;
|
||||||
|
|
|
@ -113,6 +113,19 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>50</weight>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Cinematic brightness speed |</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="CBSLabel">
|
<widget class="QLabel" name="CBSLabel">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
|
@ -126,29 +139,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="Line" name="line_3">
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Plain</enum>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<weight>50</weight>
|
|
||||||
<bold>false</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Cinematic brightness speed</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -215,28 +205,103 @@
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="idleSleepIncreaseBtn">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
<property name="sizePolicy">
|
<item>
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||||
<horstretch>0</horstretch>
|
<item>
|
||||||
<verstretch>0</verstretch>
|
<widget class="QPushButton" name="idleSleepIncreaseBtn">
|
||||||
</sizepolicy>
|
<property name="sizePolicy">
|
||||||
</property>
|
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||||
<property name="text">
|
<horstretch>0</horstretch>
|
||||||
<string/>
|
<verstretch>0</verstretch>
|
||||||
</property>
|
</sizepolicy>
|
||||||
</widget>
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>+1s</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="idleSleepDecreaseBtn">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>-1s</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="idleSleepIncreaseMBtn">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>+1m</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="idleSleepDecreaseMBtn">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>-1m</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="idleSleepDecreaseBtn">
|
<widget class="QLabel" name="label_5">
|
||||||
<property name="sizePolicy">
|
<property name="font">
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
<font>
|
||||||
<horstretch>0</horstretch>
|
<weight>50</weight>
|
||||||
<verstretch>0</verstretch>
|
<bold>false</bold>
|
||||||
</sizepolicy>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string>Sleep when idle |</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -253,29 +318,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="Line" name="line_4">
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Plain</enum>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<weight>50</weight>
|
|
||||||
<bold>false</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Sleep when idle</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_9">
|
<spacer name="horizontalSpacer_9">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
Loading…
Reference in a new issue