mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 23:57:22 -08:00
better idle time choosing
This commit is contained in:
parent
d27f1d31bc
commit
94c42ad201
3 changed files with 137 additions and 71 deletions
|
@ -50,16 +50,26 @@ powerDaemonSettings::powerDaemonSettings(QWidget *parent) :
|
|||
ui->CBSIncreaseBtn->setIcon(QIcon(":/resources/plus.png"));
|
||||
ui->CBSIncreaseBtn->setFixedWidth(controlBtnFixedLength);
|
||||
|
||||
ui->idleSleepDecreaseBtn->setIcon(QIcon(":/resources/minus.png"));
|
||||
ui->idleSleepDecreaseBtn->setFixedWidth(controlBtnFixedLength);
|
||||
ui->idleSleepIncreaseBtn->setIcon(QIcon(":/resources/plus.png"));
|
||||
ui->idleSleepIncreaseBtn->setFixedWidth(controlBtnFixedLength);
|
||||
|
||||
int idleButtonsWidth;
|
||||
if(global::deviceID == "n306\n") {
|
||||
idleButtonsWidth = 100;
|
||||
}
|
||||
else {
|
||||
idleButtonsWidth = 100;
|
||||
}
|
||||
ui->idleSleepDecreaseBtn->setFixedWidth(idleButtonsWidth);
|
||||
ui->idleSleepIncreaseBtn->setFixedWidth(idleButtonsWidth);
|
||||
ui->idleSleepDecreaseMBtn->setFixedWidth(idleButtonsWidth);
|
||||
ui->idleSleepIncreaseMBtn->setFixedWidth(idleButtonsWidth);
|
||||
|
||||
// Padding
|
||||
ui->CBSDecreaseBtn->setStyleSheet("padding: 10px");
|
||||
ui->CBSIncreaseBtn->setStyleSheet("padding: 10px");
|
||||
ui->idleSleepDecreaseBtn->setStyleSheet("padding: 10px");
|
||||
ui->idleSleepIncreaseBtn->setStyleSheet("padding: 10px");
|
||||
ui->idleSleepDecreaseMBtn->setStyleSheet("padding: 10px");
|
||||
ui->idleSleepIncreaseMBtn->setStyleSheet("padding: 10px");
|
||||
|
||||
// Stylesheet
|
||||
QFile stylesheetFile("/mnt/onboard/.adds/inkbox/eink.qss");
|
||||
|
@ -87,6 +97,13 @@ powerDaemonSettings::powerDaemonSettings(QWidget *parent) :
|
|||
ui->idleSleepIncreaseBtn->setAutoRepeatDelay(autoRepeatDelay);
|
||||
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
|
||||
ui->hLabel_3->hide();
|
||||
|
@ -339,7 +356,7 @@ void powerDaemonSettings::convertIdleSleepInt()
|
|||
ui->idleSleepLabel->setText("Never");
|
||||
return;
|
||||
}
|
||||
while(copiedIdleSleepInt > 60) {
|
||||
while(copiedIdleSleepInt >= 60) {
|
||||
minutes = minutes + 1;
|
||||
copiedIdleSleepInt = copiedIdleSleepInt - 60;
|
||||
}
|
||||
|
@ -347,9 +364,10 @@ void powerDaemonSettings::convertIdleSleepInt()
|
|||
|
||||
QString text;
|
||||
if(minutes != 0) {
|
||||
text.append(QString::number(minutes) + "m ");
|
||||
text.append(QString::number(minutes) + "m");
|
||||
}
|
||||
if(seconds != 0) {
|
||||
text.append(" ");
|
||||
text.append(QString::number(seconds) + "s");
|
||||
}
|
||||
ui->idleSleepLabel->setText(text);
|
||||
|
@ -387,3 +405,29 @@ void powerDaemonSettings::convertCinematicInt() {
|
|||
text.append("ms");
|
||||
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 convertCinematicInt();
|
||||
|
||||
void on_idleSleepIncreaseMBtn_clicked();
|
||||
|
||||
void on_idleSleepDecreaseMBtn_clicked();
|
||||
|
||||
private:
|
||||
Ui::powerDaemonSettings * ui;
|
||||
bool whenChargerSleepBool;
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>680</width>
|
||||
<height>545</height>
|
||||
<height>553</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
|
@ -113,6 +113,19 @@
|
|||
</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>
|
||||
<widget class="QLabel" name="CBSLabel">
|
||||
<property name="font">
|
||||
|
@ -126,29 +139,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
|
@ -215,28 +205,79 @@
|
|||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QPushButton" name="idleSleepIncreaseBtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<item>
|
||||
<widget class="QPushButton" name="idleSleepIncreaseBtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</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="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="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="text">
|
||||
<string>-1m</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="idleSleepDecreaseBtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>Sleep when idle |</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -253,29 +294,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
<spacer name="horizontalSpacer_9">
|
||||
<property name="orientation">
|
||||
|
|
Loading…
Reference in a new issue