From 7552e9d73519032df3b97f603ced9038c8985d2c Mon Sep 17 00:00:00 2001 From: Ansariel Date: Fri, 26 Sep 2014 11:38:28 +0200 Subject: [PATCH] While already at it: Change our callbacks into instance methods and use boost::bind to wire them up --- indra/newview/llpanellandaudio.cpp | 30 +++++++++++------------------- indra/newview/llpanellandaudio.h | 6 +++--- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/indra/newview/llpanellandaudio.cpp b/indra/newview/llpanellandaudio.cpp index 0a6eb840ed..4f2c40bf90 100755 --- a/indra/newview/llpanellandaudio.cpp +++ b/indra/newview/llpanellandaudio.cpp @@ -98,13 +98,13 @@ BOOL LLPanelLandAudio::postBuild() childSetCommitCallback("music_url", onCommitAny, this); mBtnStreamAdd = getChild("stream_add_btn"); - childSetCommitCallback("stream_add_btn", onBtnStreamAdd, this); + mBtnStreamAdd->setCommitCallback(boost::bind(&LLPanelLandAudio::onBtnStreamAdd, this)); mBtnStreamDelete = getChild("stream_delete_btn"); - childSetCommitCallback("stream_delete_btn", onBtnStreamDelete, this); + mBtnStreamDelete->setCommitCallback(boost::bind(&LLPanelLandAudio::onBtnStreamDelete, this)); mBtnStreamCopyToClipboard = getChild("stream_copy_btn"); - childSetCommitCallback("stream_copy_btn", onBtnCopyToClipboard, this); + mBtnStreamCopyToClipboard->setCommitCallback(boost::bind(&LLPanelLandAudio::onBtnCopyToClipboard, this)); // mCheckAVSoundAny = getChild("all av sound check"); @@ -248,12 +248,9 @@ void LLPanelLandAudio::onCommitAny(LLUICtrl*, void *userdata) } // FIRE-593 - Add/remove streams from the list with these. They're fantastic! -// static -void LLPanelLandAudio::onBtnStreamAdd(LLUICtrl*, void *userdata) +void LLPanelLandAudio::onBtnStreamAdd() { - LLPanelLandAudio *self = (LLPanelLandAudio *)userdata; - - std::string music_url = self->mMusicURLEdit->getSimple(); + std::string music_url = mMusicURLEdit->getSimple(); LLStringUtil::trim(music_url); if (!music_url.empty()) @@ -262,16 +259,13 @@ void LLPanelLandAudio::onBtnStreamAdd(LLUICtrl*, void *userdata) streamlist["version"] = 1; streamlist["audio"].append(music_url); gSavedSettings.setLLSD("FSStreamList", streamlist); - self->refresh(); + refresh(); } } -// static -void LLPanelLandAudio::onBtnStreamDelete(LLUICtrl*, void *userdata) +void LLPanelLandAudio::onBtnStreamDelete() { - LLPanelLandAudio *self = (LLPanelLandAudio *)userdata; - - std::string music_url = self->mMusicURLEdit->getSimple(); + std::string music_url = mMusicURLEdit->getSimple(); LLStringUtil::trim(music_url); LLSD streamlist = gSavedSettings.getLLSD("FSStreamList"); @@ -288,14 +282,12 @@ void LLPanelLandAudio::onBtnStreamDelete(LLUICtrl*, void *userdata) } gSavedSettings.setLLSD("FSStreamList", streamlist_new); - self->refresh(); + refresh(); } -//static -void LLPanelLandAudio::onBtnCopyToClipboard(LLUICtrl*, void *userdata) +void LLPanelLandAudio::onBtnCopyToClipboard() { - LLPanelLandAudio *self = (LLPanelLandAudio *)userdata; - std::string music_url = self->mMusicURLEdit->getSimple(); + std::string music_url = mMusicURLEdit->getSimple(); LLStringUtil::trim(music_url); if (!music_url.empty()) diff --git a/indra/newview/llpanellandaudio.h b/indra/newview/llpanellandaudio.h index aacd75d520..476d6b7aa3 100755 --- a/indra/newview/llpanellandaudio.h +++ b/indra/newview/llpanellandaudio.h @@ -49,9 +49,9 @@ public: private: static void onCommitAny(LLUICtrl* ctrl, void *userdata); // FIRE-593 - Add/remove streams from the list - static void onBtnStreamAdd(LLUICtrl* ctrl, void *userdata); - static void onBtnStreamDelete(LLUICtrl* ctrl, void *userdata); - static void onBtnCopyToClipboard(LLUICtrl* ctrl, void *userdata); + void onBtnStreamAdd(); + void onBtnStreamDelete(); + void onBtnCopyToClipboard(); // private: