Added: 12-hour clock in radar and chat
--HG-- branch : develop
This commit is contained in:
parent
3895644589
commit
a64709552c
6 changed files with 39 additions and 4 deletions
|
@ -567,7 +567,7 @@
|
|||
<!-- compass clock -->
|
||||
<group id="clock"
|
||||
posref="TL TL"
|
||||
w="50"
|
||||
w="70"
|
||||
h="16"
|
||||
x="4"
|
||||
y="-4">
|
||||
|
|
|
@ -2765,6 +2765,9 @@ This MUST follow the Enum MISSION_DESC::TIconId
|
|||
<variable entry="UI:SAVE:SHOW_CLOCK"
|
||||
type="bool"
|
||||
value="false" />
|
||||
<variable entry="UI:SAVE:SHOW_CLOCK_12H"
|
||||
type="bool"
|
||||
value="false" />
|
||||
<variable entry="UI:SAVE:SHOW_RETICLE"
|
||||
type="bool"
|
||||
value="true" />
|
||||
|
|
|
@ -1399,12 +1399,20 @@
|
|||
posparent="cao"
|
||||
x="0"
|
||||
y="-12" />
|
||||
<instance template="tgcw_checkbox"
|
||||
id="show_clock_12h"
|
||||
text="uiShowClock12h"
|
||||
tooltip="uittShowClock12h"
|
||||
posref="BL TL"
|
||||
posparent="show_clock"
|
||||
x="0"
|
||||
y="-12" />
|
||||
<instance template="tgcw_checkbox"
|
||||
id="show_reticle"
|
||||
text="uiShowReticle"
|
||||
tooltip="uittShowReticle"
|
||||
posref="BL TL"
|
||||
posparent="show_clock"
|
||||
posparent="show_clock_12h"
|
||||
x="0"
|
||||
y="-12" />
|
||||
</group>
|
||||
|
@ -3255,6 +3263,11 @@
|
|||
widget="boolbut"
|
||||
link="UI:SAVE:SHOW_CLOCK"
|
||||
realtime="true" />
|
||||
<param ui="hud:show_clock_12h:c"
|
||||
type="db"
|
||||
widget="boolbut"
|
||||
link="UI:SAVE:SHOW_CLOCK_12H"
|
||||
realtime="true" />
|
||||
<param ui="hud:show_reticle:c"
|
||||
type="db"
|
||||
widget="boolbut"
|
||||
|
|
|
@ -167,6 +167,10 @@ CViewBase *CChatTextManager::createMsgText(const ucstring &cstMsg, NLMISC::CRGBA
|
|||
ucstring cur_time;
|
||||
if (showTimestamps())
|
||||
{
|
||||
CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:SHOW_CLOCK_12H", false);
|
||||
if (node && node->getValueBool())
|
||||
cur_time = CInterfaceManager::getTimestampHuman("[%I:%M:%S %p] ");
|
||||
else
|
||||
cur_time = CInterfaceManager::getTimestampHuman();
|
||||
}
|
||||
|
||||
|
|
|
@ -1495,6 +1495,9 @@ void CInterfaceManager::updateFrameEvents()
|
|||
{
|
||||
if (pVT->getActive())
|
||||
{
|
||||
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] " */)
|
||||
{
|
||||
|
|
|
@ -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] ");
|
||||
|
|
Loading…
Reference in a new issue