summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelprimmediacontrols.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelprimmediacontrols.cpp')
-rw-r--r--indra/newview/llpanelprimmediacontrols.cpp70
1 files changed, 64 insertions, 6 deletions
diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp
index b04971f980..8ae3553857 100644
--- a/indra/newview/llpanelprimmediacontrols.cpp
+++ b/indra/newview/llpanelprimmediacontrols.cpp
@@ -59,6 +59,7 @@
#include "llvovolume.h"
#include "llweb.h"
#include "llwindow.h"
+#include "llwindowshade.h"
#include "llfloatertools.h" // to enable hide if build tools are up
// Functions pulled from pipeline.cpp
@@ -90,7 +91,8 @@ LLPanelPrimMediaControls::LLPanelPrimMediaControls() :
mTargetObjectNormal(LLVector3::zero),
mZoomObjectID(LLUUID::null),
mZoomObjectFace(0),
- mVolumeSliderVisible(0)
+ mVolumeSliderVisible(0),
+ mWindowShade(NULL)
{
mCommitCallbackRegistrar.add("MediaCtrl.Close", boost::bind(&LLPanelPrimMediaControls::onClickClose, this));
mCommitCallbackRegistrar.add("MediaCtrl.Back", boost::bind(&LLPanelPrimMediaControls::onClickBack, this));
@@ -205,6 +207,9 @@ BOOL LLPanelPrimMediaControls::postBuild()
mMediaAddress->setFocusReceivedCallback(boost::bind(&LLPanelPrimMediaControls::onInputURL, _1, this ));
+ LLWindowShade::Params window_shade_params;
+ window_shade_params.name = "window_shade";
+
mCurrentZoom = ZOOM_NONE;
// clicks on buttons do not remove keyboard focus from media
setIsChrome(TRUE);
@@ -519,7 +524,7 @@ void LLPanelPrimMediaControls::updateShape()
if(LLPluginClassMediaOwner::MEDIA_LOADING == media_plugin->getStatus())
{
mMediaProgressPanel->setVisible(true);
- mMediaProgressBar->setPercent(media_plugin->getProgressPercent());
+ mMediaProgressBar->setValue(media_plugin->getProgressPercent());
}
else
{
@@ -620,12 +625,12 @@ void LLPanelPrimMediaControls::updateShape()
// convert screenspace bbox to pixels (in screen coords)
LLRect window_rect = gViewerWindow->getWorldViewRectScaled();
LLCoordGL screen_min;
- screen_min.mX = llround((F32)window_rect.getWidth() * (min.mV[VX] + 1.f) * 0.5f);
- screen_min.mY = llround((F32)window_rect.getHeight() * (min.mV[VY] + 1.f) * 0.5f);
+ screen_min.mX = llround((F32)window_rect.mLeft + (F32)window_rect.getWidth() * (min.mV[VX] + 1.f) * 0.5f);
+ screen_min.mY = llround((F32)window_rect.mBottom + (F32)window_rect.getHeight() * (min.mV[VY] + 1.f) * 0.5f);
LLCoordGL screen_max;
- screen_max.mX = llround((F32)window_rect.getWidth() * (max.mV[VX] + 1.f) * 0.5f);
- screen_max.mY = llround((F32)window_rect.getHeight() * (max.mV[VY] + 1.f) * 0.5f);
+ screen_max.mX = llround((F32)window_rect.mLeft + (F32)window_rect.getWidth() * (max.mV[VX] + 1.f) * 0.5f);
+ screen_max.mY = llround((F32)window_rect.mBottom + (F32)window_rect.getHeight() * (max.mV[VY] + 1.f) * 0.5f);
// grow panel so that screenspace bounding box fits inside "media_region" element of panel
LLRect media_panel_rect;
@@ -698,6 +703,24 @@ void LLPanelPrimMediaControls::updateShape()
/*virtual*/
void LLPanelPrimMediaControls::draw()
{
+ LLViewerMediaImpl* impl = getTargetMediaImpl();
+ if (impl)
+ {
+ LLNotificationPtr notification = impl->getCurrentNotification();
+ if (notification != mActiveNotification)
+ {
+ mActiveNotification = notification;
+ if (notification)
+ {
+ showNotification(notification);
+ }
+ else
+ {
+ hideNotification();
+ }
+ }
+ }
+
F32 alpha = getDrawContext().mAlpha;
if(mFadeTimer.getStarted())
{
@@ -1295,3 +1318,38 @@ bool LLPanelPrimMediaControls::shouldVolumeSliderBeVisible()
{
return mVolumeSliderVisible > 0;
}
+
+void LLPanelPrimMediaControls::showNotification(LLNotificationPtr notify)
+{
+ delete mWindowShade;
+ LLWindowShade::Params params;
+ params.rect = mMediaRegion->getLocalRect();
+ params.follows.flags = FOLLOWS_ALL;
+ params.notification = notify;
+
+ //HACK: don't hardcode this
+ if (notify->getIcon() == "Popup_Caution")
+ {
+ params.bg_image.name = "Yellow_Gradient";
+ params.text_color = LLColor4::black;
+ }
+ else
+ {
+ //HACK: make this a property of the notification itself, "cancellable"
+ params.can_close = false;
+ params.text_color.control = "LabelTextColor";
+ }
+
+ mWindowShade = LLUICtrlFactory::create<LLWindowShade>(params);
+
+ mMediaRegion->addChild(mWindowShade);
+ mWindowShade->show();
+}
+
+void LLPanelPrimMediaControls::hideNotification()
+{
+ if (mWindowShade)
+ {
+ mWindowShade->hide();
+ }
+}