From a64709552cc00db2dab2845eea3308819858543c Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sun, 13 Dec 2015 21:01:56 +0200 Subject: [PATCH] Added: 12-hour clock in radar and chat --HG-- branch : develop --- .../client/data/gamedev/interfaces_v3/compass.xml | 2 +- .../client/data/gamedev/interfaces_v3/config.xml | 3 +++ .../data/gamedev/interfaces_v3/game_config.xml | 15 ++++++++++++++- .../client/src/interface_v3/chat_text_manager.cpp | 6 +++++- .../client/src/interface_v3/interface_manager.cpp | 13 ++++++++++++- .../client/src/interface_v3/interface_manager.h | 4 ++++ 6 files changed, 39 insertions(+), 4 deletions(-) diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/compass.xml b/code/ryzom/client/data/gamedev/interfaces_v3/compass.xml index c2bd7a407..003c90f00 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/compass.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/compass.xml @@ -567,7 +567,7 @@ diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/config.xml b/code/ryzom/client/data/gamedev/interfaces_v3/config.xml index 50ccf385a..6377953a6 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/config.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/config.xml @@ -2765,6 +2765,9 @@ This MUST follow the Enum MISSION_DESC::TIconId + diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/game_config.xml b/code/ryzom/client/data/gamedev/interfaces_v3/game_config.xml index bd0952277..ca68212cf 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/game_config.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/game_config.xml @@ -1399,12 +1399,20 @@ posparent="cao" x="0" y="-12" /> + @@ -3255,6 +3263,11 @@ widget="boolbut" link="UI:SAVE:SHOW_CLOCK" realtime="true" /> + getDbProp("UI:SAVE:SHOW_CLOCK_12H", false); + if (node && node->getValueBool()) + cur_time = CInterfaceManager::getTimestampHuman("[%I:%M:%S %p] "); + else + cur_time = CInterfaceManager::getTimestampHuman(); } // if text contain any color code, set the text formated and white, diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index fbaac2c86..2624aef77 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -1495,7 +1495,10 @@ void CInterfaceManager::updateFrameEvents() { if (pVT->getActive()) { - str = getTimestampHuman("%H:%M"); + if (use12hClock()) + str = getTimestampHuman("%I:%M %p"); + else + str = getTimestampHuman("%H:%M"); pVT->setText(str); } } @@ -3639,6 +3642,14 @@ void CInterfaceManager::CServerToLocalAutoCopy::onLocalChange(ICDBNode *localNod } } +// ------------------------------------------------------------------------------------------------ +bool CInterfaceManager::use12hClock() +{ + CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:SHOW_CLOCK_12H", false); + + return (node && node->getValueBool()); +} + // ------------------------------------------------------------------------------------------------ char* CInterfaceManager::getTimestampHuman(const char* format /* "[%H:%M:%S] " */) { diff --git a/code/ryzom/client/src/interface_v3/interface_manager.h b/code/ryzom/client/src/interface_v3/interface_manager.h index d0dccecc5..6025868e5 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.h +++ b/code/ryzom/client/src/interface_v3/interface_manager.h @@ -408,6 +408,10 @@ public: void notifyMailAvailable(); void notifyForumUpdated(); + /** Return true if 12-hour clock should be used + */ + static bool use12hClock(); + /** Returns a human readable timestamp with the given format. */ static char* getTimestampHuman(const char* format = "[%H:%M:%S] ");