Merge viewer-bear

meow-7.2.2
Ansariel 2019-02-26 22:15:11 +01:00
commit dab71ac322
14 changed files with 491 additions and 392 deletions

View File

@ -289,8 +289,14 @@ void LLLayoutStack::draw()
// always clip to stack itself
LLLocalClipRect clip(getLocalRect());
BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
for (LLLayoutPanel* panelp : mPanels)
{
if ((!panelp->getVisible() || panelp->mCollapsed)
&& (panelp->mVisibleAmt < 0.001f || !mAnimate))
{
// essentially invisible
continue;
}
// clip to layout rectangle, not bounding rectangle
LLRect clip_rect = panelp->getRect();
// scale clipping rectangle by visible amount

View File

@ -378,6 +378,7 @@ set(viewer_SOURCE_FILES
llfloatermemleak.cpp
llfloatermodelpreview.cpp
llfloatermodeluploadbase.cpp
llfloatermyscripts.cpp
llfloaternamedesc.cpp
llfloaternotificationsconsole.cpp
llfloaternotificationstabbed.cpp
@ -1140,6 +1141,7 @@ set(viewer_HEADER_FILES
llfloatermemleak.h
llfloatermodelpreview.h
llfloatermodeluploadbase.h
llfloatermyscripts.h
llfloaternamedesc.h
llfloaternotificationsconsole.h
llfloaternotificationstabbed.h

View File

@ -236,6 +236,8 @@ void LLConversationViewSession::draw()
// Draw children if root folder, or any other folder that is open. Do not draw children when animating to closed state or you get rendering overlap.
bool draw_children = getRoot() == static_cast<LLFolderViewFolder*>(this) || isOpen();
// Todo/fix this: arrange hides children 'out of bonds', session 'slowly' adjusts container size, unhides children
// this process repeats until children fit
for (folders_t::iterator iter = mFolders.begin();
iter != mFolders.end();)
{
@ -256,9 +258,6 @@ void LLConversationViewSession::draw()
updateLabelRotation();
drawOpenFolderArrow(default_params, sFgColor);
}
refresh();
LLView::draw();
}
@ -570,6 +569,7 @@ void LLConversationViewParticipant::draw()
F32 text_left = (F32)getLabelXPos();
LLColor4 color;
LLLocalSpeakerMgr *speakerMgr = LLLocalSpeakerMgr::getInstance();
if (speakerMgr && speakerMgr->isSpeakerToBeRemoved(mUUID))
@ -581,9 +581,14 @@ void LLConversationViewParticipant::draw()
color = mIsSelected ? sHighlightFgColor : sFgColor;
}
LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(getViewModelItem());
if (participant_model)
{
mSpeakingIndicator->setIsModeratorMuted(participant_model->isModeratorMuted());
}
drawHighlight(show_context, mIsSelected, sHighlightBgColor, sFlashBgColor, sFocusOutlineColor, sMouseOverColor);
drawLabel(font, text_left, y, color, right_x);
refresh();
LLView::draw();
}

View File

@ -270,6 +270,9 @@ BOOL LLFloaterIMContainer::postBuild()
// When display name option change, we need to reload all participant names
LLAvatarNameCache::addUseDisplayNamesCallback(boost::bind(&LLFloaterIMContainer::processParticipantsStyleUpdate, this));
mParticipantRefreshTimer.setTimerExpirySec(0);
mParticipantRefreshTimer.start();
return TRUE;
}
@ -421,14 +424,66 @@ void LLFloaterIMContainer::processParticipantsStyleUpdate()
void LLFloaterIMContainer::idle(void* user_data)
{
LLFloaterIMContainer* self = static_cast<LLFloaterIMContainer*>(user_data);
// Update the distance to agent in the nearby chat session if required
// Note: it makes no sense of course to update the distance in other session
if (self->mConversationViewModel.getSorter().getSortOrderParticipants() == LLConversationFilter::SO_DISTANCE)
{
self->setNearbyDistances();
}
self->mConversationsRoot->update();
if (!self->getVisible() || self->isMinimized())
{
return;
}
self->idleUpdate();
}
void LLFloaterIMContainer::idleUpdate()
{
if (mTabContainer->getTabCount() == 0)
{
// Do not close the container when every conversation is torn off because the user
// still needs the conversation list. Simply collapse the message pane in that case.
collapseMessagesPane(true);
}
U32 sort_order = mConversationViewModel.getSorter().getSortOrderParticipants();
if (mParticipantRefreshTimer.hasExpired())
{
const LLConversationItem *current_session = getCurSelectedViewModelItem();
if (current_session)
{
// Update moderator options visibility
LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = current_session->getChildrenBegin();
LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = current_session->getChildrenEnd();
bool is_moderator = isGroupModerator();
bool can_ban = haveAbilityToBan();
while (current_participant_model != end_participant_model)
{
LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(*current_participant_model);
participant_model->setModeratorOptionsVisible(is_moderator && participant_model->getUUID() != gAgentID);
participant_model->setGroupBanVisible(can_ban && participant_model->getUUID() != gAgentID);
current_participant_model++;
}
// Update floater's title as required by the currently selected session or use the default title
LLFloaterIMSession * conversation_floaterp = LLFloaterIMSession::findInstance(current_session->getUUID());
setTitle(conversation_floaterp && conversation_floaterp->needsTitleOverwrite() ? conversation_floaterp->getTitle() : mGeneralTitle);
}
mParticipantRefreshTimer.setTimerExpirySec(1.0f);
}
// Update the distance to agent in the nearby chat session if required
// Note: it makes no sense of course to update the distance in other session
if (sort_order == LLConversationFilter::SO_DISTANCE)
{
// almost real-time updates
setNearbyDistances(); //calls arrange all
}
mConversationsRoot->update(); //arranges, resizes, heavy
// "Manually" resize of mConversationsPane: same as temporarity cancellation of the flag "auto_resize=false" for it
if (!mConversationsPane->isCollapsed() && mMessagesPane->isCollapsed())
{
LLRect stack_rect = mConversationsStack->getRect();
mConversationsPane->reshape(stack_rect.getWidth(), stack_rect.getHeight(), true);
}
}
bool LLFloaterIMContainer::onConversationModelEvent(const LLSD& event)
@ -527,39 +582,6 @@ bool LLFloaterIMContainer::onConversationModelEvent(const LLSD& event)
void LLFloaterIMContainer::draw()
{
if (mTabContainer->getTabCount() == 0)
{
// Do not close the container when every conversation is torn off because the user
// still needs the conversation list. Simply collapse the message pane in that case.
collapseMessagesPane(true);
}
const LLConversationItem *current_session = getCurSelectedViewModelItem();
if (current_session)
{
// Update moderator options visibility
LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = current_session->getChildrenBegin();
LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = current_session->getChildrenEnd();
while (current_participant_model != end_participant_model)
{
LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(*current_participant_model);
participant_model->setModeratorOptionsVisible(isGroupModerator() && participant_model->getUUID() != gAgentID);
participant_model->setGroupBanVisible(haveAbilityToBan() && participant_model->getUUID() != gAgentID);
current_participant_model++;
}
// Update floater's title as required by the currently selected session or use the default title
LLFloaterIMSession * conversation_floaterp = LLFloaterIMSession::findInstance(current_session->getUUID());
setTitle(conversation_floaterp && conversation_floaterp->needsTitleOverwrite() ? conversation_floaterp->getTitle() : mGeneralTitle);
}
// "Manually" resize of mConversationsPane: same as temporarity cancellation of the flag "auto_resize=false" for it
if (!mConversationsPane->isCollapsed() && mMessagesPane->isCollapsed())
{
LLRect stack_rect = mConversationsStack->getRect();
mConversationsPane->reshape(stack_rect.getWidth(), stack_rect.getHeight(), true);
}
LLFloater::draw();
}

View File

@ -182,6 +182,8 @@ private:
void openNearbyChat();
bool isParticipantListExpanded();
void idleUpdate(); // for convenience (self) from static idle
LLButton* mExpandCollapseBtn;
LLButton* mStubCollapseBtn;
LLButton* mSpeakBtn;
@ -228,6 +230,8 @@ private:
LLConversationViewModel mConversationViewModel;
LLFolderView* mConversationsRoot;
LLEventStream mConversationsEventStream;
LLTimer mParticipantRefreshTimer;
};
#endif // LL_LLFLOATERIMCONTAINER_H

View File

