From 4b97f03b04e7df25e5b3622122f6d124d4a5f617 Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Fri, 20 May 2011 16:00:36 -0400 Subject: Revamped viewer cache preference controls. Implemented improved cache control user interface, changes approved by wolf. * Moved viewer cache controls from the setup preference panel to advanced * Changed cache size control slider into a spinner * Readded a clear cache button along with a cache clear confirmation dialog * Renamed the reset button to "Default Location" to clarify its function Related JIRAs: ER-815 ER-816 ER-818 ER-820 ER-821 ER-831 --- indra/newview/llappviewer.cpp | 8 +- indra/newview/llfloaterpreference.cpp | 21 +++- indra/newview/llfloaterpreference.h | 5 +- .../newview/skins/default/xui/en/notifications.xml | 12 +++ .../default/xui/en/panel_preferences_advanced.xml | 106 ++++++++++++++++++++- .../default/xui/en/panel_preferences_setup.xml | 92 ------------------ 6 files changed, 145 insertions(+), 99 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 7e682fc83b..53c075450a 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3586,10 +3586,12 @@ bool LLAppViewer::initCache() // Init the texture cache // Allocate 80% of the cache size for textures const S32 MB = 1024 * 1024; - S64 cache_size = (S64)(gSavedSettings.getU32("CacheSize")) * MB; - const S64 MAX_CACHE_SIZE = 10 * 1024ll * MB; + const S64 MIN_CACHE_SIZE = 64 * MB; + const S64 MAX_CACHE_SIZE = 9984ll * MB; const S64 MAX_VFS_SIZE = 1024 * MB; // 1 GB - cache_size = llmin(cache_size, MAX_CACHE_SIZE); + + S64 cache_size = (S64)(gSavedSettings.getU32("CacheSize")) * MB; + cache_size = llclamp(cache_size, MIN_CACHE_SIZE, MAX_CACHE_SIZE); S64 texture_cache_size = ((cache_size * 8) / 10); S64 vfs_size = cache_size - texture_cache_size; diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 8d13e59a79..396ea53ff3 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -187,12 +187,26 @@ void LLVoiceSetKeyDialog::onCancel(void* user_data) void handleNameTagOptionChanged(const LLSD& newvalue); void handleDisplayNamesOptionChanged(const LLSD& newvalue); bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response); +bool callback_clear_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); void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator); +bool callback_clear_cache(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if ( option == 0 ) // YES + { + // flag client texture cache for clearing next time the client runs + gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE); + LLNotificationsUtil::add("CacheWillClear"); + } + + return false; +} + bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); @@ -305,7 +319,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.Cancel", boost::bind(&LLFloaterPreference::onBtnCancel, this)); mCommitCallbackRegistrar.add("Pref.OK", boost::bind(&LLFloaterPreference::onBtnOK, this)); -// mCommitCallbackRegistrar.add("Pref.ClearCache", boost::bind(&LLFloaterPreference::onClickClearCache, this)); + mCommitCallbackRegistrar.add("Pref.ClearCache", boost::bind(&LLFloaterPreference::onClickClearCache, this)); mCommitCallbackRegistrar.add("Pref.WebClearCache", boost::bind(&LLFloaterPreference::onClickBrowserClearCache, this)); mCommitCallbackRegistrar.add("Pref.SetCache", boost::bind(&LLFloaterPreference::onClickSetCache, this)); mCommitCallbackRegistrar.add("Pref.ResetCache", boost::bind(&LLFloaterPreference::onClickResetCache, this)); @@ -809,6 +823,11 @@ void LLFloaterPreference::refreshEnabledGraphics() } } +void LLFloaterPreference::onClickClearCache() +{ + LLNotificationsUtil::add("ConfirmClearCache", LLSD(), LLSD(), callback_clear_cache); +} + void LLFloaterPreference::onClickBrowserClearCache() { LLNotificationsUtil::add("ConfirmClearBrowserCache", LLSD(), LLSD(), callback_clear_browser_cache); diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 5fe509fb37..ef92575347 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -88,7 +88,8 @@ protected: void onBtnCancel(); void onBtnApply(); - void onClickBrowserClearCache(); + void onClickClearCache(); // Clear viewer texture cache, vfs, and VO cache on next startup + void onClickBrowserClearCache(); // Clear web history and caches as well as viewer caches above void onLanguageChange(); void onNameTagOpacityChange(const LLSD& newvalue); @@ -99,7 +100,7 @@ protected: void onChangeCustom(); void updateMeterText(LLUICtrl* ctrl); void onOpenHardwareSettings(); - /// callback for defaults + // callback for defaults void setHardwareDefaults(); // callback for when client turns on shaders void onVertexShaderEnable(); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 3fb3717e68..207e55073d 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -4763,6 +4763,18 @@ Are you sure you want to delete your travel, web, and search history? notext="Cancel" yestext="OK"/> + + +Are you sure you want to clear your viewer cache? + confirm + + + Cache: + + + + MB + + + + Cache location: + + + + + UI size: diff --git a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml index bdc21960cd..1c22a5c02e 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml @@ -93,98 +93,6 @@ name="connection_port" top_delta="3" width="170" /> - - Cache size - - - - MB - - - Cache location: - - - -