This commit is contained in:
kervala 2015-12-13 20:35:21 +01:00
commit fb6af14b28
7 changed files with 43 additions and 8 deletions

View file

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

View file

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

View file

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

View file

@ -4048,7 +4048,7 @@ public:
// Get the sum of the bulk for this db branch // Get the sum of the bulk for this db branch
const double epsilon = 0.001; 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 // Get the Max value
sint32 maxVal= 0; sint32 maxVal= 0;
@ -4058,7 +4058,7 @@ public:
// Replace in the formated text // Replace in the formated text
ucstring str= CI18N::get("uittBulkFormat"); ucstring str= CI18N::get("uittBulkFormat");
strFindReplace(str, "%v", toString(val) ); strFindReplace(str, "%v", toString("%.2f", val) );
strFindReplace(str, "%m", toString(maxVal) ); strFindReplace(str, "%m", toString(maxVal) );
CWidgetManager::getInstance()->setContextHelpText(str); 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; 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,

View file

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

View file

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