@ -0,0 +1,294 @@
/**
* @file llfloatermyscripts.cpp
* @brief LLFloaterMyScripts class implementation.
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2019, 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 "llfloatermyscripts.h"
#include "llagent.h"
#include "llcorehttputil.h"
#include "llcoros.h"
#include "lleventcoro.h"
#include "llfloaterreg.h"
#include "llscrolllistctrl.h"
#include "lltrans.h"
#include "llviewerregion.h"
const S32 SIZE_OF_ONE_KB = 1024;
LLFloaterMyScripts::LLFloaterMyScripts(const LLSD& seed)
: LLFloater(seed),
mGotAttachmentMemoryUsed(false),
mAttachmentMemoryMax(0),
mAttachmentMemoryUsed(0),
mGotAttachmentURLsUsed(false),
mAttachmentURLsMax(0),
mAttachmentURLsUsed(0)
{
}
BOOL LLFloaterMyScripts::postBuild()
{
childSetAction("refresh_list_btn", onClickRefresh, this);
std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting");
getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
return requestAttachmentDetails();
}
BOOL LLFloaterMyScripts::requestAttachmentDetails()
{
if (!gAgent.getRegion()) return FALSE;
LLSD body;
std::string url = gAgent.getRegion()->getCapability("AttachmentResources");
if (!url.empty())
{
LLCoros::instance().launch("LLFloaterMyScripts::getAttachmentLimitsCoro",
boost::bind(&LLFloaterMyScripts::getAttachmentLimitsCoro, this, url));
return TRUE;
}
else
{
return FALSE;
}
}
void LLFloaterMyScripts::getAttachmentLimitsCoro(std::string url)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getAttachmentLimitsCoro", httpPolicy));
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
LLSD result = httpAdapter->getAndSuspend(httpRequest, url);
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
if (!status)
{
LL_WARNS() << "Unable to retrieve attachment limits." << LL_ENDL;
return;
}
LLFloaterMyScripts* instance = LLFloaterReg::getTypedInstance<LLFloaterMyScripts>("my_scripts");
if (!instance)
{
LL_WARNS() << "Failed to get LLFloaterMyScripts instance" << LL_ENDL;
return;
}
instance->getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string("")));
LLButton* btn = instance->getChild<LLButton>("refresh_list_btn");
if (btn)
{
btn->setEnabled(true);
}
result.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS);
instance->setAttachmentDetails(result);
}
void LLFloaterMyScripts::setAttachmentDetails(LLSD content)
{
LLScrollListCtrl *list = getChild<LLScrollListCtrl>("scripts_list");
if(!list)
{
return;
}
S32 number_attachments = content["attachments"].size();
for(int i = 0; i < number_attachments; i++)
{
std::string humanReadableLocation = "";
if(content["attachments"][i].has("location"))
{
std::string actualLocation = content["attachments"][i]["location"];
humanReadableLocation = LLTrans::getString(actualLocation.c_str());
}
S32 number_objects = content["attachments"][i]["objects"].size();
for(int j = 0; j < number_objects; j++)
{
LLUUID task_id = content["attachments"][i]["objects"][j]["id"].asUUID();
S32 size = 0;
if(content["attachments"][i]["objects"][j]["resources"].has("memory"))
{
size = content["attachments"][i]["objects"][j]["resources"]["memory"].asInteger() / SIZE_OF_ONE_KB;
}
S32 urls = 0;
if(content["attachments"][i]["objects"][j]["resources"].has("urls"))
{
urls = content["attachments"][i]["objects"][j]["resources"]["urls"].asInteger();
}
std::string name = content["attachments"][i]["objects"][j]["name"].asString();
LLSD element;
element["id"] = task_id;
element["columns"][0]["column"] = "size";
element["columns"][0]["value"] = llformat("%d", size);
element["columns"][0]["font"] = "SANSSERIF";
element["columns"][0]["halign"] = LLFontGL::RIGHT;
element["columns"][1]["column"] = "urls";
element["columns"][1]["value"] = llformat("%d", urls);
element["columns"][1]["font"] = "SANSSERIF";
element["columns"][1]["halign"] = LLFontGL::RIGHT;
element["columns"][2]["column"] = "name";
element["columns"][2]["value"] = name;
element["columns"][2]["font"] = "SANSSERIF";
element["columns"][3]["column"] = "location";
element["columns"][3]["value"] = humanReadableLocation;
element["columns"][3]["font"] = "SANSSERIF";
list->addElement(element);
}
}
setAttachmentSummary(content);
getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string("")));
LLButton* btn = getChild<LLButton>("refresh_list_btn");
if(btn)
{
btn->setEnabled(true);
}
}
void LLFloaterMyScripts::clearList()
{
LLCtrlListInterface *list = childGetListInterface("scripts_list");
if (list)
{
list->operateOnAll(LLCtrlListInterface::OP_DELETE);
}
std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting");
getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
}
void LLFloaterMyScripts::setAttachmentSummary(LLSD content)
{
if(content["summary"]["used"][0]["type"].asString() == std::string("memory"))
{
mAttachmentMemoryUsed = content["summary"]["used"][0]["amount"].asInteger() / SIZE_OF_ONE_KB;
mAttachmentMemoryMax = content["summary"]["available"][0]["amount"].asInteger() / SIZE_OF_ONE_KB;
mGotAttachmentMemoryUsed = true;
}
else if(content["summary"]["used"][1]["type"].asString() == std::string("memory"))
{
mAttachmentMemoryUsed = content["summary"]["used"][1]["amount"].asInteger() / SIZE_OF_ONE_KB;
mAttachmentMemoryMax = content["summary"]["available"][1]["amount"].asInteger() / SIZE_OF_ONE_KB;
mGotAttachmentMemoryUsed = true;
}
else
{
LL_WARNS() << "attachment details don't contain memory summary info" << LL_ENDL;
return;
}
if(content["summary"]["used"][0]["type"].asString() == std::string("urls"))
{
mAttachmentURLsUsed = content["summary"]["used"][0]["amount"].asInteger();
mAttachmentURLsMax = content["summary"]["available"][0]["amount"].asInteger();
mGotAttachmentURLsUsed = true;
}
else if(content["summary"]["used"][1]["type"].asString() == std::string("urls"))
{
mAttachmentURLsUsed = content["summary"]["used"][1]["amount"].asInteger();
mAttachmentURLsMax = content["summary"]["available"][1]["amount"].asInteger();
mGotAttachmentURLsUsed = true;
}
else
{
LL_WARNS() << "attachment details don't contain urls summary info" << LL_ENDL;
return;
}
if((mAttachmentMemoryUsed >= 0) && (mAttachmentMemoryMax >= 0))
{
LLStringUtil::format_map_t args_attachment_memory;
args_attachment_memory["[COUNT]"] = llformat ("%d", mAttachmentMemoryUsed);
std::string translate_message = "ScriptLimitsMemoryUsedSimple";
if (0 < mAttachmentMemoryMax)
{
S32 attachment_memory_available = mAttachmentMemoryMax - mAttachmentMemoryUsed;
args_attachment_memory["[MAX]"] = llformat ("%d", mAttachmentMemoryMax);
args_attachment_memory["[AVAILABLE]"] = llformat ("%d", attachment_memory_available);
translate_message = "ScriptLimitsMemoryUsed";
}
getChild<LLUICtrl>("memory_used")->setValue(LLTrans::getString(translate_message, args_attachment_memory));
}
if((mAttachmentURLsUsed >= 0) && (mAttachmentURLsMax >= 0))
{
S32 attachment_urls_available = mAttachmentURLsMax - mAttachmentURLsUsed;
LLStringUtil::format_map_t args_attachment_urls;
args_attachment_urls["[COUNT]"] = llformat ("%d", mAttachmentURLsUsed);
args_attachment_urls["[MAX]"] = llformat ("%d", mAttachmentURLsMax);
args_attachment_urls["[AVAILABLE]"] = llformat ("%d", attachment_urls_available);
std::string msg_attachment_urls = LLTrans::getString("ScriptLimitsURLsUsed", args_attachment_urls);
getChild<LLUICtrl>("urls_used")->setValue(LLSD(msg_attachment_urls));
}
}
// static
void LLFloaterMyScripts::onClickRefresh(void* userdata)
{
LLFloaterMyScripts* instance = LLFloaterReg::getTypedInstance<LLFloaterMyScripts>("my_scripts");
if(instance)
{
LLButton* btn = instance->getChild<LLButton>("refresh_list_btn");
//To stop people from hammering the refesh button and accidentally dosing themselves - enough requests can crash the viewer!
//turn the button off, then turn it on when we get a response
if(btn)
{
btn->setEnabled(false);
}
instance->clearList();
instance->requestAttachmentDetails();
}
else
{
LL_WARNS() << "could not find LLFloaterMyScripts instance after refresh button clicked" << LL_ENDL;
}
}

View File

@ -0,0 +1,60 @@
/**
* @file llfloatermyscripts.h
* @brief LLFloaterMyScripts class definition.
*
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2019, 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_LLFLOATERMYSCRIPTS_H
#define LL_LLFLOATERMYSCRIPTS_H
#include "llfloater.h"
#include "llpanel.h"
class LLFloaterMyScripts : public LLFloater
{
public:
LLFloaterMyScripts(const LLSD& seed);
BOOL postBuild();
void setAttachmentDetails(LLSD content);
void setAttachmentSummary(LLSD content);
BOOL requestAttachmentDetails();
void clearList();
private:
void getAttachmentLimitsCoro(std::string url);
bool mGotAttachmentMemoryUsed;
S32 mAttachmentMemoryMax;
S32 mAttachmentMemoryUsed;
bool mGotAttachmentURLsUsed;
S32 mAttachmentURLsMax;
S32 mAttachmentURLsUsed;
protected:
static void onClickRefresh(void* userdata);
};
#endif

View File

@ -90,19 +90,6 @@ LLFloaterScriptLimits::LLFloaterScriptLimits(const LLSD& seed)
BOOL LLFloaterScriptLimits::postBuild()
{
// a little cheap and cheerful - if there's an about land panel open default to showing parcel info,
// otherwise default to showing attachments (avatar appearance)
bool selectParcelPanel = false;
LLFloaterLand* instance = LLFloaterReg::getTypedInstance<LLFloaterLand>("about_land");
if(instance)
{
if(instance->isShown())
{
selectParcelPanel = true;
}
}
mTab = getChild<LLTabContainer>("scriptlimits_panels");
if(!mTab)
@ -111,28 +98,12 @@ BOOL LLFloaterScriptLimits::postBuild()
return FALSE;
}
// contruct the panels
// contruct the panel
LLPanelScriptLimitsRegionMemory* panel_memory = new LLPanelScriptLimitsRegionMemory;
mInfoPanels.push_back(panel_memory);
panel_memory->buildFromFile( "panel_script_limits_region_memory.xml");
mTab->addTabPanel(panel_memory);
LLPanelScriptLimitsAttachment* panel_attachments = new LLPanelScriptLimitsAttachment;
mInfoPanels.push_back(panel_attachments);
panel_attachments->buildFromFile("panel_script_limits_my_avatar.xml");
mTab->addTabPanel(panel_attachments);
if(mInfoPanels.size() > 0)
{
mTab->selectTab(0);
}
if(!selectParcelPanel && (mInfoPanels.size() > 1))
{
mTab->selectTab(1);
}
mTab->selectTab(0);
return TRUE;
}
@ -969,269 +940,3 @@ void LLPanelScriptLimitsRegionMemory::onClickReturn(void* userdata)
}
}
///----------------------------------------------------------------------------
// Attachment Panel
///----------------------------------------------------------------------------
BOOL LLPanelScriptLimitsAttachment::requestAttachmentDetails()
{
if (!gAgent.getRegion()) return FALSE;
LLSD body;
std::string url = gAgent.getRegion()->getCapability("AttachmentResources");
if (!url.empty())
{
LLCoros::instance().launch("LLPanelScriptLimitsAttachment::getAttachmentLimitsCoro",
boost::bind(&LLPanelScriptLimitsAttachment::getAttachmentLimitsCoro, this, url));
return TRUE;
}
else
{
return FALSE;
}
}
void LLPanelScriptLimitsAttachment::getAttachmentLimitsCoro(std::string url)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getAttachmentLimitsCoro", httpPolicy));
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
LLSD result = httpAdapter->getAndSuspend(httpRequest, url);
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
if (!status)
{
LL_WARNS() << "Unable to retrieve attachment limits." << LL_ENDL;
return;
}
LLFloaterScriptLimits* instance = LLFloaterReg::getTypedInstance<LLFloaterScriptLimits>("script_limits");
if (!instance)
{
LL_WARNS() << "Failed to get llfloaterscriptlimits instance" << LL_ENDL;
return;
}
LLTabContainer* tab = instance->getChild<LLTabContainer>("scriptlimits_panels");
if (!tab)
{
LL_WARNS() << "Failed to get scriptlimits_panels" << LL_ENDL;
return;
}
LLPanelScriptLimitsAttachment* panel = (LLPanelScriptLimitsAttachment*)tab->getChild<LLPanel>("script_limits_my_avatar_panel");
if (!panel)
{
LL_WARNS() << "Failed to get script_limits_my_avatar_panel" << LL_ENDL;
return;
}
panel->getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string("")));
LLButton* btn = panel->getChild<LLButton>("refresh_list_btn");
if (btn)
{
btn->setEnabled(true);
}
result.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS);
panel->setAttachmentDetails(result);
}
void LLPanelScriptLimitsAttachment::setAttachmentDetails(LLSD content)
{
LLScrollListCtrl *list = getChild<LLScrollListCtrl>("scripts_list");
if(!list)
{
return;
}
S32 number_attachments = content["attachments"].size();
for(int i = 0; i < number_attachments; i++)
{
std::string humanReadableLocation = "";
if(content["attachments"][i].has("location"))
{
std::string actualLocation = content["attachments"][i]["location"];
humanReadableLocation = LLTrans::getString(actualLocation.c_str());
}
S32 number_objects = content["attachments"][i]["objects"].size();
for(int j = 0; j < number_objects; j++)
{
LLUUID task_id = content["attachments"][i]["objects"][j]["id"].asUUID();
S32 size = 0;
if(content["attachments"][i]["objects"][j]["resources"].has("memory"))
{
size = content["attachments"][i]["objects"][j]["resources"]["memory"].asInteger() / SIZE_OF_ONE_KB;
}
S32 urls = 0;
if(content["attachments"][i]["objects"][j]["resources"].has("urls"))
{
urls = content["attachments"][i]["objects"][j]["resources"]["urls"].asInteger();
}
std::string name = content["attachments"][i]["objects"][j]["name"].asString();
LLSD element;
element["id"] = task_id;
element["columns"][0]["column"] = "size";
element["columns"][0]["value"] = llformat("%d", size);
element["columns"][0]["font"] = "SANSSERIF";
element["columns"][0]["halign"] = LLFontGL::RIGHT;
element["columns"][1]["column"] = "urls";
element["columns"][1]["value"] = llformat("%d", urls);
element["columns"][1]["font"] = "SANSSERIF";
element["columns"][1]["halign"] = LLFontGL::RIGHT;
element["columns"][2]["column"] = "name";
element["columns"][2]["value"] = name;
element["columns"][2]["font"] = "SANSSERIF";
element["columns"][3]["column"] = "location";
element["columns"][3]["value"] = humanReadableLocation;
element["columns"][3]["font"] = "SANSSERIF";
list->addElement(element);
}
}
setAttachmentSummary(content);
getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string("")));
LLButton* btn = getChild<LLButton>("refresh_list_btn");
if(btn)
{
btn->setEnabled(true);
}
}
BOOL LLPanelScriptLimitsAttachment::postBuild()
{
childSetAction("refresh_list_btn", onClickRefresh, this);
std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting");
getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
return requestAttachmentDetails();
}
void LLPanelScriptLimitsAttachment::clearList()
{
LLCtrlListInterface *list = childGetListInterface("scripts_list");
if (list)
{
list->operateOnAll(LLCtrlListInterface::OP_DELETE);
}
std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting");
getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
}
void LLPanelScriptLimitsAttachment::setAttachmentSummary(LLSD content)
{
if(content["summary"]["used"][0]["type"].asString() == std::string("memory"))
{
mAttachmentMemoryUsed = content["summary"]["used"][0]["amount"].asInteger() / SIZE_OF_ONE_KB;
mAttachmentMemoryMax = content["summary"]["available"][0]["amount"].asInteger() / SIZE_OF_ONE_KB;
mGotAttachmentMemoryUsed = true;
}
else if(content["summary"]["used"][1]["type"].asString() == std::string("memory"))
{
mAttachmentMemoryUsed = content["summary"]["used"][1]["amount"].asInteger() / SIZE_OF_ONE_KB;
mAttachmentMemoryMax = content["summary"]["available"][1]["amount"].asInteger() / SIZE_OF_ONE_KB;
mGotAttachmentMemoryUsed = true;
}
else
{
LL_WARNS() << "attachment details don't contain memory summary info" << LL_ENDL;
return;
}
if(content["summary"]["used"][0]["type"].asString() == std::string("urls"))
{
mAttachmentURLsUsed = content["summary"]["used"][0]["amount"].asInteger();
mAttachmentURLsMax = content["summary"]["available"][0]["amount"].asInteger();
mGotAttachmentURLsUsed = true;
}
else if(content["summary"]["used"][1]["type"].asString() == std::string("urls"))
{
mAttachmentURLsUsed = content["summary"]["used"][1]["amount"].asInteger();
mAttachmentURLsMax = content["summary"]["available"][1]["amount"].asInteger();
mGotAttachmentURLsUsed = true;
}
else
{
LL_WARNS() << "attachment details don't contain urls summary info" << LL_ENDL;
return;
}
if((mAttachmentMemoryUsed >= 0) && (mAttachmentMemoryMax >= 0))
{
LLStringUtil::format_map_t args_attachment_memory;
args_attachment_memory["[COUNT]"] = llformat ("%d", mAttachmentMemoryUsed);
std::string translate_message = "ScriptLimitsMemoryUsedSimple";
if (0 < mAttachmentMemoryMax)
{
S32 attachment_memory_available = mAttachmentMemoryMax - mAttachmentMemoryUsed;
args_attachment_memory["[MAX]"] = llformat ("%d", mAttachmentMemoryMax);
args_attachment_memory["[AVAILABLE]"] = llformat ("%d", attachment_memory_available);
translate_message = "ScriptLimitsMemoryUsed";
}
getChild<LLUICtrl>("memory_used")->setValue(LLTrans::getString(translate_message, args_attachment_memory));
}
if((mAttachmentURLsUsed >= 0) && (mAttachmentURLsMax >= 0))
{
S32 attachment_urls_available = mAttachmentURLsMax - mAttachmentURLsUsed;
LLStringUtil::format_map_t args_attachment_urls;
args_attachment_urls["[COUNT]"] = llformat ("%d", mAttachmentURLsUsed);
args_attachment_urls["[MAX]"] = llformat ("%d", mAttachmentURLsMax);
args_attachment_urls["[AVAILABLE]"] = llformat ("%d", attachment_urls_available);
std::string msg_attachment_urls = LLTrans::getString("ScriptLimitsURLsUsed", args_attachment_urls);
getChild<LLUICtrl>("urls_used")->setValue(LLSD(msg_attachment_urls));
}
}
// static
void LLPanelScriptLimitsAttachment::onClickRefresh(void* userdata)
{
LLFloaterScriptLimits* instance = LLFloaterReg::getTypedInstance<LLFloaterScriptLimits>("script_limits");
if(instance)
{
LLTabContainer* tab = instance->getChild<LLTabContainer>("scriptlimits_panels");
LLPanelScriptLimitsAttachment* panel_attachments = (LLPanelScriptLimitsAttachment*)tab->getChild<LLPanel>("script_limits_my_avatar_panel");
LLButton* btn = panel_attachments->getChild<LLButton>("refresh_list_btn");
//To stop people from hammering the refesh button and accidentally dosing themselves - enough requests can crash the viewer!
//turn the button off, then turn it on when we get a response
if(btn)
{
btn->setEnabled(false);
}
panel_attachments->clearList();
panel_attachments->requestAttachmentDetails();
return;
}
else
{
LL_WARNS() << "could not find LLPanelScriptLimitsRegionMemory instance after refresh button clicked" << LL_ENDL;
return;
}
}

View File

@ -152,51 +152,4 @@ protected:
static void onClickReturn(void* userdata);
};
/////////////////////////////////////////////////////////////////////////////
// Attachment panel
/////////////////////////////////////////////////////////////////////////////
class LLPanelScriptLimitsAttachment : public LLPanelScriptLimitsInfo
{
public:
LLPanelScriptLimitsAttachment()
: LLPanelScriptLimitsInfo(),
mGotAttachmentMemoryUsed(false),
mAttachmentMemoryMax(0),
mAttachmentMemoryUsed(0),
mGotAttachmentURLsUsed(false),
mAttachmentURLsMax(0),
mAttachmentURLsUsed(0)
{};
~LLPanelScriptLimitsAttachment()
{
};
// LLPanel
virtual BOOL postBuild();
void setAttachmentDetails(LLSD content);
void setAttachmentSummary(LLSD content);
BOOL requestAttachmentDetails();
void clearList();
private:
void getAttachmentLimitsCoro(std::string url);
bool mGotAttachmentMemoryUsed;
S32 mAttachmentMemoryMax;
S32 mAttachmentMemoryUsed;
bool mGotAttachmentURLsUsed;
S32 mAttachmentURLsMax;
S32 mAttachmentURLsUsed;
protected:
static void onClickRefresh(void* userdata);
};
#endif

View File

@ -1913,7 +1913,17 @@ bool LLMeshRepoThread::headerReceived(const LLVolumeParams& mesh_params, U8* dat
return false;
}
header_size += stream.tellg();
if (!header.isMap() || !header.has("version"))
{
LL_WARNS(LOG_MESH) << "Mesh header is invalid for ID: " << mesh_id << LL_ENDL;
return false;
}
// make sure there is at least one lod, function returns -1 and marks as 404 otherwise
if (LLMeshRepository::getActualMeshLOD(header, 0) >= 0)
{
header_size += stream.tellg();
}
}
else
{
@ -2998,12 +3008,17 @@ S32 LLMeshRepository::getActualMeshLOD(LLSD& header, S32 lod)
{
lod = llclamp(lod, 0, 3);
if (header.has("404"))
{
return -1;
}
// <FS:Ansariel> OpenSim mesh fix
//S32 version = header["version"];
S32 version = header["version"].asInteger();
// </FS:Ansariel>
if (header.has("404") || version > MAX_MESH_VERSION)
if (version > MAX_MESH_VERSION)
{
return -1;
}

View File

@ -90,6 +90,7 @@
#include "llfloatermediasettings.h"
#include "llfloatermemleak.h"
#include "llfloatermodelpreview.h"
#include "llfloatermyscripts.h"
#include "llfloaternamedesc.h"
#include "llfloaternotificationsconsole.h"
#include "llfloaternotificationstabbed.h"
@ -407,6 +408,7 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("script_debug_output", "floater_script_debug_panel.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptDebugOutput>);
LLFloaterReg::add("script_floater", "floater_script.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLScriptFloater>);
LLFloaterReg::add("script_limits", "floater_script_limits.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptLimits>);
LLFloaterReg::add("my_scripts", "floater_my_scripts.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMyScripts>);
LLFloaterReg::add("sell_land", "floater_sell_land.xml", &LLFloaterSellLand::buildFloater);
LLFloaterReg::add("settings_debug", "floater_settings_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSettingsDebug>);
LLFloaterReg::add("sound_devices", "floater_sound_devices.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSoundDevices>);

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater
legacy_header_height="18"
can_resize="true"
height="570"
help_topic="scriptlimits"
layout="topleft"
name="myscripts"
save_rect="true"
title="My Scripts"
min_width="620"
width="620">
<panel
filename="panel_script_limits_my_avatar.xml"
follows="all"
bottom="555"
layout="topleft"
left="3"
right="-2"
name="script_limits_my_avatar_panel"
top="20"/>
</floater>

View File

@ -9,6 +9,7 @@
<file>gulim.ttc</file>
<file>simhei.ttf</file>
<file>ArialUni.ttf</file>
<file>msyh.ttc</file>
</os>
<os name="Mac">
<file>ヒラギノ角ゴシック W3.ttc</file>
@ -19,6 +20,7 @@
<file>AppleGothic.ttf</file>
<file>AppleSDGothicNeo-Regular.otf</file>
<file>华文细黑.ttf</file>
<file>PingFang.ttc</file>
</os>
</font>

View File

@ -305,6 +305,13 @@
function="Advanced.ToggleInfoDisplay"
parameter="avatardrawinfo" />
</menu_item_check>
<menu_item_call
label="Scripts"
name="MyScripts">
<menu_item_call.on_click
function="Floater.Toggle"
parameter="my_scripts"/>
</menu_item_call>
<menu_item_call
label="Lag Meter"
name="Lag Meter">