From 4efe9c3c7df30a9dc529cccdbde9b3d2b0529d01 Mon Sep 17 00:00:00 2001 From: bigbiff bigbiff Date: Wed, 20 Feb 2013 18:58:11 -0500 Subject: add military time option --- data.cpp | 22 +++++++++++++++------- gui/devices/1024x600/res/ui.xml | 8 ++++++++ gui/devices/1024x768/res/ui.xml | 8 ++++++++ gui/devices/1280x800/res/ui.xml | 8 ++++++++ gui/devices/1920x1200/res/ui.xml | 9 +++++++++ gui/devices/2560x1600/res/ui.xml | 8 ++++++++ gui/devices/320x480/res/ui.xml | 8 ++++++++ gui/devices/480x800/res/ui.xml | 8 ++++++++ gui/devices/480x854/res/ui.xml | 8 ++++++++ gui/devices/540x960/res/ui.xml | 8 ++++++++ gui/devices/720x1280/res/ui.xml | 8 ++++++++ gui/devices/800x1280/res/ui.xml | 8 ++++++++ gui/devices/800x480/res/ui.xml | 10 +++++++++- variables.h | 1 + 14 files changed, 114 insertions(+), 8 deletions(-) diff --git a/data.cpp b/data.cpp index a4cb464c2..de83d9547 100644 --- a/data.cpp +++ b/data.cpp @@ -879,6 +879,7 @@ void DataManager::SetDefaultValues() mConstValues.insert(make_pair("tw_has_brightnesss_file", "0")); } #endif + mValues.insert(make_pair(TW_MILITARY_TIME, make_pair("0", 0))); } // Magic Values @@ -891,14 +892,22 @@ int DataManager::GetMagicValue(const string varName, string& value) struct tm *current; time_t now; + int tw_military_time; now = time(0); current = localtime(&now); - - if (current->tm_hour >= 12) - sprintf(tmp, "%d:%02d PM", current->tm_hour == 12 ? 12 : current->tm_hour - 12, current->tm_min); - else - sprintf(tmp, "%d:%02d AM", current->tm_hour == 0 ? 12 : current->tm_hour, current->tm_min); - + GetValue(TW_MILITARY_TIME, tw_military_time); + if (current->tm_hour >= 12) { + if (tw_military_time == 1) + sprintf(tmp, "%d:%02d", current->tm_hour, current->tm_min); + else + sprintf(tmp, "%d:%02d PM", current->tm_hour == 12 ? 12 : current->tm_hour - 12, current->tm_min); + } + else { + if (tw_military_time == 1) + sprintf(tmp, "%d:%02d", current->tm_hour, current->tm_min); + else + sprintf(tmp, "%d:%02d AM", current->tm_hour == 0 ? 12 : current->tm_hour, current->tm_min); + } value = tmp; return 0; } @@ -1032,7 +1041,6 @@ void DataManager::ReadSettingsFile(void) if (strcmp(EXPAND(TW_BRIGHTNESS_PATH), "/nobrightness") != 0) { string brightness_path = EXPAND(TW_BRIGHTNESS_PATH); string brightness_value = GetStrValue("tw_brightness"); - LOGI("writing %s to brightness\n", brightness_value.c_str()); TWFunc::write_file(brightness_path, brightness_value); } #endif diff --git a/gui/devices/1024x600/res/ui.xml b/gui/devices/1024x600/res/ui.xml index 393e40d2a..fbdf14e93 100755 --- a/gui/devices/1024x600/res/ui.xml +++ b/gui/devices/1024x600/res/ui.xml @@ -2448,6 +2448,14 @@ + + + + Use Military Time + + + + diff --git a/gui/devices/1024x768/res/ui.xml b/gui/devices/1024x768/res/ui.xml index 5748e435b..025362a15 100644 --- a/gui/devices/1024x768/res/ui.xml +++ b/gui/devices/1024x768/res/ui.xml @@ -2440,6 +2440,14 @@ + + + + Use Military Time + + + + diff --git a/gui/devices/1280x800/res/ui.xml b/gui/devices/1280x800/res/ui.xml index 953318933..9529d1107 100644 --- a/gui/devices/1280x800/res/ui.xml +++ b/gui/devices/1280x800/res/ui.xml @@ -2440,6 +2440,14 @@ + + + + Use Military Time + + + + diff --git a/gui/devices/1920x1200/res/ui.xml b/gui/devices/1920x1200/res/ui.xml index 874dcaa16..5fe7fd525 100644 --- a/gui/devices/1920x1200/res/ui.xml +++ b/gui/devices/1920x1200/res/ui.xml @@ -2440,6 +2440,15 @@ + + + + + Use Military Time + + + + diff --git a/gui/devices/2560x1600/res/ui.xml b/gui/devices/2560x1600/res/ui.xml index bd058c16f..6d0e40558 100644 --- a/gui/devices/2560x1600/res/ui.xml +++ b/gui/devices/2560x1600/res/ui.xml @@ -2440,6 +2440,14 @@ + + + + Use Military Time + + + + diff --git a/gui/devices/320x480/res/ui.xml b/gui/devices/320x480/res/ui.xml index 5de1e7e33..38e7b1d34 100644 --- a/gui/devices/320x480/res/ui.xml +++ b/gui/devices/320x480/res/ui.xml @@ -2412,6 +2412,14 @@ + + + + Use Military Time + + + + diff --git a/gui/devices/480x800/res/ui.xml b/gui/devices/480x800/res/ui.xml index b44c23d40..60ad8280c 100644 --- a/gui/devices/480x800/res/ui.xml +++ b/gui/devices/480x800/res/ui.xml @@ -2411,6 +2411,14 @@ + + + + Use Military Time + + + + diff --git a/gui/devices/480x854/res/ui.xml b/gui/devices/480x854/res/ui.xml index 8959e9916..a570faf72 100644 --- a/gui/devices/480x854/res/ui.xml +++ b/gui/devices/480x854/res/ui.xml @@ -2410,6 +2410,14 @@ + + + + Use Military Time + + + + diff --git a/gui/devices/540x960/res/ui.xml b/gui/devices/540x960/res/ui.xml index 184ffba63..9e8034bf1 100644 --- a/gui/devices/540x960/res/ui.xml +++ b/gui/devices/540x960/res/ui.xml @@ -2411,6 +2411,14 @@ + + + + Use Military Time + + + + diff --git a/gui/devices/720x1280/res/ui.xml b/gui/devices/720x1280/res/ui.xml index 031364ba0..79de4ca86 100644 --- a/gui/devices/720x1280/res/ui.xml +++ b/gui/devices/720x1280/res/ui.xml @@ -2424,6 +2424,14 @@ + + + + Use Military Time + + + + diff --git a/gui/devices/800x1280/res/ui.xml b/gui/devices/800x1280/res/ui.xml index 6703376c1..07ffec4e2 100755 --- a/gui/devices/800x1280/res/ui.xml +++ b/gui/devices/800x1280/res/ui.xml @@ -2412,6 +2412,14 @@ + + + + Use Military Time + + + + diff --git a/gui/devices/800x480/res/ui.xml b/gui/devices/800x480/res/ui.xml index 7c815cfac..f12c242e4 100755 --- a/gui/devices/800x480/res/ui.xml +++ b/gui/devices/800x480/res/ui.xml @@ -2448,6 +2448,14 @@ + + + + Use Military Time + + + + @@ -2484,7 +2492,7 @@ main - + diff --git a/variables.h b/variables.h index 7f2ab0000..0461c5d93 100644 --- a/variables.h +++ b/variables.h @@ -151,6 +151,7 @@ #define TW_CRYPTO_PASSWORD "tw_crypto_password" #define TW_DATA_BLK_DEVICE "tw_data_blk_device" // Original block device - not decrypted #define TW_SDEXT_DISABLE_EXT4 "tw_sdext_disable_ext4" +#define TW_MILITARY_TIME "tw_military_time" // Also used: // tw_boot_is_mountable -- cgit v1.2.3