diff options
Diffstat (limited to 'linden/indra/newview/llprefsvoice.cpp')
-rw-r--r-- | linden/indra/newview/llprefsvoice.cpp | 68 |
1 files changed, 32 insertions, 36 deletions
diff --git a/linden/indra/newview/llprefsvoice.cpp b/linden/indra/newview/llprefsvoice.cpp index 773ddfe..22a0115 100644 --- a/linden/indra/newview/llprefsvoice.cpp +++ b/linden/indra/newview/llprefsvoice.cpp | |||
@@ -38,12 +38,12 @@ | |||
38 | #include "llcombobox.h" | 38 | #include "llcombobox.h" |
39 | 39 | ||
40 | #include "llviewercontrol.h" | 40 | #include "llviewercontrol.h" |
41 | #include "llvieweruictrlfactory.h" | 41 | #include "lluictrlfactory.h" |
42 | 42 | ||
43 | #include "llmodaldialog.h" | 43 | #include "llmodaldialog.h" |
44 | #include "llkeyboard.h" | 44 | #include "llkeyboard.h" |
45 | #include "llfocusmgr.h" | 45 | #include "llfocusmgr.h" |
46 | #include "llfloatervoicewizard.h" | 46 | #include "llfloatervoicedevicesettings.h" |
47 | 47 | ||
48 | #include "llappviewer.h" | 48 | #include "llappviewer.h" |
49 | 49 | ||
@@ -62,7 +62,7 @@ public: | |||
62 | { | 62 | { |
63 | mOldFrontmost = gFloaterView->getFrontmost(); | 63 | mOldFrontmost = gFloaterView->getFrontmost(); |
64 | 64 | ||
65 | gUICtrlFactory->buildFloater(this, "floater_select_key.xml"); | 65 | LLUICtrlFactory::getInstance()->buildFloater(this, "floater_select_key.xml"); |
66 | 66 | ||
67 | childSetAction("Cancel", LLVoiceHotkeySelectDialog::onCancel, this ); | 67 | childSetAction("Cancel", LLVoiceHotkeySelectDialog::onCancel, this ); |
68 | childSetFocus("Cancel"); | 68 | childSetFocus("Cancel"); |
@@ -71,14 +71,17 @@ public: | |||
71 | /*virtual*/ void setFocus( BOOL b ) | 71 | /*virtual*/ void setFocus( BOOL b ) |
72 | { | 72 | { |
73 | LLFloater::setFocus(b); | 73 | LLFloater::setFocus(b); |
74 | 74 | ||
75 | // This forces keyboard processing to happen at the raw key level instead of going through handleUnicodeChar. | 75 | // This forces keyboard processing to happen at the raw key level instead of going through handleUnicodeChar. |
76 | gFocusMgr.removeKeyboardFocusWithoutCallback(gFocusMgr.getKeyboardFocus()); | 76 | if (b) |
77 | { | ||
78 | gFocusMgr.setKeystrokesOnly(TRUE); | ||
79 | } | ||
77 | } | 80 | } |
78 | 81 | ||
79 | static void onCancel( void* userdata ); | 82 | static void onCancel( void* userdata ); |
80 | 83 | ||
81 | BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent ); | 84 | BOOL handleKeyHere(KEY key, MASK mask); |
82 | 85 | ||
83 | }; | 86 | }; |
84 | 87 | ||
@@ -98,11 +101,14 @@ void LLPrefsVoiceLogic::init() | |||
98 | mPushToTalkToggle = gSavedSettings.getBOOL("PushToTalkToggle"); | 101 | mPushToTalkToggle = gSavedSettings.getBOOL("PushToTalkToggle"); |
99 | mEarLocation = gSavedSettings.getS32("VoiceEarLocation"); | 102 | mEarLocation = gSavedSettings.getS32("VoiceEarLocation"); |
100 | 103 | ||
101 | mCtrlEarLocation = LLUICtrlFactory::getSelectionInterfaceByName(mPanel, "ear_location"); | 104 | LLUICtrl* ear_location = mPanel->getChild<LLUICtrl>("ear_location"); |
102 | mCtrlEarLocation->selectByValue(LLSD(gSavedSettings.getS32("VoiceEarLocation"))); | 105 | mCtrlEarLocation = ear_location->getSelectionInterface(); |
106 | if (mCtrlEarLocation) | ||
107 | { | ||
108 | mCtrlEarLocation->selectByValue(LLSD(gSavedSettings.getS32("VoiceEarLocation"))); | ||
109 | } | ||
103 | mPanel->childSetCommitCallback("ear_location", onEarLocationCommit, this ); | 110 | mPanel->childSetCommitCallback("ear_location", onEarLocationCommit, this ); |
104 | 111 | ||
105 | mPanel->childSetAction("launch_voice_wizard_button", onClickLaunchWizard, mPanel); | ||
106 | mPanel->childSetAction("set_voice_hotkey_button", onClickSetKey, this); | 112 | mPanel->childSetAction("set_voice_hotkey_button", onClickSetKey, this); |
107 | mPanel->childSetAction("set_voice_middlemouse_button", onClickSetMiddleMouse, this); | 113 | mPanel->childSetAction("set_voice_middlemouse_button", onClickSetMiddleMouse, this); |
108 | 114 | ||
@@ -112,11 +118,12 @@ void LLPrefsVoiceLogic::init() | |||
112 | 118 | ||
113 | void LLPrefsVoiceLogic::refresh() | 119 | void LLPrefsVoiceLogic::refresh() |
114 | { | 120 | { |
115 | mPanel->childSetVisible("voice_unavailable", gDisableVoice); | 121 | BOOL voiceDisabled = gSavedSettings.getBOOL("CmdLineDisableVoice"); |
116 | mPanel->childSetVisible("enable_voice_check", !gDisableVoice); | 122 | mPanel->childSetVisible("voice_unavailable", voiceDisabled); |
117 | mPanel->childSetEnabled("enable_voice_check", !gDisableVoice); | 123 | mPanel->childSetVisible("enable_voice_check", !voiceDisabled); |
124 | mPanel->childSetEnabled("enable_voice_check", !voiceDisabled); | ||
118 | 125 | ||
119 | bool enable = !gDisableVoice && gSavedSettings.getBOOL("EnableVoiceChat"); | 126 | bool enable = !voiceDisabled && gSavedSettings.getBOOL("EnableVoiceChat"); |
120 | 127 | ||
121 | mPanel->childSetEnabled("friends_only_check", enable); | 128 | mPanel->childSetEnabled("friends_only_check", enable); |
122 | mPanel->childSetEnabled("push_to_talk_check", enable); | 129 | mPanel->childSetEnabled("push_to_talk_check", enable); |
@@ -152,18 +159,6 @@ void LLPrefsVoiceLogic::onEarLocationCommit(LLUICtrl* ctrl, void* user_data) | |||
152 | } | 159 | } |
153 | } | 160 | } |
154 | 161 | ||
155 | //static | ||
156 | void LLPrefsVoiceLogic::onClickLaunchWizard(void* user_data) | ||
157 | { | ||
158 | LLPrefsVoice* prefs = (LLPrefsVoice*)user_data; | ||
159 | LLFloaterVoiceWizard* floaterp = LLFloaterVoiceWizard::showInstance(); | ||
160 | LLFloater* parent_floater = gFloaterView->getParentFloater(prefs); | ||
161 | if (parent_floater) | ||
162 | { | ||
163 | parent_floater->addDependentFloater(floaterp, FALSE); | ||
164 | } | ||
165 | } | ||
166 | |||
167 | // static | 162 | // static |
168 | void LLPrefsVoiceLogic::onClickSetKey(void* user_data) | 163 | void LLPrefsVoiceLogic::onClickSetKey(void* user_data) |
169 | { | 164 | { |
@@ -209,7 +204,7 @@ void LLVoiceHotkeySelectDialog::onCancel( void* userdata ) | |||
209 | self->mOldFrontmost->setFrontmost(TRUE); | 204 | self->mOldFrontmost->setFrontmost(TRUE); |
210 | } | 205 | } |
211 | 206 | ||
212 | BOOL LLVoiceHotkeySelectDialog::handleKey(KEY key, MASK mask, BOOL called_from_parent ) | 207 | BOOL LLVoiceHotkeySelectDialog::handleKeyHere(KEY key, MASK mask) |
213 | { | 208 | { |
214 | BOOL result = TRUE; | 209 | BOOL result = TRUE; |
215 | 210 | ||
@@ -236,13 +231,13 @@ BOOL LLVoiceHotkeySelectDialog::handleKey(KEY key, MASK mask, BOOL called_from_p | |||
236 | LLPrefsVoice::LLPrefsVoice() | 231 | LLPrefsVoice::LLPrefsVoice() |
237 | : LLPanel("Voice Chat Panel") | 232 | : LLPanel("Voice Chat Panel") |
238 | { | 233 | { |
239 | gUICtrlFactory->buildPanel(this, "panel_preferences_voice.xml"); | 234 | LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_voice.xml"); |
240 | mLogic = new LLPrefsVoiceLogic(this); | 235 | mLogic = new LLPrefsVoiceLogic(this); |
241 | childSetAction("device_settings_btn", onClickDeviceSettingsBtn, this); | 236 | childSetAction("device_settings_btn", onClickVoiceDeviceSettingsBtn, this); |
242 | 237 | ||
243 | // create floater immediately and keep it hidden | 238 | // create floater immediately and keep it hidden |
244 | // since it stores preference state for audio devices | 239 | // since it stores preference state for audio devices |
245 | mDeviceSettings = LLFloaterDeviceSettings::getInstance(); | 240 | mVoiceDeviceSettings = LLFloaterVoiceDeviceSettings::getInstance(); |
246 | } | 241 | } |
247 | 242 | ||
248 | LLPrefsVoice::~LLPrefsVoice() | 243 | LLPrefsVoice::~LLPrefsVoice() |
@@ -252,34 +247,35 @@ LLPrefsVoice::~LLPrefsVoice() | |||
252 | 247 | ||
253 | void LLPrefsVoice::draw() | 248 | void LLPrefsVoice::draw() |
254 | { | 249 | { |
255 | bool enable = !gDisableVoice && gSavedSettings.getBOOL("EnableVoiceChat"); | 250 | bool enable = !gSavedSettings.getBOOL("CmdLineDisableVoice") |
251 | && gSavedSettings.getBOOL("EnableVoiceChat"); | ||
256 | childSetEnabled("device_settings_btn", enable); | 252 | childSetEnabled("device_settings_btn", enable); |
257 | 253 | ||
258 | mLogic->refresh(); | 254 | mLogic->refresh(); |
259 | mDeviceSettings->refresh(); | 255 | mVoiceDeviceSettings->refresh(); |
260 | LLPanel::draw(); | 256 | LLPanel::draw(); |
261 | } | 257 | } |
262 | 258 | ||
263 | void LLPrefsVoice::apply() | 259 | void LLPrefsVoice::apply() |
264 | { | 260 | { |
265 | mLogic->apply(); | 261 | mLogic->apply(); |
266 | mDeviceSettings->apply(); | 262 | mVoiceDeviceSettings->apply(); |
267 | } | 263 | } |
268 | 264 | ||
269 | void LLPrefsVoice::cancel() | 265 | void LLPrefsVoice::cancel() |
270 | { | 266 | { |
271 | mLogic->cancel(); | 267 | mLogic->cancel(); |
272 | mDeviceSettings->cancel(); | 268 | mVoiceDeviceSettings->cancel(); |
273 | } | 269 | } |
274 | 270 | ||
275 | //static | 271 | //static |
276 | void LLPrefsVoice::onClickDeviceSettingsBtn(void* user_data) | 272 | void LLPrefsVoice::onClickVoiceDeviceSettingsBtn(void* user_data) |
277 | { | 273 | { |
278 | LLPrefsVoice* prefs = (LLPrefsVoice*)user_data; | 274 | LLPrefsVoice* prefs = (LLPrefsVoice*)user_data; |
279 | prefs->mDeviceSettings->open(); | 275 | prefs->mVoiceDeviceSettings->open(); |
280 | LLFloater* parent_floater = gFloaterView->getParentFloater(prefs); | 276 | LLFloater* parent_floater = gFloaterView->getParentFloater(prefs); |
281 | if (parent_floater) | 277 | if (parent_floater) |
282 | { | 278 | { |
283 | parent_floater->addDependentFloater(prefs->mDeviceSettings, FALSE); | 279 | parent_floater->addDependentFloater(prefs->mVoiceDeviceSettings, FALSE); |
284 | } | 280 | } |
285 | } | 281 | } |