diff options
author | Logan Dethrow <log@lindenlab.com> | 2011-05-20 16:00:36 -0400 |
---|---|---|
committer | Logan Dethrow <log@lindenlab.com> | 2011-05-20 16:00:36 -0400 |
commit | 4b97f03b04e7df25e5b3622122f6d124d4a5f617 (patch) | |
tree | 574f9f5cf37b90c6ab94e0c1147f14b6d2dfb774 | |
parent | 39ad3f1d880a26dcf8189cad2501002c189a7ac2 (diff) |
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
-rw-r--r-- | indra/newview/llappviewer.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llfloaterpreference.cpp | 21 | ||||
-rw-r--r-- | indra/newview/llfloaterpreference.h | 5 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 12 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_preferences_advanced.xml | 106 | ||||
-rw-r--r-- | indra/newview/skins/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"/> </notification> + + <notification + icon="alertmodal.tga" + name="ConfirmClearCache" + type="alertmodal"> +Are you sure you want to clear your viewer cache? + <tag>confirm</tag> + <usetemplate + name="okcancelbuttons" + notext="Cancel" + yestext="OK"/> + </notification> <notification icon="alertmodal.tga" diff --git a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml index 37aab059a9..2cc9d9c1b0 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml @@ -20,8 +20,112 @@ height="12" layout="topleft" left="33" + name="Cache:" + top_pad="10" + width="100"> + Cache: + </text> + <spinner + control_name="CacheSize" + decimal_digits="0" + follows="left|top" + height="23" + increment="64" + initial_value="1024" + label="Cache size (64 - 9984MB)" + label_width="150" + layout="topleft" + left="80" + max_val="9984" + min_val="64" + top_pad="10" + name="cachesizespinner" + width="200" /> + <text + type="string" + length="1" + follows="left|top" + height="23" + layout="topleft" + left_pad="5" + mouse_opaque="false" + name="text_box5" + width="20"> + MB + </text> + <button + follows="left|top" + height="23" + label="Clear Cache" + label_selected="Clear Cache" + layout="topleft" + left_pad="30" + name="clear_cache" + top_delta="0" + width="100"> + <button.commit_callback + function="Pref.ClearCache" /> + </button> + <text + type="string" + length="1" + follows="left|top" + height="10" + layout="topleft" + left="80" + name="Cache location" + top_pad="5" + width="300"> + Cache location: + </text> + <line_editor + control_name="CacheLocationTopFolder" + border_style="line" + border_thickness="1" + follows="left|top" + font="SansSerif" + height="23" + layout="topleft" + left="80" + max_length="4096" + name="cache_location" + top_pad="5" + width="205" /> + <button + follows="left|top" + height="23" + label="Browse" + label_selected="Browse" + layout="topleft" + left_pad="5" + name="set_cache" + top_delta="0" + width="100"> + <button.commit_callback + function="Pref.SetCache" /> + </button> + <button + follows="left|top" + height="23" + label="Default Location" + label_selected="Default Location" + layout="topleft" + left_pad="3" + name="default_cache_location" + top_delta="0" + width="100"> + <button.commit_callback + function="Pref.ResetCache" /> + </button> + <text + type="string" + length="1" + follows="left|top" + height="12" + layout="topleft" + left="33" name="UI Size:" - top_pad="25" + top_pad="20" width="100"> UI size: </text> 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" /> - <text - type="string" - length="1" - follows="left|top" - height="10" - layout="topleft" - left="80" - mouse_opaque="false" - name="cache_size_label_l" - top_pad="20" - width="200"> - Cache size - </text> - <slider - can_edit_text="true" - control_name="CacheSize" - decimal_digits="0" - follows="left|top" - height="15" - increment="16" - initial_value="1024" - layout="topleft" - left_delta="150" - max_val="10240" - min_val="32" - name="cache_size" - top_delta="-2" - width="180" /> - <text - type="string" - length="1" - follows="left|top" - height="10" - layout="topleft" - left_pad="6" - mouse_opaque="false" - name="text_box5" - top_delta="1" - width="40"> - MB - </text> - <text - type="string" - length="1" - follows="left|top" - height="10" - layout="topleft" - left="80" - name="Cache location" - top_delta="20" - width="300"> - Cache location: - </text> - <line_editor - control_name="CacheLocationTopFolder" - border_style="line" - border_thickness="1" - follows="left|top" - font="SansSerif" - height="23" - layout="topleft" - left="80" - max_length="4096" - name="cache_location" - top_pad="5" - width="205" /> - <button - follows="left|top" - height="23" - label="Browse" - label_selected="Browse" - layout="topleft" - left_pad="5" - name="set_cache" - top_delta="-1" - width="100"> - <button.commit_callback - function="Pref.SetCache" /> - </button> - <button - follows="left|top" - height="23" - label="Reset" - label_selected="Reset" - layout="topleft" - left_pad="3" - name="reset_cache" - top_delta="0" - width="100"> - <button.commit_callback - function="Pref.ResetCache" /> - </button> <text type="string" |