mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-28 11:50:53 +00:00
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 -->
|
<!-- compass clock -->
|
||||||
<group id="clock"
|
<group id="clock"
|
||||||
posref="TL TL"
|
posref="TL TL"
|
||||||
w="50"
|
w="70"
|
||||||
h="16"
|
h="16"
|
||||||
x="4"
|
x="4"
|
||||||
y="-4">
|
y="-4">
|
||||||
|
|
|
@ -2765,6 +2765,9 @@ This MUST follow the Enum MISSION_DESC::TIconId
|
||||||
<variable entry="UI:SAVE:SHOW_CLOCK"
|
<variable entry="UI:SAVE:SHOW_CLOCK"
|
||||||
type="bool"
|
type="bool"
|
||||||
value="false" />
|
value="false" />
|
||||||
|
<variable entry="UI:SAVE:SHOW_CLOCK_12H"
|
||||||
|
type="bool"
|
||||||
|
value="false" />
|
||||||
<variable entry="UI:SAVE:SHOW_RETICLE"
|
<variable entry="UI:SAVE:SHOW_RETICLE"
|
||||||
type="bool"
|
type="bool"
|
||||||
value="true" />
|
value="true" />
|
||||||
|
|
|
@ -1399,12 +1399,20 @@
|
||||||
posparent="cao"
|
posparent="cao"
|
||||||
x="0"
|
x="0"
|
||||||
y="-12" />
|
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"
|
<instance template="tgcw_checkbox"
|
||||||
id="show_reticle"
|
id="show_reticle"
|
||||||
text="uiShowReticle"
|
text="uiShowReticle"
|
||||||
tooltip="uittShowReticle"
|
tooltip="uittShowReticle"
|
||||||
posref="BL TL"
|
posref="BL TL"
|
||||||
posparent="show_clock"
|
posparent="show_clock_12h"
|
||||||
x="0"
|
x="0"
|
||||||
y="-12" />
|
y="-12" />
|
||||||
</group>
|
</group>
|
||||||
|
@ -3255,6 +3263,11 @@
|
||||||
widget="boolbut"
|
widget="boolbut"
|
||||||
link="UI:SAVE:SHOW_CLOCK"
|
link="UI:SAVE:SHOW_CLOCK"
|
||||||
realtime="true" />
|
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"
|
<param ui="hud:show_reticle:c"
|
||||||
type="db"
|
type="db"
|
||||||
widget="boolbut"
|
widget="boolbut"
|
||||||
|
|
|
@ -167,7 +167,11 @@ CViewBase *CChatTextManager::createMsgText(const ucstring &cstMsg, NLMISC::CRGBA
|
||||||
ucstring cur_time;
|
ucstring cur_time;
|
||||||
if (showTimestamps())
|
if (showTimestamps())
|
||||||
{
|
{
|
||||||
cur_time = CInterfaceManager::getTimestampHuman();
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if text contain any color code, set the text formated and white,
|
// if text contain any color code, set the text formated and white,
|
||||||
|
|
|
@ -1495,7 +1495,10 @@ void CInterfaceManager::updateFrameEvents()
|
||||||
{
|
{
|
||||||
if (pVT->getActive())
|
if (pVT->getActive())
|
||||||
{
|
{
|
||||||
str = getTimestampHuman("%H:%M");
|
if (use12hClock())
|
||||||
|
str = getTimestampHuman("%I:%M %p");
|
||||||
|
else
|
||||||
|
str = getTimestampHuman("%H:%M");
|
||||||
pVT->setText(str);
|
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] " */)
|
char* CInterfaceManager::getTimestampHuman(const char* format /* "[%H:%M:%S] " */)
|
||||||
{
|
{
|
||||||
|
|
|
@ -408,6 +408,10 @@ public:
|
||||||
void notifyMailAvailable();
|
void notifyMailAvailable();
|
||||||
void notifyForumUpdated();
|
void notifyForumUpdated();
|
||||||
|
|
||||||
|
/** Return true if 12-hour clock should be used
|
||||||
|
*/
|
||||||
|
static bool use12hClock();
|
||||||
|
|
||||||
/** Returns a human readable timestamp with the given format.
|
/** Returns a human readable timestamp with the given format.
|
||||||
*/
|
*/
|
||||||
static char* getTimestampHuman(const char* format = "[%H:%M:%S] ");
|
static char* getTimestampHuman(const char* format = "[%H:%M:%S] ");
|
||||||
|
|
Loading…
Reference in a new issue