diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-03-29 22:56:48 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-03-29 22:56:48 +0300 |
commit | 0d068b0f3080a3378b54d508029bbc11e262aa2f (patch) | |
tree | 12586145545658827ab165892d283b628f18bf1a | |
parent | 8ed39a469b1b7337855c113f785fb64e66cf3b8f (diff) |
SL-19479 Remove outfit photo preview and replace with a pop up
-rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/newview/llfloateroutfitphotopreview.cpp | 288 | ||||
-rw-r--r-- | indra/newview/llfloateroutfitphotopreview.h | 77 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llviewerfloaterreg.cpp | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_outfit_photo_preview.xml | 65 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 11 |
7 files changed, 13 insertions, 440 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 1d7c238629..70024ce8a5 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -288,7 +288,6 @@ set(viewer_SOURCE_FILES llfloaternamedesc.cpp llfloaternotificationsconsole.cpp llfloaternotificationstabbed.cpp - llfloateroutfitphotopreview.cpp llfloaterobjectweights.cpp llfloateropenobject.cpp llfloatersimplesnapshot.cpp @@ -935,7 +934,6 @@ set(viewer_HEADER_FILES llfloaternamedesc.h llfloaternotificationsconsole.h llfloaternotificationstabbed.h - llfloateroutfitphotopreview.h llfloaterobjectweights.h llfloateropenobject.h llfloatersimplesnapshot.h diff --git a/indra/newview/llfloateroutfitphotopreview.cpp b/indra/newview/llfloateroutfitphotopreview.cpp deleted file mode 100644 index ade258aef7..0000000000 --- a/indra/newview/llfloateroutfitphotopreview.cpp +++ /dev/null @@ -1,288 +0,0 @@ -/** - * @file llfloateroutfitphotopreview.cpp - * @brief LLFloaterOutfitPhotoPreview class implementation - * - * $LicenseInfo:firstyear=2002&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 "llwindow.h" - -#include "llfloateroutfitphotopreview.h" - -#include "llagent.h" -#include "llappearancemgr.h" -#include "llbutton.h" -#include "llcombobox.h" -#include "llfilepicker.h" -#include "llfloaterreg.h" -#include "llimagetga.h" -#include "llimagepng.h" -#include "llinventory.h" -#include "llinventorymodel.h" -#include "llnotificationsutil.h" -#include "llresmgr.h" -#include "lltrans.h" -#include "lltextbox.h" -#include "lltextureview.h" -#include "llui.h" -#include "llviewerinventory.h" -#include "llviewertexture.h" -#include "llviewertexturelist.h" -#include "lluictrlfactory.h" -#include "llviewerwindow.h" -#include "lllineeditor.h" - -const S32 MAX_OUTFIT_PHOTO_WIDTH = 256; -const S32 MAX_OUTFIT_PHOTO_HEIGHT = 256; - -const S32 CLIENT_RECT_VPAD = 4; - -LLFloaterOutfitPhotoPreview::LLFloaterOutfitPhotoPreview(const LLSD& key) - : LLPreview(key), - mUpdateDimensions(TRUE), - mImage(NULL), - mOutfitID(LLUUID()), - mImageOldBoostLevel(LLGLTexture::BOOST_NONE), - mExceedLimits(FALSE) -{ - updateImageID(); -} - -LLFloaterOutfitPhotoPreview::~LLFloaterOutfitPhotoPreview() -{ - LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList) ; - - if (mImage.notNull()) - { - mImage->setBoostLevel(mImageOldBoostLevel); - mImage = NULL; - } -} - -// virtual -BOOL LLFloaterOutfitPhotoPreview::postBuild() -{ - getChild<LLButton>("ok_btn")->setClickedCallback(boost::bind(&LLFloaterOutfitPhotoPreview::onOkBtn, this)); - getChild<LLButton>("cancel_btn")->setClickedCallback(boost::bind(&LLFloaterOutfitPhotoPreview::onCancelBtn, this)); - - return LLPreview::postBuild(); -} - -void LLFloaterOutfitPhotoPreview::draw() -{ - updateDimensions(); - - LLPreview::draw(); - - if (!isMinimized()) - { - LLGLSUIDefault gls_ui; - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - const LLRect& border = mClientRect; - LLRect interior = mClientRect; - interior.stretch( -PREVIEW_BORDER_WIDTH ); - - // ...border - gl_rect_2d( border, LLColor4(0.f, 0.f, 0.f, 1.f)); - gl_rect_2d_checkerboard( interior ); - - if ( mImage.notNull() ) - { - // Draw the texture - gGL.diffuseColor3f( 1.f, 1.f, 1.f ); - gl_draw_scaled_image(interior.mLeft, - interior.mBottom, - interior.getWidth(), - interior.getHeight(), - mImage); - - // Pump the texture priority - F32 pixel_area = (F32)(interior.getWidth() * interior.getHeight() ); - mImage->addTextureStats( pixel_area ); - - S32 int_width = interior.getWidth(); - S32 int_height = interior.getHeight(); - mImage->setKnownDrawSize(int_width, int_height); - } - } - -} - -// virtual -void LLFloaterOutfitPhotoPreview::reshape(S32 width, S32 height, BOOL called_from_parent) -{ - LLPreview::reshape(width, height, called_from_parent); - - LLRect dim_rect(getChildView("dimensions")->getRect()); - - S32 horiz_pad = 2 * (LLPANEL_BORDER_WIDTH + PREVIEW_PAD) + PREVIEW_RESIZE_HANDLE_SIZE; - - S32 info_height = dim_rect.mTop + CLIENT_RECT_VPAD; - - LLRect client_rect(horiz_pad, getRect().getHeight(), getRect().getWidth() - horiz_pad, 0); - client_rect.mTop -= (PREVIEW_HEADER_SIZE + CLIENT_RECT_VPAD); - client_rect.mBottom += PREVIEW_BORDER + CLIENT_RECT_VPAD + info_height ; - - S32 client_width = client_rect.getWidth(); - S32 client_height = client_width; - - if(client_height > client_rect.getHeight()) - { - client_height = client_rect.getHeight(); - client_width = client_height; - } - mClientRect.setLeftTopAndSize(client_rect.getCenterX() - (client_width / 2), client_rect.getCenterY() + (client_height / 2), client_width, client_height); - -} - - -void LLFloaterOutfitPhotoPreview::updateDimensions() -{ - if (!mImage) - { - return; - } - if ((mImage->getFullWidth() * mImage->getFullHeight()) == 0) - { - return; - } - - if (mAssetStatus != PREVIEW_ASSET_LOADED) - { - mAssetStatus = PREVIEW_ASSET_LOADED; - mUpdateDimensions = TRUE; - } - - getChild<LLUICtrl>("dimensions")->setTextArg("[WIDTH]", llformat("%d", mImage->getFullWidth())); - getChild<LLUICtrl>("dimensions")->setTextArg("[HEIGHT]", llformat("%d", mImage->getFullHeight())); - - if ((mImage->getFullWidth() <= MAX_OUTFIT_PHOTO_WIDTH) && (mImage->getFullHeight() <= MAX_OUTFIT_PHOTO_HEIGHT)) - { - getChild<LLButton>("ok_btn")->setEnabled(TRUE); - mExceedLimits = FALSE; - } - else - { - mExceedLimits = TRUE; - LLStringUtil::format_map_t args; - args["MAX_WIDTH"] = llformat("%d", MAX_OUTFIT_PHOTO_WIDTH); - args["MAX_HEIGHT"] = llformat("%d", MAX_OUTFIT_PHOTO_HEIGHT); - std::string label = getString("exceed_limits", args); - getChild<LLUICtrl>("notification")->setValue(label); - getChild<LLUICtrl>("notification")->setColor(LLColor4::yellow); - getChild<LLButton>("ok_btn")->setEnabled(FALSE); - } - - if (mUpdateDimensions) - { - mUpdateDimensions = FALSE; - - reshape(getRect().getWidth(), getRect().getHeight()); - gFloaterView->adjustToFitScreen(this, FALSE); - } -} - -void LLFloaterOutfitPhotoPreview::loadAsset() -{ - if (mImage.notNull()) - { - mImage->setBoostLevel(mImageOldBoostLevel); - } - mImage = LLViewerTextureManager::getFetchedTexture(mImageID, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); - mImageOldBoostLevel = mImage->getBoostLevel(); - mImage->setBoostLevel(LLGLTexture::BOOST_PREVIEW); - mImage->forceToSaveRawImage(0) ; - mAssetStatus = PREVIEW_ASSET_LOADING; - mUpdateDimensions = TRUE; - updateDimensions(); -} - -LLPreview::EAssetStatus LLFloaterOutfitPhotoPreview::getAssetStatus() -{ - if (mImage.notNull() && (mImage->getFullWidth() * mImage->getFullHeight() > 0)) - { - mAssetStatus = PREVIEW_ASSET_LOADED; - } - return mAssetStatus; -} - -void LLFloaterOutfitPhotoPreview::updateImageID() -{ - const LLViewerInventoryItem *item = static_cast<const LLViewerInventoryItem*>(getItem()); - if(item) - { - mImageID = item->getAssetUUID(); - } - else - { - mImageID = mItemUUID; - } - -} - -/* virtual */ -void LLFloaterOutfitPhotoPreview::setObjectID(const LLUUID& object_id) -{ - mObjectUUID = object_id; - - const LLUUID old_image_id = mImageID; - - updateImageID(); - if (mImageID != old_image_id) - { - mAssetStatus = PREVIEW_ASSET_UNLOADED; - loadAsset(); - } - refreshFromItem(); -} - -void LLFloaterOutfitPhotoPreview::setOutfitID(const LLUUID& outfit_id) -{ - mOutfitID = outfit_id; - LLViewerInventoryCategory* outfit_folder = gInventory.getCategory(mOutfitID); - if(outfit_folder && !mExceedLimits) - { - getChild<LLUICtrl>("notification")->setValue( getString("photo_confirmation")); - getChild<LLUICtrl>("notification")->setTextArg("[OUTFIT]", outfit_folder->getName()); - getChild<LLUICtrl>("notification")->setColor(LLColor4::white); - } - -} - -void LLFloaterOutfitPhotoPreview::onOkBtn() -{ - if(mOutfitID.notNull() && getItem()) - { - LLAppearanceMgr::instance().removeOutfitPhoto(mOutfitID); - LLPointer<LLInventoryCallback> cb = NULL; - link_inventory_object(mOutfitID, LLConstPointer<LLInventoryObject>(getItem()), cb); - } - closeFloater(); -} - -void LLFloaterOutfitPhotoPreview::onCancelBtn() -{ - closeFloater(); -} diff --git a/indra/newview/llfloateroutfitphotopreview.h b/indra/newview/llfloateroutfitphotopreview.h deleted file mode 100644 index a1e7b58abe..0000000000 --- a/indra/newview/llfloateroutfitphotopreview.h +++ /dev/null @@ -1,77 +0,0 @@ -/** - * @file llfloateroutfitphotopreview.h - * @brief LLFloaterOutfitPhotoPreview class definition - * - * $LicenseInfo:firstyear=2002&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_LLFLOATEROUTFITPHOTOPREVIEW_H -#define LL_LLFLOATEROUTFITPHOTOPREVIEW_H - -#include "llpreview.h" -#include "llbutton.h" -#include "llframetimer.h" -#include "llviewertexture.h" - -class LLComboBox; -class LLImageRaw; - -class LLFloaterOutfitPhotoPreview : public LLPreview -{ -public: - LLFloaterOutfitPhotoPreview(const LLSD& key); - ~LLFloaterOutfitPhotoPreview(); - - virtual void draw(); - - virtual void loadAsset(); - virtual EAssetStatus getAssetStatus(); - - virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - - /*virtual*/ void setObjectID(const LLUUID& object_id); - - void setOutfitID(const LLUUID& outfit_id); - void onOkBtn(); - void onCancelBtn(); - -protected: - void init(); - /* virtual */ BOOL postBuild(); - -private: - void updateImageID(); // set what image is being uploaded. - void updateDimensions(); - LLUUID mImageID; - LLUUID mOutfitID; - LLPointer<LLViewerFetchedTexture> mImage; - S32 mImageOldBoostLevel; - - // This is stored off in a member variable, because the save-as - // button and drag and drop functionality need to know. - BOOL mUpdateDimensions; - - BOOL mExceedLimits; - - LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList ; -}; -#endif // LL_LLFLOATEROUTFITPHOTOPREVIEW_H diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 41aa11628f..24cbc28359 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -41,7 +41,6 @@ #include "llfloateropenobject.h" #include "llfloaterreg.h" #include "llfloatermarketplacelistings.h" -#include "llfloateroutfitphotopreview.h" #include "llfloatersidepanelcontainer.h" #include "llsidepanelinventory.h" #include "llfloaterworldmap.h" @@ -4896,11 +4895,8 @@ void LLFolderBridge::dropToOutfit(LLInventoryItem* inv_item, BOOL move_is_into_c const LLUUID &my_outifts_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); if(mUUID != my_outifts_id) { - LLFloaterOutfitPhotoPreview* photo_preview = LLFloaterReg::showTypedInstance<LLFloaterOutfitPhotoPreview>("outfit_photo_preview", inv_item->getUUID()); - if(photo_preview) - { - photo_preview->setOutfitID(mUUID); - } + // Legacy: prior to thumbnails images in outfits were used for outfit gallery. + LLNotificationsUtil::add("ThumbnailOutfitPhoto"); } return; } diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 36cfefdbb2..837742bf5a 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -104,7 +104,6 @@ #include "llfloaternotificationstabbed.h" #include "llfloaterobjectweights.h" #include "llfloateropenobject.h" -#include "llfloateroutfitphotopreview.h" #include "llfloatersimplesnapshot.h" #include "llfloaterpathfindingcharacters.h" #include "llfloaterpathfindingconsole.h" @@ -409,7 +408,6 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("object_weights", "floater_object_weights.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterObjectWeights>); LLFloaterReg::add("openobject", "floater_openobject.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterOpenObject>); LLFloaterReg::add("outgoing_call", "floater_outgoing_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLOutgoingCallDialog>); - LLFloaterReg::add("outfit_photo_preview", "floater_outfit_photo_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterOutfitPhotoPreview>); LLFloaterPayUtil::registerFloater(); LLFloaterReg::add("pathfinding_characters", "floater_pathfinding_characters.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPathfindingCharacters>); diff --git a/indra/newview/skins/default/xui/en/floater_outfit_photo_preview.xml b/indra/newview/skins/default/xui/en/floater_outfit_photo_preview.xml deleted file mode 100644 index bfc1c39e9d..0000000000 --- a/indra/newview/skins/default/xui/en/floater_outfit_photo_preview.xml +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes" ?> -<floater - legacy_header_height="18" - can_resize="false" - height="325" - layout="topleft" - name="outfit_photo_preview" - help_topic="preview_texture" - width="410"> - <floater.string - name="Title"> - Texture: [NAME] - </floater.string> - <floater.string - name="exceed_limits"> - Max outfit photo size is [MAX_WIDTH]*[MAX_HEIGHT]. Please select another texture. - </floater.string> - <floater.string - name="photo_confirmation"> - Set this as Outfit Photo for [OUTFIT]? - </floater.string> - <text - type="string" - halign="right" - length="1" - follows="right|bottom" - height="16" - layout="topleft" - left="110" - name="dimensions" - top="255" - width="200"> - [WIDTH]px x [HEIGHT]px - </text> - <text - type="string" - follows="left|top" - height="16" - layout="topleft" - name="notification" - left="25" - halign="center" - top_pad="5" - width="360"> - </text> - <button - follows="right|bottom" - height="22" - label="OK" - layout="topleft" - name="ok_btn" - top_pad="5" - right="-115" - top_delta="0" - width="90" /> - <button - follows="right|bottom" - height="22" - label="Cancel" - layout="topleft" - name="cancel_btn" - right="-20" - top_delta="0" - width="90" /> -</floater> diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 73ce5a6096..e6f670aa39 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6155,6 +6155,17 @@ Are you sure you want to delete them? </notification> <notification + icon="alertmodal.tga" + name="ThumbnailOutfitPhoto" + type="alertmodal"> + <unique/> + To add an image to an outfit, use the Outfit Gallery window, or right-click on the outfit folder and select "Image..." + <usetemplate + name="okbutton" + yestext="OK"/> + </notification> + + <notification icon="alertmodal.tga" name="ConfirmUnlink" type="alertmodal"> |