diff options
Diffstat (limited to 'indra/newview/llfloaterpreference.cpp')
| -rw-r--r-- | indra/newview/llfloaterpreference.cpp | 244 |
1 files changed, 244 insertions, 0 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index fdac390e8a..aa36782942 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -366,6 +366,11 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.ClearLog", boost::bind(&LLConversationLog::onClearLog, &LLConversationLog::instance())); mCommitCallbackRegistrar.add("Pref.DeleteTranscripts", boost::bind(&LLFloaterPreference::onDeleteTranscripts, this)); mCommitCallbackRegistrar.add("UpdateFilter", boost::bind(&LLFloaterPreference::onUpdateFilterTerm, this, false)); // <FS:ND/> Hook up for filtering +#ifdef LL_DISCORD + gSavedSettings.getControl("EnableDiscord")->getCommitSignal()->connect(boost::bind(&LLAppViewer::updateDiscordActivity)); + gSavedSettings.getControl("ShowDiscordActivityDetails")->getCommitSignal()->connect(boost::bind(&LLAppViewer::updateDiscordActivity)); + gSavedSettings.getControl("ShowDiscordActivityState")->getCommitSignal()->connect(boost::bind(&LLAppViewer::updateDiscordActivity)); +#endif } void LLFloaterPreference::processProperties( void* pData, EAvatarProcessorType type ) @@ -470,6 +475,8 @@ bool LLFloaterPreference::postBuild() getChild<LLUICtrl>("log_path_string")->setEnabled(false); // make it read-only but selectable getChild<LLComboBox>("language_combobox")->setCommitCallback(boost::bind(&LLFloaterPreference::onLanguageChange, this)); + mTimeFormatCombobox = getChild<LLComboBox>("time_format_combobox"); + mTimeFormatCombobox->setCommitCallback(boost::bind(&LLFloaterPreference::onTimeFormatChange, this)); getChild<LLComboBox>("FriendIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"FriendIMOptions")); getChild<LLComboBox>("NonFriendIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"NonFriendIMOptions")); @@ -523,6 +530,11 @@ bool LLFloaterPreference::postBuild() getChild<LLComboBox>("language_combobox")->add("System default", LLSD("default"), ADD_TOP, true); } +#ifndef LL_DISCORD + LLPanel* panel = getChild<LLPanel>("privacy_preferences_discord"); + getChild<LLTabContainer>("privacy_tab_container")->removeTabPanel(panel); +#endif + return true; } @@ -748,6 +760,7 @@ void LLFloaterPreference::onOpen(const LLSD& key) // Forget previous language changes. mLanguageChanged = false; + mLastQualityLevel = gSavedSettings.getU32("RenderQualityPerformance"); // Display selected maturity icons. onChangeMaturity(); @@ -761,6 +774,17 @@ void LLFloaterPreference::onOpen(const LLSD& key) // Load (double-)click to walk/teleport settings. updateClickActionViews(); +#if LL_LINUX + // Lixux doesn't support automatic mode + LLComboBox* combo = getChild<LLComboBox>("double_click_action_combo"); + S32 mode = gSavedSettings.getS32("MouseWarpMode"); + if (mode == 0) + { + combo->setValue("1"); + } + combo->setEnabledByValue("0", false); +#endif + // Enabled/disabled popups, might have been changed by user actions // while preferences floater was closed. buildPopupLists(); @@ -1092,6 +1116,13 @@ void LLFloaterPreference::onLanguageChange() } } +void LLFloaterPreference::onTimeFormatChange() +{ + std::string val = mTimeFormatCombobox->getValue(); + gSavedSettings.setBOOL("Use24HourClock", val == "1"); + onLanguageChange(); +} + void LLFloaterPreference::onNotificationsChange(const std::string& OptionName) { mNotificationOptions[OptionName] = getChild<LLComboBox>(OptionName)->getSelectedItemLabel(); @@ -1307,6 +1338,8 @@ void LLFloaterPreference::refresh() advanced->refresh(); } updateClickActionViews(); + + mTimeFormatCombobox->selectByValue(gSavedSettings.getBOOL("Use24HourClock") ? "1" : "0"); } void LLFloaterPreference::onCommitWindowedMode() @@ -1317,7 +1350,35 @@ void LLFloaterPreference::onCommitWindowedMode() void LLFloaterPreference::onChangeQuality(const LLSD& data) { U32 level = (U32)(data.asReal()); + constexpr U32 LVL_HIGH = 4; + if (level >= LVL_HIGH && mLastQualityLevel < level) + { + constexpr U32 LOW_MEM_THRESHOLD = 4097; + U32 total_mem = (U32Megabytes)LLMemory::getMaxMemKB(); + if (total_mem < LOW_MEM_THRESHOLD) + { + LLSD args; + args["TOTAL_MEM"] = LLSD::Integer(total_mem); + LLNotificationsUtil::add("PreferenceQualityWithLowMemory", args, LLSD(), [this](const LLSD& notification, const LLSD& response) + { + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + // If cancel pressed + if (option == 1) + { + constexpr U32 LVL_MED_PLUS = 3; + gSavedSettings.setU32("RenderQualityPerformance", LVL_MED_PLUS); + mLastQualityLevel = LVL_MED_PLUS; + LLFeatureManager::getInstance()->setGraphicsLevel(LVL_MED_PLUS, true); + refreshEnabledGraphics(); + refresh(); + } + } + ); + } + } + mLastQualityLevel = level; LLFeatureManager::getInstance()->setGraphicsLevel(level, true); + gSavedSettings.setU32("DebugQualityPerformance", level); refreshEnabledGraphics(); refresh(); } @@ -1968,7 +2029,21 @@ void LLFloaterPreference::selectChatPanel() void LLFloaterPreference::changed() { + if (LLConversationLog::instance().getIsLoggingEnabled()) + { getChild<LLButton>("clear_log")->setEnabled(LLConversationLog::instance().getConversations().size() > 0); + } + else + { + // onClearLog clears list, then notifies changed() and only then clears file, + // so check presence of conversations before checking file, file will cleared later. + llstat st; + bool has_logs = LLConversationLog::instance().getConversations().size() > 0 + && LLFile::stat(LLConversationLog::instance().getFileName(), &st) == 0 + && S_ISREG(st.st_mode) + && st.st_size > 0; + getChild<LLButton>("clear_log")->setEnabled(has_logs); + } // set 'enable' property for 'Delete transcripts...' button updateDeleteTranscriptsButton(); @@ -2354,6 +2429,7 @@ private: }; static LLPanelInjector<LLPanelPreferenceGraphics> t_pref_graph("panel_preference_graphics"); +static LLPanelInjector<LLPanelPreferenceGraphics3> t_pref_graph3("panel_preference_graphics3"); static LLPanelInjector<LLPanelPreferencePrivacy> t_pref_privacy("panel_preference_privacy"); bool LLPanelPreferenceGraphics::postBuild() @@ -2523,6 +2599,174 @@ void LLPanelPreferenceGraphics::setHardwareDefaults() resetDirtyChilds(); } +// LLPanelPreferenceGraphics3 (Visuals Effects) + +bool LLPanelPreferenceGraphics3::postBuild() +{ + getChild<LLButton>("MPBalancedButton")->setCommitCallback(boost::bind(&LLPanelPreferenceGraphics3::onMPRecommanded, this)); + return LLPanelPreference::postBuild(); +} + +void LLPanelPreferenceGraphics3::draw() +{ + LLPanelPreference::draw(); +} + +bool LLPanelPreferenceGraphics3::hasDirtyChilds() +{ + LLFloater* advanced = LLFloaterReg::findTypedInstance<LLFloater>("prefs_graphics_advanced"); + std::list<LLView*> view_stack; + view_stack.push_back(this); + if (advanced) + { + view_stack.push_back(advanced); + } + while(!view_stack.empty()) + { + // Process view on top of the stack + LLView* curview = view_stack.front(); + view_stack.pop_front(); + + LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview); + if (ctrl) + { + if (ctrl->isDirty()) + { + LLControlVariable* control = ctrl->getControlVariable(); + if (control) + { + std::string control_name = control->getName(); + if (!control_name.empty()) + { + return true; + } + } + } + } + // Push children onto the end of the work stack + for (child_list_t::const_iterator iter = curview->getChildList()->begin(); + iter != curview->getChildList()->end(); ++iter) + { + view_stack.push_back(*iter); + } + } + + return false; +} + +void LLPanelPreferenceGraphics3::resetDirtyChilds() +{ + LLFloater* advanced = LLFloaterReg::findTypedInstance<LLFloater>("prefs_graphics_advanced"); + std::list<LLView*> view_stack; + view_stack.push_back(this); + if (advanced) + { + view_stack.push_back(advanced); + } + while(!view_stack.empty()) + { + // Process view on top of the stack + LLView* curview = view_stack.front(); + view_stack.pop_front(); + + LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview); + if (ctrl) + { + ctrl->resetDirty(); + } + // Push children onto the end of the work stack + for (child_list_t::const_iterator iter = curview->getChildList()->begin(); + iter != curview->getChildList()->end(); ++iter) + { + view_stack.push_back(*iter); + } + } +} + +void LLPanelPreferenceGraphics3::cancel(const std::vector<std::string> settings_to_skip) +{ + LLPanelPreference::cancel(settings_to_skip); +} +void LLPanelPreferenceGraphics3::saveSettings() +{ + resetDirtyChilds(); + std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); + if (preset_graphic_active.empty()) + { + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences"); + if (instance) + { + //don't restore previous preset after closing Preferences + instance->saveGraphicsPreset(preset_graphic_active); + } + } + LLPanelPreference::saveSettings(); +} + +void LLPanelPreferenceGraphics3::onMPRecommanded() +{ + //LL_WARNS() << "onClickMPRecommanded()" << LL_ENDL; + + // LOD + + gSavedSettings.setF32("RenderVolumeLODFactor", 3.5); + gSavedSettings.setF32("RenderAvatarPhysicsLODFactor", 1.0); + + // AA + + gSavedSettings.setU32("RenderFSAAType", 2); + gSavedSettings.setU32("RenderFSAASamples", 2); + + gSavedSettings.setBOOL("RenderAnisotropic", false); + + // Shadows + + gSavedSettings.setS32("RenderShadowDetail", 0); + gSavedSettings.setF32("MPRenderShadowMaxDist", 40.0); + gSavedSettings.setF32("RenderShadowResolutionScale", 2.0); + gSavedSettings.setF32("RenderShadowBlurSize", 0.2); + gSavedSettings.setBOOL("RenderDeferredSSAO", 0); + + // Bloom + + gSavedSettings.setU32("MPRenderBloom", 0); + gSavedSettings.setF32("MPBloomBlurRadius", 1.2); + gSavedSettings.setF32("MPBloomBlurRadiusAdd", 1.2); + gSavedSettings.setF32("MPBloomExtractBrightness", 0.1); + gSavedSettings.setF32("MPBloomStrength", 1.0); + + gSavedSettings.setF32("MPBloomExtractMetal", 0.4); + gSavedSettings.setF32("MPBloomExtractNonMetal", 0.0); + + // Probes + + gSavedSettings.setS32("RenderReflectionProbeDetail", 0); + gSavedSettings.setS32("RenderReflectionProbeLevel", 1); + gSavedSettings.setU32("RenderReflectionProbeCount", 32); + gSavedSettings.setU32("RenderReflectionProbeResolution", 128); + gSavedSettings.setF32("RenderReflectionProbeDrawDistance", 24.0); + gSavedSettings.setF32("RenderDefaultProbeUpdatePeriod", 20.0); + gSavedSettings.setF32("MPRenderProbeUpdatePeriod", 30.0); + gSavedSettings.setF32("MPRenderProbeSlowDown", 0.02); + + // Misc + + gSavedSettings.setBOOL("RenderDisableVintageMode", true); + gSavedSettings.setBOOL("RenderTransparentWater", true); + gSavedSettings.setU32("MPColorPrecision", 0); + + gSavedSettings.setU32("RenderResolutionDivisor", 1.0); + + gSavedSettings.setBOOL("RenderGLMultiThreadedTextures", false); + gSavedSettings.setBOOL("RenderAppleUseMultGL", false); + gSavedSettings.setBOOL("MPNoGLDebug", true); + + gSavedSettings.setBOOL("MPHDRDisplay", false); + gSavedSettings.setF32("MPHDRBoost", 1.0); + gSavedSettings.setF32("MPHDRUIBoost", 1.0); + gSavedSettings.setF32("MPHDRGamma", 2.4); +} + //------------------------LLPanelPreferenceControls-------------------------------- static LLPanelInjector<LLPanelPreferenceControls> t_pref_contrls("panel_preference_controls"); |
