diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llpanelaudioprefs.cpp | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/llpanelaudioprefs.cpp')
-rw-r--r-- | linden/indra/newview/llpanelaudioprefs.cpp | 216 |
1 files changed, 216 insertions, 0 deletions
diff --git a/linden/indra/newview/llpanelaudioprefs.cpp b/linden/indra/newview/llpanelaudioprefs.cpp new file mode 100644 index 0000000..4b36069 --- /dev/null +++ b/linden/indra/newview/llpanelaudioprefs.cpp | |||
@@ -0,0 +1,216 @@ | |||
1 | /** | ||
2 | * @file llpanelaudioprefs.cpp | ||
3 | * @brief Audio preference implementation | ||
4 | * | ||
5 | * Copyright (c) 2001-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #include "llviewerprecompiledheaders.h" | ||
29 | |||
30 | // file include | ||
31 | #include "llpanelaudioprefs.h" | ||
32 | |||
33 | // linden library includes | ||
34 | #include "llerror.h" | ||
35 | #include "llrect.h" | ||
36 | #include "llstring.h" | ||
37 | #include "llfontgl.h" | ||
38 | |||
39 | // project includes | ||
40 | #include "llviewerwindow.h" | ||
41 | #include "llui.h" | ||
42 | #include "llspinctrl.h" | ||
43 | #include "llslider.h" | ||
44 | #include "llradiogroup.h" | ||
45 | #include "llsliderctrl.h" | ||
46 | #include "llcheckboxctrl.h" | ||
47 | #include "lltextbox.h" | ||
48 | #include "llbutton.h" | ||
49 | #include "llcombobox.h" | ||
50 | #include "audioengine.h" | ||
51 | #include "llmediaengine.h" | ||
52 | #include "llfirstuse.h" | ||
53 | #include "llparcel.h" | ||
54 | #include "llviewerparcelmgr.h" | ||
55 | #include "llnotify.h" | ||
56 | #include "llvieweruictrlfactory.h" | ||
57 | #include "llresmgr.h" | ||
58 | #include "viewer.h" // do_disconnect | ||
59 | |||
60 | // | ||
61 | // Imported globals | ||
62 | // | ||
63 | |||
64 | extern LLAudioEngine *gAudiop; | ||
65 | |||
66 | // | ||
67 | // Globals | ||
68 | // | ||
69 | |||
70 | |||
71 | // | ||
72 | // Static functions | ||
73 | // | ||
74 | |||
75 | |||
76 | |||
77 | |||
78 | LLPanelAudioPrefs::LLPanelAudioPrefs() | ||
79 | { | ||
80 | |||
81 | gUICtrlFactory->buildPanel(this, "panel_preferences_audio.xml"); | ||
82 | |||
83 | |||
84 | } | ||
85 | |||
86 | |||
87 | LLPanelAudioPrefs::~LLPanelAudioPrefs() | ||
88 | { | ||
89 | // Children all cleaned up by default view destructor. | ||
90 | } | ||
91 | |||
92 | |||
93 | |||
94 | |||
95 | BOOL LLPanelAudioPrefs::postBuild() | ||
96 | { | ||
97 | |||
98 | |||
99 | mPreviousMediaVolume = gSavedSettings.getF32("MediaAudioVolume"); | ||
100 | mPreviousVolume = gSavedSettings.getF32("AudioLevelMaster"); | ||
101 | mPreviousUI = gSavedSettings.getF32("AudioLevelUI"); | ||
102 | mPreviousFootsteps = gSavedSettings.getF32("AudioLevelFootsteps"); | ||
103 | mPreviousWind = gSavedSettings.getF32("AudioLevelWind"); | ||
104 | mPreviousDoppler = gSavedSettings.getF32("AudioLevelDoppler"); | ||
105 | mPreviousDistance = gSavedSettings.getF32("AudioLevelDistance"); | ||
106 | mPreviousRolloff = gSavedSettings.getF32("AudioLevelRolloff"); | ||
107 | |||
108 | mPreviousBitrate = gSavedSettings.getS32("AudioDefaultBitrate"); | ||
109 | |||
110 | mPreviousMoneyThreshold = gSavedSettings.getF32("UISndMoneyChangeThreshold"); | ||
111 | mPreviousHealthThreshold = gSavedSettings.getF32("UISndHealthReductionThreshold"); | ||
112 | |||
113 | mPreviousStreamingMusic = gSavedSettings.getBOOL("AudioStreamingMusic"); | ||
114 | mPreviousStreamingVideo = gSavedSettings.getBOOL("AudioStreamingVideo"); | ||
115 | |||
116 | mPreviousMuteAudio = gSavedSettings.getBOOL("MuteAudio"); | ||
117 | mPreviousMuteWhenMinimized = gSavedSettings.getBOOL("MuteWhenMinimized"); | ||
118 | |||
119 | |||
120 | |||
121 | childSetCommitCallback("disable audio", onMuteAudio, this); | ||
122 | |||
123 | enable(!gSavedSettings.getBOOL("MuteAudio")); | ||
124 | |||
125 | return TRUE; | ||
126 | |||
127 | } | ||
128 | |||
129 | |||
130 | void LLPanelAudioPrefs::enable(BOOL b) | ||
131 | { | ||
132 | childSetEnabled("mute_when_minimized", b); | ||
133 | |||
134 | childSetEnabled("streaming_text", b); | ||
135 | childSetEnabled("streaming_music", b); | ||
136 | childSetEnabled("streaming_video", b); | ||
137 | |||
138 | childSetEnabled("System Volume", b); | ||
139 | childSetEnabled("system_volume_text", b); | ||
140 | |||
141 | childSetEnabled("Wind Volume", b); | ||
142 | childSetEnabled("wind_volume_text", b); | ||
143 | |||
144 | childSetEnabled("Footsteps Volume", b); | ||
145 | childSetEnabled("footsteps_volume_text", b); | ||
146 | |||
147 | childSetEnabled("UI Volume", b); | ||
148 | childSetEnabled("ui_volume", b); | ||
149 | |||
150 | childSetEnabled("Doppler Effect", b); | ||
151 | childSetEnabled("doppler_effect_text", b); | ||
152 | |||
153 | childSetEnabled("Distance Factor", b); | ||
154 | childSetEnabled("distance_factor_text", b); | ||
155 | |||
156 | childSetEnabled("Rolloff Factor", b); | ||
157 | childSetEnabled("rolloff_factor_text", b); | ||
158 | |||
159 | childSetEnabled("L$ Change Threshold", b); | ||
160 | |||
161 | childSetEnabled("Health Change Threshold", b); | ||
162 | |||
163 | childSetEnabled("bitrate", b); | ||
164 | childSetEnabled("default_upload_bitrate_text", b); | ||
165 | } | ||
166 | |||
167 | struct LLPARestartData | ||
168 | { | ||
169 | BOOL mMuteAudio; | ||
170 | }; | ||
171 | |||
172 | |||
173 | |||
174 | void LLPanelAudioPrefs::apply() | ||
175 | { | ||
176 | |||
177 | } | ||
178 | |||
179 | |||
180 | |||
181 | void LLPanelAudioPrefs::onMuteAudio(LLUICtrl* ctrl, void* userdata) | ||
182 | { | ||
183 | LLPanelAudioPrefs* self = (LLPanelAudioPrefs*)userdata; | ||
184 | LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)ctrl; | ||
185 | |||
186 | self->enable(!check->get()); | ||
187 | |||
188 | } | ||
189 | |||
190 | |||
191 | void LLPanelAudioPrefs::cancel() | ||
192 | { | ||
193 | |||
194 | gSavedSettings.setS32("AudioDefaultBitrate", mPreviousBitrate); | ||
195 | gSavedSettings.setF32("MediaAudioVolume", mPreviousMediaVolume); | ||
196 | gSavedSettings.setF32("AudioLevelMaster", mPreviousVolume ); | ||
197 | gSavedSettings.setF32("AudioLevelUI", mPreviousUI ); | ||
198 | gSavedSettings.setF32("AudioLevelFootsteps", mPreviousFootsteps ); | ||
199 | gSavedSettings.setF32("AudioLevelWind", mPreviousWind ); | ||
200 | gSavedSettings.setF32("AudioLevelDoppler", mPreviousDoppler ); | ||
201 | gSavedSettings.setF32("AudioLevelDistance", mPreviousDistance ); | ||
202 | gSavedSettings.setF32("AudioLevelRolloff", mPreviousRolloff ); | ||
203 | |||
204 | gSavedSettings.setF32("UISndMoneyChangeThreshold", mPreviousMoneyThreshold ); | ||
205 | gSavedSettings.setF32("UISndHealthReductionThreshold", mPreviousHealthThreshold ); | ||
206 | |||
207 | gSavedSettings.setBOOL("AudioStreamingMusic", mPreviousStreamingMusic ); | ||
208 | gSavedSettings.setBOOL("AudioStreamingVideo", mPreviousStreamingVideo ); | ||
209 | |||
210 | |||
211 | gSavedSettings.setBOOL("MuteAudio", mPreviousMuteAudio ); | ||
212 | gSavedSettings.setBOOL("MuteWhenMinimized", mPreviousMuteWhenMinimized ); | ||
213 | |||
214 | |||
215 | |||
216 | } | ||