diff options
author | Sergei Litovchuk <slitovchuk@productengine.com> | 2010-02-02 18:48:40 +0200 |
---|---|---|
committer | Sergei Litovchuk <slitovchuk@productengine.com> | 2010-02-02 18:48:40 +0200 |
commit | e367c412988a55515fb68179d21f5d1c19249969 (patch) | |
tree | 4ea90fa2ec2b51e400f42cabd539b9b109e87751 | |
parent | 5fc508bbc2ddd5bb3d91a20a16dcc68783099986 (diff) |
Working on (EXT-4347) Moving object contents to inventory opens files, changes menu.
- Removing LLPanelPlaces dependency from open_inventory_offer handler.
- Added landmark offer handling to Places panel.
--HG--
branch : product-engine
-rw-r--r-- | indra/newview/llpanelplaces.cpp | 57 | ||||
-rw-r--r-- | indra/newview/llpanelplaces.h | 8 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 53 | ||||
-rw-r--r-- | indra/newview/llviewermessage.h | 5 |
4 files changed, 91 insertions, 32 deletions
diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp index 29cfbbe606..a49386cb5c 100644 --- a/indra/newview/llpanelplaces.cpp +++ b/indra/newview/llpanelplaces.cpp @@ -70,6 +70,7 @@ #include "lltoggleablemenu.h" #include "llviewerinventory.h" #include "llviewermenu.h" +#include "llviewermessage.h" #include "llviewerparcelmgr.h" #include "llviewerregion.h" #include "llviewerwindow.h" @@ -105,22 +106,35 @@ private: LLPanelPlaces* mPlaces; }; -class LLPlacesInventoryObserver : public LLInventoryObserver +class LLPlacesInventoryObserver : public LLInventoryAddedObserver { public: LLPlacesInventoryObserver(LLPanelPlaces* places_panel) : - LLInventoryObserver(), - mPlaces(places_panel) + mPlaces(places_panel), + mTabsCreated(false) {} /*virtual*/ void changed(U32 mask) { - if (mPlaces) - mPlaces->changedInventory(mask); + LLInventoryAddedObserver::changed(mask); + + if (!mTabsCreated && mPlaces) + { + mPlaces->createTabs(); + mTabsCreated = true; + } + } + +protected: + /*virtual*/ void done() + { + mPlaces->showAddedLandmarkInfo(mAdded); + mAdded.clear(); } private: LLPanelPlaces* mPlaces; + bool mTabsCreated; }; class LLPlacesRemoteParcelInfoObserver : public LLRemoteParcelInfoObserver @@ -943,7 +957,7 @@ void LLPanelPlaces::changedParcelSelection() updateVerbs(); } -void LLPanelPlaces::changedInventory(U32 mask) +void LLPanelPlaces::createTabs() { if (!(gInventory.isInventoryUsable() && LLTeleportHistory::getInstance())) return; @@ -979,10 +993,6 @@ void LLPanelPlaces::changedInventory(U32 mask) // Filter applied to show all items. if (mActivePanel) mActivePanel->onSearchEdit(mActivePanel->getFilterSubString()); - - // we don't need to monitor inventory changes anymore, - // so remove the observer - gInventory.removeObserver(mInventoryObserver); } void LLPanelPlaces::changedGlobalPos(const LLVector3d &global_pos) @@ -991,6 +1001,33 @@ void LLPanelPlaces::changedGlobalPos(const LLVector3d &global_pos) updateVerbs(); } +void LLPanelPlaces::showAddedLandmarkInfo(const std::vector<LLUUID>& items) +{ + for (std::vector<LLUUID>::const_iterator item_iter = items.begin(); + item_iter != items.end(); + ++item_iter) + { + const LLUUID& item_id = (*item_iter); + if(!highlight_offered_item(item_id)) + { + continue; + } + + LLInventoryItem* item = gInventory.getItem(item_id); + + if (LLAssetType::AT_LANDMARK == item->getType()) + { + // Created landmark is passed to Places panel to allow its editing. + // If the panel is closed we don't reopen it until created landmark is loaded. + if("create_landmark" == getPlaceInfoType() && !getItem()) + { + setItem(item); + } + break; + } + } +} + void LLPanelPlaces::updateVerbs() { bool is_place_info_visible; diff --git a/indra/newview/llpanelplaces.h b/indra/newview/llpanelplaces.h index 110d7a1054..78fcbbb11d 100644 --- a/indra/newview/llpanelplaces.h +++ b/indra/newview/llpanelplaces.h @@ -66,11 +66,15 @@ public: // Called on parcel selection change to update place information. void changedParcelSelection(); - // Called on agent inventory change to find out when inventory gets usable. - void changedInventory(U32 mask); + // Called once on agent inventory first change to find out when inventory gets usable + // and to create "My Landmarks" and "Teleport History" tabs. + void createTabs(); // Called when we receive the global 3D position of a parcel. void changedGlobalPos(const LLVector3d &global_pos); + // Opens landmark info panel when agent creates or receives landmark. + void showAddedLandmarkInfo(const std::vector<LLUUID>& items); + void setItem(LLInventoryItem* item); LLInventoryItem* getItem() { return mItem; } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index b0952dd698..26c9a1dd79 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -860,28 +860,12 @@ void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& f ++item_iter) { const LLUUID& item_id = (*item_iter); - LLInventoryItem* item = gInventory.getItem(item_id); - if(!item) + if(!highlight_offered_item(item_id)) { - LL_WARNS("Messaging") << "Unable to show inventory item: " << item_id << LL_ENDL; continue; } - //////////////////////////////////////////////////////////////////////////////// - // Don't highlight if it's in certain "quiet" folders which don't need UI - // notification (e.g. trash, cof, lost-and-found). - if(!gAgent.getAFK()) - { - const LLViewerInventoryCategory *parent = gInventory.getFirstNondefaultParent(item_id); - if (parent) - { - const LLFolderType::EType parent_type = parent->getPreferredType(); - if (LLViewerFolderType::lookupIsQuietType(parent_type)) - { - continue; - } - } - } + LLInventoryItem* item = gInventory.getItem(item_id); //////////////////////////////////////////////////////////////////////////////// // Special handling for various types. @@ -928,10 +912,11 @@ void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& f LLPanelPlaces *places_panel = dynamic_cast<LLPanelPlaces*>(LLSideTray::getInstance()->getPanel("panel_places")); if (places_panel) { - // we are creating a landmark + // Landmark creation handling is moved to LLPanelPlaces::showAddedLandmarkInfo() + // TODO* LLPanelPlaces dependency is going to be removed. See EXT-4347. if("create_landmark" == places_panel->getPlaceInfoType() && !places_panel->getItem()) { - places_panel->setItem(item); + //places_panel->setItem(item); } // we are opening a group notice attachment else @@ -981,6 +966,34 @@ void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& f } } +bool highlight_offered_item(const LLUUID& item_id) +{ + LLInventoryItem* item = gInventory.getItem(item_id); + if(!item) + { + LL_WARNS("Messaging") << "Unable to show inventory item: " << item_id << LL_ENDL; + return false; + } + + //////////////////////////////////////////////////////////////////////////////// + // Don't highlight if it's in certain "quiet" folders which don't need UI + // notification (e.g. trash, cof, lost-and-found). + if(!gAgent.getAFK()) + { + const LLViewerInventoryCategory *parent = gInventory.getFirstNondefaultParent(item_id); + if (parent) + { + const LLFolderType::EType parent_type = parent->getPreferredType(); + if (LLViewerFolderType::lookupIsQuietType(parent_type)) + { + return false; + } + } + } + + return true; +} + void inventory_offer_mute_callback(const LLUUID& blocked_id, const std::string& first_name, const std::string& last_name, diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h index 1415c16090..7dd629dcfd 100644 --- a/indra/newview/llviewermessage.h +++ b/indra/newview/llviewermessage.h @@ -203,6 +203,11 @@ void process_initiate_download(LLMessageSystem* msg, void**); void start_new_inventory_observer(); void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& from_name); +// Returns true if item is not in certain "quiet" folder which don't need UI +// notification (e.g. trash, cof, lost-and-found) and agent is not AFK, false otherwise. +// Returns false if item is not found. +bool highlight_offered_item(const LLUUID& item_id); + struct LLOfferInfo { LLOfferInfo() |