diff options
author | Rye Mutt <rye@alchemyviewer.org> | 2024-08-18 15:35:33 -0400 |
---|---|---|
committer | Rye Mutt <rye@alchemyviewer.org> | 2024-08-18 15:35:33 -0400 |
commit | ba2b77d0882f8ca3ef0ae95ca9d388aa217f9a7a (patch) | |
tree | a22cecbf65ac1c34aef6711c4bdf891cad8b5d8a | |
parent | 4c0f342c93b4716ad6f7fb2b2b04bf217c0b824d (diff) |
Fix findChild during draw in preference floater
-rw-r--r-- | indra/newview/llfloaterpreference.cpp | 49 | ||||
-rw-r--r-- | indra/newview/llfloaterpreference.h | 7 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_preferences_alerts.xml | 2 |
3 files changed, 28 insertions, 30 deletions
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<LLButton>("delete_transcripts"); + + mEnabledPopups = getChild<LLScrollListCtrl>("enabled_popups"); + mDisabledPopups = getChild<LLScrollListCtrl>("disabled_popups"); + mEnablePopupBtn = getChild<LLButton>("enable_this_popup"); + mDisablePopupBtn = getChild<LLButton>("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<LLButton>("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<LLScrollListCtrl>("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<LLScrollListCtrl>("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<LLScrollListCtrl>("disabled_popups"); - LLScrollListCtrl& enabled_popups = - getChildRef<LLScrollListCtrl>("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<LLScrollListCtrl>("disabled_popups"); - - std::vector<LLScrollListItem*> items = disabled_popups.getAllSelected(); + std::vector<LLScrollListItem*> items = mDisabledPopups->getAllSelected(); std::vector<LLScrollListItem*>::iterator itor; for (itor = items.begin(); itor != items.end(); ++itor) { @@ -1345,9 +1345,7 @@ void LLFloaterPreference::onClickEnablePopup() void LLFloaterPreference::onClickDisablePopup() { - LLScrollListCtrl& enabled_popups = getChildRef<LLScrollListCtrl>("enabled_popups"); - - std::vector<LLScrollListItem*> items = enabled_popups.getAllSelected(); + std::vector<LLScrollListItem*> items = mEnabledPopups->getAllSelected(); std::vector<LLScrollListItem*>::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<LLButton>("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<LLScrollListCtrl>("enabled_popups").highlightMatchingItems(mFilterEdit->getValue()); - visible |= getChildRef<LLScrollListCtrl>("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" /> <button - enabled_control="FirstSelectedDisabledPopups" follows="top|left" height="23" image_overlay="Arrow_Up" @@ -83,7 +82,6 @@ function="Pref.ClickEnablePopup" /> </button> <button - enabled_control="FirstSelectedEnabledPopups" follows="top|left" height="23" image_overlay="Arrow_Down" |