diff options
| author | Brad Linden <brad@lindenlab.com> | 2024-05-23 11:31:19 -0700 | 
|---|---|---|
| committer | Brad Linden <brad@lindenlab.com> | 2024-05-23 11:31:19 -0700 | 
| commit | a1f49564d670a2c41bfa25c833bba2564b9b7f48 (patch) | |
| tree | 1d205e51bc37621916a17d459ad83782fe41f975 /indra/newview/llpanelsnapshot.cpp | |
| parent | 6af5db09faf5ea33a2d4c47b64e76f42edae178a (diff) | |
| parent | 6377610f6587989c126b00f490dfc8d527a1c2ce (diff) | |
Merge remote-tracking branch 'origin/DRTVWR-600-maint-A' into brad/merge-maint-a-to-dev
Diffstat (limited to 'indra/newview/llpanelsnapshot.cpp')
| -rw-r--r-- | indra/newview/llpanelsnapshot.cpp | 192 | 
1 files changed, 96 insertions, 96 deletions
diff --git a/indra/newview/llpanelsnapshot.cpp b/indra/newview/llpanelsnapshot.cpp index a7e1f57f9d..2536dce606 100644 --- a/indra/newview/llpanelsnapshot.cpp +++ b/indra/newview/llpanelsnapshot.cpp @@ -1,25 +1,25 @@ -/**  +/**   * @file llpanelsnapshot.cpp   * @brief Snapshot panel base class   *   * $LicenseInfo:firstyear=2011&license=viewerlgpl$   * Second Life Viewer Source Code   * Copyright (C) 2011, 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$   */ @@ -45,24 +45,24 @@ constexpr S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512  S32 power_of_two(S32 sz, S32 upper)  { -	S32 res = upper; -	while( upper >= sz) -	{ -		res = upper; -		upper >>= 1; -	} -	return res; +    S32 res = upper; +    while( upper >= sz) +    { +        res = upper; +        upper >>= 1; +    } +    return res;  }  LLPanelSnapshot::LLPanelSnapshot() -	: mSnapshotFloater(NULL) +    : mSnapshotFloater(NULL)  {}  // virtual  bool LLPanelSnapshot::postBuild()  { -	getChild<LLUICtrl>("save_btn")->setLabelArg("[UPLOAD_COST]", std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost())); -	getChild<LLUICtrl>(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onResolutionComboCommit, this, _1)); +    getChild<LLUICtrl>("save_btn")->setLabelArg("[UPLOAD_COST]", std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost())); +    getChild<LLUICtrl>(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onResolutionComboCommit, this, _1));      if (!getWidthSpinnerName().empty())      {          getChild<LLUICtrl>(getWidthSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onCustomResolutionCommit, this)); @@ -75,56 +75,56 @@ bool LLPanelSnapshot::postBuild()      {          getChild<LLUICtrl>(getAspectRatioCBName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onKeepAspectRatioCommit, this, _1));      } -	updateControls(LLSD()); +    updateControls(LLSD()); -	mSnapshotFloater = getParentByType<LLFloaterSnapshotBase>(); -	return true; +    mSnapshotFloater = getParentByType<LLFloaterSnapshotBase>(); +    return true;  }  // virtual  void LLPanelSnapshot::onOpen(const LLSD& key)  { -	S32 old_format = gSavedSettings.getS32("SnapshotFormat"); -	S32 new_format = (S32) getImageFormat(); +    S32 old_format = gSavedSettings.getS32("SnapshotFormat"); +    S32 new_format = (S32) getImageFormat(); -	gSavedSettings.setS32("SnapshotFormat", new_format); -	setCtrlsEnabled(true); +    gSavedSettings.setS32("SnapshotFormat", new_format); +    setCtrlsEnabled(true); -	// Switching panels will likely change image format. -	// Not updating preview right away may lead to errors, -	// e.g. attempt to send a large BMP image by email. -	if (old_format != new_format) -	{ +    // Switching panels will likely change image format. +    // Not updating preview right away may lead to errors, +    // e.g. attempt to send a large BMP image by email. +    if (old_format != new_format) +    {          getParentByType<LLFloater>()->notify(LLSD().with("image-format-change", true)); -	} +    }  }  LLSnapshotModel::ESnapshotFormat LLPanelSnapshot::getImageFormat() const  { -	return LLSnapshotModel::SNAPSHOT_FORMAT_JPEG; +    return LLSnapshotModel::SNAPSHOT_FORMAT_JPEG;  }  void LLPanelSnapshot::enableControls(bool enable)  { -	setCtrlsEnabled(enable); +    setCtrlsEnabled(enable);  }  LLSpinCtrl* LLPanelSnapshot::getWidthSpinner()  {      llassert(!getWidthSpinnerName().empty()); -	return getChild<LLSpinCtrl>(getWidthSpinnerName()); +    return getChild<LLSpinCtrl>(getWidthSpinnerName());  }  LLSpinCtrl* LLPanelSnapshot::getHeightSpinner()  {      llassert(!getHeightSpinnerName().empty()); -	return getChild<LLSpinCtrl>(getHeightSpinnerName()); +    return getChild<LLSpinCtrl>(getHeightSpinnerName());  }  S32 LLPanelSnapshot::getTypedPreviewWidth() const  {      llassert(!getWidthSpinnerName().empty()); -	return getChild<LLUICtrl>(getWidthSpinnerName())->getValue().asInteger(); +    return getChild<LLUICtrl>(getWidthSpinnerName())->getValue().asInteger();  }  S32 LLPanelSnapshot::getTypedPreviewHeight() const @@ -141,96 +141,96 @@ void LLPanelSnapshot::enableAspectRatioCheckbox(bool enable)  LLSideTrayPanelContainer* LLPanelSnapshot::getParentContainer()  { -	LLSideTrayPanelContainer* parent = dynamic_cast<LLSideTrayPanelContainer*>(getParent()); -	if (!parent) -	{ -		LL_WARNS() << "Cannot find panel container" << LL_ENDL; -		return NULL; -	} +    LLSideTrayPanelContainer* parent = dynamic_cast<LLSideTrayPanelContainer*>(getParent()); +    if (!parent) +    { +        LL_WARNS() << "Cannot find panel container" << LL_ENDL; +        return NULL; +    } -	return parent; +    return parent;  }  void LLPanelSnapshot::updateImageQualityLevel()  { -	LLSliderCtrl* quality_slider = getChild<LLSliderCtrl>("image_quality_slider"); -	S32 quality_val = llfloor((F32) quality_slider->getValue().asReal()); - -	std::string quality_lvl; - -	if (quality_val < 20) -	{ -		quality_lvl = LLTrans::getString("snapshot_quality_very_low"); -	} -	else if (quality_val < 40) -	{ -		quality_lvl = LLTrans::getString("snapshot_quality_low"); -	} -	else if (quality_val < 60) -	{ -		quality_lvl = LLTrans::getString("snapshot_quality_medium"); -	} -	else if (quality_val < 80) -	{ -		quality_lvl = LLTrans::getString("snapshot_quality_high"); -	} -	else -	{ -		quality_lvl = LLTrans::getString("snapshot_quality_very_high"); -	} - -	getChild<LLTextBox>("image_quality_level")->setTextArg("[QLVL]", quality_lvl); +    LLSliderCtrl* quality_slider = getChild<LLSliderCtrl>("image_quality_slider"); +    S32 quality_val = llfloor((F32) quality_slider->getValue().asReal()); + +    std::string quality_lvl; + +    if (quality_val < 20) +    { +        quality_lvl = LLTrans::getString("snapshot_quality_very_low"); +    } +    else if (quality_val < 40) +    { +        quality_lvl = LLTrans::getString("snapshot_quality_low"); +    } +    else if (quality_val < 60) +    { +        quality_lvl = LLTrans::getString("snapshot_quality_medium"); +    } +    else if (quality_val < 80) +    { +        quality_lvl = LLTrans::getString("snapshot_quality_high"); +    } +    else +    { +        quality_lvl = LLTrans::getString("snapshot_quality_very_high"); +    } + +    getChild<LLTextBox>("image_quality_level")->setTextArg("[QLVL]", quality_lvl);  }  void LLPanelSnapshot::goBack()  { -	LLSideTrayPanelContainer* parent = getParentContainer(); -	if (parent) -	{ -		parent->openPreviousPanel(); -		parent->getCurrentPanel()->onOpen(LLSD()); -	} +    LLSideTrayPanelContainer* parent = getParentContainer(); +    if (parent) +    { +        parent->openPreviousPanel(); +        parent->getCurrentPanel()->onOpen(LLSD()); +    }  }  void LLPanelSnapshot::cancel()  { -	goBack(); +    goBack();      getParentByType<LLFloater>()->notify(LLSD().with("set-ready", true));  }  void LLPanelSnapshot::onCustomResolutionCommit()  { -	LLSD info; +    LLSD info;      std::string widthSpinnerName = getWidthSpinnerName();      std::string heightSpinnerName = getHeightSpinnerName();      llassert(!widthSpinnerName.empty() && !heightSpinnerName.empty());      LLSpinCtrl *widthSpinner = getChild<LLSpinCtrl>(widthSpinnerName);      LLSpinCtrl *heightSpinner = getChild<LLSpinCtrl>(heightSpinnerName); -	if (getName() == "panel_snapshot_inventory") -	{ -		S32 width = widthSpinner->getValue().asInteger(); -		width = power_of_two(width, MAX_TEXTURE_SIZE); -		info["w"] = width; -		widthSpinner->setIncrement(width >> 1); -		widthSpinner->forceSetValue(width); -		S32 height =  heightSpinner->getValue().asInteger(); -		height = power_of_two(height, MAX_TEXTURE_SIZE); -		heightSpinner->setIncrement(height >> 1); -		heightSpinner->forceSetValue(height); -		info["h"] = height; -	} -	else -	{ -		info["w"] = widthSpinner->getValue().asInteger(); -		info["h"] = heightSpinner->getValue().asInteger(); -	} +    if (getName() == "panel_snapshot_inventory") +    { +        S32 width = widthSpinner->getValue().asInteger(); +        width = power_of_two(width, MAX_TEXTURE_SIZE); +        info["w"] = width; +        widthSpinner->setIncrement(width >> 1); +        widthSpinner->forceSetValue(width); +        S32 height =  heightSpinner->getValue().asInteger(); +        height = power_of_two(height, MAX_TEXTURE_SIZE); +        heightSpinner->setIncrement(height >> 1); +        heightSpinner->forceSetValue(height); +        info["h"] = height; +    } +    else +    { +        info["w"] = widthSpinner->getValue().asInteger(); +        info["h"] = heightSpinner->getValue().asInteger(); +    }      getParentByType<LLFloater>()->notify(LLSD().with("custom-res-change", info));  }  void LLPanelSnapshot::onResolutionComboCommit(LLUICtrl* ctrl)  { -	LLSD info; -	info["combo-res-change"]["control-name"] = ctrl->getName(); +    LLSD info; +    info["combo-res-change"]["control-name"] = ctrl->getName();      getParentByType<LLFloater>()->notify(info);  } @@ -241,5 +241,5 @@ void LLPanelSnapshot::onKeepAspectRatioCommit(LLUICtrl* ctrl)  LLSnapshotModel::ESnapshotType LLPanelSnapshot::getSnapshotType()  { -	return LLSnapshotModel::SNAPSHOT_WEB; +    return LLSnapshotModel::SNAPSHOT_WEB;  }  | 
