summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelnearbymedia.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelnearbymedia.cpp')
-rw-r--r--indra/newview/llpanelnearbymedia.cpp44
1 files changed, 35 insertions, 9 deletions
diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp
index 4f2d6374ca..79786c06d9 100644
--- a/indra/newview/llpanelnearbymedia.cpp
+++ b/indra/newview/llpanelnearbymedia.cpp
@@ -74,6 +74,7 @@ static const LLUUID PARCEL_AUDIO_LIST_ITEM_UUID = LLUUID("DF4B020D-8A24-4B95-AB5
// LLPanelNearByMedia
//
+
LLPanelNearByMedia::LLPanelNearByMedia()
: mMediaList(NULL),
mEnableAllCtrl(NULL),
@@ -87,6 +88,8 @@ LLPanelNearByMedia::LLPanelNearByMedia()
mParcelAudioAutoStart = gSavedSettings.getBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING) &&
gSavedSettings.getBOOL("MediaTentativeAutoPlay");
+ gSavedSettings.getControl(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING)->getSignal()->connect(boost::bind(&LLPanelNearByMedia::handleMediaAutoPlayChanged, this, _2));
+
mCommitCallbackRegistrar.add("MediaListCtrl.EnableAll", boost::bind(&LLPanelNearByMedia::onClickEnableAll, this));
mCommitCallbackRegistrar.add("MediaListCtrl.DisableAll", boost::bind(&LLPanelNearByMedia::onClickDisableAll, this));
mCommitCallbackRegistrar.add("MediaListCtrl.GoMediaPrefs", boost::bind(&LLPanelNearByMedia::onAdvancedButtonClick, this));
@@ -168,12 +171,19 @@ BOOL LLPanelNearByMedia::postBuild()
mLessRect = getRect();
mLessRect.mBottom = minimized_controls->getRect().mBottom;
- getChild<LLUICtrl>("more_less_btn")->setValue(false);
+ getChild<LLUICtrl>("more_btn")->setVisible(false);
onMoreLess();
return TRUE;
}
+void LLPanelNearByMedia::handleMediaAutoPlayChanged(const LLSD& newvalue)
+{
+ // update mParcelAudioAutoStart if AUTO_PLAY_MEDIA_SETTING changes
+ mParcelAudioAutoStart = gSavedSettings.getBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING) &&
+ gSavedSettings.getBOOL("MediaTentativeAutoPlay");
+}
+
/*virtual*/
void LLPanelNearByMedia::onMouseEnter(S32 x, S32 y, MASK mask)
{
@@ -954,7 +964,7 @@ void LLPanelNearByMedia::onAdvancedButtonClick()
void LLPanelNearByMedia::onMoreLess()
{
- bool is_more = getChild<LLUICtrl>("more_less_btn")->getValue();
+ bool is_more = getChild<LLUICtrl>("more_btn")->getVisible();
mNearbyMediaPanel->setVisible(is_more);
// enable resizing when expanded
@@ -964,6 +974,9 @@ void LLPanelNearByMedia::onMoreLess()
new_rect.translate(getRect().mRight - new_rect.mRight, getRect().mTop - new_rect.mTop);
setShape(new_rect);
+
+ getChild<LLUICtrl>("more_btn")->setVisible(!is_more);
+ getChild<LLUICtrl>("less_btn")->setVisible(is_more);
}
void LLPanelNearByMedia::updateControls()
@@ -997,7 +1010,7 @@ void LLPanelNearByMedia::updateControls()
if (NULL == impl)
{
// Just means it hasn't started yet
- showBasicControls(false, false, false);
+ showBasicControls(false, false, false, false, 0);
}
else if (impl->isMediaTimeBased())
{
@@ -1009,7 +1022,11 @@ void LLPanelNearByMedia::updateControls()
}
else {
// non-time-based parcel media
- showBasicControls(LLViewerMedia::isParcelMediaPlaying(), false, false);
+ showBasicControls(LLViewerMedia::isParcelMediaPlaying(),
+ false,
+ false,
+ impl->getVolume() == 0.0,
+ impl->getVolume());
}
}
}
@@ -1032,19 +1049,28 @@ void LLPanelNearByMedia::updateControls()
else {
showBasicControls(!impl->isMediaDisabled(),
! impl->isParcelMedia(), // include_zoom
- LLViewerMediaFocus::getInstance()->isZoomed());
+ LLViewerMediaFocus::getInstance()->isZoomed(),
+ impl->getVolume() == 0.0,
+ impl->getVolume());
}
}
}
}
-void LLPanelNearByMedia::showBasicControls(bool playing, bool include_zoom, bool is_zoomed)
+void LLPanelNearByMedia::showBasicControls(bool playing, bool include_zoom, bool is_zoomed, bool muted, F32 volume)
{
mStopCtrl->setVisible(playing);
mPlayCtrl->setVisible(!playing);
mPauseCtrl->setVisible(false);
- mMuteCtrl->setVisible(false);
+#ifdef PER_MEDIA_VOLUME
+ mVolumeSliderCtrl->setVisible(true);
+ mMuteCtrl->setVisible(true);
+ mMuteBtn->setValue(muted);
+ mVolumeSlider->setValue(volume);
+#else
mVolumeSliderCtrl->setVisible(false);
+ mMuteCtrl->setVisible(false);
+#endif
mZoomCtrl->setVisible(include_zoom && !is_zoomed);
mUnzoomCtrl->setVisible(include_zoom && is_zoomed);
mStopCtrl->setEnabled(true);
@@ -1143,7 +1169,7 @@ void LLPanelNearByMedia::onClickSelectedMediaMute()
else {
LLViewerMediaImpl* impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ?
((LLViewerMediaImpl*)LLViewerParcelMedia::getParcelMedia()) : LLViewerMedia::getMediaImplFromTextureID(selected_media_id);
- if (NULL != impl && impl->isMediaTimeBased())
+ if (NULL != impl)
{
F32 volume = impl->getVolume();
if(volume > 0.0)
@@ -1174,7 +1200,7 @@ void LLPanelNearByMedia::onCommitSelectedMediaVolume()
else {
LLViewerMediaImpl* impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ?
((LLViewerMediaImpl*)LLViewerParcelMedia::getParcelMedia()) : LLViewerMedia::getMediaImplFromTextureID(selected_media_id);
- if (NULL != impl && impl->isMediaTimeBased())
+ if (NULL != impl)
{
impl->setVolume(mVolumeSlider->getValueF32());
}