From 60aee53f43815df393d4282812312a0360ef6e17 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Mon, 29 Nov 2021 16:56:00 +0100 Subject: [PATCH] FIRE-23984: Show parcel picture for events in legacy search --- indra/newview/fsfloatersearch.cpp | 63 +++++++++++++++++-- indra/newview/fsfloatersearch.h | 9 ++- .../default/xui/en/floater_fs_search.xml | 11 ++++ .../latency/xui/en/floater_fs_search.xml | 12 ++++ 4 files changed, 87 insertions(+), 8 deletions(-) diff --git a/indra/newview/fsfloatersearch.cpp b/indra/newview/fsfloatersearch.cpp index fd5e39d3a7..61562d6bf9 100644 --- a/indra/newview/fsfloatersearch.cpp +++ b/indra/newview/fsfloatersearch.cpp @@ -57,6 +57,7 @@ #include "llparcel.h" #include "llproductinforequest.h" #include "llqueryflags.h" +#include "llregionhandle.h" #include "llremoteparcelrequest.h" #include "lltimer.h" #include "lltrans.h" @@ -64,6 +65,7 @@ #include "llviewergenericmessage.h" #include "llviewernetwork.h" #include "llviewerregion.h" +#include "llworldmapmessage.h" #include "message.h" #include #include @@ -82,8 +84,9 @@ void fillSearchComboBox(LLSearchComboBox* search_combo); class FSSearchRemoteParcelInfoObserver : public LLRemoteParcelInfoObserver { public: - FSSearchRemoteParcelInfoObserver(FSFloaterSearch* floater) : LLRemoteParcelInfoObserver(), - mParent(floater) + FSSearchRemoteParcelInfoObserver(FSFloaterSearch* floater, bool for_events) : LLRemoteParcelInfoObserver(), + mParent(floater), + mForEvents(for_events) {} ~FSSearchRemoteParcelInfoObserver() @@ -102,7 +105,14 @@ public: { if (mParent) { - mParent->displayParcelDetails(parcel_data); + if (mForEvents) + { + mParent->displayEventParcelImage(parcel_data); + } + else + { + mParent->displayParcelDetails(parcel_data); + } } mParcelIDs.erase(parcel_data.parcel_id); LLRemoteParcelInfoProcessor::getInstance()->removeObserver(parcel_data.parcel_id, this); @@ -125,6 +135,7 @@ public: private: std::set mParcelIDs; FSFloaterSearch* mParent; + bool mForEvents; }; ///// Avatar Properties Observer ///// @@ -234,13 +245,15 @@ SearchQuery::SearchQuery() FSFloaterSearch::FSFloaterSearch(const Params& key) : LLFloater(key) { - mRemoteParcelObserver = new FSSearchRemoteParcelInfoObserver(this); + mRemoteParcelObserver = new FSSearchRemoteParcelInfoObserver(this, false); + mRemoteParcelEventLocationObserver = new FSSearchRemoteParcelInfoObserver(this, true); mAvatarPropertiesObserver = new FSSearchAvatarPropertiesObserver(this); } FSFloaterSearch::~FSFloaterSearch() { delete mRemoteParcelObserver; + delete mRemoteParcelEventLocationObserver; delete mAvatarPropertiesObserver; gGenericDispatcher.addHandler("classifiedclickthrough", nullptr); } @@ -312,6 +325,7 @@ BOOL FSFloaterSearch::postBuild() mDetailAux2 = getChild("aux2"); mDetailLocation = getChild("location"); mDetailSnapshot = getChild("snapshot"); + mDetailSnapshotParcel = getChild("snapshot_parcel"); mDetailMaturity = getChild("maturity_icon"); mTabContainer = getChild("ls_tabs"); @@ -349,6 +363,18 @@ void FSFloaterSearch::onTabChange() { mDetailsPanel->setVisible(mHasSelection); } + + if (active_panel == mPanelPeople || active_panel == mPanelGroups) + { + mDetailSnapshotParcel->setVisible(FALSE); + mDetailSnapshot->setVisible(TRUE); + } + else if (active_panel == mPanelPlaces || active_panel == mPanelLand || + active_panel == mPanelEvents || active_panel == mPanelClassifieds) + { + mDetailSnapshot->setVisible(FALSE); + mDetailSnapshotParcel->setVisible(TRUE); + } } //static @@ -457,7 +483,7 @@ void FSFloaterSearch::displayParcelDetails(const LLParcelData& parcel_data) mDetailAux1->setValue(getString("string.traffic", map)); mDetailAux2->setValue(getString("string.area", map)); mDetailLocation->setValue(getString("string.location", map)); - mDetailSnapshot->setValue(parcel_data.snapshot_id); + mDetailSnapshotParcel->setValue(parcel_data.snapshot_id); childSetVisible("teleport_btn", true); childSetVisible("map_btn", true); setLoadingProgress(false); @@ -539,7 +565,7 @@ void FSFloaterSearch::displayClassifiedDetails(LLAvatarClassifiedInfo*& c_info) mParcelGlobal = c_info->pos_global; mDetailTitle->setValue(c_info->name); mDetailDesc->setValue(c_info->description); - mDetailSnapshot->setValue(c_info->snapshot_id); + mDetailSnapshotParcel->setValue(c_info->snapshot_id); mDetailAux1->setValue(getString("string.listing_price", map)); mDetailLocation->setValue(getString("string.slurl", map)); childSetVisible("teleport_btn", true); @@ -587,9 +613,34 @@ void FSFloaterSearch::displayEventDetails(U32 eventId, F64 eventEpoch, const std mDetailDesc->setValue(eventDesc); mDetailAux1->setValue(getString("string.duration", map)); mDetailLocation->setValue(getString("string.location", map)); + mDetailSnapshotParcel->setValue(LLUUID::null); childSetVisible("teleport_btn", true); childSetVisible("map_btn", true); childSetVisible("event_reminder_btn", true); + + LLWorldMapMessage::getInstance()->sendNamedRegionRequest(simName, boost::bind(&FSFloaterSearch::regionHandleCallback, this, _1, eventGlobalPos), "", false); +} + +void FSFloaterSearch::regionHandleCallback(U64 region_handle, LLVector3d pos_global) +{ + std::string url = gAgent.getRegionCapability("RemoteParcelRequest"); + if (!url.empty()) + { + auto region_origin = from_region_handle(region_handle); + LLVector3 pos_region(LLVector3(pos_global - region_origin)); + + LLRemoteParcelInfoProcessor::getInstance()->requestRegionParcelInfo(url, + LLUUID::null, pos_region, pos_global, mRemoteParcelEventLocationObserver->getObserverHandle()); + } + else + { + setLoadingProgress(false); + } +} + +void FSFloaterSearch::displayEventParcelImage(const LLParcelData& parcel_data) +{ + mDetailSnapshotParcel->setValue(parcel_data.snapshot_id); setLoadingProgress(false); } diff --git a/indra/newview/fsfloatersearch.h b/indra/newview/fsfloatersearch.h index eff98d68c8..8ef70656e7 100644 --- a/indra/newview/fsfloatersearch.h +++ b/indra/newview/fsfloatersearch.h @@ -42,7 +42,7 @@ #include "llscrolllistctrl.h" #include "lltabcontainer.h" -class LLRemoteParcelInfoObserver; +class FSSearchRemoteParcelInfoObserver; class LLAvatarPropertiesObserver; class LLGroupMgrObserver; class LLSearchEditor; @@ -360,6 +360,7 @@ public: U32 eventFlags, U32 eventCover, LLVector3d eventGlobalPos); + void displayEventParcelImage(const LLParcelData& parcel_data); void setLoadingProgress(bool started); template @@ -386,7 +387,10 @@ private: void onBtnTeleport(); void onBtnMap(); - LLRemoteParcelInfoObserver* mRemoteParcelObserver; + void regionHandleCallback(U64 region_handle, LLVector3d pos_global); + + FSSearchRemoteParcelInfoObserver* mRemoteParcelObserver; + FSSearchRemoteParcelInfoObserver* mRemoteParcelEventLocationObserver; LLAvatarPropertiesObserver* mAvatarPropertiesObserver; LLGroupMgrObserver* mGroupPropertiesRequest; @@ -405,6 +409,7 @@ private: LLTextEditor* mDetailAux2; LLTextEditor* mDetailLocation; LLTextureCtrl* mDetailSnapshot; + LLTextureCtrl* mDetailSnapshotParcel; LLIconCtrl* mDetailMaturity; LLTabContainer* mTabContainer; FSPanelProfile* mPanelProfile; diff --git a/indra/newview/skins/default/xui/en/floater_fs_search.xml b/indra/newview/skins/default/xui/en/floater_fs_search.xml index f47d5902a1..0249d0fa1f 100644 --- a/indra/newview/skins/default/xui/en/floater_fs_search.xml +++ b/indra/newview/skins/default/xui/en/floater_fs_search.xml @@ -140,6 +140,17 @@ name="snapshot" top_pad="4" width="280"/> + +