aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloatermute.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:42 -0500
committerJacek Antonelli2008-08-15 23:45:42 -0500
commitce28e056c20bf2723f565bbf464b87781ec248a2 (patch)
treeef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/llfloatermute.cpp
parentSecond Life viewer sources 1.19.1.4b (diff)
downloadmeta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/newview/llfloatermute.cpp')
-rw-r--r--linden/indra/newview/llfloatermute.cpp45
1 files changed, 23 insertions, 22 deletions
diff --git a/linden/indra/newview/llfloatermute.cpp b/linden/indra/newview/llfloatermute.cpp
index db88d46..d519791 100644
--- a/linden/indra/newview/llfloatermute.cpp
+++ b/linden/indra/newview/llfloatermute.cpp
@@ -50,7 +50,7 @@
50#include "lltextbox.h" 50#include "lltextbox.h"
51#include "llviewertexteditor.h" 51#include "llviewertexteditor.h"
52#include "llviewerwindow.h" 52#include "llviewerwindow.h"
53#include "llvieweruictrlfactory.h" 53#include "lluictrlfactory.h"
54#include "llfocusmgr.h" 54#include "llfocusmgr.h"
55 55
56// 56//
@@ -65,10 +65,6 @@ const S32 LINE = 16;
65const S32 LEFT = 2; 65const S32 LEFT = 2;
66const S32 VPAD = 4; 66const S32 VPAD = 4;
67const S32 HPAD = 4; 67const S32 HPAD = 4;
68//
69// Global statics
70//
71LLFloaterMute* gFloaterMute = NULL;
72 68
73//----------------------------------------------------------------------------- 69//-----------------------------------------------------------------------------
74// LLFloaterMuteObjectUI() 70// LLFloaterMuteObjectUI()
@@ -86,7 +82,7 @@ public:
86protected: 82protected:
87 LLFloaterMuteObjectUI(); 83 LLFloaterMuteObjectUI();
88 virtual ~LLFloaterMuteObjectUI(); 84 virtual ~LLFloaterMuteObjectUI();
89 virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); 85 virtual BOOL handleKeyHere(KEY key, MASK mask);
90 86
91private: 87private:
92 // UI Callbacks 88 // UI Callbacks
@@ -107,7 +103,7 @@ LLFloaterMuteObjectUI::LLFloaterMuteObjectUI()
107 mCallback(NULL), 103 mCallback(NULL),
108 mCallbackUserData(NULL) 104 mCallbackUserData(NULL)
109{ 105{
110 gUICtrlFactory->buildFloater(this, "floater_mute_object.xml", NULL); 106 LLUICtrlFactory::getInstance()->buildFloater(this, "floater_mute_object.xml", NULL);
111} 107}
112 108
113// Destroys the object 109// Destroys the object
@@ -166,7 +162,7 @@ void LLFloaterMuteObjectUI::onBtnCancel(void* userdata)
166 self->close(); 162 self->close();
167} 163}
168 164
169BOOL LLFloaterMuteObjectUI::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) 165BOOL LLFloaterMuteObjectUI::handleKeyHere(KEY key, MASK mask)
170{ 166{
171 if (key == KEY_RETURN && mask == MASK_NONE) 167 if (key == KEY_RETURN && mask == MASK_NONE)
172 { 168 {
@@ -179,7 +175,7 @@ BOOL LLFloaterMuteObjectUI::handleKeyHere(KEY key, MASK mask, BOOL called_from_p
179 return TRUE; 175 return TRUE;
180 } 176 }
181 177
182 return LLFloater::handleKeyHere(key, mask, called_from_parent); 178 return LLFloater::handleKeyHere(key, mask);
183} 179}
184 180
185// 181//
@@ -194,7 +190,13 @@ LLFloaterMute::LLFloaterMute(const LLSD& seed)
194 RESIZE_YES, 220, 140, DRAG_ON_TOP, MINIMIZE_YES, CLOSE_YES) 190 RESIZE_YES, 220, 140, DRAG_ON_TOP, MINIMIZE_YES, CLOSE_YES)
195{ 191{
196 192
197 gUICtrlFactory->buildFloater(this, "floater_mute.xml", NULL, FALSE); 193 LLUICtrlFactory::getInstance()->buildFloater(this, "floater_mute.xml", NULL, FALSE);
194}
195
196// LLMuteListObserver callback interface implementation.
197/* virtual */ void LLFloaterMute::onChange()
198{
199 refreshMuteList();
198} 200}
199 201
200BOOL LLFloaterMute::postBuild() 202BOOL LLFloaterMute::postBuild()
@@ -204,8 +206,10 @@ BOOL LLFloaterMute::postBuild()
204 childSetAction("Mute object by name...", onClickMuteByName, this); 206 childSetAction("Mute object by name...", onClickMuteByName, this);
205 childSetAction("Unmute", onClickRemove, this); 207 childSetAction("Unmute", onClickRemove, this);
206 208
207 mMuteList = LLUICtrlFactory::getScrollListByName(this, "mutes"); 209 mMuteList = getChild<LLScrollListCtrl>("mutes");
208 mMuteList->setCommitOnSelectionChange(TRUE); 210 mMuteList->setCommitOnSelectionChange(TRUE);
211
212 LLMuteList::getInstance()->addObserver(this);
209 213
210 refreshMuteList(); 214 refreshMuteList();
211 215
@@ -226,15 +230,12 @@ void LLFloaterMute::refreshMuteList()
226{ 230{
227 mMuteList->deleteAllItems(); 231 mMuteList->deleteAllItems();
228 232
229 if (gMuteListp) 233 std::vector<LLMute> mutes = LLMuteList::getInstance()->getMutes();
234 std::vector<LLMute>::iterator it;
235 for (it = mutes.begin(); it != mutes.end(); ++it)
230 { 236 {
231 std::vector<LLMute> mutes = gMuteListp->getMutes(); 237 LLString display_name = it->getDisplayName();
232 std::vector<LLMute>::iterator it; 238 mMuteList->addStringUUIDItem(display_name, it->mID);
233 for (it = mutes.begin(); it != mutes.end(); ++it)
234 {
235 LLString display_name = it->getDisplayName();
236 mMuteList->addStringUUIDItem(display_name, it->mID);
237 }
238 } 239 }
239 240
240 updateButtons(); 241 updateButtons();
@@ -285,7 +286,7 @@ void LLFloaterMute::onClickRemove(void *data)
285 // now mute.mName has the suffix trimmed off 286 // now mute.mName has the suffix trimmed off
286 287
287 S32 last_selected = floater->mMuteList->getFirstSelectedIndex(); 288 S32 last_selected = floater->mMuteList->getFirstSelectedIndex();
288 if (gMuteListp->remove(mute)) 289 if (LLMuteList::getInstance()->remove(mute))
289 { 290 {
290 // Above removals may rebuild this dialog. 291 // Above removals may rebuild this dialog.
291 292
@@ -325,7 +326,7 @@ void LLFloaterMute::onPickUser(const std::vector<std::string>& names, const std:
325 if (names.empty() || ids.empty()) return; 326 if (names.empty() || ids.empty()) return;
326 327
327 LLMute mute(ids[0], names[0], LLMute::AGENT); 328 LLMute mute(ids[0], names[0], LLMute::AGENT);
328 gMuteListp->add(mute); 329 LLMuteList::getInstance()->add(mute);
329 floaterp->updateButtons(); 330 floaterp->updateButtons();
330} 331}
331 332
@@ -344,7 +345,7 @@ void LLFloaterMute::callbackMuteByName(const LLString& text, void* data)
344 if (text.empty()) return; 345 if (text.empty()) return;
345 346
346 LLMute mute(LLUUID::null, text, LLMute::BY_NAME); 347 LLMute mute(LLUUID::null, text, LLMute::BY_NAME);
347 BOOL success = gMuteListp->add(mute); 348 BOOL success = LLMuteList::getInstance()->add(mute);
348 if (!success) 349 if (!success)
349 { 350 {
350 gViewerWindow->alertXml("MuteByNameFailed"); 351 gViewerWindow->alertXml("MuteByNameFailed");