Satisfy Issue 1115: Make clock on top status line toggleable
Click the clock to change from server time to local~
This commit is contained in:
@@ -753,6 +753,17 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>0</integer>
|
<integer>0</integer>
|
||||||
</map>
|
</map>
|
||||||
|
<key>LiruLocalTime</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Whether or not to display system time in the top bar instead of server time.</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Boolean</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<boolean>0</boolean>
|
||||||
|
</map>
|
||||||
<key>LiruMapShowAvCount</key>
|
<key>LiruMapShowAvCount</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
|
|||||||
@@ -154,6 +154,12 @@ public:
|
|||||||
|
|
||||||
static LLDispatchUPCBalance sDispatchUPCBalance;
|
static LLDispatchUPCBalance sDispatchUPCBalance;
|
||||||
|
|
||||||
|
static void toggle_time_value()
|
||||||
|
{
|
||||||
|
LLControlVariable* control = gSavedSettings.getControl("LiruLocalTime");
|
||||||
|
control->set(!control->get());
|
||||||
|
}
|
||||||
|
|
||||||
LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect)
|
LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect)
|
||||||
: LLPanel(name, LLRect(), FALSE), // not mouse opaque
|
: LLPanel(name, LLRect(), FALSE), // not mouse opaque
|
||||||
mBalance(0),
|
mBalance(0),
|
||||||
@@ -195,6 +201,7 @@ mIsNavMeshDirty(false)
|
|||||||
|
|
||||||
mTextHealth = getChild<LLTextBox>("HealthText" );
|
mTextHealth = getChild<LLTextBox>("HealthText" );
|
||||||
mTextTime = getChild<LLTextBox>("TimeText" );
|
mTextTime = getChild<LLTextBox>("TimeText" );
|
||||||
|
mTextTime->setClickedCallback(boost::bind(toggle_time_value));
|
||||||
|
|
||||||
if (!mUPCSupported)
|
if (!mUPCSupported)
|
||||||
mTextUPC->setVisible(false);
|
mTextUPC->setVisible(false);
|
||||||
@@ -314,23 +321,28 @@ void LLStatusBar::refresh()
|
|||||||
mSGBandwidth->setThreshold(1, bwtotal);
|
mSGBandwidth->setThreshold(1, bwtotal);
|
||||||
mSGBandwidth->setThreshold(2, bwtotal);
|
mSGBandwidth->setThreshold(2, bwtotal);
|
||||||
|
|
||||||
// *TODO: Localize / translate time
|
// Singu Note: Use system's time if the user desires, otherwise use server time
|
||||||
|
static const LLCachedControl<bool> show_local_time("LiruLocalTime");
|
||||||
|
|
||||||
// Get current UTC time, adjusted for the user's clock
|
// Get current UTC time, adjusted for the user's clock
|
||||||
// being off.
|
// being off.
|
||||||
time_t utc_time;
|
time_t utc_time = show_local_time ? time(NULL) : time_corrected();
|
||||||
utc_time = time_corrected();
|
|
||||||
|
|
||||||
// There's only one internal tm buffer.
|
// There's only one internal tm buffer.
|
||||||
struct tm* internal_time;
|
struct tm* internal_time;
|
||||||
|
|
||||||
// Convert to Pacific, based on server's opinion of whether
|
// Convert to Pacific, based on server's opinion of whether
|
||||||
// it's daylight savings time there.
|
// it's daylight savings time there.
|
||||||
internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime);
|
internal_time = show_local_time ? std::localtime(&utc_time) : utc_to_pacific_time(utc_time, gPacificDaylightTime);
|
||||||
|
|
||||||
std::string t;
|
std::string t;
|
||||||
timeStructToFormattedString(internal_time, gSavedSettings.getString("ShortTimeFormat"), t);
|
timeStructToFormattedString(internal_time, gSavedSettings.getString("ShortTimeFormat"), t);
|
||||||
if (gPacificDaylightTime)
|
if (show_local_time)
|
||||||
|
{
|
||||||
|
static const std::string local(" " + getString("Local"));
|
||||||
|
t += local;
|
||||||
|
}
|
||||||
|
else if (gPacificDaylightTime)
|
||||||
{
|
{
|
||||||
t += " PDT";
|
t += " PDT";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,4 +137,5 @@
|
|||||||
<string name="bandwidth_tooltip">
|
<string name="bandwidth_tooltip">
|
||||||
Bandwidth
|
Bandwidth
|
||||||
</string>
|
</string>
|
||||||
|
<string name="Local">Local</string>
|
||||||
</panel>
|
</panel>
|
||||||
|
|||||||
Reference in New Issue
Block a user