diff options
Diffstat (limited to 'indra/newview/llfloaterpreference.cpp')
-rw-r--r-- | indra/newview/llfloaterpreference.cpp | 184 |
1 files changed, 52 insertions, 132 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 7e0e8bfaa7..fc036cb354 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -51,7 +51,7 @@ #include "lldirpicker.h" #include "llfeaturemanager.h" #include "llfocusmgr.h" -#include "llfirstuse.h" +//#include "llfirstuse.h" #include "llfloaterreg.h" #include "llfloaterabout.h" #include "llfloaterhardwaresettings.h" @@ -103,15 +103,10 @@ #include "llworld.h" #include "pipeline.h" #include "lluictrlfactory.h" -#include "llboost.h" #include "llviewermedia.h" #include "llpluginclassmedia.h" #include "llteleporthistorystorage.h" -#include <boost/regex.hpp> - -//RN temporary includes for resolution switching -#include "llglheaders.h" const F32 MAX_USER_FAR_CLIP = 512.f; const F32 MIN_USER_FAR_CLIP = 64.f; @@ -190,10 +185,9 @@ void handleNameTagOptionChanged(const LLSD& newvalue); viewer_media_t get_web_media(); bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response); -bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater); -bool callback_reset_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater); +//bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater); +//bool callback_reset_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater); -bool extractWindowSizeFromString(const std::string& instr, U32 &width, U32 &height); void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator); viewer_media_t get_web_media() @@ -242,7 +236,7 @@ void handleNameTagOptionChanged(const LLSD& newvalue) } } -bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater) +/*bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (0 == option && floater ) @@ -250,7 +244,7 @@ bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFlo if ( floater ) { floater->setAllIgnored(); - LLFirstUse::disableFirstUse(); + // LLFirstUse::disableFirstUse(); floater->buildPopupLists(); } } @@ -265,30 +259,13 @@ bool callback_reset_dialogs(const LLSD& notification, const LLSD& response, LLFl if ( floater ) { floater->resetAllIgnored(); - LLFirstUse::resetFirstUse(); + //LLFirstUse::resetFirstUse(); floater->buildPopupLists(); } } return false; } - - -// Extract from strings of the form "<width> x <height>", e.g. "640 x 480". -bool extractWindowSizeFromString(const std::string& instr, U32 &width, U32 &height) -{ - using namespace boost; - cmatch what; - const regex expression("([0-9]+) x ([0-9]+)"); - if (regex_match(instr.c_str(), what, expression)) - { - width = atoi(what[1].first); - height = atoi(what[2].first); - return true; - } - - width = height = 0; - return false; -} +*/ void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator) { @@ -336,8 +313,8 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.SelectSkin", boost::bind(&LLFloaterPreference::onSelectSkin, this)); mCommitCallbackRegistrar.add("Pref.VoiceSetKey", boost::bind(&LLFloaterPreference::onClickSetKey, this)); mCommitCallbackRegistrar.add("Pref.VoiceSetMiddleMouse", boost::bind(&LLFloaterPreference::onClickSetMiddleMouse, this)); - mCommitCallbackRegistrar.add("Pref.ClickSkipDialogs", boost::bind(&LLFloaterPreference::onClickSkipDialogs, this)); - mCommitCallbackRegistrar.add("Pref.ClickResetDialogs", boost::bind(&LLFloaterPreference::onClickResetDialogs, this)); +// mCommitCallbackRegistrar.add("Pref.ClickSkipDialogs", boost::bind(&LLFloaterPreference::onClickSkipDialogs, this)); +// mCommitCallbackRegistrar.add("Pref.ClickResetDialogs", boost::bind(&LLFloaterPreference::onClickResetDialogs, this)); mCommitCallbackRegistrar.add("Pref.ClickEnablePopup", boost::bind(&LLFloaterPreference::onClickEnablePopup, this)); mCommitCallbackRegistrar.add("Pref.ClickDisablePopup", boost::bind(&LLFloaterPreference::onClickDisablePopup, this)); mCommitCallbackRegistrar.add("Pref.LogPath", boost::bind(&LLFloaterPreference::onClickLogPath, this)); @@ -348,6 +325,8 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.WindowedMod", boost::bind(&LLFloaterPreference::onCommitWindowedMode, this)); mCommitCallbackRegistrar.add("Pref.UpdateSliderText", boost::bind(&LLFloaterPreference::onUpdateSliderText,this, _1,_2)); mCommitCallbackRegistrar.add("Pref.AutoDetectAspect", boost::bind(&LLFloaterPreference::onCommitAutoDetectAspect, this)); + mCommitCallbackRegistrar.add("Pref.ParcelMediaAutoPlayEnable", boost::bind(&LLFloaterPreference::onCommitParcelMediaAutoPlayEnable, this)); + mCommitCallbackRegistrar.add("Pref.MediaEnabled", boost::bind(&LLFloaterPreference::onCommitMediaEnabled, this)); mCommitCallbackRegistrar.add("Pref.onSelectAspectRatio", boost::bind(&LLFloaterPreference::onKeystrokeAspectRatio, this)); mCommitCallbackRegistrar.add("Pref.QualityPerformance", boost::bind(&LLFloaterPreference::onChangeQuality, this, _2)); mCommitCallbackRegistrar.add("Pref.applyUIColor", boost::bind(&LLFloaterPreference::applyUIColor, this ,_1, _2)); @@ -499,13 +478,6 @@ void LLFloaterPreference::apply() } applyResolution(); - - // Only set window size if we're not in fullscreen mode - if(!gSavedSettings.getBOOL("WindowFullScreen")) - { - applyWindowSize(); - } - } void LLFloaterPreference::cancel() @@ -631,8 +603,8 @@ void LLFloaterPreference::onBtnOK() apply(); closeFloater(false); - gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE ); LLUIColorTable::instance().saveUserSettings(); + gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE ); std::string crash_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE); // save all settings, even if equals defaults gCrashSettings.saveToFile(crash_settings_filename, FALSE); @@ -1016,6 +988,27 @@ void LLFloaterPreference::onCommitAutoDetectAspect() } } +void LLFloaterPreference::onCommitParcelMediaAutoPlayEnable() +{ + BOOL autoplay = getChild<LLCheckBoxCtrl>("autoplay_enabled")->get(); + + gSavedSettings.setBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING, autoplay); + + lldebugs << "autoplay now = " << int(autoplay) << llendl; +} + +void LLFloaterPreference::onCommitMediaEnabled() +{ + LLCheckBoxCtrl *media_enabled_ctrl = getChild<LLCheckBoxCtrl>("media_enabled"); + bool enabled = media_enabled_ctrl->get(); + gSavedSettings.setBOOL("AudioStreamingVideo", enabled); + gSavedSettings.setBOOL("AudioStreamingMusic", enabled); + gSavedSettings.setBOOL("AudioStreamingMedia", enabled); + media_enabled_ctrl->setTentative(false); + // Update enabled state of the "autoplay" checkbox + getChild<LLCheckBoxCtrl>("autoplay_enabled")->setEnabled(enabled); +} + void LLFloaterPreference::refresh() { LLPanel::refresh(); @@ -1080,7 +1073,7 @@ void LLFloaterPreference::onClickSetMiddleMouse() // update the control right away since we no longer wait for apply getChild<LLUICtrl>("modifier_combo")->onCommit(); } - +/* void LLFloaterPreference::onClickSkipDialogs() { LLNotificationsUtil::add("SkipShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_skip_dialogs, _1, _2, this)); @@ -1090,6 +1083,7 @@ void LLFloaterPreference::onClickResetDialogs() { LLNotificationsUtil::add("ResetShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_reset_dialogs, _1, _2, this)); } + */ void LLFloaterPreference::onClickEnablePopup() { @@ -1264,20 +1258,6 @@ void LLFloaterPreference::onKeystrokeAspectRatio() getChild<LLCheckBoxCtrl>("aspect_auto_detect")->set(FALSE); } -void LLFloaterPreference::applyWindowSize() -{ - LLComboBox* ctrl_windowSize = getChild<LLComboBox>("windowsize combo"); - if (ctrl_windowSize->getVisible() && (ctrl_windowSize->getCurrentIndex() != -1)) - { - U32 width = 0; - U32 height = 0; - if (extractWindowSizeFromString(ctrl_windowSize->getValue().asString().c_str(), width,height)) - { - LLViewerWindow::movieSize(width, height); - } - } -} - void LLFloaterPreference::applyResolution() { LLComboBox* ctrl_aspect_ratio = getChild<LLComboBox>( "aspect_ratio"); @@ -1345,36 +1325,7 @@ void LLFloaterPreference::applyResolution() refresh(); } -void LLFloaterPreference::initWindowSizeControls(LLPanel* panelp) -{ - // Window size - // mWindowSizeLabel = getChild<LLTextBox>("WindowSizeLabel"); - LLComboBox* ctrl_window_size = panelp->getChild<LLComboBox>("windowsize combo"); - - // Look to see if current window size matches existing window sizes, if so then - // just set the selection value... - const U32 height = gViewerWindow->getWindowHeightRaw(); - const U32 width = gViewerWindow->getWindowWidthRaw(); - for (S32 i=0; i < ctrl_window_size->getItemCount(); i++) - { - U32 height_test = 0; - U32 width_test = 0; - ctrl_window_size->setCurrentByIndex(i); - if (extractWindowSizeFromString(ctrl_window_size->getValue().asString(), width_test, height_test)) - { - if ((height_test == height) && (width_test == width)) - { - return; - } - } - } - // ...otherwise, add a new entry with the current window height/width. - LLUIString resolution_label = panelp->getString("resolution_format"); - resolution_label.setArg("[RES_X]", llformat("%d", width)); - resolution_label.setArg("[RES_Y]", llformat("%d", height)); - ctrl_window_size->add(resolution_label, ADD_TOP); - ctrl_window_size->setCurrentByIndex(0); -} + void LLFloaterPreference::applyUIColor(LLUICtrl* ctrl, const LLSD& param) @@ -1433,53 +1384,8 @@ BOOL LLPanelPreference::postBuild() if(hasChild("aspect_ratio")) { - //============================================================================ - // Resolution -/* - S32 num_resolutions = 0; - LLWindow::LLWindowResolution* supported_resolutions = gViewerWindow->getWindow()->getSupportedResolutions(num_resolutions); - - S32 fullscreen_mode = num_resolutions - 1; - - LLComboBox*ctrl_full_screen = getChild<LLComboBox>( "fullscreen combo"); - LLUIString resolution_label = getString("resolution_format"); - - for (S32 i = 0; i < num_resolutions; i++) - { - resolution_label.setArg("[RES_X]", llformat("%d", supported_resolutions[i].mWidth)); - resolution_label.setArg("[RES_Y]", llformat("%d", supported_resolutions[i].mHeight)); - ctrl_full_screen->add( resolution_label, ADD_BOTTOM ); - } - - { - BOOL targetFullscreen; - S32 targetWidth; - S32 targetHeight; - - gViewerWindow->getTargetWindow(targetFullscreen, targetWidth, targetHeight); - - if (targetFullscreen) - { - fullscreen_mode = 0; // default to 800x600 - for (S32 i = 0; i < num_resolutions; i++) - { - if (targetWidth == supported_resolutions[i].mWidth - && targetHeight == supported_resolutions[i].mHeight) - { - fullscreen_mode = i; - } - } - ctrl_full_screen->setCurrentByIndex(fullscreen_mode); - } - else - { - // set to windowed mode - //fullscreen_mode = mCtrlFullScreen->getItemCount() - 1; - ctrl_full_screen->setCurrentByIndex(0); - } - } - */ - LLFloaterPreference::initWindowSizeControls(this); + // We used to set up fullscreen resolution and window size + // controls here, see LLFloaterWindowSize::initWindowSizeControls() if (gSavedSettings.getBOOL("FullScreenAutoDetectAspectRatio")) { @@ -1517,6 +1423,20 @@ BOOL LLPanelPreference::postBuild() refresh(); } + //////////////////////PanelPrivacy /////////////////// + if(hasChild("media_enabled")) + { + bool video_enabled = gSavedSettings.getBOOL("AudioStreamingVideo"); + bool music_enabled = gSavedSettings.getBOOL("AudioStreamingMusic"); + bool media_enabled = gSavedSettings.getBOOL("AudioStreamingMedia"); + bool enabled = video_enabled || music_enabled || media_enabled; + + LLCheckBoxCtrl *media_enabled_ctrl = getChild<LLCheckBoxCtrl>("media_enabled"); + media_enabled_ctrl->set(enabled); + media_enabled_ctrl->setTentative(!(video_enabled == music_enabled == media_enabled)); + getChild<LLCheckBoxCtrl>("autoplay_enabled")->setEnabled(enabled); + } + apply(); return true; } |