Screen Timeout
This commit is contained in:
@@ -93,7 +93,7 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event) {
|
||||
case QEvent::MouseMove: {
|
||||
// ignore events when device is awakened by resetInteractiveTimeout
|
||||
ignore = !device()->isAwake();
|
||||
device()->resetInteractiveTimeout();
|
||||
device()->resetInteractiveTimeout(frogpilot_toggles.value("screen_timeout").toInt(), frogpilot_toggles.value("screen_timeout_onroad").toInt());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
+4
-3
@@ -160,7 +160,7 @@ void UIState::update() {
|
||||
QJsonObject &frogpilot_toggles = frogpilot_scene.frogpilot_toggles;
|
||||
|
||||
if (frogpilot_scene.downloading_update || frogpilot_scene.frogpilot_panel_active) {
|
||||
device()->resetInteractiveTimeout();
|
||||
device()->resetInteractiveTimeout(frogpilot_toggles.value("screen_timeout").toInt(), frogpilot_toggles.value("screen_timeout_onroad").toInt());
|
||||
}
|
||||
|
||||
fs->update();
|
||||
@@ -187,11 +187,12 @@ void Device::setAwake(bool on) {
|
||||
}
|
||||
}
|
||||
|
||||
void Device::resetInteractiveTimeout(int timeout) {
|
||||
void Device::resetInteractiveTimeout(int timeout, int timeout_onroad) {
|
||||
if (timeout == -1) {
|
||||
timeout = (ignition_on ? 10 : 30);
|
||||
} else {
|
||||
// FrogPilot variables
|
||||
timeout = (ignition_on ? timeout_onroad : timeout);
|
||||
}
|
||||
interactive_timeout = timeout * UI_FREQ;
|
||||
}
|
||||
@@ -242,7 +243,7 @@ void Device::updateWakefulness(const UIState &s, const FrogPilotUIState &fs) {
|
||||
ignition_on = s.scene.ignition;
|
||||
|
||||
if (ignition_just_turned_off) {
|
||||
resetInteractiveTimeout();
|
||||
resetInteractiveTimeout(frogpilot_toggles.value("screen_timeout").toInt(), frogpilot_toggles.value("screen_timeout_onroad").toInt());
|
||||
} else if (ignition_on && frogpilot_toggles.value("screen_brightness_onroad").toInt() == 0) {
|
||||
resetInteractiveTimeout(0, 0);
|
||||
} else if (interactive_timeout > 0 && --interactive_timeout == 0) {
|
||||
|
||||
+1
-1
@@ -136,7 +136,7 @@ signals:
|
||||
void interactiveTimeout();
|
||||
|
||||
public slots:
|
||||
void resetInteractiveTimeout(int timeout = -1);
|
||||
void resetInteractiveTimeout(int timeout = -1, int timeout_onroad = -1);
|
||||
void update(const UIState &s, const FrogPilotUIState &fs);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user