diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 8323ba1ce7..3030bce9d9 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -25623,5 +25623,16 @@ Change of this parameter will affect the layout of buttons in notification toast
Value
0
+ StatusBarTimeFormat
+
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index 134dfd5a73..2348b6727f 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -519,9 +519,53 @@ BOOL LLStatusBar::postBuild()
updateVolumeControlsVisibility(LLSD(FALSE));
}
//
+
+ // FIRE-20390, FIRE-4269 - Option for 12/24 hour clock and seconds display
+ mClockFormatChoices["12 Hour"] = "[hour12, datetime, slt]:[min, datetime, slt] [ampm, datetime, slt]";
+ mClockFormatChoices["12 Hour Seconds"] = "[hour12, datetime, slt]:[min, datetime, slt]:[second, datetime, slt] [ampm, datetime, slt]";
+ mClockFormatChoices["12 Hour TZ"] = "[hour12, datetime, slt]:[min, datetime, slt] [ampm, datetime, slt] [timezone,datetime, slt]";
+ mClockFormatChoices["12 Hour TZ Seconds"] = "[hour12, datetime, slt]:[min, datetime, slt]:[second, datetime, slt] [ampm, datetime, slt] [timezone,datetime, slt]";
+ mClockFormatChoices["24 Hour"] = "[hour24, datetime, slt]:[min, datetime, slt]";
+ mClockFormatChoices["24 Hour Seconds"] = "[hour24, datetime, slt]:[min, datetime, slt]:[second, datetime, slt]";
+ mClockFormatChoices["24 Hour TZ"] = "[hour24, datetime, slt]:[min, datetime, slt] [timezone, datetime, slt]";
+ mClockFormatChoices["24 Hour TZ Seconds"] = "[hour24, datetime, slt]:[min, datetime, slt]:[second, datetime, slt] [timezone, datetime, slt]";
+
+ // use the time format defined in the language's panel_status_bar.xml (default)
+ mClockFormatChoices["Language"] = getString("time");
+
+ mClockFormat = gSavedSettings.getString("StatusBarTimeFormat");
+
+ getChild("TimeText")->setClickedCallback(boost::bind(&LLStatusBar::onClockClicked, this));
+ getChild("TimeText")->setDoubleClickCallback(boost::bind(&LLStatusBar::onClockDoubleClicked, this));
+ gSavedSettings.getControl("StatusBarTimeFormat")->getSignal()->connect(boost::bind(&LLStatusBar::onTimeFormatChanged, this, _2));
+ //
+
return TRUE;
}
+// FIRE-20390, FIRE-4269 - Option for 12/24 hour clock and seconds display
+void LLStatusBar::updateClockDisplay()
+{
+ // Get current UTC time, adjusted for the user's clock
+ // being off.
+ time_t utc_time;
+ utc_time = time_corrected();
+
+ std::string timeStr = mClockFormatChoices[mClockFormat];
+ LLSD substitution;
+ substitution["datetime"] = (S32) utc_time;
+ LLStringUtil::format (timeStr, substitution);
+ mTextTime->setText(timeStr);
+
+ // Add seconds to clock
+ static const std::string tooltip_template = getString("timeTooltip");
+ std::string dtStr = tooltip_template;
+ //
+ LLStringUtil::format (dtStr, substitution);
+ mTextTime->setToolTip (dtStr);
+}
+//
+
// Per-frame updates of visibility
void LLStatusBar::refresh()
{
@@ -562,29 +606,25 @@ void LLStatusBar::refresh()
{
mClockUpdateTimer.reset();
- // Get current UTC time, adjusted for the user's clock
- // being off.
- time_t utc_time;
- utc_time = time_corrected();
+ // FIRE-20390, FIRE-4269 - Option for 12/24 hour clock and seconds display
+ // // Get current UTC time, adjusted for the user's clock
+ // // being off.
+ // time_t utc_time;
+ // utc_time = time_corrected();
- // Add seconds to clock
- //std::string timeStr = getString("time");
- static const std::string time_template = getString("time");
- std::string timeStr = time_template;
- //
- LLSD substitution;
- substitution["datetime"] = (S32) utc_time;
- LLStringUtil::format (timeStr, substitution);
- mTextTime->setText(timeStr);
+ // std::string timeStr = getString("time");
+ // LLSD substitution;
+ // substitution["datetime"] = (S32) utc_time;
+ // LLStringUtil::format (timeStr, substitution);
+ // mTextTime->setText(timeStr);
- // set the tooltip to have the date
- // Add seconds to clock
- //std::string dtStr = getString("timeTooltip");
- static const std::string tooltip_template = getString("timeTooltip");
- std::string dtStr = tooltip_template;
- //
- LLStringUtil::format (dtStr, substitution);
- mTextTime->setToolTip (dtStr);
+ // // set the tooltip to have the date
+ // std::string dtStr = getString("timeTooltip");
+ // LLStringUtil::format (dtStr, substitution);
+ // mTextTime->setToolTip (dtStr);
+
+ updateClockDisplay();
+ //
}
// Pathfinding rebake functions
@@ -1717,6 +1757,36 @@ void LLStatusBar::onPopupRolloverChanged(const LLSD& newvalue)
}
}
+// FIRE-20390, FIRE-4269 - Option for 12/24 hour clock and seconds display
+void LLStatusBar::onClockClicked()
+{
+ auto current_entry = mClockFormatChoices.find(mClockFormat);
+
+ // get the next time format from the list, skipping the "Language" entry
+ do
+ {
+ current_entry++;
+ if (current_entry == mClockFormatChoices.end())
+ {
+ current_entry = mClockFormatChoices.begin();
+ }
+ } while (current_entry->first == "Language");
+
+ gSavedSettings.setString("StatusBarTimeFormat", current_entry->first);
+}
+
+void LLStatusBar::onClockDoubleClicked()
+{
+ gSavedSettings.setString("StatusBarTimeFormat", "Language");
+}
+
+void LLStatusBar::onTimeFormatChanged(const LLSD& new_format)
+{
+ mClockFormat = new_format.asString();
+ updateClockDisplay();
+}
+//
+
// Implements secondlife:///app/balance/request to request a L$ balance
// update via UDP message system. JC
class LLBalanceHandler : public LLCommandHandler
diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h
index a14a1f8370..2b9d027a8e 100644
--- a/indra/newview/llstatusbar.h
+++ b/indra/newview/llstatusbar.h
@@ -395,6 +395,16 @@ private:
void onMouseLeaveParcelInfo();
//
+// FIRE-20390, FIRE-4269 - Option for 12/24 hour clock and seconds display
+ std::map mClockFormatChoices;
+ std::string mClockFormat;
+
+ void updateClockDisplay();
+ void onClockClicked();
+ void onClockDoubleClicked();
+ void onTimeFormatChanged(const LLSD& new_format);
+//
+
std::string mCurrentLocationString;
};
diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml
index f55b7faf91..3a1eaa0d03 100644
--- a/indra/newview/skins/default/xui/en/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml
@@ -199,6 +199,9 @@
[weekday, datetime, slt], [day, datetime, slt] [month, datetime, slt] [year, datetime, slt]
+
+Click to cycle through different time display modes.
+Double click to restore to default, so time format depends on chosen viewer language.
@@ -307,7 +310,7 @@
font="SansSerifSmall"
text_color="TimeTextColor"
follows="right|top"
- halign="left"
+ halign="center"
height="16"
h_pad="2"
top="4"
diff --git a/indra/newview/skins/starlight/xui/en/panel_status_bar.xml b/indra/newview/skins/starlight/xui/en/panel_status_bar.xml
index 30e50a876c..1ac0719fbb 100644
--- a/indra/newview/skins/starlight/xui/en/panel_status_bar.xml
+++ b/indra/newview/skins/starlight/xui/en/panel_status_bar.xml
@@ -197,6 +197,9 @@
[weekday, datetime, slt], [day, datetime, slt] [month, datetime, slt] [year, datetime, slt]
+
+Click to cycle through different time display modes.
+Double click to restore to default, so time format depends on chosen viewer language.
@@ -336,7 +339,7 @@
font="SansSerifSmall"
text_color="TimeTextColor"
follows="right|top"
- halign="left"
+ halign="center"
height="16"
h_pad="2"
top="4"
diff --git a/indra/newview/skins/starlightcui/xui/en/panel_status_bar.xml b/indra/newview/skins/starlightcui/xui/en/panel_status_bar.xml
index 7228f074ae..c335230f58 100644
--- a/indra/newview/skins/starlightcui/xui/en/panel_status_bar.xml
+++ b/indra/newview/skins/starlightcui/xui/en/panel_status_bar.xml
@@ -196,6 +196,9 @@
[weekday, datetime, slt], [day, datetime, slt] [month, datetime, slt] [year, datetime, slt]
+
+Click to cycle through different time display modes.
+Double click to restore to default, so time format depends on chosen viewer language.
@@ -332,7 +335,7 @@
font="SansSerifSmall"
text_color="TimeTextColor"
follows="right|top"
- halign="left"
+ halign="center"
height="16"
h_pad="2"
top="4"