From 49cbc80ee0304ba63bb86490a962ea3b62edf9f4 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Tue, 18 Jun 2013 08:09:17 -0500 Subject: [PATCH] Added 'NearbyMedia' floater (accessable via new button in Media Remote popup) -Floater utilizes a slightly modified LLPanelNearbyMedia, which has fading and the 'minimal' mode disabled when its parent is a floater. -Due to how LL designed LLPanelNearbyMedia, only one instance should ever be allowed at a time. Added LLNameBox. To avoid having dupilcate code, logic in LLTextBox::fromXML had to be moved to LLTextBox::initFromXML. -Perfomed some additional cleanup. 'name' attribute now parsed in LLUICtrl::initFromXML, or as-needed for elements not based off of LLUICtrl. LLSlider now respects current DrawContext Fixed the AO toolbar widget reserving too much width. Made the "wlfAdvSettingsPopup" setting persist, and un-inverted its logic. Altered ui initilization order. Toolbar/overlay panels now constructed further into login process. --- indra/llui/llcheckboxctrl.cpp | 5 +- indra/llui/llcombobox.cpp | 10 +- indra/llui/llfiltereditor.cpp | 5 +- indra/llui/lliconctrl.cpp | 5 +- indra/llui/lllayoutstack.cpp | 8 - indra/llui/lllineeditor.cpp | 5 +- indra/llui/llmenugl.cpp | 5 +- indra/llui/llmultislider.cpp | 5 +- indra/llui/llmultisliderctrl.cpp | 5 +- indra/llui/llradiogroup.cpp | 9 +- indra/llui/llscrollingpanellist.cpp | 5 +- indra/llui/llscrolllistctrl.cpp | 5 +- indra/llui/llsearcheditor.cpp | 5 +- indra/llui/llslider.cpp | 47 +- indra/llui/llslider.h | 6 +- indra/llui/llsliderctrl.cpp | 5 +- indra/llui/llspinctrl.cpp | 5 +- indra/llui/lltextbox.cpp | 125 +- indra/llui/lltextbox.h | 1 + indra/llui/lltexteditor.cpp | 5 +- indra/llui/lluictrl.cpp | 4 + indra/llui/lluictrlfactory.cpp | 5 +- indra/newview/CMakeLists.txt | 2 + indra/newview/app_settings/settings.xml | 32 +- indra/newview/llcolorswatch.cpp | 5 +- indra/newview/llfloaterpreference.h | 1 + indra/newview/lljoystickbutton.cpp | 10 +- indra/newview/llnamebox.cpp | 71 +- indra/newview/llnamebox.h | 15 +- indra/newview/llnameeditor.cpp | 5 +- indra/newview/llnamelistctrl.cpp | 5 +- indra/newview/lloverlaybar.cpp | 26 +- indra/newview/lloverlaybar.h | 2 +- indra/newview/llpanelgroupgeneral.cpp | 9 +- .../llpanelmediasettingspermissions.cpp | 8 +- indra/newview/llpanelnearbymedia.cpp | 1313 +++++++++++++++++ indra/newview/llpanelnearbymedia.h | 198 +++ indra/newview/llstartup.cpp | 2 - indra/newview/lltexturectrl.cpp | 5 +- .../newview/llviewermedia_streamingaudio.cpp | 32 +- indra/newview/llviewerparcelmediaautoplay.cpp | 37 +- indra/newview/llviewerparcelmediaautoplay.h | 2 + indra/newview/llviewertexteditor.cpp | 5 +- indra/newview/llviewerwindow.cpp | 40 +- .../xui/en-us/floater_nearby_media.xml | 20 + .../skins/default/xui/en-us/floater_tools.xml | 15 +- .../default/xui/en-us/floater_web_content.xml | 21 +- .../skins/default/xui/en-us/panel_audio.xml | 3 +- .../default/xui/en-us/panel_group_general.xml | 7 +- .../xui/en-us/panel_media_remote_expanded.xml | 2 +- .../panel_media_settings_permissions.xml | 4 +- .../default/xui/en-us/panel_nearby_media.xml | 382 +++++ .../default/xui/en-us/panel_overlaybar.xml | 2 +- .../xui/en-us/panel_prim_media_controls.xml | 23 +- .../skins/default/xui/es/floater_tools.xml | 4 +- .../skins/default/xui/es/panel_audio.xml | 1 + .../xui/es/panel_media_settings_general.xml | 33 + .../es/panel_media_settings_permissions.xml | 29 + .../xui/es/panel_media_settings_security.xml | 15 + .../default/xui/es/panel_nearby_media.xml | 71 + .../skins/default/xui/fr/floater_tools.xml | 4 +- .../skins/default/xui/fr/panel_audio.xml | 1 + .../xui/fr/panel_media_settings_general.xml | 32 + .../fr/panel_media_settings_permissions.xml | 29 + .../xui/fr/panel_media_settings_security.xml | 16 + .../default/xui/fr/panel_nearby_media.xml | 71 + .../skins/default/xui/pt/floater_tools.xml | 4 +- .../skins/default/xui/pt/panel_audio.xml | 17 +- .../xui/pt/panel_media_settings_general.xml | 32 + .../pt/panel_media_settings_permissions.xml | 29 + .../xui/pt/panel_media_settings_security.xml | 15 + .../default/xui/pt/panel_nearby_media.xml | 71 + indra/newview/wlfPanel_AdvSettings.cpp | 6 +- 73 files changed, 2750 insertions(+), 314 deletions(-) create mode 100644 indra/newview/llpanelnearbymedia.cpp create mode 100644 indra/newview/llpanelnearbymedia.h create mode 100644 indra/newview/skins/default/xui/en-us/floater_nearby_media.xml create mode 100644 indra/newview/skins/default/xui/en-us/panel_nearby_media.xml create mode 100644 indra/newview/skins/default/xui/es/panel_media_settings_general.xml create mode 100644 indra/newview/skins/default/xui/es/panel_media_settings_permissions.xml create mode 100644 indra/newview/skins/default/xui/es/panel_media_settings_security.xml create mode 100644 indra/newview/skins/default/xui/es/panel_nearby_media.xml create mode 100644 indra/newview/skins/default/xui/fr/panel_media_settings_general.xml create mode 100644 indra/newview/skins/default/xui/fr/panel_media_settings_permissions.xml create mode 100644 indra/newview/skins/default/xui/fr/panel_media_settings_security.xml create mode 100644 indra/newview/skins/default/xui/fr/panel_nearby_media.xml create mode 100644 indra/newview/skins/default/xui/pt/panel_media_settings_general.xml create mode 100644 indra/newview/skins/default/xui/pt/panel_media_settings_permissions.xml create mode 100644 indra/newview/skins/default/xui/pt/panel_media_settings_security.xml create mode 100644 indra/newview/skins/default/xui/pt/panel_nearby_media.xml diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp index ad0fac5df..ada81b639 100644 --- a/indra/llui/llcheckboxctrl.cpp +++ b/indra/llui/llcheckboxctrl.cpp @@ -307,9 +307,6 @@ LLXMLNodePtr LLCheckBoxCtrl::getXML(bool save_children) const // static LLView* LLCheckBoxCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("checkbox"); - node->getAttributeString("name", name); - std::string label(""); node->getAttributeString("label", label); @@ -326,7 +323,7 @@ LLView* LLCheckBoxCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto LLRect rect; createRect(node, rect, parent, LLRect()); - LLCheckBoxCtrl* checkbox = new LLCheckboxCtrl(name, + LLCheckBoxCtrl* checkbox = new LLCheckboxCtrl("checkbox", rect, label, font, diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index bdd0fe4a8..30a10c39a 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -149,9 +149,6 @@ LLXMLNodePtr LLComboBox::getXML(bool save_children) const // static LLView* LLComboBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("combo_box"); - node->getAttributeString("name", name); - std::string label(""); node->getAttributeString("label", label); @@ -164,7 +161,7 @@ LLView* LLComboBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory * S32 max_chars = 20; node->getAttributeS32("max_chars", max_chars); - LLComboBox* combo_box = new LLComboBox(name, + LLComboBox* combo_box = new LLComboBox("combo_box", rect, label); combo_box->setAllowTextEntry(allow_text_entry, max_chars); @@ -1245,16 +1242,13 @@ LLXMLNodePtr LLFlyoutButton::getXML(bool save_children) const //static LLView* LLFlyoutButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name = "flyout_button"; - node->getAttributeString("name", name); - std::string label(""); node->getAttributeString("label", label); LLRect rect; createRect(node, rect, parent, LLRect()); - LLFlyoutButton* flyout_button = new LLFlyoutButton(name, + LLFlyoutButton* flyout_button = new LLFlyoutButton("flyout_button", rect, label); diff --git a/indra/llui/llfiltereditor.cpp b/indra/llui/llfiltereditor.cpp index fa05c03d7..12e1c2d52 100644 --- a/indra/llui/llfiltereditor.cpp +++ b/indra/llui/llfiltereditor.cpp @@ -52,9 +52,6 @@ void LLFilterEditor::handleKeystroke() // static LLView* LLFilterEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("filter_editor"); - node->getAttributeString("name", name); - LLRect rect; createRect(node, rect, parent, LLRect()); @@ -63,7 +60,7 @@ LLView* LLFilterEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto std::string text = node->getValue().substr(0, max_text_length - 1); - LLFilterEditor* search_editor = new LLFilterEditor(name, + LLFilterEditor* search_editor = new LLFilterEditor("filter_editor", rect, max_text_length); diff --git a/indra/llui/lliconctrl.cpp b/indra/llui/lliconctrl.cpp index 889878af1..90b313d45 100644 --- a/indra/llui/lliconctrl.cpp +++ b/indra/llui/lliconctrl.cpp @@ -158,9 +158,6 @@ LLXMLNodePtr LLIconCtrl::getXML(bool save_children) const LLView* LLIconCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("icon"); - node->getAttributeString("name", name); - LLRect rect; createRect(node, rect, parent, LLRect()); @@ -173,7 +170,7 @@ LLView* LLIconCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory * LLColor4 color(LLColor4::white); LLUICtrlFactory::getAttributeColor(node,"color", color); - LLIconCtrl* icon = new LLIconCtrl(name, rect, image_name); + LLIconCtrl* icon = new LLIconCtrl("icon", rect, image_name); icon->setColor(color); diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 46e60bd3e..e939cd411 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -976,8 +976,6 @@ LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactor layout_stackp->setName(name); layout_stackp->initFromXML(node, parent); - llinfos << "Created layout stack '"<getAttributeString("name", name); - LLRect rect; createRect(node, rect, parent, LLRect()); @@ -2584,7 +2581,7 @@ LLView* LLLineEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory S32 border_thickness = 1; node->getAttributeS32("border_thickness", border_thickness); - LLLineEditor* line_editor = new LLLineEditor(name, + LLLineEditor* line_editor = new LLLineEditor("line_editor", rect, text, font, diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 8b16476ed..33e39bc60 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -4150,13 +4150,10 @@ LLXMLNodePtr LLMenuBarGL::getXML(bool save_children) const LLView* LLMenuBarGL::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("menu"); - node->getAttributeString("name", name); - BOOL opaque = FALSE; node->getAttributeBOOL("opaque", opaque); - LLMenuBarGL *menubar = new LLMenuBarGL(name); + LLMenuBarGL *menubar = new LLMenuBarGL("menu"); LLHandle parent_handle; LLFloater* parent_floater = dynamic_cast(parent); diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index f0b140b40..183a1245f 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -624,9 +624,6 @@ LLXMLNodePtr LLMultiSlider::getXML(bool save_children) const //static LLView* LLMultiSlider::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("multi_slider_bar"); - node->getAttributeString("name", name); - LLRect rect; createRect(node, rect, parent, LLRect()); @@ -654,7 +651,7 @@ LLView* LLMultiSlider::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactor BOOL use_triangle = FALSE; node->getAttributeBOOL("use_triangle", use_triangle); - LLMultiSlider* multiSlider = new LLMultiSlider(name, + LLMultiSlider* multiSlider = new LLMultiSlider("multi_slider_bar", rect, NULL, initial_value, diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index 1cd91c3a4..06de6f937 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -472,9 +472,6 @@ LLXMLNodePtr LLMultiSliderCtrl::getXML(bool save_children) const LLView* LLMultiSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("multi_slider"); - node->getAttributeString("name", name); - std::string label; node->getAttributeString("label", label); @@ -558,7 +555,7 @@ LLView* LLMultiSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFa label.assign(node->getTextContents()); } - LLMultiSliderCtrl* slider = new LLMultiSliderCtrl(name, + LLMultiSliderCtrl* slider = new LLMultiSliderCtrl("multi_slider", rect, label, font, diff --git a/indra/llui/llradiogroup.cpp b/indra/llui/llradiogroup.cpp index ce01f75bf..c592fccfb 100644 --- a/indra/llui/llradiogroup.cpp +++ b/indra/llui/llradiogroup.cpp @@ -352,9 +352,6 @@ LLXMLNodePtr LLRadioGroup::getXML(bool save_children) const // static LLView* LLRadioGroup::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("radio_group"); - node->getAttributeString("name", name); - U32 initial_value = 0; node->getAttributeU32("initial_value", initial_value); @@ -364,7 +361,7 @@ LLView* LLRadioGroup::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory LLRect rect; createRect(node, rect, parent, LLRect()); - LLRadioGroup* radio_group = new LLRadioGroup(name, + LLRadioGroup* radio_group = new LLRadioGroup("radio_group", rect, initial_value, NULL, @@ -408,10 +405,8 @@ LLView* LLRadioGroup::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory LLRect item_rect; createRect(child, item_rect, radio_group, rect); - std::string radioname("radio"); - child->getAttributeString("name", radioname); std::string item_label = child->getTextContents(); - LLRadioCtrl* radio = radio_group->addRadioButton(radioname, item_label, item_rect, font); + LLRadioCtrl* radio = radio_group->addRadioButton("radio", item_label, item_rect, font); radio->initFromXML(child, radio_group); } diff --git a/indra/llui/llscrollingpanellist.cpp b/indra/llui/llscrollingpanellist.cpp index 8aa8b9fe3..c5d1ad6ed 100644 --- a/indra/llui/llscrollingpanellist.cpp +++ b/indra/llui/llscrollingpanellist.cpp @@ -152,13 +152,10 @@ LLXMLNodePtr LLScrollingPanelList::getXML(bool save_children) const // static LLView* LLScrollingPanelList::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("scrolling_panel_list"); - node->getAttributeString("name", name); - LLRect rect; createRect(node, rect, parent, LLRect()); - LLScrollingPanelList* scrolling_panel_list = new LLScrollingPanelList(name, rect); + LLScrollingPanelList* scrolling_panel_list = new LLScrollingPanelList("scrolling_panel_list", rect); scrolling_panel_list->initFromXML(node, parent); return scrolling_panel_list; } diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index a5bbc9b90..5a5bc1d41 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -3104,9 +3104,6 @@ void LLScrollListCtrl::setScrollListParameters(LLXMLNodePtr node) // static LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("scroll_list"); - node->getAttributeString("name", name); - LLRect rect; createRect(node, rect, parent, LLRect()); @@ -3132,7 +3129,7 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac node->getAttributeBOOL("mouse_wheel_opaque", mouse_wheel_opaque); LLScrollListCtrl* scroll_list = new LLScrollListCtrl( - name, + "scroll_list", rect, NULL, multi_select, diff --git a/indra/llui/llsearcheditor.cpp b/indra/llui/llsearcheditor.cpp index a326803e4..6ccfed88a 100644 --- a/indra/llui/llsearcheditor.cpp +++ b/indra/llui/llsearcheditor.cpp @@ -147,9 +147,6 @@ void LLSearchEditor::handleKeystroke() // static LLView* LLSearchEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("search_editor"); - node->getAttributeString("name", name); - LLRect rect; createRect(node, rect, parent, LLRect()); @@ -158,7 +155,7 @@ LLView* LLSearchEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto std::string text = node->getValue().substr(0, max_text_length - 1); - LLSearchEditor* search_editor = new LLSearchEditor(name, + LLSearchEditor* search_editor = new LLSearchEditor("search_editor", rect, max_text_length); diff --git a/indra/llui/llslider.cpp b/indra/llui/llslider.cpp index becc33424..893354252 100644 --- a/indra/llui/llslider.cpp +++ b/indra/llui/llslider.cpp @@ -250,6 +250,8 @@ BOOL LLSlider::handleKeyHere(KEY key, MASK mask) void LLSlider::draw() { + F32 alpha = getDrawContext().mAlpha; + // since thumb image might still be decoding, need thumb to accomodate image size updateThumbRect(); @@ -258,31 +260,47 @@ void LLSlider::draw() // drawing solids requires texturing be disabled gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - F32 opacity = getEnabled() ? 1.f : 0.3f; - LLColor4 center_color = (mThumbCenterColor % opacity); - // Track LLRect track_rect(mThumbImage->getWidth() / 2, getLocalRect().getCenterY() + (mTrackImage->getHeight() / 2), getRect().getWidth() - mThumbImage->getWidth() / 2, getLocalRect().getCenterY() - (mTrackImage->getHeight() / 2) ); LLRect highlight_rect(track_rect.mLeft, track_rect.mTop, mThumbRect.getCenterX(), track_rect.mBottom); - mTrackImage->draw(track_rect); - mTrackHighlightImage->draw(highlight_rect); + mTrackImage->draw(track_rect, LLColor4::white % alpha); + mTrackHighlightImage->draw(highlight_rect, LLColor4::white % alpha); // Thumb - if( hasMouseCapture() ) - { - // Show ghost where thumb was before dragging began. - mThumbImage->draw(mDragStartThumbRect, mThumbCenterColor % 0.3f); - } if (hasFocus()) { // Draw focus highlighting. - mThumbImage->drawBorder(mThumbRect, gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth()); + mThumbImage->drawBorder(mThumbRect, gFocusMgr.getFocusColor() % alpha, gFocusMgr.getFocusFlashWidth()); + } + + if( hasMouseCapture() ) + { + // Show ghost where thumb was before dragging began. + if (mThumbImage.notNull()) + { + mThumbImage->draw(mDragStartThumbRect, mThumbCenterColor % (0.3f * alpha)); + mThumbImage->draw(mThumbRect, mThumbOutlineColor % alpha); + } + } + else if(!getEnabled()) + { + if (mThumbImage.notNull()) + { + mThumbImage->draw(mThumbRect, mThumbCenterColor % (0.3f * alpha)); + } + } + else + { + if (mThumbImage.notNull()) + { + mThumbImage->draw(mThumbRect, mThumbCenterColor % alpha); + } } // Fill in the thumb. - mThumbImage->draw(mThumbRect, hasMouseCapture() ? mThumbOutlineColor : center_color); + LLUICtrl::draw(); } @@ -325,9 +343,6 @@ boost::signals2::connection LLSlider::setMouseUpCallback( const commit_signal_t: //static LLView* LLSlider::fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory) { - std::string name("slider_bar"); - node->getAttributeString("name", name); - LLRect rect; createRect(node, rect, parent, LLRect()); @@ -346,7 +361,7 @@ LLView* LLSlider::fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFacto BOOL volume = node->hasName("volume_slider") ? TRUE : FALSE; node->getAttributeBOOL("volume", volume); - LLSlider* slider = new LLSlider(name, + LLSlider* slider = new LLSlider("slider_bar", rect, NULL, initial_value, diff --git a/indra/llui/llslider.h b/indra/llui/llslider.h index 8d16911f6..59bda673f 100644 --- a/indra/llui/llslider.h +++ b/indra/llui/llslider.h @@ -96,9 +96,9 @@ private: S32 mMouseOffset; LLRect mDragStartThumbRect; - LLUIImage* mThumbImage; - LLUIImage* mTrackImage; - LLUIImage* mTrackHighlightImage; + LLPointer mThumbImage; + LLPointer mTrackImage; + LLPointer mTrackHighlightImage; LLRect mThumbRect; LLColor4 mTrackColor; diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp index 53f54d75c..42c72a2f5 100644 --- a/indra/llui/llsliderctrl.cpp +++ b/indra/llui/llsliderctrl.cpp @@ -403,9 +403,6 @@ LLXMLNodePtr LLSliderCtrl::getXML(bool save_children) const LLView* LLSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("slider"); - node->getAttributeString("name", name); - std::string label; node->getAttributeString("label", label); @@ -480,7 +477,7 @@ LLView* LLSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory label.assign(node->getTextContents()); } - LLSliderCtrl* slider = new LLSliderCtrl(name, + LLSliderCtrl* slider = new LLSliderCtrl("slider", rect, label, font, diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp index a7950ccbf..37244e640 100644 --- a/indra/llui/llspinctrl.cpp +++ b/indra/llui/llspinctrl.cpp @@ -519,9 +519,6 @@ LLXMLNodePtr LLSpinCtrl::getXML(bool save_children) const LLView* LLSpinCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("spinner"); - node->getAttributeString("name", name); - std::string label; node->getAttributeString("label", label); @@ -556,7 +553,7 @@ LLView* LLSpinCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory * label.assign( node->getValue() ); } - LLSpinCtrl* spinner = new LLSpinCtrl(name, + LLSpinCtrl* spinner = new LLSpinCtrl("spinner", rect, label, font, diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index 799441a99..239ac5b74 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -387,6 +387,69 @@ void LLTextBox::reshapeToFitText() reshape( width + 2 * mHPad, height + 2 * mVPad ); } +// virtual +void LLTextBox::initFromXML(LLXMLNodePtr node, LLView* parent) +{ + LLUICtrl::initFromXML(node, parent); + + LLFontGL* font = LLView::selectFont(node); + if(font) + mFontGL = font; + + setText(node->getTextContents()); + + LLFontGL::HAlign halign = LLView::selectFontHAlign(node); + setHAlign(halign); + + node->getAttributeS32("line_spacing", mLineSpacing); + + std::string font_style; + if (node->getAttributeString("font-style", font_style)) + { + mFontStyle = LLFontGL::getStyleFromString(font_style); + } + + if (node->getAttributeString("font-shadow", font_style)) + { + if(font_style == "soft") + mFontShadow = LLFontGL::DROP_SHADOW_SOFT; + else if(font_style == "hard") + mFontShadow = LLFontGL::DROP_SHADOW; + else + mFontShadow = LLFontGL::NO_SHADOW; + } + + BOOL mouse_opaque = getMouseOpaque(); + if (node->getAttributeBOOL("mouse_opaque", mouse_opaque)) + { + setMouseOpaque(mouse_opaque); + } + + if(node->hasAttribute("text_color")) + { + LLColor4 color; + LLUICtrlFactory::getAttributeColor(node, "text_color", color); + setColor(color); + } + + if(node->hasAttribute("hover_color")) + { + LLColor4 color; + LLUICtrlFactory::getAttributeColor(node, "hover_color", color); + setHoverColor(color); + setHoverActive(true); + } + + BOOL hover_active = FALSE; + if(node->getAttributeBOOL("hover", hover_active)) + { + setHoverActive(hover_active); + } + + node->getAttributeBOOL("use_ellipses", mUseEllipses); + +} + // virtual LLXMLNodePtr LLTextBox::getXML(bool save_children) const { @@ -416,68 +479,8 @@ LLXMLNodePtr LLTextBox::getXML(bool save_children) const // static LLView* LLTextBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("text_box"); - node->getAttributeString("name", name); - LLFontGL* font = LLView::selectFont(node); - - std::string text = node->getTextContents(); - - LLTextBox* text_box = new LLTextBox(name, - LLRect(), - text, - font, - FALSE); - - - LLFontGL::HAlign halign = LLView::selectFontHAlign(node); - text_box->setHAlign(halign); - + LLTextBox* text_box = new LLTextBox("text_box", LLRect(), "" , NULL, FALSE); text_box->initFromXML(node, parent); - node->getAttributeS32("line_spacing", text_box->mLineSpacing); - - std::string font_style; - if (node->getAttributeString("font-style", font_style)) - { - text_box->mFontStyle = LLFontGL::getStyleFromString(font_style); - } - - if (node->getAttributeString("font-shadow", font_style)) - { - if(font_style == "soft") - text_box->mFontShadow = LLFontGL::DROP_SHADOW_SOFT; - else if(font_style == "hard") - text_box->mFontShadow = LLFontGL::DROP_SHADOW; - else - text_box->mFontShadow = LLFontGL::NO_SHADOW; - } - - BOOL mouse_opaque = text_box->getMouseOpaque(); - if (node->getAttributeBOOL("mouse_opaque", mouse_opaque)) - { - text_box->setMouseOpaque(mouse_opaque); - } - - if(node->hasAttribute("text_color")) - { - LLColor4 color; - LLUICtrlFactory::getAttributeColor(node, "text_color", color); - text_box->setColor(color); - } - - if(node->hasAttribute("hover_color")) - { - LLColor4 color; - LLUICtrlFactory::getAttributeColor(node, "hover_color", color); - text_box->setHoverColor(color); - text_box->setHoverActive(true); - } - - BOOL hover_active = FALSE; - if(node->getAttributeBOOL("hover", hover_active)) - { - text_box->setHoverActive(hover_active); - } - return text_box; } diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h index de3e0c6e5..ce9f71aff 100644 --- a/indra/llui/lltextbox.h +++ b/indra/llui/lltextbox.h @@ -63,6 +63,7 @@ public: virtual ~LLTextBox() {} + virtual void initFromXML(LLXMLNodePtr node, LLView* parent); virtual LLXMLNodePtr getXML(bool save_children = true) const; static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory); diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 09d41c589..e6049f843 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -4748,9 +4748,6 @@ LLXMLNodePtr LLTextEditor::getXML(bool save_children) const // static LLView* LLTextEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("text_editor"); - node->getAttributeString("name", name); - LLRect rect; createRect(node, rect, parent, LLRect()); @@ -4764,7 +4761,7 @@ LLView* LLTextEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory std::string text = node->getTextContents().substr(0, max_text_length - 1); - LLTextEditor* text_editor = new LLTextEditor(name, + LLTextEditor* text_editor = new LLTextEditor("text_editor", rect, max_text_length, text, diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index 625aa7eab..803cb7f0f 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -485,6 +485,10 @@ BOOL LLUICtrl::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect void LLUICtrl::initFromXML(LLXMLNodePtr node, LLView* parent) { + std::string name; + if(node->getAttributeString("name", name)) + setName(name); + BOOL has_tab_stop = hasTabStop(); node->getAttributeBOOL("tab_stop", has_tab_stop); diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index 126a8ba46..d5bb963d4 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -102,11 +102,8 @@ public: static LLView *fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("pad"); - node->getAttributeString("name", name); - LLUICtrlLocate *new_ctrl = new LLUICtrlLocate(); - new_ctrl->setName(name); + new_ctrl->setName("pad"); new_ctrl->initFromXML(node, parent); return new_ctrl; } diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 878141ad0..fca9817c1 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -370,6 +370,7 @@ set(viewer_SOURCE_FILES llpanelmediasettingsgeneral.cpp llpanelmediasettingspermissions.cpp llpanelmediasettingssecurity.cpp + llpanelnearbymedia.cpp llpanelmorph.cpp llpanelmsgs.cpp llpanelnetwork.cpp @@ -871,6 +872,7 @@ set(viewer_HEADER_FILES llpanelmediasettingsgeneral.h llpanelmediasettingspermissions.h llpanelmediasettingssecurity.h + llpanelnearbymedia.h llpanelmorph.h llpanelmsgs.h llpanelnetwork.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 8569c5258..d7ce62765 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -425,7 +425,19 @@ - + ShowNearbyMediaFloater + + Comment + Show nearby media floter + Persist + 1 + Type + Boolean + Value + 0 + + + ShowAOSitPopup @@ -1125,7 +1137,7 @@ This should be as low as possible, but too low may break functionality Comment Show Windlight popup Persist - 0 + 1 Type Boolean Value @@ -16940,6 +16952,22 @@ This should be as low as possible, but too low may break functionality 473 + FloaterNearbyMediaRect + + Comment + Rectangle for nearby media floater. + Persist + 1 + Type + Rect + Value + + 0 + 0 + 0 + 0 + + WindEnabled Comment diff --git a/indra/newview/llcolorswatch.cpp b/indra/newview/llcolorswatch.cpp index 5c044a496..b5bc95088 100644 --- a/indra/newview/llcolorswatch.cpp +++ b/indra/newview/llcolorswatch.cpp @@ -352,9 +352,6 @@ LLXMLNodePtr LLColorSwatchCtrl::getXML(bool save_children) const LLView* LLColorSwatchCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("colorswatch"); - node->getAttributeString("name", name); - std::string label; node->getAttributeString("label", label); @@ -373,7 +370,7 @@ LLView* LLColorSwatchCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFa } LLColorSwatchCtrl* color_swatch = new LLColorSwatchCtrl( - name, + "colorswatch", rect, label, color ); diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 387c20ccc..ea6a0e0fd 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -124,6 +124,7 @@ public: static void closeWithoutSaving(); protected: + friend class LLPanelNearByMedia; LLPreferenceCore *mPreferenceCore; /*virtual*/ void onClose(bool app_quitting); diff --git a/indra/newview/lljoystickbutton.cpp b/indra/newview/lljoystickbutton.cpp index 5e6f3e1b0..c33667061 100644 --- a/indra/newview/lljoystickbutton.cpp +++ b/indra/newview/lljoystickbutton.cpp @@ -331,9 +331,6 @@ LLXMLNodePtr LLJoystickAgentTurn::getXML(bool save_children) const LLView* LLJoystickAgentTurn::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("button"); - node->getAttributeString("name", name); - std::string image_unselected; if (node->hasAttribute("image_unselected")) node->getAttributeString("image_unselected",image_unselected); @@ -343,7 +340,7 @@ LLView* LLJoystickAgentTurn::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrl EJoystickQuadrant quad = JQ_ORIGIN; if (node->hasAttribute("quadrant")) quad = selectQuadrant(node); - LLJoystickAgentTurn *button = new LLJoystickAgentTurn(name, + LLJoystickAgentTurn *button = new LLJoystickAgentTurn("button", LLRect(), image_unselected, image_selected, @@ -449,9 +446,6 @@ LLXMLNodePtr LLJoystickAgentSlide::getXML(bool save_children) const // static LLView* LLJoystickAgentSlide::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("button"); - node->getAttributeString("name", name); - std::string image_unselected; if (node->hasAttribute("image_unselected")) node->getAttributeString("image_unselected",image_unselected); @@ -462,7 +456,7 @@ LLView* LLJoystickAgentSlide::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtr EJoystickQuadrant quad = JQ_ORIGIN; if (node->hasAttribute("quadrant")) quad = selectQuadrant(node); - LLJoystickAgentSlide *button = new LLJoystickAgentSlide(name, + LLJoystickAgentSlide *button = new LLJoystickAgentSlide("button", LLRect(), image_unselected, image_selected, diff --git a/indra/newview/llnamebox.cpp b/indra/newview/llnamebox.cpp index 449bf9329..28381301d 100644 --- a/indra/newview/llnamebox.cpp +++ b/indra/newview/llnamebox.cpp @@ -46,20 +46,18 @@ // statics std::set LLNameBox::sInstances; +static LLRegisterWidget r("name_box"); -LLNameBox::LLNameBox(const std::string& name, const LLRect& rect, const LLUUID& name_id, BOOL is_group, const LLFontGL* font, BOOL mouse_opaque) -: LLTextBox(name, rect, std::string("(retrieving)"), font, mouse_opaque), - mNameID(name_id) + +LLNameBox::LLNameBox(const std::string& name) +: LLTextBox(name, LLRect(), "" , NULL, TRUE) { + mNameID = LLUUID::null; + mLink = false; + //mParseHTML = mLink; // STORM-215 + mInitialValue = "(retrieving)"; LLNameBox::sInstances.insert(this); - if(!name_id.isNull()) - { - setNameID(name_id, is_group); - } - else - { - setText(LLStringUtil::null); - } + setText(LLStringUtil::null); } LLNameBox::~LLNameBox() @@ -72,25 +70,30 @@ void LLNameBox::setNameID(const LLUUID& name_id, BOOL is_group) mNameID = name_id; std::string name; + BOOL got_name = FALSE; if (!is_group) { - gCacheName->getFullName(name_id, name); + got_name = gCacheName->getFullName(name_id, name); } else { - gCacheName->getGroupName(name_id, name); + got_name = gCacheName->getGroupName(name_id, name); } - setText(name); + // Got the name already? Set it. + // Otherwise it will be set later in refresh(). + if (got_name) + setName(name, is_group); + else + setText(mInitialValue); } void LLNameBox::refresh(const LLUUID& id, const std::string& full_name, bool is_group) - { if (id == mNameID) { - setText(full_name); + setName(full_name, is_group); } } @@ -105,3 +108,39 @@ void LLNameBox::refreshAll(const LLUUID& id, const std::string& full_name, bool box->refresh(id, full_name, is_group); } } + +void LLNameBox::setName(const std::string& name, BOOL is_group) +{ + if (mLink) + { + std::string url; + + if (is_group) + url = "[secondlife:///app/group/" + mNameID.asString() + "/about " + name + "]"; + else + url = "[secondlife:///app/agent/" + mNameID.asString() + "/about " + name + "]"; + + setText(url); + } + else + { + setText(name); + } +} + +// virtual +void LLNameBox::initFromXML(LLXMLNodePtr node, LLView* parent) +{ + LLTextBox::initFromXML(node, parent); + node->getAttributeBOOL("link", mLink); + node->getAttributeString("initial_value", mInitialValue); +} + +// static +LLView* LLNameBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) +{ + LLNameBox* name_box = new LLNameBox("name_box"); + name_box->initFromXML(node,parent); + return name_box; +} + diff --git a/indra/newview/llnamebox.h b/indra/newview/llnamebox.h index cb968e78d..0d5ec6a83 100644 --- a/indra/newview/llnamebox.h +++ b/indra/newview/llnamebox.h @@ -44,10 +44,9 @@ class LLNameBox : public LLTextBox { public: - LLNameBox(const std::string& name, const LLRect& rect, const LLUUID& name_id = LLUUID::null, BOOL is_group = FALSE, const LLFontGL* font = NULL, BOOL mouse_opaque = TRUE ); - // By default, follows top and left and is mouse-opaque. - // If no text, text = name. - // If no font, uses default system font. + virtual void initFromXML(LLXMLNodePtr node, LLView* parent); + static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); + virtual ~LLNameBox(); void setNameID(const LLUUID& name_id, BOOL is_group); @@ -56,11 +55,19 @@ public: static void refreshAll(const LLUUID& id, const std::string& full_name, bool is_group); +protected: + LLNameBox (const std::string& name); + + friend class LLUICtrlFactory; private: + void setName(const std::string& name, BOOL is_group); + static std::set sInstances; private: LLUUID mNameID; + BOOL mLink; + std::string mInitialValue; }; diff --git a/indra/newview/llnameeditor.cpp b/indra/newview/llnameeditor.cpp index 1fac553c0..d7c948d36 100644 --- a/indra/newview/llnameeditor.cpp +++ b/indra/newview/llnameeditor.cpp @@ -132,9 +132,6 @@ LLXMLNodePtr LLNameEditor::getXML(bool save_children) const LLView* LLNameEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("name_editor"); - node->getAttributeString("name", name); - LLRect rect; createRect(node, rect, parent, LLRect()); @@ -143,7 +140,7 @@ LLView* LLNameEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory LLFontGL* font = LLView::selectFont(node); - LLNameEditor* line_editor = new LLNameEditor(name, + LLNameEditor* line_editor = new LLNameEditor("name_editor", rect, LLUUID::null, FALSE, font, diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index 7c2b128d6..49f26ad4e 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -319,9 +319,6 @@ LLXMLNodePtr LLNameListCtrl::getXML(bool save_children) const LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("name_list"); - node->getAttributeString("name", name); - LLRect rect; createRect(node, rect, parent, LLRect()); @@ -337,7 +334,7 @@ LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto S32 name_column_index = 0; node->getAttributeS32("name_column_index", name_column_index); - LLNameListCtrl* name_list = new LLNameListCtrl(name, + LLNameListCtrl* name_list = new LLNameListCtrl("name_list", rect, multi_select, draw_border, diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp index 4ef005d0a..fcb924e9f 100644 --- a/indra/newview/lloverlaybar.cpp +++ b/indra/newview/lloverlaybar.cpp @@ -69,7 +69,7 @@ #include "llmediactrl.h" #include "llselectmgr.h" #include "wlfPanel_AdvSettings.h" - +#include "llpanelnearbymedia.h" @@ -90,7 +90,6 @@ LLOverlayBar *gOverlayBar = NULL; extern S32 MENU_BAR_HEIGHT; extern ImportTracker gImportTracker; -BOOL LLOverlayBar::sAdvSettingsPopup; BOOL LLOverlayBar::sChatVisible; // @@ -156,15 +155,15 @@ LLOverlayBar::LLOverlayBar() bool updateAdvSettingsPopup(const LLSD &data) { - LLOverlayBar::sAdvSettingsPopup = gSavedSettings.getBOOL("wlfAdvSettingsPopup"); + bool wfl_adv_settings_popup = gSavedSettings.getBOOL("wlfAdvSettingsPopup"); wlfPanel_AdvSettings::updateClass(); if(LLLayoutStack* layout_stack = gOverlayBar->findChild("overlay_layout_panel")) { LLLayoutPanel* layout_panel = layout_stack->findChild("AdvSettings_container"); if(layout_panel) { - layout_stack->collapsePanel(layout_panel,LLOverlayBar::sAdvSettingsPopup); - if(!LLOverlayBar::sAdvSettingsPopup) + layout_stack->collapsePanel(layout_panel,!wfl_adv_settings_popup); + if(wfl_adv_settings_popup) layout_panel->setTargetDim(layout_panel->getChild("Adv_Settings")->getBoundingRect().getWidth()); } } @@ -184,6 +183,11 @@ bool updateAORemote(const LLSD &data) return true; } +bool updateNearbyMediaFloater(const LLSD &data) +{ + LLFloaterNearbyMedia::updateClass(); + return true; +} BOOL LLOverlayBar::postBuild() { @@ -212,22 +216,26 @@ BOOL LLOverlayBar::postBuild() layoutButtons(); - sAdvSettingsPopup = gSavedSettings.getBOOL("wlfAdvSettingsPopup"); sChatVisible = gSavedSettings.getBOOL("ChatVisible"); - gSavedSettings.getControl("wlfAdvSettingsPopup")->getSignal()->connect(boost::bind(&updateAdvSettingsPopup,_2)); + LLControlVariable* wfl_adv_settings_popupp = gSavedSettings.getControl("wlfAdvSettingsPopup"); + wfl_adv_settings_popupp->getSignal()->connect(boost::bind(&updateAdvSettingsPopup,_2)); gSavedSettings.getControl("ChatVisible")->getSignal()->connect(boost::bind(&updateChatVisible,_2)); gSavedSettings.getControl("EnableAORemote")->getSignal()->connect(boost::bind(&updateAORemote,_2)); + gSavedSettings.getControl("ShowNearbyMediaFloater")->getSignal()->connect(boost::bind(&updateNearbyMediaFloater,_2)); + childSetVisible("ao_remote_container", gSavedSettings.getBOOL("EnableAORemote")); wlfPanel_AdvSettings::updateClass(); + + bool wfl_adv_settings_popup = wfl_adv_settings_popupp->getValue().asBoolean(); if(LLLayoutStack* layout_stack = findChild("overlay_layout_panel")) { LLLayoutPanel* layout_panel = layout_stack->findChild("AdvSettings_container"); if(layout_panel) { - layout_stack->collapsePanel(layout_panel,LLOverlayBar::sAdvSettingsPopup); - if(!LLOverlayBar::sAdvSettingsPopup) + layout_stack->collapsePanel(layout_panel,!wfl_adv_settings_popup); + if(wfl_adv_settings_popup) layout_panel->setTargetDim(layout_panel->getChild("Adv_Settings")->getBoundingRect().getWidth()); } } diff --git a/indra/newview/lloverlaybar.h b/indra/newview/lloverlaybar.h index a668d4fbd..1b8cf767d 100644 --- a/indra/newview/lloverlaybar.h +++ b/indra/newview/lloverlaybar.h @@ -99,7 +99,6 @@ public: void setCancelTPButtonVisible(BOOL b, const std::string& label); static BOOL sChatVisible; - static BOOL sAdvSettingsPopup; protected: static void* createMediaRemote(void* userdata); static void* createVoiceRemote(void* userdata); @@ -110,6 +109,7 @@ protected: void enableMediaButtons(); protected: + friend class LLFloaterNearbyMedia; //Crappy workaround to access mMediaRemote LLMediaRemoteCtrl* mMediaRemote; LLVoiceRemoteCtrl* mVoiceRemote; LLButton* mCancelBtn; diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index f215e8266..6b7a445c9 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -142,14 +142,7 @@ BOOL LLPanelGroupGeneral::postBuild() mBtnInfo->setClickedCallback(boost::bind(&LLPanelGroupGeneral::onClickInfo, this)); } - LLTextBox* founder = getChild("founder_name"); - if (founder) - { - mFounderName = new LLNameBox(founder->getName(),founder->getRect(),LLUUID::null,FALSE,founder->getFont(),founder->getMouseOpaque()); - removeChild(founder); - delete founder; - addChild(mFounderName); - } + mFounderName = getChild("founder_name"); mListVisibleMembers = getChild("visible_members", recurse); if (mListVisibleMembers) diff --git a/indra/newview/llpanelmediasettingspermissions.cpp b/indra/newview/llpanelmediasettingspermissions.cpp index 5f7042a3c..d9e5d4ad2 100644 --- a/indra/newview/llpanelmediasettingspermissions.cpp +++ b/indra/newview/llpanelmediasettingspermissions.cpp @@ -76,7 +76,7 @@ BOOL LLPanelMediaSettingsPermissions::postBuild() mPermsWorldInteract = getChild< LLCheckBoxCtrl >( LLPanelContents::PERMS_ANYONE_INTERACT_KEY ); mPermsWorldControl = getChild< LLCheckBoxCtrl >( LLPanelContents::PERMS_ANYONE_CONTROL_KEY ); - //mPermsGroupName = getChild< LLNameBox >( "perms_group_name" ); + mPermsGroupName = getChild< LLNameBox >( "perms_group_name" ); return true; } @@ -94,7 +94,7 @@ void LLPanelMediaSettingsPermissions::draw() // housekeeping LLPanel::draw(); - //getChild("perms_group_name")->setValue(LLStringUtil::null); + getChild("perms_group_name")->setValue(LLStringUtil::null); LLUUID group_id; BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); if (groups_identical) @@ -139,7 +139,7 @@ void LLPanelMediaSettingsPermissions::clearValues( void* userdata, bool editable self->getChild< LLTextBox >("controls_label")->setEnabled(editable); self->getChild< LLTextBox >("owner_label")->setEnabled(editable); self->getChild< LLTextBox >("group_label")->setEnabled(editable); - //self->getChild< LLNameBox >("perms_group_name")->setEnabled(editable); + self->getChild< LLNameBox >("perms_group_name")->setEnabled(editable); self->getChild< LLTextBox >("anyone_label")->setEnabled(editable); } @@ -218,7 +218,7 @@ void LLPanelMediaSettingsPermissions::initValues( void* userdata, const LLSD& me self->getChild< LLTextBox >("controls_label")->setEnabled(editable); self->getChild< LLTextBox >("owner_label")->setEnabled(editable); self->getChild< LLTextBox >("group_label")->setEnabled(editable); - //self->getChild< LLNameBox >("perms_group_name")->setEnabled(editable); + self->getChild< LLNameBox >("perms_group_name")->setEnabled(editable); self->getChild< LLTextBox >("anyone_label")->setEnabled(editable); } diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp new file mode 100644 index 000000000..0c7d3990d --- /dev/null +++ b/indra/newview/llpanelnearbymedia.cpp @@ -0,0 +1,1313 @@ +/** + * @file llpanelnearbymedia.cpp + * @brief Management interface for muting and controlling nearby media + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llpanelnearbymedia.h" + +#include "llaudioengine.h" +#include "llcheckboxctrl.h" +#include "llcombobox.h" +#include "llresizebar.h" +#include "llresizehandle.h" +#include "llscrolllistctrl.h" +#include "llslider.h" +#include "llsliderctrl.h" +#include "llagent.h" +#include "llagentui.h" +#include "llbutton.h" +#include "lltextbox.h" +#include "llviewermedia.h" +#include "llviewerparcelmedia.h" +#include "llviewerregion.h" +#include "llviewermediafocus.h" +#include "llviewerparcelmgr.h" +#include "llparcel.h" +#include "llpluginclassmedia.h" +#include "llvovolume.h" +#include "llstatusbar.h" +#include "llsdutil.h" +#include "llvieweraudio.h" +#include "lluictrlfactory.h" + +#include "llfloaterpreference.h" // for the gear icon +#include "lltabcontainer.h" + +#include + +#include "lloverlaybar.h" +#include "llmediaremotectrl.h" +#include "llchatbar.h" +#include "lltoolbar.h" + +extern LLControlGroup gSavedSettings; + +static const LLUUID PARCEL_MEDIA_LIST_ITEM_UUID = LLUUID("CAB5920F-E484-4233-8621-384CF373A321"); +static const LLUUID PARCEL_AUDIO_LIST_ITEM_UUID = LLUUID("DF4B020D-8A24-4B95-AB5D-CA970D694822"); + +// +// LLPanelNearByMedia +// + + +LLPanelNearByMedia::LLPanelNearByMedia(bool standalone_panel) +: mMediaList(NULL), + mEnableAllCtrl(NULL), + mAllMediaDisabled(false), + mDebugInfoVisible(false), + mParcelMediaItem(NULL), + mParcelAudioItem(NULL), + mStandalonePanel(standalone_panel) +{ + mHoverTimer.stop(); + + 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)); + mCommitCallbackRegistrar.add("MediaListCtrl.MoreLess", boost::bind(&LLPanelNearByMedia::onMoreLess, this)); + mCommitCallbackRegistrar.add("SelectedMediaCtrl.Stop", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaStop, this)); + mCommitCallbackRegistrar.add("SelectedMediaCtrl.Play", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaPlay, this)); + mCommitCallbackRegistrar.add("SelectedMediaCtrl.Pause", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaPause, this)); + mCommitCallbackRegistrar.add("SelectedMediaCtrl.Mute", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaMute, this)); + mCommitCallbackRegistrar.add("SelectedMediaCtrl.Volume", boost::bind(&LLPanelNearByMedia::onCommitSelectedMediaVolume, this)); + mCommitCallbackRegistrar.add("SelectedMediaCtrl.Zoom", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaZoom, this)); + mCommitCallbackRegistrar.add("SelectedMediaCtrl.Unzoom", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaUnzoom, this)); + + //buildFromFile( "panel_nearby_media.xml"); + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_nearby_media.xml"); +} + +LLPanelNearByMedia::~LLPanelNearByMedia() +{ + //Wipe the mInNearbyMediaList value for all impls since we don't need them anymore. + LLViewerMedia::impl_list impls = LLViewerMedia::getPriorityList(); + LLViewerMedia::impl_list::iterator priority_iter; + for(priority_iter = impls.begin(); priority_iter != impls.end(); priority_iter++) + { + (*priority_iter)->setInNearbyMediaList(false); + } +} + +BOOL LLPanelNearByMedia::postBuild() +{ + LLPanel::postBuild(); + + if(mStandalonePanel) + { + const S32 RESIZE_BAR_THICKNESS = 6; + LLResizeBar::Params p; + p.rect = LLRect(0, RESIZE_BAR_THICKNESS, getRect().getWidth(), 0); + p.name = "resizebar_bottom"; + p.min_size = getRect().getHeight(); + p.side = LLResizeBar::BOTTOM; + p.resizing_view = this; + addChild( LLUICtrlFactory::create(p) ); + + p.rect = LLRect( 0, getRect().getHeight(), RESIZE_BAR_THICKNESS, 0); + p.name = "resizebar_left"; + p.min_size = getRect().getWidth(); + p.side = LLResizeBar::LEFT; + addChild( LLUICtrlFactory::create(p) ); + + LLResizeHandle::Params resize_handle_p; + resize_handle_p.rect = LLRect( 0, RESIZE_HANDLE_HEIGHT, RESIZE_HANDLE_WIDTH, 0 ); + resize_handle_p.mouse_opaque(false); + resize_handle_p.min_width(getRect().getWidth()); + resize_handle_p.min_height(getRect().getHeight()); + resize_handle_p.corner(LLResizeHandle::LEFT_BOTTOM); + addChild(LLUICtrlFactory::create(resize_handle_p)); + } + + mNearbyMediaPanel = getChild("nearby_media_panel"); + mMediaList = getChild("media_list"); + mEnableAllCtrl = getChild("all_nearby_media_enable_btn"); + mDisableAllCtrl = getChild("all_nearby_media_disable_btn"); + mShowCtrl = getChild("show_combo"); + + // Dynamic (selection-dependent) controls + mStopCtrl = getChild("stop"); + mPlayCtrl = getChild("play"); + mPauseCtrl = getChild("pause"); + mMuteCtrl = getChild("mute"); + mVolumeSliderCtrl = getChild("volume_slider_ctrl"); + mZoomCtrl = getChild("zoom"); + mUnzoomCtrl = getChild("unzoom"); + mVolumeSlider = getChild("volume_slider"); + mMuteBtn = getChild("mute_btn"); + + mEmptyNameString = getString("empty_item_text"); + mParcelMediaName = getString("parcel_media_name"); + mParcelAudioName = getString("parcel_audio_name"); + mPlayingString = getString("playing_suffix"); + + mMediaList->setDoubleClickCallback(onZoomMedia, this); + mMediaList->sortByColumnIndex(PROXIMITY_COLUMN, TRUE); + mMediaList->sortByColumnIndex(VISIBILITY_COLUMN, FALSE); + + refreshList(); + updateControls(); + updateColumns(); + + LLView* minimized_controls = getChildView("minimized_controls"); + mMoreRect = getRect(); + mLessRect = getRect(); + mLessRect.mBottom = minimized_controls->getRect().mBottom; + + getChild("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) +{ + mHoverTimer.stop(); + LLPanel::onMouseEnter(x,y,mask); +} + + +/*virtual*/ +void LLPanelNearByMedia::onMouseLeave(S32 x, S32 y, MASK mask) +{ + if(mStandalonePanel) + mHoverTimer.start(); + LLPanel::onMouseLeave(x,y,mask); +} + +/*virtual*/ +void LLPanelNearByMedia::onTopLost() +{ + setVisible(FALSE); +} + + +/*virtual*/ +void LLPanelNearByMedia::handleVisibilityChange ( BOOL new_visibility ) +{ + if (mStandalonePanel && new_visibility) + { + mHoverTimer.start(); // timer will be stopped when mouse hovers over panel + } + else + { + mHoverTimer.stop(); + } +} + +/*virtual*/ +void LLPanelNearByMedia::reshape(S32 width, S32 height, BOOL called_from_parent) +{ + LLPanel::reshape(width, height, called_from_parent); + + LLButton* more_btn = findChild("more_btn"); + if (!mStandalonePanel || more_btn && more_btn->getValue().asBoolean()) + { + mMoreRect = getRect(); + } + +} + +const F32 AUTO_CLOSE_FADE_TIME_START= 4.0f; +const F32 AUTO_CLOSE_FADE_TIME_END = 5.0f; + +/*virtual*/ +void LLPanelNearByMedia::draw() +{ + // keep bottom of panel on screen + LLRect screen_rect = calcScreenRect(); + if (screen_rect.mBottom < 0) + { + LLRect new_rect = getRect(); + new_rect.mBottom += 0 - screen_rect.mBottom; + setShape(new_rect); + } + + refreshList(); + updateControls(); + + + F32 alpha = mHoverTimer.getStarted() + ? clamp_rescale(mHoverTimer.getElapsedTimeF32(), AUTO_CLOSE_FADE_TIME_START, AUTO_CLOSE_FADE_TIME_END, 1.f, 0.f) + : 1.0f; + + LLViewDrawContext context(alpha); + + LLPanel::draw(); + + if (alpha == 0.f) + { + setVisible(false); + } +} + +/*virtual*/ +BOOL LLPanelNearByMedia::handleHover(S32 x, S32 y, MASK mask) +{ + LLPanel::handleHover(x, y, mask); + + // If we are hovering over this panel, make sure to clear any hovered media + // ID. Note that the more general solution would be to clear this ID when + // the mouse leaves the in-scene view, but that proved to be problematic. + // See EXT-5517 + LLViewerMediaFocus::getInstance()->clearHover(); + + // Always handle + return true; +} + +bool LLPanelNearByMedia::getParcelAudioAutoStart() +{ + return mParcelAudioAutoStart; +} + +LLScrollListItem* LLPanelNearByMedia::addListItem(const LLUUID &id) +{ + if (NULL == mMediaList) return NULL; + + // Just set up the columns -- the values will be filled in by updateListItem(). + + LLSD row; + row["id"] = id; + + LLSD &columns = row["columns"]; + columns[CHECKBOX_COLUMN]["name"]="media_checkbox_ctrl"; + columns[CHECKBOX_COLUMN]["column"] = "media_checkbox_ctrl"; + columns[CHECKBOX_COLUMN]["type"] = "checkbox"; + //if(mDebugInfoVisible) + { + columns[PROXIMITY_COLUMN]["name"]="media_proximity"; + columns[PROXIMITY_COLUMN]["column"] = "media_proximity"; + columns[PROXIMITY_COLUMN]["value"] = ""; + columns[VISIBILITY_COLUMN]["name"]="media_visibility"; + columns[VISIBILITY_COLUMN]["column"] = "media_visibility"; + columns[VISIBILITY_COLUMN]["value"] = ""; + columns[CLASS_COLUMN]["name"]="media_class"; + columns[CLASS_COLUMN]["column"] = "media_class"; + columns[CLASS_COLUMN]["type"] = "text"; + columns[CLASS_COLUMN]["value"] = ""; + } + columns[NAME_COLUMN]["name"] = "media_name"; + columns[NAME_COLUMN]["column"] = "media_name"; + columns[NAME_COLUMN]["type"] = "text"; + columns[NAME_COLUMN]["value"] = ""; + //if(mDebugInfoVisible) + { + columns[DEBUG_COLUMN]["name"] = "media_debug"; + columns[DEBUG_COLUMN]["column"] = "media_debug"; + columns[DEBUG_COLUMN]["type"] = "text"; + columns[DEBUG_COLUMN]["value"] = ""; + } + + LLScrollListItem* new_item = mMediaList->addElement(row); + if (NULL != new_item) + { + LLScrollListCheck* scroll_list_check = dynamic_cast(new_item->getColumn(CHECKBOX_COLUMN)); + if (scroll_list_check) + { + LLCheckBoxCtrl *check = scroll_list_check->getCheckBox(); + check->setCommitCallback(boost::bind(&LLPanelNearByMedia::onCheckItem, this, _1, id)); + } + } + return new_item; +} + +extern char const* PRIORITYToString(LLViewerMediaImpl::EPriority priority); +void LLPanelNearByMedia::updateListItem(LLScrollListItem* item, LLViewerMediaImpl* impl) +{ + std::string item_name; + std::string item_tooltip; + std::string debug_str; + LLPanelNearByMedia::MediaClass media_class = MEDIA_CLASS_ALL; + + getNameAndUrlHelper(impl, item_name, item_tooltip, mEmptyNameString); + // Focused + if (impl->hasFocus()) + { + media_class = MEDIA_CLASS_FOCUSED; + } + // Is attached to another avatar? + else if (impl->isAttachedToAnotherAvatar()) + { + media_class = MEDIA_CLASS_ON_OTHERS; + } + // Outside agent parcel + else if (!impl->isInAgentParcel()) + { + media_class = MEDIA_CLASS_OUTSIDE_PARCEL; + } + else { + // inside parcel + media_class = MEDIA_CLASS_WITHIN_PARCEL; + } + + if(mDebugInfoVisible) + { + debug_str += llformat("%g/", (float)impl->getInterest()); + + // proximity distance is actually distance squared -- display it as straight distance. + debug_str += llformat("%g/", (F32) sqrt(impl->getProximityDistance())); + + // s += llformat("%g/", (float)impl->getCPUUsage()); + // s += llformat("%g/", (float)impl->getApproximateTextureInterest()); + debug_str += llformat("%g/", (float)(NULL == impl->getSomeObject()) ? 0.0 : impl->getSomeObject()->getPixelArea()); + + debug_str += PRIORITYToString(impl->getPriority()); + + if(impl->hasMedia()) + { + debug_str += '@'; + } + else if(impl->isPlayable()) + { + debug_str += '+'; + } + else if(impl->isForcedUnloaded()) + { + debug_str += '!'; + } + } + + updateListItem(item, + item_name, + item_tooltip, + impl->getProximity(), + impl->isMediaDisabled(), + impl->hasMedia(), + impl->isMediaTimeBased() && impl->isMediaPlaying(), + media_class, + debug_str); +} + +void LLPanelNearByMedia::updateListItem(LLScrollListItem* item, + const std::string &item_name, + const std::string &item_tooltip, + S32 proximity, + bool is_disabled, + bool has_media, + bool is_time_based_and_playing, + LLPanelNearByMedia::MediaClass media_class, + const std::string &debug_str) +{ + LLScrollListCell* cell = item->getColumn(PROXIMITY_COLUMN); + if(cell) + { + // since we are forced to sort by text, encode sort order as string + std::string proximity_string = STRINGIZE(proximity); + std::string old_proximity_string = cell->getValue().asString(); + if(proximity_string != old_proximity_string) + { + cell->setValue(proximity_string); + mMediaList->setNeedsSort(true); + } + } + + cell = item->getColumn(CHECKBOX_COLUMN); + if(cell) + { + cell->setValue(!is_disabled); + } + + cell = item->getColumn(VISIBILITY_COLUMN); + if(cell) + { + S32 old_visibility = cell->getValue(); + // *HACK ALERT: force ordering of Media before Audio before the rest of the list + S32 new_visibility = + item->getUUID() == PARCEL_MEDIA_LIST_ITEM_UUID ? 3 + : item->getUUID() == PARCEL_AUDIO_LIST_ITEM_UUID ? 2 + : (has_media) ? 1 + : ((is_disabled) ? 0 + : -1); + cell->setValue(STRINGIZE(new_visibility)); + if (new_visibility != old_visibility) + { + mMediaList->setNeedsSort(true); + } + } + + cell = item->getColumn(NAME_COLUMN); + if(cell) + { + std::string name = item_name; + std::string old_name = cell->getValue().asString(); + if (has_media) + { + name += " " + mPlayingString; + } + if (name != old_name) + { + cell->setValue(name); + } + item->setToolTip(item_tooltip); + + // *TODO: Make these font styles/colors configurable via XUI + U8 font_style = LLFontGL::NORMAL; + LLColor4 cell_color = LLColor4::black; + + // Only colorize by class in debug + if (mDebugInfoVisible) + { + switch (media_class) { + case MEDIA_CLASS_FOCUSED: + cell_color = LLColor4::yellow; + break; + case MEDIA_CLASS_ON_OTHERS: + cell_color = LLColor4::red; + break; + case MEDIA_CLASS_OUTSIDE_PARCEL: + cell_color = LLColor4::orange; + break; + case MEDIA_CLASS_WITHIN_PARCEL: + default: + break; + } + } + if (is_disabled) + { + if (mDebugInfoVisible) + { + font_style |= LLFontGL::ITALIC; + cell_color = LLColor4::black; + } + else { + // Dim it if it is disabled + cell_color.setAlpha(0.25); + } + } + // Dim it if it isn't "showing" + else if (!has_media) + { + cell_color.setAlpha(0.25); + } + // Bold it if it is time-based media and it is playing + else if (is_time_based_and_playing) + { + if (mDebugInfoVisible) font_style |= LLFontGL::BOLD; + } + cell->setColor(cell_color); + LLScrollListText *text_cell = dynamic_cast (cell); + if (text_cell) + { + text_cell->setFontStyle(font_style); + } + } + + cell = item->getColumn(CLASS_COLUMN); + if(cell) + { + // TODO: clean this up! + cell->setValue(STRINGIZE(media_class)); + } + + if(mDebugInfoVisible) + { + cell = item->getColumn(DEBUG_COLUMN); + if(cell) + { + cell->setValue(debug_str); + } + } +} + +void LLPanelNearByMedia::removeListItem(const LLUUID &id) +{ + if (NULL == mMediaList) return; + + mMediaList->deleteSingleItem(mMediaList->getItemIndex(id)); +} + +void LLPanelNearByMedia::refreshParcelItems() +{ + // + // First add/remove the "fake" items Parcel Media and Parcel Audio. + // These items will have special UUIDs + // PARCEL_MEDIA_LIST_ITEM_UUID + // PARCEL_AUDIO_LIST_ITEM_UUID + // + // Get the filter choice. + const LLSD &choice_llsd = mShowCtrl->getSelectedValue(); + MediaClass choice = (MediaClass)choice_llsd.asInteger(); + // Only show "special parcel items" if "All" or "Within" filter + // (and if media is "enabled") + bool should_include = (choice == MEDIA_CLASS_ALL || choice == MEDIA_CLASS_WITHIN_PARCEL); + + // First Parcel Media: add or remove it as necessary + if (gSavedSettings.getBOOL("AudioStreamingMedia") &&should_include && LLViewerMedia::hasParcelMedia()) + { + // Yes, there is parcel media. + if (NULL == mParcelMediaItem) + { + mParcelMediaItem = addListItem(PARCEL_MEDIA_LIST_ITEM_UUID); + mMediaList->setNeedsSort(true); + } + } + else { + if (NULL != mParcelMediaItem) { + removeListItem(PARCEL_MEDIA_LIST_ITEM_UUID); + mParcelMediaItem = NULL; + mMediaList->setNeedsSort(true); + } + } + + // ... then update it + if (NULL != mParcelMediaItem) + { + std::string name, url, tooltip; + getNameAndUrlHelper(LLViewerParcelMedia::getParcelMedia(), name, url, ""); + if (name.empty() || name == url) + { + tooltip = url; + } + else + { + tooltip = name + " : " + url; + } + LLViewerMediaImpl *impl = LLViewerParcelMedia::getParcelMedia(); + updateListItem(mParcelMediaItem, + mParcelMediaName, + tooltip, + -2, // Proximity closer than anything else, before Parcel Audio + impl == NULL || impl->isMediaDisabled(), + impl != NULL && !LLViewerParcelMedia::getURL().empty(), + impl != NULL && impl->isMediaTimeBased() && impl->isMediaPlaying(), + MEDIA_CLASS_ALL, + "parcel media"); + } + + // Next Parcel Audio: add or remove it as necessary (don't show if disabled in prefs) + if (should_include && LLViewerMedia::hasParcelAudio() && gSavedSettings.getBOOL("AudioStreamingMusic")) + { + // Yes, there is parcel audio. + if (NULL == mParcelAudioItem) + { + mParcelAudioItem = addListItem(PARCEL_AUDIO_LIST_ITEM_UUID); + mMediaList->setNeedsSort(true); + } + } + else { + if (NULL != mParcelAudioItem) { + removeListItem(PARCEL_AUDIO_LIST_ITEM_UUID); + mParcelAudioItem = NULL; + mMediaList->setNeedsSort(true); + } + } + + // ... then update it + if (NULL != mParcelAudioItem) + { + bool is_playing = LLViewerMedia::isParcelAudioPlaying(); + + std::string url; + url = LLViewerMedia::getParcelAudioURL(); + + updateListItem(mParcelAudioItem, + mParcelAudioName, + url, + -1, // Proximity after Parcel Media, but closer than anything else + (!is_playing), + is_playing, + is_playing, + MEDIA_CLASS_ALL, + "parcel audio"); + } +} + +void LLPanelNearByMedia::refreshList() +{ + bool all_items_deleted = false; + + if(!mMediaList) + { + // None of this makes any sense if the media list isn't there. + return; + } + + // Check whether the debug column has been shown/hidden. + bool debug_info_visible = gSavedSettings.getBOOL("MediaPerformanceManagerDebug"); + if(debug_info_visible != mDebugInfoVisible) + { + mDebugInfoVisible = debug_info_visible; + + // Clear all items so the list gets regenerated. + mMediaList->deleteAllItems(); + mParcelAudioItem = NULL; + mParcelMediaItem = NULL; + all_items_deleted = true; + + updateColumns(); + } + + refreshParcelItems(); + + // Get the canonical list from LLViewerMedia + LLViewerMedia::impl_list impls = LLViewerMedia::getPriorityList(); + LLViewerMedia::impl_list::iterator priority_iter; + + U32 enabled_count = 0; + U32 disabled_count = 0; + + // iterate over the impl list, creating rows as necessary. + for(priority_iter = impls.begin(); priority_iter != impls.end(); priority_iter++) + { + LLViewerMediaImpl *impl = *priority_iter; + + // If we just emptied out the list, every flag needs to be reset. + if(all_items_deleted) + { + impl->setInNearbyMediaList(false); + } + + if (!impl->isParcelMedia()) + { + LLUUID media_id = impl->getMediaTextureID(); + S32 proximity = impl->getProximity(); + // This is expensive (i.e. a linear search) -- don't use it here. We now use mInNearbyMediaList instead. + //S32 index = mMediaList->getItemIndex(media_id); + if (proximity < 0 || !shouldShow(impl)) + { + if (impl->getInNearbyMediaList()) + { + // There's a row for this impl -- remove it. + removeListItem(media_id); + impl->setInNearbyMediaList(false); + } + } + else + { + if (!impl->getInNearbyMediaList()) + { + // We don't have a row for this impl -- add one. + addListItem(media_id); + impl->setInNearbyMediaList(true); + } + } + // Update counts + if (impl->isMediaDisabled()) + { + disabled_count++; + } + else { + enabled_count++; + } + } + } + mDisableAllCtrl->setEnabled((gSavedSettings.getBOOL("AudioStreamingMusic") || + gSavedSettings.getBOOL("AudioStreamingMedia")) && + (LLViewerMedia::isAnyMediaShowing() || + LLViewerMedia::isParcelMediaPlaying() || + LLViewerMedia::isParcelAudioPlaying())); + + mEnableAllCtrl->setEnabled( (gSavedSettings.getBOOL("AudioStreamingMusic") || + gSavedSettings.getBOOL("AudioStreamingMedia")) && + (disabled_count > 0 || + // parcel media (if we have it, and it isn't playing, enable "start") + (LLViewerMedia::hasParcelMedia() && ! LLViewerMedia::isParcelMediaPlaying()) || + // parcel audio (if we have it, and it isn't playing, enable "start") + (LLViewerMedia::hasParcelAudio() && ! LLViewerMedia::isParcelAudioPlaying()))); + + // Iterate over the rows in the control, updating ones whose impl exists, and deleting ones whose impl has gone away. + std::vector items = mMediaList->getAllData(); + + for (std::vector::iterator item_it = items.begin(); + item_it != items.end(); + ++item_it) + { + LLScrollListItem* item = (*item_it); + LLUUID row_id = item->getUUID(); + + if (row_id != PARCEL_MEDIA_LIST_ITEM_UUID && + row_id != PARCEL_AUDIO_LIST_ITEM_UUID) + { + LLViewerMediaImpl* impl = LLViewerMedia::getMediaImplFromTextureID(row_id); + if(impl) + { + updateListItem(item, impl); + } + else + { + // This item's impl has been deleted -- remove the row. + // Removing the row won't throw off our iteration, since we have a local copy of the array. + // We just need to make sure we don't access this item after the delete. + removeListItem(row_id); + } + } + } + + // Set the selection to whatever media impl the media focus/hover is on. + // This is an experiment, and can be removed by ifdefing out these 4 lines. + LLUUID media_target = LLViewerMediaFocus::getInstance()->getControlsMediaID(); + if(media_target.notNull()) + { + mMediaList->selectByID(media_target); + } +} + +void LLPanelNearByMedia::updateColumns() +{ + if (!mDebugInfoVisible) + { + if (mMediaList->getColumn(CHECKBOX_COLUMN)) mMediaList->getColumn(VISIBILITY_COLUMN)->setWidth(-1); + if (mMediaList->getColumn(VISIBILITY_COLUMN)) mMediaList->getColumn(VISIBILITY_COLUMN)->setWidth(-1); + if (mMediaList->getColumn(PROXIMITY_COLUMN)) mMediaList->getColumn(PROXIMITY_COLUMN)->setWidth(-1); + if (mMediaList->getColumn(CLASS_COLUMN)) mMediaList->getColumn(CLASS_COLUMN)->setWidth(-1); + if (mMediaList->getColumn(DEBUG_COLUMN)) mMediaList->getColumn(DEBUG_COLUMN)->setWidth(-1); + } + else { + if (mMediaList->getColumn(CHECKBOX_COLUMN)) mMediaList->getColumn(VISIBILITY_COLUMN)->setWidth(20); + if (mMediaList->getColumn(VISIBILITY_COLUMN)) mMediaList->getColumn(VISIBILITY_COLUMN)->setWidth(20); + if (mMediaList->getColumn(PROXIMITY_COLUMN)) mMediaList->getColumn(PROXIMITY_COLUMN)->setWidth(30); + if (mMediaList->getColumn(CLASS_COLUMN)) mMediaList->getColumn(CLASS_COLUMN)->setWidth(20); + if (mMediaList->getColumn(DEBUG_COLUMN)) mMediaList->getColumn(DEBUG_COLUMN)->setWidth(200); + } +} + +void LLPanelNearByMedia::onClickEnableAll() +{ + LLViewerMedia::setAllMediaEnabled(true); +} + +void LLPanelNearByMedia::onClickDisableAll() +{ + LLViewerMedia::setAllMediaEnabled(false); +} + +void LLPanelNearByMedia::onClickEnableParcelMedia() +{ + if ( ! LLViewerMedia::isParcelMediaPlaying() ) + { + LLViewerParcelMedia::play(LLViewerParcelMgr::getInstance()->getAgentParcel()); + } +} + +void LLPanelNearByMedia::onClickDisableParcelMedia() +{ + // This actually unloads the impl, as opposed to "stop"ping the media + LLViewerParcelMedia::stop(); +} + +void LLPanelNearByMedia::onCheckItem(LLUICtrl* ctrl, const LLUUID &row_id) +{ + LLCheckBoxCtrl* check = static_cast(ctrl); + + setDisabled(row_id, ! check->getValue()); +} + +bool LLPanelNearByMedia::setDisabled(const LLUUID &row_id, bool disabled) +{ + if (row_id == PARCEL_AUDIO_LIST_ITEM_UUID) + { + if (disabled) + { + onClickParcelAudioStop(); + } + else + { + onClickParcelAudioPlay(); + } + return true; + } + else if (row_id == PARCEL_MEDIA_LIST_ITEM_UUID) + { + if (disabled) + { + onClickDisableParcelMedia(); + } + else + { + onClickEnableParcelMedia(); + } + return true; + } + else { + LLViewerMediaImpl* impl = LLViewerMedia::getMediaImplFromTextureID(row_id); + if(impl) + { + impl->setDisabled(disabled, true); + return true; + } + } + return false; +} + +//static +void LLPanelNearByMedia::onZoomMedia(void* user_data) +{ + LLPanelNearByMedia* panelp = (LLPanelNearByMedia*)user_data; + LLUUID media_id = panelp->mMediaList->getValue().asUUID(); + + LLViewerMediaFocus::getInstance()->focusZoomOnMedia(media_id); +} + +void LLPanelNearByMedia::onClickParcelMediaPlay() +{ + LLViewerParcelMedia::play(LLViewerParcelMgr::getInstance()->getAgentParcel()); +} + +void LLPanelNearByMedia::onClickParcelMediaStop() +{ + if (LLViewerParcelMedia::getParcelMedia()) + { + // This stops the media playing, as opposed to unloading it like + // LLViewerParcelMedia::stop() does + LLViewerParcelMedia::getParcelMedia()->stop(); + } +} + +void LLPanelNearByMedia::onClickParcelMediaPause() +{ + LLViewerParcelMedia::pause(); +} + +void LLPanelNearByMedia::onClickParcelAudioPlay() +{ + // User *explicitly* started the internet stream, so keep the stream + // playing and updated as they cross to other parcels etc. + mParcelAudioAutoStart = true; + if (!gAudiop) + return; + + if (LLAudioEngine::AUDIO_PAUSED == gAudiop->isInternetStreamPlaying()) + { + // 'false' means unpause + gAudiop->pauseInternetStream(false); + } + else + { + gAudiop->startInternetStream(LLViewerMedia::getParcelAudioURL()); + } +} + +void LLPanelNearByMedia::onClickParcelAudioStop() +{ + // User *explicitly* stopped the internet stream, so don't + // re-start audio when i.e. they move to another parcel, until + // they explicitly start it again. + mParcelAudioAutoStart = false; + if (!gAudiop) + return; + + gAudiop->stopInternetStream(); +} + +void LLPanelNearByMedia::onClickParcelAudioPause() +{ + if (!gAudiop) + return; + + // 'true' means pause + gAudiop->pauseInternetStream(true); +} + +bool LLPanelNearByMedia::shouldShow(LLViewerMediaImpl* impl) +{ + const LLSD &choice_llsd = mShowCtrl->getSelectedValue(); + MediaClass choice = (MediaClass)choice_llsd.asInteger(); + + switch (choice) + { + case MEDIA_CLASS_ALL: + return true; + break; + case MEDIA_CLASS_WITHIN_PARCEL: + return impl->isInAgentParcel(); + break; + case MEDIA_CLASS_OUTSIDE_PARCEL: + return ! impl->isInAgentParcel(); + break; + case MEDIA_CLASS_ON_OTHERS: + return impl->isAttachedToAnotherAvatar(); + break; + default: + break; + } + return true; +} + +void LLPanelNearByMedia::onAdvancedButtonClick() +{ + // bring up the prefs floater + + LLFloaterPreference::show(NULL); + LLFloaterPreference* prefsfloater = LLFloaterPreference::sInstance; + + if (prefsfloater) + { + // grab the 'audio' panel from the preferences floater and + // bring it the front! + LLTabContainer* tabcontainer = prefsfloater->getChild("pref core"); + if (tabcontainer) + { + tabcontainer->selectTabByName("Media Panel"); + } + } +} + +void LLPanelNearByMedia::onMoreLess() +{ + bool is_more = !mStandalonePanel || getChild("more_btn")->getToggleState(); + mNearbyMediaPanel->setVisible(is_more); + + // enable resizing when expanded + getChildView("resizebar_bottom")->setEnabled(is_more); + + LLRect new_rect = is_more ? mMoreRect : mLessRect; + new_rect.translate(getRect().mRight - new_rect.mRight, getRect().mTop - new_rect.mTop); + + setShape(new_rect); + + getChild("more_btn")->setVisible(mStandalonePanel); +} + +void LLPanelNearByMedia::updateControls() +{ + LLUUID selected_media_id = mMediaList->getValue().asUUID(); + + if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID) + { + if (!LLViewerMedia::hasParcelAudio() || !gSavedSettings.getBOOL("AudioStreamingMusic")) + { + // disable controls if audio streaming music is disabled from preference + showDisabledControls(); + } + else { + showTimeBasedControls(LLViewerMedia::isParcelAudioPlaying(), + false, // include_zoom + false, // is_zoomed + gSavedSettings.getBOOL("MuteMusic"), + gSavedSettings.getF32("AudioLevelMusic") ); + } + } + else if (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) + { + if (!LLViewerMedia::hasParcelMedia() || !gSavedSettings.getBOOL("AudioStreamingMedia")) + { + // disable controls if audio streaming media is disabled from preference + showDisabledControls(); + } + else { + LLViewerMediaImpl* impl = LLViewerParcelMedia::getParcelMedia(); + if (NULL == impl) + { + // Just means it hasn't started yet + showBasicControls(false, false, false, false, 0); + } + else if (impl->isMediaTimeBased()) + { + showTimeBasedControls(impl->isMediaPlaying(), + false, // include_zoom + false, // is_zoomed + impl->getVolume() == 0.0, + impl->getVolume() ); + } + else { + // non-time-based parcel media + showBasicControls(LLViewerMedia::isParcelMediaPlaying(), + false, + false, + impl->getVolume() == 0.0, + impl->getVolume()); + } + } + } + else { + LLViewerMediaImpl* impl = LLViewerMedia::getMediaImplFromTextureID(selected_media_id); + + if (NULL == impl || !gSavedSettings.getBOOL("AudioStreamingMedia")) + { + showDisabledControls(); + } + else { + if (impl->isMediaTimeBased()) + { + showTimeBasedControls(impl->isMediaPlaying(), + ! impl->isParcelMedia(), // include_zoom + LLViewerMediaFocus::getInstance()->isZoomed(), + impl->getVolume() == 0.0, + impl->getVolume()); + } + else { + showBasicControls(!impl->isMediaDisabled(), + ! impl->isParcelMedia(), // include_zoom + LLViewerMediaFocus::getInstance()->isZoomed(), + impl->getVolume() == 0.0, + impl->getVolume()); + } + } + } +} + +void LLPanelNearByMedia::showBasicControls(bool playing, bool include_zoom, bool is_zoomed, bool muted, F32 volume) +{ + mStopCtrl->setVisible(playing); + mPlayCtrl->setVisible(!playing); + mPauseCtrl->setVisible(false); + mVolumeSliderCtrl->setVisible(true); + mMuteCtrl->setVisible(true); + mMuteBtn->setValue(muted); + mVolumeSlider->setValue(volume); + mZoomCtrl->setVisible(include_zoom && !is_zoomed); + mUnzoomCtrl->setVisible(include_zoom && is_zoomed); + mStopCtrl->setEnabled(true); + mZoomCtrl->setEnabled(true); +} + +void LLPanelNearByMedia::showTimeBasedControls(bool playing, bool include_zoom, bool is_zoomed, bool muted, F32 volume) +{ + mStopCtrl->setVisible(true); + mPlayCtrl->setVisible(!playing); + mPauseCtrl->setVisible(playing); + mMuteCtrl->setVisible(true); + mVolumeSliderCtrl->setVisible(true); + mZoomCtrl->setVisible(include_zoom); + mZoomCtrl->setVisible(include_zoom && !is_zoomed); + mUnzoomCtrl->setVisible(include_zoom && is_zoomed); + mStopCtrl->setEnabled(true); + mZoomCtrl->setEnabled(true); + mMuteBtn->setValue(muted); + mVolumeSlider->setValue(volume); +} + +void LLPanelNearByMedia::showDisabledControls() +{ + mStopCtrl->setVisible(true); + mPlayCtrl->setVisible(false); + mPauseCtrl->setVisible(false); + mMuteCtrl->setVisible(false); + mVolumeSliderCtrl->setVisible(false); + mZoomCtrl->setVisible(true); + mUnzoomCtrl->setVisible(false); + mStopCtrl->setEnabled(false); + mZoomCtrl->setEnabled(false); +} + +void LLPanelNearByMedia::onClickSelectedMediaStop() +{ + setDisabled(mMediaList->getValue().asUUID(), true); +} + +void LLPanelNearByMedia::onClickSelectedMediaPlay() +{ + LLUUID selected_media_id = mMediaList->getValue().asUUID(); + + // First enable it + setDisabled(selected_media_id, false); + + // Special code to make play "unpause" if time-based and playing + if (selected_media_id != PARCEL_AUDIO_LIST_ITEM_UUID) + { + LLViewerMediaImpl *impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ? + ((LLViewerMediaImpl*)LLViewerParcelMedia::getParcelMedia()) : LLViewerMedia::getMediaImplFromTextureID(selected_media_id); + if (NULL != impl) + { + if (impl->isMediaTimeBased() && impl->isMediaPaused()) + { + // Aha! It's really time-based media that's paused, so unpause + impl->play(); + return; + } + else if (impl->isParcelMedia()) + { + LLViewerParcelMedia::play(LLViewerParcelMgr::getInstance()->getAgentParcel()); + } + } + } +} + +void LLPanelNearByMedia::onClickSelectedMediaPause() +{ + LLUUID selected_media_id = mMediaList->getValue().asUUID(); + if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID) + { + onClickParcelAudioPause(); + } + else if (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) + { + onClickParcelMediaPause(); + } + else { + LLViewerMediaImpl* impl = LLViewerMedia::getMediaImplFromTextureID(selected_media_id); + if (NULL != impl && impl->isMediaTimeBased() && impl->isMediaPlaying()) + { + impl->pause(); + } + } +} + +void LLPanelNearByMedia::onClickSelectedMediaMute() +{ + LLUUID selected_media_id = mMediaList->getValue().asUUID(); + if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID) + { + gSavedSettings.setBOOL("MuteMusic", mMuteBtn->getValue()); + } + else { + LLViewerMediaImpl* impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ? + ((LLViewerMediaImpl*)LLViewerParcelMedia::getParcelMedia()) : LLViewerMedia::getMediaImplFromTextureID(selected_media_id); + if (NULL != impl) + { + F32 volume = impl->getVolume(); + if(volume > 0.0) + { + impl->setVolume(0.0); + } + else if (mVolumeSlider->getValueF32() == 0.0) + { + impl->setVolume(1.0); + mVolumeSlider->setValue(1.0); + } + else + { + impl->setVolume(mVolumeSlider->getValueF32()); + } + } + } +} + +void LLPanelNearByMedia::onCommitSelectedMediaVolume() +{ + LLUUID selected_media_id = mMediaList->getValue().asUUID(); + if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID) + { + F32 vol = mVolumeSlider->getValueF32(); + gSavedSettings.setF32("AudioLevelMusic", vol); + } + else { + LLViewerMediaImpl* impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ? + ((LLViewerMediaImpl*)LLViewerParcelMedia::getParcelMedia()) : LLViewerMedia::getMediaImplFromTextureID(selected_media_id); + if (NULL != impl) + { + impl->setVolume(mVolumeSlider->getValueF32()); + } + } +} + +void LLPanelNearByMedia::onClickSelectedMediaZoom() +{ + LLUUID selected_media_id = mMediaList->getValue().asUUID(); + if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID || selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) + return; + LLViewerMediaFocus::getInstance()->focusZoomOnMedia(selected_media_id); +} + +void LLPanelNearByMedia::onClickSelectedMediaUnzoom() +{ + LLViewerMediaFocus::getInstance()->unZoom(); +} + + +// static +void LLPanelNearByMedia::getNameAndUrlHelper(LLViewerMediaImpl* impl, std::string& name, std::string & url, const std::string &defaultName) +{ + if (NULL == impl) return; + + name = impl->getName(); + url = impl->getCurrentMediaURL(); // This is the URL the media impl actually has loaded + if (url.empty()) + { + url = impl->getMediaEntryURL(); // This is the current URL from the media data + } + if (url.empty()) + { + url = impl->getHomeURL(); // This is the home URL from the media data + } + if (name.empty()) + { + name = url; + } + if (name.empty()) + { + name = defaultName; + } +} + +// static +void* createNearbyMediaPanel(void* userdata) +{ + return new LLPanelNearByMedia(false); +} + +LLFloaterNearbyMedia::LLFloaterNearbyMedia() +{ + mFactoryMap["nearby_media"] = LLCallbackMap(createNearbyMediaPanel, this); + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_nearby_media.xml",&mFactoryMap,false); +} + +// static +void LLFloaterNearbyMedia::updateClass() +{ + if(gSavedSettings.getBOOL("ShowNearbyMediaFloater")) + LLFloaterNearbyMedia::getInstance()->open(); + else if(LLFloaterNearbyMedia::instanceExists()) + LLFloaterNearbyMedia::getInstance()->close(); +} + +void LLFloaterNearbyMedia::onClose(bool app_quitting) +{ + if(!app_quitting) + gSavedSettings.setBOOL("ShowNearbyMediaFloater", false); + LLFloater::onClose(app_quitting); +} + +void LLFloaterNearbyMedia::onOpen() +{ + //Mess around with control rect to not change unless the user actually tweaked it.. + LLRect rect = gSavedSettings.getRect("FloaterNearbyMediaRect"); + if(!rect.isEmpty()) + { + setRectControl("FloaterNearbyMediaRect"); + applyRectControl(); + } + else + { + const LLRect media_rect = gOverlayBar->mMediaRemote->calcScreenRect(); + setOrigin(media_rect.mLeft - getRect().getWidth(), media_rect.mBottom + gOverlayBar->mChatBar->getRect().getHeight()); + } + gSavedSettings.setBOOL("ShowNearbyMediaFloater", true); +} + +// virtual +void LLFloaterNearbyMedia::handleReshape(const LLRect& new_rect, bool by_user) +{ + if(by_user && getRectControl().empty()) + { + setRectControl("FloaterNearbyMediaRect"); + } + LLFloater::handleReshape(new_rect, by_user); +} + diff --git a/indra/newview/llpanelnearbymedia.h b/indra/newview/llpanelnearbymedia.h new file mode 100644 index 000000000..e6d0a4d9b --- /dev/null +++ b/indra/newview/llpanelnearbymedia.h @@ -0,0 +1,198 @@ +/** + * @file llpanelnearbymedia.h + * @brief Management interface for muting and controlling nearby media + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLPANELNEARBYMEDIA_H +#define LL_LLPANELNEARBYMEDIA_H + +#include "llpanel.h" +#include "llfloater.h" +#include "llsingleton.h" + +class LLPanelNearbyMedia; +class LLButton; +class LLScrollListCtrl; +class LLSlider; +class LLSliderCtrl; +class LLCheckBoxCtrl; +class LLTextBox; +class LLComboBox; +class LLViewerMediaImpl; + +class LLPanelNearByMedia : public LLPanel +{ +public: + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void draw(); + /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask); + /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); + /*virtual*/ void onTopLost(); + /*virtual*/ void handleVisibilityChange ( BOOL new_visibility ); + /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent); + /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + + // this is part of the nearby media *dialog* so we can track whether + // the user *implicitly* wants audio on or off via their *explicit* + // interaction with our buttons. + bool getParcelAudioAutoStart(); + + // callback for when the auto play media preference changes + // to update mParcelAudioAutoStart + void handleMediaAutoPlayChanged(const LLSD& newvalue); + + LLPanelNearByMedia(bool standalone_panel = true); + virtual ~LLPanelNearByMedia(); + +private: + + enum ColumnIndex { + CHECKBOX_COLUMN = 0, + PROXIMITY_COLUMN = 1, + VISIBILITY_COLUMN = 2, + CLASS_COLUMN = 3, + NAME_COLUMN = 4, + DEBUG_COLUMN = 5 + }; + + // Media "class" enumeration + enum MediaClass { + MEDIA_CLASS_ALL = 0, + MEDIA_CLASS_FOCUSED = 1, + MEDIA_CLASS_WITHIN_PARCEL = 2, + MEDIA_CLASS_OUTSIDE_PARCEL = 3, + MEDIA_CLASS_ON_OTHERS = 4 + }; + + // Add/remove an LLViewerMediaImpl to/from the list + LLScrollListItem* addListItem(const LLUUID &id); + void updateListItem(LLScrollListItem* item, LLViewerMediaImpl* impl); + void updateListItem(LLScrollListItem* item, + const std::string &item_name, + const std::string &item_tooltip, + S32 proximity, + bool is_disabled, + bool has_media, + bool is_time_based_and_playing, + MediaClass media_class, + const std::string &debug_str); + void removeListItem(const LLUUID &id); + + // Refresh the list in the UI + void refreshList(); + + void refreshParcelItems(); + + // UI Callbacks + void onClickEnableAll(); + void onClickDisableAll(); + void onClickEnableParcelMedia(); + void onClickDisableParcelMedia(); + void onClickMuteParcelMedia(); + void onParcelMediaVolumeSlider(); + void onClickParcelMediaPlay(); + void onClickParcelMediaStop(); + void onClickParcelMediaPause(); + void onClickParcelAudioPlay(); + void onClickParcelAudioStop(); + void onClickParcelAudioPause(); + void onCheckAutoPlay(); + void onAdvancedButtonClick(); + void onMoreLess(); + + void onCheckItem(LLUICtrl* ctrl, const LLUUID &row_id); + + static void onZoomMedia(void* user_data); + +private: + bool setDisabled(const LLUUID &id, bool disabled); + + static void getNameAndUrlHelper(LLViewerMediaImpl* impl, std::string& name, std::string & url, const std::string &defaultName); + + void updateColumns(); + + bool shouldShow(LLViewerMediaImpl* impl); + + void showBasicControls(bool playing, bool include_zoom, bool is_zoomed, bool muted, F32 volume); + void showTimeBasedControls(bool playing, bool include_zoom, bool is_zoomed, bool muted, F32 volume); + void showDisabledControls(); + void updateControls(); + + void onClickSelectedMediaStop(); + void onClickSelectedMediaPlay(); + void onClickSelectedMediaPause(); + void onClickSelectedMediaMute(); + void onCommitSelectedMediaVolume(); + void onClickSelectedMediaZoom(); + void onClickSelectedMediaUnzoom(); + + LLUICtrl* mNearbyMediaPanel; + LLScrollListCtrl* mMediaList; + LLUICtrl* mEnableAllCtrl; + LLUICtrl* mDisableAllCtrl; + LLComboBox* mShowCtrl; + + // Dynamic (selection-dependent) controls + LLUICtrl* mStopCtrl; + LLUICtrl* mPlayCtrl; + LLUICtrl* mPauseCtrl; + LLUICtrl* mMuteCtrl; + LLUICtrl* mVolumeSliderCtrl; + LLUICtrl* mZoomCtrl; + LLUICtrl* mUnzoomCtrl; + LLSlider* mVolumeSlider; + LLButton* mMuteBtn; + + bool mAllMediaDisabled; + bool mDebugInfoVisible; + bool mParcelAudioAutoStart; + std::string mEmptyNameString; + std::string mPlayingString; + std::string mParcelMediaName; + std::string mParcelAudioName; + + LLRect mMoreRect; + LLRect mLessRect; + LLFrameTimer mHoverTimer; + LLScrollListItem* mParcelMediaItem; + LLScrollListItem* mParcelAudioItem; + + bool mStandalonePanel; +}; + +class LLFloaterNearbyMedia : public LLFloater, public LLSingleton +{ +public: + LLFloaterNearbyMedia(); + + static void updateClass(); + + /*virtual*/ void onClose(bool app_quitting); + /*virtual*/ void onOpen(); + + virtual void handleReshape(const LLRect& new_rect, bool by_user); +}; + +#endif // LL_LLPANELNEARBYMEDIA_H diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 44ba523b8..6224935fc 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -4207,8 +4207,6 @@ bool process_login_success_response(std::string& password) LLViewerMedia::openIDSetup(openid_url, openid_token); } - gIMMgr->loadIgnoreGroup(); - bool success = false; // JC: gesture loading done below, when we have an asset system // in place. Don't delete/clear user_credentials until then. diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index ea0ac8b94..f125d2ca5 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -1175,9 +1175,6 @@ LLXMLNodePtr LLTextureCtrl::getXML(bool save_children) const LLView* LLTextureCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("texture_picker"); - node->getAttributeString("name", name); - LLRect rect; createRect(node, rect, parent); @@ -1208,7 +1205,7 @@ LLView* LLTextureCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactor } LLTextureCtrl* texture_picker = new LLTextureCtrl( - name, + "texture_picker", rect, label, LLUUID(image_id), diff --git a/indra/newview/llviewermedia_streamingaudio.cpp b/indra/newview/llviewermedia_streamingaudio.cpp index 6adff36c6..de7bfc767 100644 --- a/indra/newview/llviewermedia_streamingaudio.cpp +++ b/indra/newview/llviewermedia_streamingaudio.cpp @@ -35,6 +35,7 @@ #include "linden_common.h" #include "llpluginclassmedia.h" +#include "llpluginclassmediaowner.h" #include "llviewermedia.h" #include "llviewermedia_streamingaudio.h" @@ -63,18 +64,18 @@ void LLStreamingAudio_MediaPlugins::start(const std::string& url) if (!mMediaPlugin) // lazy-init the underlying media plugin { mMediaPlugin = initializeMedia("audio/mpeg"); // assumes that whatever media implementation supports mp3 also supports vorbis. - llinfos << "mMediaPlugin is now " << mMediaPlugin << llendl; + llinfos << "streaming audio mMediaPlugin is now " << mMediaPlugin << llendl; } if(!mMediaPlugin) return; - + if (!url.empty()) { llinfos << "Starting internet stream: " << url << llendl; mURL = url; mMediaPlugin->loadURI ( url ); mMediaPlugin->start(); - llinfos << "Playing....." << llendl; + llinfos << "Playing stream..." << llendl; } else { llinfos << "setting stream to NULL"<< llendl; mURL.clear(); @@ -84,11 +85,9 @@ void LLStreamingAudio_MediaPlugins::start(const std::string& url) void LLStreamingAudio_MediaPlugins::stop() { - llinfos << "entered LLStreamingAudio_MediaPlugins::stop()" << llendl; - + llinfos << "Stopping internet stream." << llendl; if(mMediaPlugin) { - llinfos << "Stopping internet stream: " << mURL << llendl; mMediaPlugin->stop(); } @@ -102,10 +101,12 @@ void LLStreamingAudio_MediaPlugins::pause(int pause) if(pause) { + llinfos << "Pausing internet stream." << llendl; mMediaPlugin->pause(); } else { + llinfos << "Unpausing internet stream." << llendl; mMediaPlugin->start(); } } @@ -119,20 +120,21 @@ void LLStreamingAudio_MediaPlugins::update() int LLStreamingAudio_MediaPlugins::isPlaying() { if (!mMediaPlugin) - return 0; + return 0; // stopped - // *TODO: can probably do better than this - if (mMediaPlugin->isPluginRunning()) - { - return 1; // Active and playing - } + LLPluginClassMediaOwner::EMediaStatus status = + mMediaPlugin->getStatus(); - if (mMediaPlugin->isPluginExited()) + switch (status) { + case LLPluginClassMediaOwner::MEDIA_LOADING: // but not MEDIA_LOADED + case LLPluginClassMediaOwner::MEDIA_PLAYING: + return 1; // Active and playing + case LLPluginClassMediaOwner::MEDIA_PAUSED: + return 2; // paused + default: return 0; // stopped } - - return 2; // paused } void LLStreamingAudio_MediaPlugins::setGain(F32 vol) diff --git a/indra/newview/llviewerparcelmediaautoplay.cpp b/indra/newview/llviewerparcelmediaautoplay.cpp index 523fc0e29..ecd887440 100644 --- a/indra/newview/llviewerparcelmediaautoplay.cpp +++ b/indra/newview/llviewerparcelmediaautoplay.cpp @@ -35,12 +35,14 @@ #include "llviewerparcelmedia.h" #include "llviewercontrol.h" #include "llviewermedia.h" +#include "llviewerregion.h" #include "llparcel.h" #include "llviewerparcelmgr.h" #include "lluuid.h" #include "message.h" #include "llviewertexturelist.h" // for texture stats #include "llagent.h" +#include "llmimetypes.h" const F32 AUTOPLAY_TIME = 5; // how many seconds before we autoplay const F32 AUTOPLAY_SIZE = 24*24; // how big the texture must be (pixel area) before we autoplay @@ -48,6 +50,8 @@ const F32 AUTOPLAY_SPEED = 0.1f; // how slow should the agent be moving t LLViewerParcelMediaAutoPlay::LLViewerParcelMediaAutoPlay() : LLEventTimer(1), + + mLastParcelID(-1), mPlayed(FALSE), mTimeInParcel(0) { @@ -81,39 +85,54 @@ void LLViewerParcelMediaAutoPlay::playStarted() BOOL LLViewerParcelMediaAutoPlay::tick() { LLParcel *this_parcel = NULL; + LLViewerRegion *this_region = NULL; std::string this_media_url; + std::string this_media_type; LLUUID this_media_texture_id; S32 this_parcel_id = 0; + LLUUID this_region_id; + + this_region = gAgent.getRegion(); + + if (this_region) + { + this_region_id = this_region->getRegionID(); + } this_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (this_parcel) { - this_media_url = std::string(this_parcel->getMediaURL()); + this_media_url = this_parcel->getMediaURL(); + + this_media_type = this_parcel->getMediaType(); this_media_texture_id = this_parcel->getMediaID(); this_parcel_id = this_parcel->getLocalID(); } - if (this_parcel_id != mLastParcelID) + if (this_parcel_id != mLastParcelID || + this_region_id != mLastRegionID) { // we've entered a new parcel mPlayed = FALSE; // we haven't autoplayed yet mTimeInParcel = 0; // reset our timer mLastParcelID = this_parcel_id; + mLastRegionID = this_region_id; } - mTimeInParcel += mPeriod; // increase mTimeInParcel by the amount of time between ticks + mTimeInParcel += mPeriod; // increase mTimeInParcel by the amount of time between ticks - if ((!mPlayed) && // if we've never played - (mTimeInParcel > AUTOPLAY_TIME) && // and if we've been here for so many seconds - (this_media_url.size() != 0) && // and if the parcel has media - (LLViewerParcelMedia::sMediaImpl.isNull())) // and if the media is not already playing + if ((!mPlayed) && // if we've never played + (mTimeInParcel > AUTOPLAY_TIME) && // and if we've been here for so many seconds + (!this_media_url.empty()) && // and if the parcel has media + (stricmp(this_media_type.c_str(), LLMIMETypes::getDefaultMimeType().c_str()) != 0) && + (LLViewerParcelMedia::sMediaImpl.isNull())) // and if the media is not already playing { - if (this_media_texture_id.notNull()) // and if the media texture is good + if (this_media_texture_id.notNull()) // and if the media texture is good { - LLViewerTexture *image = LLViewerTextureManager::getFetchedTexture(this_media_texture_id, FALSE); + LLViewerMediaTexture *image = LLViewerTextureManager::getMediaTexture(this_media_texture_id, FALSE) ; F32 image_size = 0; diff --git a/indra/newview/llviewerparcelmediaautoplay.h b/indra/newview/llviewerparcelmediaautoplay.h index 243da2f38..40142c1dd 100644 --- a/indra/newview/llviewerparcelmediaautoplay.h +++ b/indra/newview/llviewerparcelmediaautoplay.h @@ -34,6 +34,7 @@ #define LLVIEWERPARCELMEDIAAUTOPLAY_H #include "lleventtimer.h" +#include "lluuid.h" // timer to automatically play media class LLViewerParcelMediaAutoPlay : LLEventTimer @@ -47,6 +48,7 @@ class LLViewerParcelMediaAutoPlay : LLEventTimer private: S32 mLastParcelID; + LLUUID mLastRegionID; BOOL mPlayed; F32 mTimeInParcel; }; diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index d12b63997..587c67dda 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -1625,9 +1625,6 @@ LLXMLNodePtr LLViewerTextEditor::getXML(bool save_children) const LLView* LLViewerTextEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { - std::string name("text_editor"); - node->getAttributeString("name", name); - LLRect rect; createRect(node, rect, parent, LLRect()); @@ -1648,7 +1645,7 @@ LLView* LLViewerTextEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlF text.erase(max_text_length); } - LLViewerTextEditor* text_editor = new LLViewerTextEditor(name, + LLViewerTextEditor* text_editor = new LLViewerTextEditor("text_editor", rect, max_text_length, LLStringUtil::null, diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 2ef25f6c1..122ac3f10 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -199,6 +199,8 @@ #include "llfloatertest.h" // HACK! #include "llfloaternotificationsconsole.h" +#include "llpanelnearbymedia.h" + // [RLVa:KB] #include "rlvhandler.h" // [/RLVa:KB] @@ -2107,11 +2109,24 @@ void LLViewerWindow::adjustControlRectanglesForFirstUse(const LLRect& window) void LLViewerWindow::initWorldUI() { pre_init_menus(); + if(!gMenuHolder) + { + // + // Tools for building + // + init_menus(); + } +} +// initWorldUI that wasn't before logging in. Some of this may require the access the 'LindenUserDir'. +void LLViewerWindow::initWorldUI_postLogin() +{ S32 height = mRootView->getRect().getHeight(); S32 width = mRootView->getRect().getWidth(); LLRect full_window(0, height, width, 0); + //============================================ + //Begin LLViewerWindow::initWorlUI // Don't re-enter if objects are alreay created if (gBottomPanel == NULL) { @@ -2119,18 +2134,15 @@ void LLViewerWindow::initWorldUI() gBottomPanel = new LLBottomPanel(mRootView->getRect()); mRootView->addChild(gBottomPanel); + LLFloaterNearbyMedia::updateClass(); //Dependent on the overlay panel being fully initialized. + // View for hover information gHoverView = new LLHoverView(std::string("gHoverView"), full_window); gHoverView->setVisible(TRUE); mRootView->addChild(gHoverView); gIMMgr = LLIMMgr::getInstance(); - - // - // Tools for building - // - - init_menus(); + gIMMgr->loadIgnoreGroup(); // Toolbox floater gFloaterTools = new LLFloaterTools(); @@ -2149,19 +2161,16 @@ void LLViewerWindow::initWorldUI() // put behind everything else in the UI mRootView->addChildInBack(gHUDView); } + //End LLViewerWindow::initWorlUI + //============================================ + LLPanel* panel_ssf_container = getRootView()->getChild("state_management_buttons_container"); panel_ssf_container->setVisible(TRUE); LLMenuOptionPathfindingRebakeNavmesh::getInstance()->initialize(); -} -// initWorldUI that wasn't before logging in. Some of this may require the access the 'LindenUserDir'. -void LLViewerWindow::initWorldUI_postLogin() -{ - S32 height = mRootView->getRect().getHeight(); - S32 width = mRootView->getRect().getWidth(); - LLRect full_window(0, height, width, 0); + // Don't re-enter if objects are alreay created. if (!gStatusBar) @@ -2236,7 +2245,8 @@ void LLViewerWindow::shutdownViews() mRootView = NULL; llinfos << "RootView deleted." << llendl ; - LLMenuOptionPathfindingRebakeNavmesh::getInstance()->quit(); + if(LLMenuOptionPathfindingRebakeNavmesh::instanceExists()) + LLMenuOptionPathfindingRebakeNavmesh::getInstance()->quit(); // Automatically deleted as children of mRootView. Fix the globals. gFloaterTools = NULL; @@ -3440,7 +3450,7 @@ void LLViewerWindow::updateLayout() } // Update rectangles for the various toolbars - if (gOverlayBar && gNotifyBoxView && gConsole && gToolBar) + if (gOverlayBar && gNotifyBoxView && gConsole && gToolBar && gHUDView) { LLRect bar_rect(-1, STATUS_BAR_HEIGHT, getWindowWidth()+1, -1); diff --git a/indra/newview/skins/default/xui/en-us/floater_nearby_media.xml b/indra/newview/skins/default/xui/en-us/floater_nearby_media.xml new file mode 100644 index 000000000..2b9ecafd8 --- /dev/null +++ b/indra/newview/skins/default/xui/en-us/floater_nearby_media.xml @@ -0,0 +1,20 @@ + + + + \ No newline at end of file diff --git a/indra/newview/skins/default/xui/en-us/floater_tools.xml b/indra/newview/skins/default/xui/en-us/floater_tools.xml index e08bd1703..349a2dffd 100644 --- a/indra/newview/skins/default/xui/en-us/floater_tools.xml +++ b/indra/newview/skins/default/xui/en-us/floater_tools.xml @@ -483,13 +483,14 @@ mouse_opaque="true" name="Group:" v_pad="0" width="78"> Group: - - The Lindens - + + + + + + + + + Show: + + + +All + + +In this Parcel + + +Outside this Parcel + + +On other Avatars + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en-us/panel_overlaybar.xml b/indra/newview/skins/default/xui/en-us/panel_overlaybar.xml index 97acc4768..a10f0b74a 100644 --- a/indra/newview/skins/default/xui/en-us/panel_overlaybar.xml +++ b/indra/newview/skins/default/xui/en-us/panel_overlaybar.xml @@ -50,7 +50,7 @@ + width="96"> + tool_tip="Media is Loading"/> + width="22" + tool_tip="Navigate forward"> @@ -130,6 +132,7 @@ follows="top" image_overlay="go-home.png" label="" + tool_tip="Home page" bottom="-22" height="22" width="22"> @@ -151,6 +154,7 @@ follows="top" image_overlay="go-media-stop.png" label="" + tool_tip="Stop media" bottom="-22" height="22" width="22"> @@ -172,6 +176,7 @@ follows="top" image_overlay="go-reload.png" label="" + tool_tip="Reload" bottom="-22" height="22" width="22"> @@ -193,6 +198,7 @@ follows="top" image_overlay="go-stop.png" label="" + tool_tip = "Stop loading" bottom="-22" height="22" width="22"> @@ -214,6 +220,7 @@ follows="top" image_overlay="go-media-play.png" label="" + tool_tip = "Play media" bottom="-22" height="22" width="22"> @@ -258,6 +265,7 @@ follows="top|left|right" height="22" bottom="-22" + tool_tip="Media URL" text_pad_right="16"> @@ -269,7 +277,7 @@ height="20" width="38" left="140" - bottom="0" + bottom="0" border_size="0" mouse_opaque="false" orientation="horizontal"> @@ -284,6 +292,7 @@ height="16" image_name="Flag.png" layout="topleft" + tool_tip="White List enabled" bottom="-16" width="16" /> @@ -297,6 +306,7 @@ height="16" image_name="lock.png" bottom="-16" + tool_tip="Secured Browsing" width="16" /> @@ -317,6 +327,7 @@ height="22" increment="0.01" initial_value="0.5" + tool_tip="Movie play progress" width="200"> @@ -337,6 +348,7 @@ bottom="-22" auto_resize="false" height="22" + tool_tip="Step back" width="22"> @@ -356,6 +368,7 @@ label="" bottom="-22" height="22" + tool_tip="Step forward" width="22"> @@ -383,6 +396,7 @@ hover_glow_amount="0.15" is_toggle="true" scale_image="false" + tool_tip="Mute This Media" left_delta="5" bottom="-22" draw_border="true" @@ -430,6 +444,7 @@ label="" bottom="-22" height="22" + tool_tip="Zoom into media" width="22"> @@ -449,6 +464,7 @@ image_overlay="go-media-unzoom.png" label="" height="22" + tool_tip ="Zoom Back" bottom="-22" width="21"> diff --git a/indra/newview/skins/default/xui/es/floater_tools.xml b/indra/newview/skins/default/xui/es/floater_tools.xml index 02f4d726e..37d162266 100644 --- a/indra/newview/skins/default/xui/es/floater_tools.xml +++ b/indra/newview/skins/default/xui/es/floater_tools.xml @@ -135,9 +135,7 @@ Grupo: - - The Lindens - +