cinematicWarmth (Libra H2O)

This commit is contained in:
Nicolas Mailloux 2023-06-19 20:55:26 -04:00
parent 7e4b3b5d02
commit f9a1fe6931
4 changed files with 35 additions and 8 deletions

View file

@ -827,6 +827,23 @@ namespace {
}
string_writeconfig(sysfsWarmthPath, warmthValueStr);
}
void cinematicWarmth(int warmthValue) {
int currentWarmth = get_warmth();
if(warmthValue < currentWarmth) {
while(warmthValue < currentWarmth) {
currentWarmth--;
set_warmth(currentWarmth);
QThread::msleep(30);
}
}
else if(warmthValue > currentWarmth) {
while(warmthValue > currentWarmth) {
currentWarmth++;
set_warmth(currentWarmth);
QThread::msleep(30);
}
}
}
void installUpdate() {
log("Installing update package", "functions");
writeFile("/mnt/onboard/onboard/.inkbox/can_really_update", "true\n");

View file

@ -721,7 +721,7 @@ void MainWindow::setInitialBrightness() {
else {
warmth = checkconfig_str_val.toInt();
}
set_warmth(warmth);
cinematicWarmth(warmth);
}
int brightness_value = brightness_checkconfig(".config/03-brightness/config");
if(global::deviceID != "n705\n" and global::deviceID != "n905\n" and global::deviceID != "kt\n") {

View file

@ -243,13 +243,7 @@ reader::reader(QWidget *parent) :
// Custom settings
// Brightness
if(global::reader::globalReadingSettings == false) {
if(global::deviceID != "n705\n" and global::deviceID != "n905\n" and global::deviceID != "kt\n") {
int brightness_value = brightness_checkconfig(".config/03-brightness/config");
log("Local Reading Settings: Setting brightness to " + QString::number(brightness_value), className);
cinematicBrightness(brightness_value, 2);
}
}
QTimer::singleShot(0, this, SLOT(setCinematicBrightnessWarmthSlot()));
// Font
global::reader::font = readFile(".config/04-book/font");
if(global::reader::font == "u001") {
@ -2275,3 +2269,18 @@ void reader::on_brightnessBtn_clicked()
brightnessDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
brightnessDialogWindow->show();
}
void reader::setCinematicBrightnessWarmthSlot() {
if(global::reader::globalReadingSettings == false) {
if(global::deviceID != "n705\n" and global::deviceID != "n905\n" and global::deviceID != "kt\n") {
int brightness_value = brightness_checkconfig(".config/03-brightness/config");
log("Local Reading Settings: Setting brightness to " + QString::number(brightness_value), className);
cinematicBrightness(brightness_value, 2);
}
if(global::deviceID == "n873\n") {
int warmthValue = readFile(".config/03-brightness/config-warmth").toInt();
log("Local Reading Settings: Setting warmth to " + QString::number(warmthValue), className);
cinematicWarmth(warmthValue);
}
}
}

View file

@ -169,6 +169,7 @@ private slots:
void on_lineSpacingSlider_valueChanged(int value);
void on_marginsSlider_valueChanged(int value);
void on_brightnessBtn_clicked();
void setCinematicBrightnessWarmthSlot();
signals:
void openBookFile(QString book, bool relativePath);