summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2018-08-17 15:37:10 -0700
committerRider Linden <rider@lindenlab.com>2018-08-17 15:37:10 -0700
commit1e3ee272ae811b862a529b6f3bbebb50a0c22580 (patch)
treef021611725be4ae28fe3b3faece8ba2d35273635
parent076836f2456124ddd26f482934cd5c501f061abf (diff)
Add an apparent time of day. More OSX complaints.
-rw-r--r--indra/newview/llenvironment.cpp3
-rw-r--r--indra/newview/llpanelenvironment.cpp57
-rw-r--r--indra/newview/llpanelenvironment.h6
-rw-r--r--indra/newview/llsettingspicker.h4
-rw-r--r--indra/newview/skins/default/xui/en/panel_region_environment.xml25
5 files changed, 84 insertions, 11 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index 60e5b81f15..84e915a95d 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -192,9 +192,6 @@ namespace
LLSettingsBase::BlendFactor blendf = calculateBlend(targetpos, targetspan);
pendsetting->blend((*bounds.second).second, blendf);
-// pstartsetting->setValue(LLSettingsSky::SETTING_AMBIENT, LLColor3(0.0, 1.0, 0.0));
-// pendsetting->setValue(LLSettingsSky::SETTING_AMBIENT, LLColor3(1.0, 0.0, 0.0));
-
setIgnoreTimeDeltaThreshold(true); // for the next span ignore the time delta threshold.
reset(pstartsetting, pendsetting, LLEnvironment::TRANSITION_ALTITUDE);
}
diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp
index 907118aa44..1f29e4c054 100644
--- a/indra/newview/llpanelenvironment.cpp
+++ b/indra/newview/llpanelenvironment.cpp
@@ -44,6 +44,7 @@
#include "llsettingsvo.h"
#include "llappviewer.h"
+#include "llcallbacklist.h"
//=========================================================================
namespace
@@ -64,6 +65,7 @@ const std::string LLPanelEnvironmentInfo::SLD_DAYOFFSET("sld_day_offset");
const std::string LLPanelEnvironmentInfo::CHK_ALLOWOVERRIDE("chk_allow_override");
const std::string LLPanelEnvironmentInfo::BTN_APPLY("btn_apply");
const std::string LLPanelEnvironmentInfo::BTN_CANCEL("btn_cancel");
+const std::string LLPanelEnvironmentInfo::LBL_TIMEOFDAY("lbl_apparent_time");
const std::string LLPanelEnvironmentInfo::STR_LABEL_USEDEFAULT("str_label_use_default");
const std::string LLPanelEnvironmentInfo::STR_LABEL_USEREGION("str_label_use_region");
@@ -111,10 +113,11 @@ void LLPanelEnvironmentInfo::onOpen(const LLSD& key)
// virtual
void LLPanelEnvironmentInfo::onVisibilityChange(BOOL new_visibility)
{
- // If hiding (user switched to another tab or closed the floater),
- // display user's preferred environment.
- // switching back and forth between agent's environment and the one being edited.
- //
+ if (new_visibility)
+ gIdleCallbacks.addFunction(onIdlePlay, this);
+ else
+ gIdleCallbacks.deleteFunction(onIdlePlay, this);
+
}
void LLPanelEnvironmentInfo::refresh()
@@ -156,6 +159,8 @@ void LLPanelEnvironmentInfo::refresh()
getChild<LLSliderCtrl>(SLD_DAYLENGTH)->setValue(daylength.value());
getChild<LLSliderCtrl>(SLD_DAYOFFSET)->setValue(dayoffset.value());
+ udpateApparentTimeOfDay();
+
setControlsEnabled(canEdit());
}
@@ -286,6 +291,8 @@ void LLPanelEnvironmentInfo::onSldDayLengthChanged(F32 value)
mCurrentEnvironment->mDayLength = daylength;
setDirtyFlag(DIRTY_FLAG_DAYLENGTH);
+
+ udpateApparentTimeOfDay();
}
void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value)
@@ -297,6 +304,8 @@ void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value)
mCurrentEnvironment->mDayOffset = dayoffset;
setDirtyFlag(DIRTY_FLAG_DAYOFFSET);
+
+ udpateApparentTimeOfDay();
}
void LLPanelEnvironmentInfo::onBtnApply()
@@ -365,6 +374,46 @@ void LLPanelEnvironmentInfo::doApply()
}
}
+
+void LLPanelEnvironmentInfo::udpateApparentTimeOfDay()
+{
+ static const F32 SECONDSINDAY(24.0 * 60.0 * 60.0);
+
+ if (!mCurrentEnvironment)
+ return;
+
+ S32Seconds now(LLDate::now().secondsSinceEpoch());
+
+ now += mCurrentEnvironment->mDayOffset;
+
+ F32 perc = (F32)(now.value() % mCurrentEnvironment->mDayLength.value()) / (F32)(mCurrentEnvironment->mDayLength.value());
+
+ S32Seconds secondofday((S32)(perc * SECONDSINDAY));
+ S32Hours hourofday(secondofday);
+ S32Seconds secondofhour(secondofday - hourofday);
+ S32Minutes minutesofhour(secondofhour);
+ bool am_pm(hourofday.value() >= 12);
+
+ if (hourofday.value() < 1)
+ hourofday = S32Hours(12);
+ if (hourofday.value() > 12)
+ hourofday -= S32Hours(12);
+
+ std::string lblminute(((minutesofhour.value() < 10) ? "0" : "") + LLSD(minutesofhour.value()).asString());
+
+
+ getChild<LLUICtrl>(LBL_TIMEOFDAY)->setTextArg("[HH]", LLSD(hourofday.value()).asString());
+ getChild<LLUICtrl>(LBL_TIMEOFDAY)->setTextArg("[MM]", lblminute);
+ getChild<LLUICtrl>(LBL_TIMEOFDAY)->setTextArg("[AP]", std::string(am_pm ? "PM" : "AM"));
+ getChild<LLUICtrl>(LBL_TIMEOFDAY)->setTextArg("[PRC]", LLSD((S32)(100 * perc)).asString());
+
+}
+
+void LLPanelEnvironmentInfo::onIdlePlay(void *data)
+{
+ ((LLPanelEnvironmentInfo *)data)->udpateApparentTimeOfDay();
+}
+
void LLPanelEnvironmentInfo::onPickerCommited(LLUUID asset_id)
{
LLSettingsVOBase::getSettingsAsset(asset_id, [this](LLUUID, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) {
diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h
index 2fcfb725a1..44e3c11a82 100644
--- a/indra/newview/llpanelenvironment.h
+++ b/indra/newview/llpanelenvironment.h
@@ -75,6 +75,8 @@ protected:
static const std::string CHK_ALLOWOVERRIDE;
static const std::string BTN_APPLY;
static const std::string BTN_CANCEL;
+ static const std::string LBL_TIMEOFDAY;
+
static const std::string STR_LABEL_USEDEFAULT;
static const std::string STR_LABEL_USEREGION;
@@ -104,6 +106,8 @@ protected:
virtual void doApply();
+ void udpateApparentTimeOfDay();
+
void onPickerCommited(LLUUID asset_id);
void onEditCommited(LLSettingsDay::ptr_t newday);
void onPickerAssetDownloaded(LLSettingsBase::ptr_t settings);
@@ -121,6 +125,8 @@ protected:
private:
+ static void onIdlePlay(void *);
+
LLHandle<LLFloater> mSettingsFloater;
LLHandle<LLFloater> mEditFloater;
S32 mDirtyFlag;
diff --git a/indra/newview/llsettingspicker.h b/indra/newview/llsettingspicker.h
index c3ccbe22c3..b3637fd59a 100644
--- a/indra/newview/llsettingspicker.h
+++ b/indra/newview/llsettingspicker.h
@@ -109,8 +109,8 @@ private:
F32 mContextConeOpacity;
PermissionMask mImmediateFilterPermMask;
- PermissionMask mDnDFilterPermMask;
- PermissionMask mNonImmediateFilterPermMask;
+// PermissionMask mDnDFilterPermMask;
+// PermissionMask mNonImmediateFilterPermMask;
bool mActive;
bool mNoCopySettingsSelected;
diff --git a/indra/newview/skins/default/xui/en/panel_region_environment.xml b/indra/newview/skins/default/xui/en/panel_region_environment.xml
index c1cfe79ba4..bb10e0c69e 100644
--- a/indra/newview/skins/default/xui/en/panel_region_environment.xml
+++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml
@@ -119,7 +119,6 @@
</text>
<slider
can_edit_text="true"
- control_name="DayLengthSLD"
decimal_digits="1"
follows="left|top"
height="20"
@@ -145,7 +144,6 @@
</text>
<slider
can_edit_text="true"
- control_name="DayOffsetSLD"
decimal_digits="1"
follows="left|top"
height="20"
@@ -158,6 +156,29 @@
min_val="-12"
max_val="12"
width="180" />
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ height="12"
+ layout="topleft"
+ left_delta="0"
+ top_pad="20"
+ width="200">
+ Apparent Time of Day Would Be:
+ </text>
+ <text
+ name="lbl_apparent_time"
+ type="string"
+ length="1"
+ follows="left|top"
+ height="12"
+ layout="topleft"
+ left_delta="10"
+ top_pad="5"
+ width="200">
+ [HH]:[MM][AP] ([PRC]%)
+ </text>
</layout_panel>
</layout_stack>