--HG--
branch : compatibility-develop
This commit is contained in:
kervala 2015-12-13 20:34:16 +01:00
commit dcd5b3b325
8 changed files with 45 additions and 8 deletions

View file

@ -567,7 +567,7 @@
<!-- compass clock -->
<group id="clock"
posref="TL TL"
w="50"
w="70"
h="16"
x="4"
y="-4">

View file

@ -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" />
@ -3702,7 +3705,7 @@ This MUST follow the Enum MISSION_DESC::TIconId
value_from_code="getMaxDynChanPerPlayer()" />
<variable entry="UI:SAVE:ISDETACHED:DYNAMIC_CHAT$i"
type="sint32"
value="1"
value="0"
size="%max_dyn_chan_per_player" />
<variable entry="UI:SAVE:ISENABLED:DYNAMIC_CHAT$i"
type="sint32"

View file

@ -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"

View file

@ -4048,7 +4048,7 @@ public:
// Get the sum of the bulk for this db branch
const double epsilon = 0.001;
sint32 val = sint32(CInventoryManager::getBranchBulk(dbBranch, 0, 10000) + epsilon);
float val = CInventoryManager::getBranchBulk(dbBranch, 0, 10000) + epsilon;
// Get the Max value
sint32 maxVal= 0;
@ -4058,7 +4058,7 @@ public:
// Replace in the formated text
ucstring str= CI18N::get("uittBulkFormat");
strFindReplace(str, "%v", toString(val) );
strFindReplace(str, "%v", toString("%.2f", val) );
strFindReplace(str, "%m", toString(maxVal) );
CWidgetManager::getInstance()->setContextHelpText(str);
}
@ -4502,4 +4502,4 @@ public:
}
}
};
REGISTER_ACTION_HANDLER( CHandlerEmote, "emote");
REGISTER_ACTION_HANDLER( CHandlerEmote, "emote");

View file

@ -167,7 +167,11 @@ CViewBase *CChatTextManager::createMsgText(const ucstring &cstMsg, NLMISC::CRGBA
ucstring cur_time;
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,

View file

@ -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] " */)
{

View file

@ -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] ");

View file

@ -13450,3 +13450,5 @@ uiVRGeneral [Virtual Reality Options]
uigcVR [VIRTUAL REALITY]
uigcFxAnisotropicFilter [Anisotropic Filtering:]
uigcFxAnisotropicFilterNone [None]
uiShowClock12h [Use 12-hour clock]
uittShowClock12h [If checked, use 12-hour clock in compass and in chat messages.]