From 202f16cdf81fe590a7b40334016a7374e0bbdad7 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 19 Apr 2010 16:35:38 -0600 Subject: trival: remove some redundant code from llviewertexture.cpp. --- indra/newview/llviewertexture.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index a5adb11c53..c883087cf2 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1564,10 +1564,6 @@ F32 LLViewerFetchedTexture::calcDecodePriority() // larger mips are corrupted priority = -3.0f; } - else if (cur_discard <= mDesiredDiscardLevel) - { - priority = -4.0f; - } else { // priority range = 100,000 - 500,000 -- cgit v1.2.3 From 21dc4949feb0b0436471c409ddca809208a12852 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 22 Apr 2010 11:32:07 -0600 Subject: fix for EXT-6928: Viewer crashes immediately after enabling HTTP Textures on a http-texture-server-1 simulator and EXT-7009: textures fetched through http are never cached. --- indra/newview/lltexturefetch.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 2ea6e5936d..aea94fd720 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -850,6 +850,7 @@ bool LLTextureFetchWorker::doWork(S32 param) mState = WAIT_HTTP_REQ; mFetcher->addToHTTPQueue(mID); + mSentRequest = QUEUED; // Will call callbackHttpGet when curl request completes std::vector headers; headers.push_back("Accept: image/x-j2c"); @@ -936,6 +937,11 @@ bool LLTextureFetchWorker::doWork(S32 param) { mFileSize = mBufferSize; } + else //the file size is unknown + { + mFileSize = mBufferSize + 1 ; //flag the file is not fully loaded. + } + U8* buffer = new U8[mBufferSize]; if (cur_size > 0) { -- cgit v1.2.3 From 0b03cde790d54b5ebc41ee5dafa999eedde91a90 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 22 Apr 2010 13:21:40 -0600 Subject: revert -r d7a43c972af0: fix for EXT-6928: Viewer crashes immediately after enabling HTTP Textures on a http-texture-server-1 simulator and EXT-7009: textures fetched through http are never cached. This will be checked into viewer-trunk. --- indra/newview/lltexturefetch.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index aea94fd720..2ea6e5936d 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -850,7 +850,6 @@ bool LLTextureFetchWorker::doWork(S32 param) mState = WAIT_HTTP_REQ; mFetcher->addToHTTPQueue(mID); - mSentRequest = QUEUED; // Will call callbackHttpGet when curl request completes std::vector headers; headers.push_back("Accept: image/x-j2c"); @@ -937,11 +936,6 @@ bool LLTextureFetchWorker::doWork(S32 param) { mFileSize = mBufferSize; } - else //the file size is unknown - { - mFileSize = mBufferSize + 1 ; //flag the file is not fully loaded. - } - U8* buffer = new U8[mBufferSize]; if (cur_size > 0) { -- cgit v1.2.3 From 0225b5354bad94e7fe6bdb26be32322253403206 Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi Date: Fri, 23 Apr 2010 14:21:43 +0300 Subject: Related to EXT-1655 ([BSI] Always flying after pressing "Stand" to stand up from an object) - disabled forcing of flying at autopilot stops (for "Sit" autopilot behavior). Reviewed by Tofu Linden at https://codereview.productengine.com/secondlife/r/253/ --HG-- branch : product-engine --- indra/newview/llagent.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 5c54146caa..2f0afd0c91 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -2227,7 +2227,10 @@ void LLAgent::startAutoPilotGlobal(const LLVector3d &target_global, const std::s if ( distance > 1.f && heightDelta > (sqrtf(mAutoPilotStopDistance) + 1.f)) { setFlying(TRUE); - mAutoPilotFlyOnStop = TRUE; + // Do not force flying for "Sit" behavior to prevent flying after pressing "Stand" + // from an object. See EXT-1655. + if ("Sit" != mAutoPilotBehaviorName) + mAutoPilotFlyOnStop = TRUE; } mAutoPilot = TRUE; -- cgit v1.2.3 From c48e7478068f7e28f25ff06902922c9997df6f53 Mon Sep 17 00:00:00 2001 From: Eli Linden Date: Fri, 23 Apr 2010 13:04:42 -0700 Subject: FR linguistic --- indra/newview/skins/default/xui/fr/menu_group_plus.xml | 2 +- .../skins/default/xui/fr/menu_inventory_gear_default.xml | 2 +- .../skins/default/xui/fr/panel_main_inventory.xml | 2 +- indra/newview/skins/default/xui/fr/strings.xml | 16 ++++++++-------- 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/fr/menu_group_plus.xml b/indra/newview/skins/default/xui/fr/menu_group_plus.xml index f5882261b0..0db5afedc7 100644 --- a/indra/newview/skins/default/xui/fr/menu_group_plus.xml +++ b/indra/newview/skins/default/xui/fr/menu_group_plus.xml @@ -1,5 +1,5 @@ - + diff --git a/indra/newview/skins/default/xui/fr/menu_inventory_gear_default.xml b/indra/newview/skins/default/xui/fr/menu_inventory_gear_default.xml index 91bccfd699..4cfdfd2614 100644 --- a/indra/newview/skins/default/xui/fr/menu_inventory_gear_default.xml +++ b/indra/newview/skins/default/xui/fr/menu_inventory_gear_default.xml @@ -7,7 +7,7 @@ - + diff --git a/indra/newview/skins/default/xui/fr/panel_main_inventory.xml b/indra/newview/skins/default/xui/fr/panel_main_inventory.xml index 1a4450cccc..6cd9db2a5e 100644 --- a/indra/newview/skins/default/xui/fr/panel_main_inventory.xml +++ b/indra/newview/skins/default/xui/fr/panel_main_inventory.xml @@ -23,7 +23,7 @@ - + diff --git a/indra/newview/skins/default/xui/fr/strings.xml b/indra/newview/skins/default/xui/fr/strings.xml index 61659d386b..6d81df5cdb 100644 --- a/indra/newview/skins/default/xui/fr/strings.xml +++ b/indra/newview/skins/default/xui/fr/strings.xml @@ -2085,7 +2085,7 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE]. Large - Taille + Taille du front Yeux globuleux @@ -2235,7 +2235,7 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE]. Extrémités - Forme de la tête + Proéminence Cernes @@ -2559,7 +2559,7 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE]. Fente labiale - Fente labiale + Prof. fente labiale Volume des lèvres @@ -2643,7 +2643,7 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE]. Abaisser - Arête plus basse + Arête inférieure Joue inférieure @@ -2817,10 +2817,10 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE]. Épaisseur du nez - Bout du nez + Angle bout du nez - Bout du nez + Forme bout du nez Largeur du nez @@ -2946,7 +2946,7 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE]. Plus - Cernes + Paup. gonflées Couleur arc en ciel @@ -3237,7 +3237,7 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE]. Arête supérieure - Pommette + Joue supérieure Menton supérieur -- cgit v1.2.3 From f35a2112eae55aeb206a1111f86e08cdcd44884b Mon Sep 17 00:00:00 2001 From: Aimee Linden Date: Sat, 24 Apr 2010 18:55:55 +0100 Subject: EXT-7055: Re-remove old MAP_SCALE_* constants removed in DEV-30614 that have snuck back in --- indra/newview/llnetmap.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llnetmap.h b/indra/newview/llnetmap.h index 3d7f3233ac..eb53d295b2 100644 --- a/indra/newview/llnetmap.h +++ b/indra/newview/llnetmap.h @@ -46,10 +46,6 @@ class LLImageRaw; class LLTextBox; class LLViewerTexture; -const F32 MAP_SCALE_MIN = 64.f; -const F32 MAP_SCALE_MID = 172.f; -const F32 MAP_SCALE_MAX = 512.f; - class LLNetMap : public LLUICtrl { public: -- cgit v1.2.3 From 5fa00a67af6364554c05eb3ca0339770fa6da455 Mon Sep 17 00:00:00 2001 From: Aimee Linden Date: Sat, 24 Apr 2010 20:36:42 +0100 Subject: DEV-39786 (SNOW-572 / SNOW-220 / VWR-14712): GL_COLOR_INDEX8_EXT not defined as GL_EXT_paletted_texture is deprecated. Imported from Snowglobe. --- indra/newview/llvoavatarself.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 7473adda1f..63f060b58a 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2238,7 +2238,6 @@ LLGLuint LLVOAvatarSelf::getScratchTexName( LLGLenum format, S32& components, U3 { case GL_LUMINANCE: components = 1; internal_format = GL_LUMINANCE8; break; case GL_ALPHA: components = 1; internal_format = GL_ALPHA8; break; - case GL_COLOR_INDEX: components = 1; internal_format = GL_COLOR_INDEX8_EXT; break; case GL_LUMINANCE_ALPHA: components = 2; internal_format = GL_LUMINANCE8_ALPHA8; break; case GL_RGB: components = 3; internal_format = GL_RGB8; break; case GL_RGBA: components = 4; internal_format = GL_RGBA8; break; -- cgit v1.2.3 From f7588522668cdf21d4eaf837a07ebbdc998fa6ef Mon Sep 17 00:00:00 2001 From: Aimee Linden Date: Sun, 25 Apr 2010 00:41:41 +0100 Subject: DEV-42251 (SNOW-570 / SNOW-220 / VWR-14711): WaitNextEvent() is deprecated in the OS X 10.6 SDK Imported from Snowglobe. Use RunApplicationEventLoop() instead of WaitNextEvent() while the viewer is waiting for the crash logger to exit. --- indra/newview/llappviewermacosx.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp index 80d9b14345..7aeeb418f1 100644 --- a/indra/newview/llappviewermacosx.cpp +++ b/indra/newview/llappviewermacosx.cpp @@ -291,6 +291,7 @@ static OSStatus CarbonEventHandler(EventHandlerCallRef inHandlerCallRef, if(os_result >= 0 && matching_psn) { sCrashReporterIsRunning = false; + QuitApplicationEventLoop(); } } return noErr; @@ -326,7 +327,7 @@ void LLAppViewerMacOSX::handleCrashReporting(bool reportFreeze) // *NOTE:Mani A better way - make a copy of the data that the crash reporter will send // and let SL go about its business. This way makes the mac work like windows and linux // and is the smallest patch for the issue. - sCrashReporterIsRunning = true; + sCrashReporterIsRunning = false; ProcessSerialNumber o_psn; static EventHandlerRef sCarbonEventsRef = NULL; @@ -356,15 +357,13 @@ void LLAppViewerMacOSX::handleCrashReporting(bool reportFreeze) if(os_result >= 0) { - EventRecord evt; - while(sCrashReporterIsRunning) - { - while(WaitNextEvent(osMask, &evt, 0, NULL)) - { - // null op!?! - } - } - } + sCrashReporterIsRunning = true; + } + + while(sCrashReporterIsRunning) + { + RunApplicationEventLoop(); + } // Re-install the apps quit handler. AEInstallEventHandler(kCoreEventClass, -- cgit v1.2.3 From 4f38dd26825a3c9f92a6608b4b37ede71808bc30 Mon Sep 17 00:00:00 2001 From: Aimee Linden Date: Sun, 25 Apr 2010 12:42:10 +0100 Subject: DEV-49390 (SNOW-573): Deprecated methods for getting and setting the system audio mute on Mac AudioHardwareGetProperty(), AudioDeviceGetProperty() and AudioDeviceSetProperty() were deprecated in the 10.5 SDK, replaced using AudioObjectGetPropertyData() and AudioObjectSetPropertyData(). --- indra/newview/llappviewermacosx.cpp | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp index 7aeeb418f1..44ef39fb7d 100644 --- a/indra/newview/llappviewermacosx.cpp +++ b/indra/newview/llappviewermacosx.cpp @@ -452,16 +452,17 @@ std::string LLAppViewerMacOSX::generateSerialNumber() static AudioDeviceID get_default_audio_output_device(void) { AudioDeviceID device = 0; - UInt32 size; - OSStatus err; - - size = sizeof(device); - err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &size, &device); + UInt32 size = sizeof(device); + AudioObjectPropertyAddress device_address = { kAudioHardwarePropertyDefaultOutputDevice, + kAudioObjectPropertyScopeGlobal, + kAudioObjectPropertyElementMaster }; + + OSStatus err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &device_address, 0, NULL, &size, &device); if(err != noErr) { LL_DEBUGS("SystemMute") << "Couldn't get default audio output device (0x" << std::hex << err << ")" << LL_ENDL; } - + return device; } @@ -469,11 +470,15 @@ static AudioDeviceID get_default_audio_output_device(void) void LLAppViewerMacOSX::setMasterSystemAudioMute(bool new_mute) { AudioDeviceID device = get_default_audio_output_device(); - + if(device != 0) { UInt32 mute = new_mute; - OSStatus err = AudioDeviceSetProperty(device, NULL, 0, false, kAudioDevicePropertyMute, sizeof(mute), &mute); + AudioObjectPropertyAddress device_address = { kAudioDevicePropertyMute, + kAudioDevicePropertyScopeOutput, + kAudioObjectPropertyElementMaster }; + + OSStatus err = AudioObjectSetPropertyData(device, &device_address, 0, NULL, sizeof(mute), &mute); if(err != noErr) { LL_INFOS("SystemMute") << "Couldn't set audio mute property (0x" << std::hex << err << ")" << LL_ENDL; @@ -486,13 +491,17 @@ bool LLAppViewerMacOSX::getMasterSystemAudioMute() { // Assume the system isn't muted UInt32 mute = 0; - + AudioDeviceID device = get_default_audio_output_device(); - + if(device != 0) { UInt32 size = sizeof(mute); - OSStatus err = AudioDeviceGetProperty(device, 0, false, kAudioDevicePropertyMute, &size, &mute); + AudioObjectPropertyAddress device_address = { kAudioDevicePropertyMute, + kAudioDevicePropertyScopeOutput, + kAudioObjectPropertyElementMaster }; + + OSStatus err = AudioObjectGetPropertyData(device, &device_address, 0, NULL, &size, &mute); if(err != noErr) { LL_DEBUGS("SystemMute") << "Couldn't get audio mute property (0x" << std::hex << err << ")" << LL_ENDL; -- cgit v1.2.3 From fbfc85176670f3f948e6e2f00c8d8e37c96d5299 Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Mon, 26 Apr 2010 18:56:28 +0300 Subject: (EXT-6722) Create modified inventory view for "my outfits" tab in top-level appearance sidebar (tier 1) llui: - Setting container panel for accordion tab control to dynamically add tabs to accordions. - Added method to dynamically remove accordion tabs. - Added LLIconCtrl image setter. newview: - Class LLOutfitsList - a list of agents's outfits from "My Outfits" inventory category which represents each outfit by an accordion tab with a list of items inside it. - Class LLWearableItemsList - a list of wearable items used in each accordion tab of "My Outfits" tab. - Class LLInventoryItemsList - a base class for LLWearableItemsList that represents inventory items by panels in LLFlatListView. - Class LLPanelInventoryItem - inventory item representation for a flat list. Item icon is set according to item type. - Class LLInventoryCategoriesObserver - an observer used in LLOutfitsList for monitoring changes to "My Outfits" inventory category and updating outfits accordion tabs and list of items for each outfit. Reviewed by Mike Antipov https://codereview.productengine.com/secondlife/r/285/ --HG-- branch : product-engine --- indra/newview/llinventoryitemslist.cpp | 74 +++++++++++++++------- indra/newview/llinventoryitemslist.h | 36 ++++++----- indra/newview/llinventoryobserver.cpp | 30 +++++++-- indra/newview/lloutfitslist.cpp | 60 +++++++++--------- indra/newview/lloutfitslist.h | 13 ++++ indra/newview/llwearableitemslist.cpp | 5 +- indra/newview/llwearableitemslist.h | 19 ++++-- .../skins/default/xui/en/outfit_accordion_tab.xml | 4 +- 8 files changed, 158 insertions(+), 83 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llinventoryitemslist.cpp b/indra/newview/llinventoryitemslist.cpp index 9f54b86607..dca130c672 100644 --- a/indra/newview/llinventoryitemslist.cpp +++ b/indra/newview/llinventoryitemslist.cpp @@ -2,6 +2,10 @@ * @file llinventoryitemslist.cpp * @brief A list of inventory items represented by LLFlatListView. * + * Class LLInventoryItemsList implements a flat list of inventory items. + * Class LLPanelInventoryListItem displays inventory item as an element + * of LLInventoryItemsList. + * * $LicenseInfo:firstyear=2010&license=viewergpl$ * * Copyright (c) 2010, Linden Research, Inc. @@ -39,33 +43,31 @@ #include "lliconctrl.h" #include "llinventoryfunctions.h" +#include "llinventorymodel.h" #include "lltextutil.h" //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -LLPanelInventoryItem::LLPanelInventoryItem(LLAssetType::EType asset_type, - LLInventoryType::EType inventory_type, - U32 wearable_type, - const std::string &item_name, - const std::string &hl) -: LLPanel() - ,mItemName(item_name) - ,mHighlightedText(hl) - ,mIcon(NULL) - ,mTitle(NULL) +// static +LLPanelInventoryListItem* LLPanelInventoryListItem::createItemPanel(const LLViewerInventoryItem* item) { - mItemIcon = get_item_icon(asset_type, inventory_type, wearable_type, FALSE); - - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_inventory_item.xml"); + if (item) + { + return new LLPanelInventoryListItem(item); + } + else + { + return NULL; + } } -LLPanelInventoryItem::~LLPanelInventoryItem() +LLPanelInventoryListItem::~LLPanelInventoryListItem() {} //virtual -BOOL LLPanelInventoryItem::postBuild() +BOOL LLPanelInventoryListItem::postBuild() { mIcon = getChild("item_icon"); mTitle = getChild("item_name"); @@ -76,14 +78,14 @@ BOOL LLPanelInventoryItem::postBuild() } //virtual -void LLPanelInventoryItem::setValue(const LLSD& value) +void LLPanelInventoryListItem::setValue(const LLSD& value) { if (!value.isMap()) return; if (!value.has("selected")) return; childSetVisible("selected_icon", value["selected"]); } -void LLPanelInventoryItem::updateItem() +void LLPanelInventoryListItem::updateItem() { if (mItemIcon.notNull()) mIcon->setImage(mItemIcon); @@ -95,28 +97,47 @@ void LLPanelInventoryItem::updateItem() mHighlightedText); } -void LLPanelInventoryItem::onMouseEnter(S32 x, S32 y, MASK mask) +void LLPanelInventoryListItem::onMouseEnter(S32 x, S32 y, MASK mask) { childSetVisible("hovered_icon", true); LLPanel::onMouseEnter(x, y, mask); } -void LLPanelInventoryItem::onMouseLeave(S32 x, S32 y, MASK mask) +void LLPanelInventoryListItem::onMouseLeave(S32 x, S32 y, MASK mask) { childSetVisible("hovered_icon", false); LLPanel::onMouseLeave(x, y, mask); } +LLPanelInventoryListItem::LLPanelInventoryListItem(const LLViewerInventoryItem* item) +: LLPanel() + ,mIcon(NULL) + ,mTitle(NULL) +{ + mItemName = item->getName(); + mItemIcon = get_item_icon(item->getType(), item->getInventoryType(), item->getFlags(), FALSE); + + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_inventory_item.xml"); +} + //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -LLInventoryItemsList::LLInventoryItemsList(const LLFlatListView::Params& p) +LLInventoryItemsList::Params::Params() +{} + +LLInventoryItemsList::LLInventoryItemsList(const LLInventoryItemsList::Params& p) : LLFlatListView(p) , mNeedsRefresh(false) -{} +{ + // TODO: mCommitOnSelectionChange is set to "false" in LLFlatListView + // but reset to true in all derived classes. This settings might need to + // be added to LLFlatListView::Params() and/or set to "true" by default. + setCommitOnSelectionChange(true); +} // virtual LLInventoryItemsList::~LLInventoryItemsList() @@ -196,10 +217,15 @@ void LLInventoryItemsList::computeDifference( void LLInventoryItemsList::addNewItem(LLViewerInventoryItem* item) { - llassert(item); + if (!item) + { + llwarns << "No inventory item. Couldn't create flat list item." << llendl; + llassert(!"No inventory item. Couldn't create flat list item."); + } - LLPanelInventoryItem *list_item = new LLPanelInventoryItem(item->getType(), - item->getInventoryType(), item->getFlags(), item->getName(), LLStringUtil::null); + LLPanelInventoryListItem *list_item = LLPanelInventoryListItem::createItemPanel(item); + if (!list_item) + return; if (!addItem(list_item, item->getUUID())) { diff --git a/indra/newview/llinventoryitemslist.h b/indra/newview/llinventoryitemslist.h index 0ca4146867..b496f4b9e9 100644 --- a/indra/newview/llinventoryitemslist.h +++ b/indra/newview/llinventoryitemslist.h @@ -2,6 +2,10 @@ * @file llinventoryitemslist.h * @brief A list of inventory items represented by LLFlatListView. * + * Class LLInventoryItemsList implements a flat list of inventory items. + * Class LLPanelInventoryListItem displays inventory item as an element + * of LLInventoryItemsList. + * * $LicenseInfo:firstyear=2010&license=viewergpl$ * * Copyright (c) 2010, Linden Research, Inc. @@ -32,28 +36,23 @@ #ifndef LL_LLINVENTORYITEMSLIST_H #define LL_LLINVENTORYITEMSLIST_H -#include "llpanel.h" - -#include "llassettype.h" +#include "lldarray.h" -#include "llinventorytype.h" +#include "llpanel.h" // newview #include "llflatlistview.h" -#include "llinventorymodel.h" class LLIconCtrl; class LLTextBox; +class LLViewerInventoryItem; -class LLPanelInventoryItem : public LLPanel +class LLPanelInventoryListItem : public LLPanel { public: - LLPanelInventoryItem(LLAssetType::EType asset_type, - LLInventoryType::EType inventory_type, - U32 wearable_type, - const std::string &item_name, - const std::string &hl); - virtual ~LLPanelInventoryItem(); + static LLPanelInventoryListItem* createItemPanel(const LLViewerInventoryItem* item); + + virtual ~LLPanelInventoryListItem(); /*virtual*/ BOOL postBuild(); /*virtual*/ void setValue(const LLSD& value); @@ -63,6 +62,9 @@ public: void onMouseEnter(S32 x, S32 y, MASK mask); void onMouseLeave(S32 x, S32 y, MASK mask); +protected: + LLPanelInventoryListItem(const LLViewerInventoryItem* item); + private: LLIconCtrl* mIcon; LLTextBox* mTitle; @@ -72,13 +74,17 @@ private: std::string mHighlightedText; }; - class LLInventoryItemsList : public LLFlatListView { public: + struct Params : public LLInitParam::Block + { + Params(); + }; + virtual ~LLInventoryItemsList(); - void refreshList(const LLInventoryModel::item_array_t item_array); + void refreshList(const LLDynamicArray > item_array); /** * Let list know items need to be refreshed in next draw() @@ -91,7 +97,7 @@ public: protected: friend class LLUICtrlFactory; - LLInventoryItemsList(const LLFlatListView::Params& p); + LLInventoryItemsList(const LLInventoryItemsList::Params& p); uuid_vec_t& getIDs() { return mIDs; } diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 03006243f9..214b5d317a 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -658,11 +658,13 @@ void LLInventoryCategoriesObserver::changed(U32 mask) for (category_map_t::iterator iter = mCategoryMap.begin(); iter != mCategoryMap.end(); - iter++) + ++iter) { - // Inventory category version is used to find out if some changes - // to a category have been made. - S32 version = gInventory.getCategory((*iter).first)->getVersion(); + LLViewerInventoryCategory* category = gInventory.getCategory((*iter).first); + if (!category) + continue; + + S32 version = category->getVersion(); if (version != (*iter).second.mVersion) { // Update category version in map. @@ -674,11 +676,27 @@ void LLInventoryCategoriesObserver::changed(U32 mask) void LLInventoryCategoriesObserver::addCategory(const LLUUID& cat_id, callback_t cb) { - S32 version = gInventory.getCategory(cat_id)->getVersion(); + S32 version; + LLViewerInventoryCategory* category = gInventory.getCategory(cat_id); + if (category) + { + // Inventory category version is used to find out if some changes + // to a category have been made. + version = category->getVersion(); + } + else + { + // If category could not be retrieved it might mean that + // inventory is unusable at the moment so the category is + // stored with VERSION_UNKNOWN and it may be updated later. + version = LLViewerInventoryCategory::VERSION_UNKNOWN; + } + + version = category->getVersion(); mCategoryMap.insert(category_map_value_t(cat_id, LLCategoryData(cb, version))); } void LLInventoryCategoriesObserver::removeCategory(const LLUUID& cat_id) { - mCategoryMap.erase(mCategoryMap.find(cat_id)); + mCategoryMap.erase(cat_id); } diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index cce4f94028..1c627d452f 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -33,6 +33,9 @@ #include "lloutfitslist.h" +// llcommon +#include "llcommonutils.h" + #include "llaccordionctrl.h" #include "llaccordionctrltab.h" #include "llinventoryfunctions.h" @@ -45,7 +48,12 @@ LLOutfitsList::LLOutfitsList() : LLPanel() , mAccordion(NULL) , mListCommands(NULL) -{} +{ + mCategoriesObserver = new LLInventoryCategoriesObserver(); + gInventory.addObserver(mCategoriesObserver); + + gInventory.addObserver(this); +} LLOutfitsList::~LLOutfitsList() { @@ -65,11 +73,6 @@ BOOL LLOutfitsList::postBuild() { mAccordion = getChild("outfits_accordion"); - mCategoriesObserver = new LLInventoryCategoriesObserver(); - gInventory.addObserver(mCategoriesObserver); - - gInventory.addObserver(this); - return TRUE; } @@ -79,15 +82,15 @@ void LLOutfitsList::changed(U32 mask) if (!gInventory.isInventoryUsable()) return; - // Start observing changes in "My Outfits" category. const LLUUID outfits = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); - mCategoriesObserver->addCategory(outfits, - boost::bind(&LLOutfitsList::refreshList, this, outfits)); - LLViewerInventoryCategory* category = gInventory.getCategory(outfits); if (!category) return; + // Start observing changes in "My Outfits" category. + mCategoriesObserver->addCategory(outfits, + boost::bind(&LLOutfitsList::refreshList, this, outfits)); + // Fetch "My Outfits" contents and refresh the list to display // initially fetched items. If not all items are fetched now // the observer will refresh the list as soon as the new items @@ -121,7 +124,7 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) // Creating a vector of newly collected sub-categories UUIDs. for (LLInventoryModel::cat_array_t::const_iterator iter = cat_array.begin(); iter != cat_array.end(); - iter++) + ++iter) { vnew.push_back((*iter)->getUUID()); } @@ -131,35 +134,21 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) // Creating a vector of currently displayed sub-categories UUIDs. for (outfits_map_t::const_iterator iter = mOutfitsMap.begin(); iter != mOutfitsMap.end(); - iter++) + ++iter) { vcur.push_back((*iter).first); } - // Sorting both vectors to compare. - std::sort(vcur.begin(), vcur.end()); - std::sort(vnew.begin(), vnew.end()); - uuid_vec_t vadded; uuid_vec_t vremoved; - uuid_vec_t::iterator it; - size_t maxsize = llmax(vcur.size(), vnew.size()); - vadded.resize(maxsize); - vremoved.resize(maxsize); - - // what to remove - it = set_difference(vcur.begin(), vcur.end(), vnew.begin(), vnew.end(), vremoved.begin()); - vremoved.erase(it, vremoved.end()); - - // what to add - it = set_difference(vnew.begin(), vnew.end(), vcur.begin(), vcur.end(), vadded.begin()); - vadded.erase(it, vadded.end()); + // Create added and removed items vectors. + LLCommonUtils::computeDifference(vnew, vcur, vadded, vremoved); // Handle added tabs. for (uuid_vec_t::const_iterator iter = vadded.begin(); iter != vadded.end(); - iter++) + ++iter) { const LLUUID cat_id = (*iter); LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id); @@ -175,7 +164,7 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) LLAccordionCtrlTab* tab = LLUICtrlFactory::defaultBuilder(accordionXmlNode, NULL, NULL); // *TODO: LLUICtrlFactory::defaultBuilder does not use "display_children" from xml. Should be investigated. - tab->setDisplayChildren(false); + tab->setDisplayChildren(false); mAccordion->addCollapsibleCtrl(tab); // Map the new tab with outfit category UUID. @@ -185,6 +174,9 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) LLWearableItemsList* list = tab->getChild("wearable_items_list"); mCategoriesObserver->addCategory(cat_id, boost::bind(&LLWearableItemsList::updateList, list, cat_id)); + // Setting drop down callback to monitor currently selected outfit. + tab->setDropDownStateChangedCallback(boost::bind(&LLOutfitsList::onTabExpandedCollapsed, this, list)); + // Fetch the new outfit contents. cat->fetch(); @@ -252,6 +244,14 @@ void LLOutfitsList::updateOutfitTab(const LLUUID& category_id) } } +void LLOutfitsList::onTabExpandedCollapsed(LLWearableItemsList* list) +{ + if (!list) + return; + + // TODO: Add outfit selection handling. +} + void LLOutfitsList::setFilterSubString(const std::string& string) { mFilterSubString = string; diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h index f1756ce873..de14c15415 100644 --- a/indra/newview/lloutfitslist.h +++ b/indra/newview/lloutfitslist.h @@ -41,6 +41,17 @@ class LLAccordionCtrl; class LLAccordionCtrlTab; class LLWearableItemsList; +/** + * @class LLOutfitsList + * + * A list of agents's outfits from "My Outfits" inventory category + * which displays each outfit in an accordion tab with a flat list + * of items inside it. + * Uses LLInventoryCategoriesObserver to monitor changes to "My Outfits" + * inventory category and refresh the outfits listed in it. + * This class is derived from LLInventoryObserver to know when inventory + * becomes usable and it is safe to request data from inventory model. + */ class LLOutfitsList : public LLPanel, public LLInventoryObserver { public: @@ -56,6 +67,8 @@ public: // Update tab displaying outfit identified by category_id. void updateOutfitTab(const LLUUID& category_id); + void onTabExpandedCollapsed(LLWearableItemsList* list); + void setFilterSubString(const std::string& string); private: diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp index ff309cbbc3..3d110dcc78 100644 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -62,7 +62,10 @@ bool LLFindOutfitItems::operator()(LLInventoryCategory* cat, static const LLDefaultChildRegistry::Register r("wearable_items_list"); -LLWearableItemsList::LLWearableItemsList(const LLFlatListView::Params& p) +LLWearableItemsList::Params::Params() +{} + +LLWearableItemsList::LLWearableItemsList(const LLWearableItemsList::Params& p) : LLInventoryItemsList(p) {} diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h index e3b011912b..e7ccba8e6c 100644 --- a/indra/newview/llwearableitemslist.h +++ b/indra/newview/llwearableitemslist.h @@ -34,23 +34,32 @@ #include "llpanel.h" -#include "llassettype.h" - -#include "llinventorytype.h" - // newview #include "llinventoryitemslist.h" +/** + * @class LLWearableItemsList + * + * A flat list of wearable inventory items. + * Collects all items that can be a part of an outfit from + * an inventory category specified by UUID and displays them + * as a flat list. + */ class LLWearableItemsList : public LLInventoryItemsList { public: + struct Params : public LLInitParam::Block + { + Params(); + }; + virtual ~LLWearableItemsList(); void updateList(const LLUUID& category_id); protected: friend class LLUICtrlFactory; - LLWearableItemsList(const LLFlatListView::Params& p); + LLWearableItemsList(const LLWearableItemsList::Params& p); }; #endif //LL_LLWEARABLEITEMSLIST_H diff --git a/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml b/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml index d00b1bfb7b..b3150bb98b 100644 --- a/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml +++ b/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml @@ -1,10 +1,10 @@ - +