diff options
author | Alexander Gavriliuk <alexandrgproductengine@lindenlab.com> | 2024-09-18 11:44:03 +0200 |
---|---|---|
committer | Guru <alexandrgproductengine@lindenlab.com> | 2024-09-18 17:13:59 +0200 |
commit | 27b8e6d576346e3174760087a15811478a90459e (patch) | |
tree | ae0f6943799c426872019b3adacb13f9b5626d26 /indra/newview | |
parent | d9da5bbb33ce70e3bc799ba6696c8b10de0e5f04 (diff) |
#2408 The long covenant with emojis significantly slows down some operations in the viewer
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llchatmsgbox.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llexpandabletextbox.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llfloaterbuyland.cpp | 25 | ||||
-rw-r--r-- | indra/newview/llfloaterbuyland.h | 2 | ||||
-rw-r--r-- | indra/newview/llfloaterland.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llfloaterland.h | 2 | ||||
-rw-r--r-- | indra/newview/llfloaterregioninfo.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llfloaterregioninfo.h | 1 | ||||
-rw-r--r-- | indra/newview/llpanelplaceprofile.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llpanelplaceprofile.h | 2 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 36 | ||||
-rw-r--r-- | indra/newview/llviewertexteditor.cpp | 10 |
12 files changed, 111 insertions, 10 deletions
diff --git a/indra/newview/llchatmsgbox.cpp b/indra/newview/llchatmsgbox.cpp index b70b3eac95..eacbb4366d 100644 --- a/indra/newview/llchatmsgbox.cpp +++ b/indra/newview/llchatmsgbox.cpp @@ -41,6 +41,16 @@ public: mEditor(NULL) {} + /*virtual*/ LLTextSegmentPtr clone(LLTextBase& target) const + { + ChatSeparator* copy = new ChatSeparator(mStart, mEnd); + if (mEditor) + { + copy->mEditor = ⌖ + } + return copy; + } + /*virtual*/ void linkToDocument(class LLTextBase* editor) { mEditor = editor; diff --git a/indra/newview/llexpandabletextbox.cpp b/indra/newview/llexpandabletextbox.cpp index 748e10160c..5c46eb9d80 100644 --- a/indra/newview/llexpandabletextbox.cpp +++ b/indra/newview/llexpandabletextbox.cpp @@ -44,6 +44,14 @@ public: mExpanderLabel(utf8str_to_wstring(more_text)) {} + /*virtual*/ LLTextSegmentPtr clone(LLTextBase& target) const + { + LLStyleSP sp(cloneStyle(target, mStyle)); + LLExpanderSegment* copy = new LLExpanderSegment(sp, mStart, mEnd, LLStringUtil::null, target); + copy->mExpanderLabel = mExpanderLabel; + return copy; + } + /*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const { // more label always spans width of text box diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp index 11505e3047..a38cc94328 100644 --- a/indra/newview/llfloaterbuyland.cpp +++ b/indra/newview/llfloaterbuyland.cpp @@ -163,6 +163,7 @@ public: void updateParcelInfo(); void updateCovenantInfo(); static void onChangeAgreeCovenant(LLUICtrl* ctrl, void* user_data); + void updateFloaterCovenant(const LLTextBase* source, const LLUUID &asset_id); void updateFloaterCovenantText(const std::string& string, const LLUUID &asset_id); void updateFloaterEstateName(const std::string& name); void updateFloaterLastModified(const std::string& text); @@ -201,6 +202,8 @@ public: void onVisibilityChanged ( const LLSD& new_visibility ); +private: + void onCovenantTextUpdated(const LLUUID& asset_id); }; // static @@ -222,6 +225,15 @@ void LLFloaterBuyLand::buyLand( } // static +void LLFloaterBuyLand::updateCovenant(const LLTextBase* source, const LLUUID& asset_id) +{ + if (LLFloaterBuyLandUI* floater = LLFloaterReg::findTypedInstance<LLFloaterBuyLandUI>("buy_land")) + { + floater->updateFloaterCovenant(source, asset_id); + } +} + +// static void LLFloaterBuyLand::updateCovenantText(const std::string& string, const LLUUID &asset_id) { LLFloaterBuyLandUI* floater = LLFloaterReg::findTypedInstance<LLFloaterBuyLandUI>("buy_land"); @@ -560,11 +572,24 @@ void LLFloaterBuyLandUI::onChangeAgreeCovenant(LLUICtrl* ctrl, void* user_data) } } +void LLFloaterBuyLandUI::updateFloaterCovenant(const LLTextBase* source, const LLUUID& asset_id) +{ + LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("covenant_editor"); + editor->copyContents(source); + + onCovenantTextUpdated(asset_id); +} + void LLFloaterBuyLandUI::updateFloaterCovenantText(const std::string &string, const LLUUID& asset_id) { LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("covenant_editor"); editor->setText(string); + onCovenantTextUpdated(asset_id); +} + +void LLFloaterBuyLandUI::onCovenantTextUpdated(const LLUUID& asset_id) +{ LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("agree_covenant"); LLTextBox* box = getChild<LLTextBox>("covenant_text"); if (asset_id.isNull()) diff --git a/indra/newview/llfloaterbuyland.h b/indra/newview/llfloaterbuyland.h index f750a4017a..732312f10f 100644 --- a/indra/newview/llfloaterbuyland.h +++ b/indra/newview/llfloaterbuyland.h @@ -27,6 +27,7 @@ #ifndef LL_LLFLOATERBUYLAND_H #define LL_LLFLOATERBUYLAND_H +class LLTextBase; class LLFloater; class LLViewerRegion; class LLParcelSelection; @@ -37,6 +38,7 @@ public: static void buyLand(LLViewerRegion* region, LLSafeHandle<LLParcelSelection> parcel, bool is_for_group); + static void updateCovenant(const LLTextBase* source, const LLUUID& asset_id); static void updateCovenantText(const std::string& string, const LLUUID& asset_id); static void updateEstateName(const std::string& name); static void updateLastModified(const std::string& text); diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index bec76fe5e4..52a3e78d04 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -3124,6 +3124,16 @@ void LLPanelLandCovenant::refresh() } // static +void LLPanelLandCovenant::updateCovenant(const LLTextBase* source) +{ + if (LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant()) + { + LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("covenant_editor"); + editor->copyContents(source); + } +} + +// static void LLPanelLandCovenant::updateCovenantText(const std::string &string) { LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant(); diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h index 95f6a44a94..8af0caab33 100644 --- a/indra/newview/llfloaterland.h +++ b/indra/newview/llfloaterland.h @@ -50,6 +50,7 @@ class LLRadioGroup; class LLParcelSelectionObserver; class LLSpinCtrl; class LLTabContainer; +class LLTextBase; class LLTextBox; class LLTextEditor; class LLTextureCtrl; @@ -416,6 +417,7 @@ public: virtual ~LLPanelLandCovenant(); virtual bool postBuild(); void refresh(); + static void updateCovenant(const LLTextBase* source); static void updateCovenantText(const std::string& string); static void updateEstateName(const std::string& name); static void updateLastModified(const std::string& text); diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 8070284e32..efeee1ad3c 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -2820,6 +2820,16 @@ void LLPanelEstateCovenant::setEstateName(const std::string& name) } // static +void LLPanelEstateCovenant::updateCovenant(const LLTextBase* source, const LLUUID& asset_id) +{ + if (LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant()) + { + panelp->mEditor->copyContents(source); + panelp->setCovenantID(asset_id); + } +} + +// static void LLPanelEstateCovenant::updateCovenantText(const std::string& string, const LLUUID& asset_id) { LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant(); diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index b604a28fc3..65c1291728 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -382,6 +382,7 @@ public: void* user_data, S32 status, LLExtStat ext_status); // Accessor functions + static void updateCovenant(const LLTextBase* source, const LLUUID& asset_id); static void updateCovenantText(const std::string& string, const LLUUID& asset_id); static void updateEstateName(const std::string& name); static void updateLastModified(const std::string& text); diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp index 18588514f8..87f05f2028 100644 --- a/indra/newview/llpanelplaceprofile.cpp +++ b/indra/newview/llpanelplaceprofile.cpp @@ -629,6 +629,11 @@ void LLPanelPlaceProfile::updateCovenantText(const std::string &text) mCovenantText->setText(text); } +void LLPanelPlaceProfile::updateCovenant(const LLTextBase* source) +{ + mCovenantText->copyContents(source); +} + void LLPanelPlaceProfile::onForSaleBannerClick() { LLViewerParcelMgr* mgr = LLViewerParcelMgr::getInstance(); diff --git a/indra/newview/llpanelplaceprofile.h b/indra/newview/llpanelplaceprofile.h index 45a20fb86a..f562be0f5d 100644 --- a/indra/newview/llpanelplaceprofile.h +++ b/indra/newview/llpanelplaceprofile.h @@ -31,6 +31,7 @@ class LLAccordionCtrl; class LLIconCtrl; +class LLTextBase; class LLTextEditor; class LLPanelPlaceProfile : public LLPanelPlaceInfo @@ -60,6 +61,7 @@ public: void updateEstateName(const std::string& name); void updateEstateOwnerName(const std::string& name); void updateCovenantText(const std::string &text); + void updateCovenant(const LLTextBase* source); private: void onForSaleBannerClick(); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 0861b439eb..1d4828fd33 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -6739,7 +6739,8 @@ void onCovenantLoadComplete(const LLUUID& asset_uuid, { LL_DEBUGS("Messaging") << "onCovenantLoadComplete()" << LL_ENDL; std::string covenant_text; - if(0 == status) + std::unique_ptr<LLViewerTextEditor> editorp; + if (0 == status) { LLFileSystem file(asset_uuid, type, LLFileSystem::READ); @@ -6760,13 +6761,13 @@ void onCovenantLoadComplete(const LLUUID& asset_uuid, { LL_WARNS("Messaging") << "Problem importing estate covenant." << LL_ENDL; covenant_text = "Problem importing estate covenant."; + delete editor; } else { // Version 0 (just text, doesn't include version number) - covenant_text = editor->getText(); + editorp.reset(editor); // Use covenant from editorp; } - delete editor; } else { @@ -6792,17 +6793,32 @@ void onCovenantLoadComplete(const LLUUID& asset_uuid, LL_WARNS("Messaging") << "Problem loading notecard: " << status << LL_ENDL; } - LLPanelEstateCovenant::updateCovenantText(covenant_text, asset_uuid); - LLPanelLandCovenant::updateCovenantText(covenant_text); - LLFloaterBuyLand::updateCovenantText(covenant_text, asset_uuid); - LLPanelPlaceProfile* panel = LLFloaterSidePanelContainer::getPanel<LLPanelPlaceProfile>("places", "panel_place_profile"); - if (panel) + if (editorp) { - panel->updateCovenantText(covenant_text); + LLPanelEstateCovenant::updateCovenant(editorp.get(), asset_uuid); + LLPanelLandCovenant::updateCovenant(editorp.get()); + LLFloaterBuyLand::updateCovenant(editorp.get(), asset_uuid); + } + else + { + LLPanelEstateCovenant::updateCovenantText(covenant_text, asset_uuid); + LLPanelLandCovenant::updateCovenantText(covenant_text); + LLFloaterBuyLand::updateCovenantText(covenant_text, asset_uuid); } -} + if (LLPanelPlaceProfile* panel = LLFloaterSidePanelContainer::getPanel<LLPanelPlaceProfile>("places", "panel_place_profile")) + { + if (editorp) + { + panel->updateCovenant(editorp.get()); + } + else + { + panel->updateCovenantText(covenant_text); + } + } +} void process_feature_disabled_message(LLMessageSystem* msg, void**) { diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 5793a28b80..210cd62d6f 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -179,6 +179,16 @@ public: mToolTip = inv_item->getName() + '\n' + inv_item->getDescription(); } + /*virtual*/ LLTextSegmentPtr clone(LLTextBase& target) const + { + LLTextEditor* editor = dynamic_cast<LLTextEditor*>(&target); + llassert(editor); + if (!editor) + return nullptr; + + return new LLEmbeddedItemSegment(mStart, mImage, mItem, *editor); + } + /*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const { if (num_chars == 0) |