From ba2b77d0882f8ca3ef0ae95ca9d388aa217f9a7a Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Sun, 18 Aug 2024 15:35:33 -0400 Subject: Fix findChild during draw in preference floater --- indra/newview/llfloaterpreference.cpp | 49 ++++++++++------------ indra/newview/llfloaterpreference.h | 7 +++- .../default/xui/en/panel_preferences_alerts.xml | 2 - 3 files changed, 28 insertions(+), 30 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 5e5cfcecbf..3441fff7e8 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -430,6 +430,13 @@ void LLFloaterPreference::saveAvatarPropertiesCoro(const std::string cap_url, bo bool LLFloaterPreference::postBuild() { + mDeleteTranscriptsBtn = getChild("delete_transcripts"); + + mEnabledPopups = getChild("enabled_popups"); + mDisabledPopups = getChild("disabled_popups"); + mEnablePopupBtn = getChild("enable_this_popup"); + mDisablePopupBtn = getChild("disable_this_popup"); + gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLFloaterIMSessionTab::processChatHistoryStyleUpdate, false)); gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLViewerChat::signalChatFontChanged)); @@ -519,7 +526,7 @@ bool LLFloaterPreference::postBuild() void LLFloaterPreference::updateDeleteTranscriptsButton() { - getChild("delete_transcripts")->setEnabled(LLLogChat::transcriptFilesExist()); + mDeleteTranscriptsBtn->setEnabled(LLLogChat::transcriptFilesExist()); } void LLFloaterPreference::onDoNotDisturbResponseChanged() @@ -540,11 +547,11 @@ LLFloaterPreference::~LLFloaterPreference() void LLFloaterPreference::draw() { - bool has_first_selected = (getChildRef("disabled_popups").getFirstSelected()!=NULL); - gSavedSettings.setBOOL("FirstSelectedDisabledPopups", has_first_selected); + bool has_first_selected = (mDisabledPopups->getFirstSelected()!=NULL); + mEnablePopupBtn->setEnabled(has_first_selected); - has_first_selected = (getChildRef("enabled_popups").getFirstSelected()!=NULL); - gSavedSettings.setBOOL("FirstSelectedEnabledPopups", has_first_selected); + has_first_selected = (mEnabledPopups->getFirstSelected()!=NULL); + mDisablePopupBtn->setEnabled(has_first_selected); LLFloater::draw(); } @@ -1171,13 +1178,8 @@ void LLFloaterPreference::refreshSkin(void* data) void LLFloaterPreference::buildPopupLists() { - LLScrollListCtrl& disabled_popups = - getChildRef("disabled_popups"); - LLScrollListCtrl& enabled_popups = - getChildRef("enabled_popups"); - - disabled_popups.deleteAllItems(); - enabled_popups.deleteAllItems(); + mDisabledPopups->deleteAllItems(); + mEnabledPopups->deleteAllItems(); for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin(); iter != LLNotifications::instance().templatesEnd(); @@ -1219,11 +1221,11 @@ void LLFloaterPreference::buildPopupLists() } } } - item = disabled_popups.addElement(row); + item = mDisabledPopups->addElement(row); } else { - item = enabled_popups.addElement(row); + item = mEnabledPopups->addElement(row); } if (item) @@ -1324,9 +1326,7 @@ void LLFloaterPreference::onClickSetSounds() void LLFloaterPreference::onClickEnablePopup() { - LLScrollListCtrl& disabled_popups = getChildRef("disabled_popups"); - - std::vector items = disabled_popups.getAllSelected(); + std::vector items = mDisabledPopups->getAllSelected(); std::vector::iterator itor; for (itor = items.begin(); itor != items.end(); ++itor) { @@ -1345,9 +1345,7 @@ void LLFloaterPreference::onClickEnablePopup() void LLFloaterPreference::onClickDisablePopup() { - LLScrollListCtrl& enabled_popups = getChildRef("enabled_popups"); - - std::vector items = enabled_popups.getAllSelected(); + std::vector items = mEnabledPopups->getAllSelected(); std::vector::iterator itor; for (itor = items.begin(); itor != items.end(); ++itor) { @@ -1796,11 +1794,9 @@ void LLFloaterPreference::onDeleteTranscriptsResponse(const LLSD& notification, void LLFloaterPreference::onLogChatHistorySaved() { - LLButton * delete_transcripts_buttonp = getChild("delete_transcripts"); - - if (!delete_transcripts_buttonp->getEnabled()) + if (!mDeleteTranscriptsBtn->getEnabled()) { - delete_transcripts_buttonp->setEnabled(true); + mDeleteTranscriptsBtn->setEnabled(true); } } @@ -2334,7 +2330,6 @@ bool LLPanelPreferenceGraphics::postBuild() void LLPanelPreferenceGraphics::draw() { - setPresetText(); LLPanelPreference::draw(); } @@ -3315,8 +3310,8 @@ void LLFloaterPreference::onUpdateFilterTerm(bool force) void LLFloaterPreference::filterIgnorableNotifications() { - bool visible = getChildRef("enabled_popups").highlightMatchingItems(mFilterEdit->getValue()); - visible |= getChildRef("disabled_popups").highlightMatchingItems(mFilterEdit->getValue()); + bool visible = mEnabledPopups->highlightMatchingItems(mFilterEdit->getValue()); + visible |= mDisabledPopups->highlightMatchingItems(mFilterEdit->getValue()); if (visible) { diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index c8b98d8e1b..51ed3d8179 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -225,7 +225,12 @@ private: std::string mSavedGraphicsPreset; LOG_CLASS(LLFloaterPreference); - LLSearchEditor *mFilterEdit; + LLSearchEditor* mFilterEdit = nullptr; + LLScrollListCtrl* mEnabledPopups = nullptr; + LLScrollListCtrl* mDisabledPopups = nullptr; + LLButton* mDeleteTranscriptsBtn = nullptr; + LLButton* mEnablePopupBtn = nullptr; + LLButton* mDisablePopupBtn = nullptr; std::unique_ptr< ll::prefs::SearchData > mSearchData; bool mSearchDataDirty; diff --git a/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml b/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml index fb528bf98f..425cbb6f44 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml @@ -69,7 +69,6 @@ sort_ascending="true" width="495" />