From f8e2f375656b5ed8e90a501aea4f6925fe7d7d5d Mon Sep 17 00:00:00 2001 From: bigbiff bigbiff Date: Wed, 27 Feb 2013 20:50:43 -0500 Subject: Load user saved setting for blank timer on recovery startup Fix persistence of military time --- data.cpp | 7 +++++-- gui/blanktimer.cpp | 2 +- gui/gui.cpp | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/data.cpp b/data.cpp index 279c48c1f..c517a993f 100644 --- a/data.cpp +++ b/data.cpp @@ -431,10 +431,12 @@ int DataManager::SetValue(const string varName, string value, int persist /* = 0 if (pos->second.second != 0) SaveValues(); - if (varName == "tw_screen_timeout_secs") + if (varName == "tw_screen_timeout_secs") { blankTimer.setTime(atoi(value.c_str())); - else + } + else { gui_notifyVarChange(varName.c_str(), value.c_str()); + } return 0; } @@ -853,6 +855,7 @@ void DataManager::SetDefaultValues() mValues.insert(make_pair("tw_terminal_state", make_pair("0", 0))); mValues.insert(make_pair("tw_background_thread_running", make_pair("0", 0))); mValues.insert(make_pair(TW_RESTORE_FILE_DATE, make_pair("0", 0))); + mValues.insert(make_pair("tw_military_time", make_pair("0", 1))); mValues.insert(make_pair("tw_screen_timeout_secs", make_pair("60", 1))); mValues.insert(make_pair("tw_gui_done", make_pair("0", 0))); #ifdef TW_MAX_BRIGHTNESS diff --git a/gui/blanktimer.cpp b/gui/blanktimer.cpp index d991d40b3..cf35f6544 100644 --- a/gui/blanktimer.cpp +++ b/gui/blanktimer.cpp @@ -37,6 +37,7 @@ extern "C" { #include #include "pages.hpp" #include "blanktimer.hpp" +#include "../data.hpp" extern "C" { #include "../common.h" #include "../recovery_ui.h" @@ -46,7 +47,6 @@ extern "C" { blanktimer::blanktimer(void) { blanked = 0; - sleepTimer = 60; orig_brightness = getBrightness(); } diff --git a/gui/gui.cpp b/gui/gui.cpp index 4788fe0df..f08d68be3 100644 --- a/gui/gui.cpp +++ b/gui/gui.cpp @@ -185,9 +185,12 @@ input_thread (void *cookie) 0, lshift = 0, rshift = 0, key_repeat = 0; static struct timeval touchStart; HardwareKeyboard kb; + string seconds; //start screen timeout threads blankTimer.setTimerThread(); + DataManager::GetValue("tw_screen_timeout_secs", seconds); + blankTimer.setTime(atoi(seconds.c_str())); for (;;) { -- cgit v1.2.3