aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra')
-rw-r--r--linden/indra/newview/CMakeLists.txt2
-rw-r--r--linden/indra/newview/app_settings/cmd_line.xml2
-rw-r--r--linden/indra/newview/app_settings/settings.xml71
-rw-r--r--linden/indra/newview/floatercache.cpp97
-rw-r--r--linden/indra/newview/floatercache.h50
-rw-r--r--linden/indra/newview/llappviewer.cpp64
-rw-r--r--linden/indra/newview/llpanelnetwork.cpp6
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/floater_clear_cache.xml28
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/notifications.xml7
9 files changed, 299 insertions, 28 deletions
diff --git a/linden/indra/newview/CMakeLists.txt b/linden/indra/newview/CMakeLists.txt
index 46da492..1b9f75a 100644
--- a/linden/indra/newview/CMakeLists.txt
+++ b/linden/indra/newview/CMakeLists.txt
@@ -78,6 +78,7 @@ set(viewer_SOURCE_FILES
78 floaterao.cpp 78 floaterao.cpp
79 floaterbusy.cpp 79 floaterbusy.cpp
80 floatercommandline.cpp 80 floatercommandline.cpp
81 floatercache.cpp
81 floaterdice.cpp 82 floaterdice.cpp
82 floatergriddefault.cpp 83 floatergriddefault.cpp
83 floatergridmanager.cpp 84 floatergridmanager.cpp
@@ -536,6 +537,7 @@ set(viewer_HEADER_FILES
536 floaterao.h 537 floaterao.h
537 floaterbusy.h 538 floaterbusy.h
538 floatercommandline.h 539 floatercommandline.h
540 floatercache.h
539 floaterdice.h 541 floaterdice.h
540 floatergriddefault.h 542 floatergriddefault.h
541 floatergridmanager.h 543 floatergridmanager.h
diff --git a/linden/indra/newview/app_settings/cmd_line.xml b/linden/indra/newview/app_settings/cmd_line.xml
index f5c6cdb..9fd4669 100644
--- a/linden/indra/newview/app_settings/cmd_line.xml
+++ b/linden/indra/newview/app_settings/cmd_line.xml
@@ -157,7 +157,7 @@
157 <key>desc</key> 157 <key>desc</key>
158 <string>Delete files in the cache.</string> 158 <string>Delete files in the cache.</string>
159 <key>map-to</key> 159 <key>map-to</key>
160 <string>PurgeCacheOnNextStartup</string> 160 <string>PurgeCacheOnStartup</string>
161 </map> 161 </map>
162 162
163 <key>noinvlib</key> 163 <key>noinvlib</key>
diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml
index eb59254..7d9a0ca 100644
--- a/linden/indra/newview/app_settings/settings.xml
+++ b/linden/indra/newview/app_settings/settings.xml
@@ -2571,6 +2571,66 @@
2571 </map> 2571 </map>
2572 2572
2573 <!-- End: full radar (Advanced menu) --> 2573 <!-- End: full radar (Advanced menu) -->
2574
2575 <!-- Begin: cache clearing -->
2576
2577 <key>PurgeCacheOnStartup</key>
2578 <map>
2579 <key>Comment</key>
2580 <string>Clear local file cache every time viewer is run (cmd line --purge)</string>
2581 <key>Persist</key>
2582 <integer>1</integer>
2583 <key>Type</key>
2584 <string>Boolean</string>
2585 <key>Value</key>
2586 <integer>0</integer>
2587 </map>
2588 <key>ClearTextureCache</key>
2589 <map>
2590 <key>Comment</key>
2591 <string>Clear texture cache</string>
2592 <key>Persist</key>
2593 <integer>1</integer>
2594 <key>Type</key>
2595 <string>Boolean</string>
2596 <key>Value</key>
2597 <integer>0</integer>
2598 </map>
2599 <key>ClearObjectCache</key>
2600 <map>
2601 <key>Comment</key>
2602 <string>Clear object cache</string>
2603 <key>Persist</key>
2604 <integer>1</integer>
2605 <key>Type</key>
2606 <string>Boolean</string>
2607 <key>Value</key>
2608 <integer>0</integer>
2609 </map>
2610 <key>ClearInvCache</key>
2611 <map>
2612 <key>Comment</key>
2613 <string>Clear inventory cache</string>
2614 <key>Persist</key>
2615 <integer>1</integer>
2616 <key>Type</key>
2617 <string>Boolean</string>
2618 <key>Value</key>
2619 <integer>0</integer>
2620 </map>
2621 <key>ClearNameCache</key>
2622 <map>
2623 <key>Comment</key>
2624 <string>Clear cached avatar names/uuids</string>
2625 <key>Persist</key>
2626 <integer>1</integer>
2627 <key>Type</key>
2628 <string>Boolean</string>
2629 <key>Value</key>
2630 <integer>0</integer>
2631 </map>
2632
2633 <!-- End: clear cache -->
2574 2634
2575 <!-- END IMPRUDENCE-SPECIFIC SETTINGS --> 2635 <!-- END IMPRUDENCE-SPECIFIC SETTINGS -->
2576 2636
@@ -9334,17 +9394,6 @@
9334 <key>Value</key> 9394 <key>Value</key>
9335 <integer>0</integer> 9395 <integer>0</integer>
9336 </map> 9396 </map>
9337 <key>PurgeCacheOnStartup</key>
9338 <map>
9339 <key>Comment</key>
9340 <string>Clear local file cache every time viewer is run</string>
9341 <key>Persist</key>
9342 <integer>1</integer>
9343 <key>Type</key>
9344 <string>Boolean</string>
9345 <key>Value</key>
9346 <integer>0</integer>
9347 </map>
9348 <key>PushToTalkButton</key> 9397 <key>PushToTalkButton</key>
9349 <map> 9398 <map>
9350 <key>Comment</key> 9399 <key>Comment</key>
diff --git a/linden/indra/newview/floatercache.cpp b/linden/indra/newview/floatercache.cpp
new file mode 100644
index 0000000..3d3091f
--- /dev/null
+++ b/linden/indra/newview/floatercache.cpp
@@ -0,0 +1,97 @@
1/**
2* @file floatercache.cpp
3* @brief clear cache window for Imprudence
4*
5* $LicenseInfo:firstyear=2009&license=viewergpl$
6*
7* Copyright (c) 2011, McCabe Maxsted
8*
9* Imprudence Viewer Source Code
10* The source code in this file ("Source Code") is provided to you
11* under the terms of the GNU General Public License, version 2.0
12* ("GPL"). Terms of the GPL can be found in doc/GPL-license.txt in
13* this distribution, or online at
14* http://secondlifegrid.net/programs/open_source/licensing/gplv2
15*
16* There are special exceptions to the terms and conditions of the GPL as
17* it is applied to this Source Code. View the full text of the exception
18* in the file doc/FLOSS-exception.txt in this software distribution, or
19* online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
20*
21* By copying, modifying or distributing this software, you acknowledge
22* that you have read and understood your obligations described above,
23* and agree to abide by those obligations.
24*
25* ALL SOURCE CODE IS PROVIDED "AS IS." THE AUTHOR MAKES NO
26* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
27* COMPLETENESS OR PERFORMANCE.
28* $/LicenseInfo$
29*/
30
31#include "llviewerprecompiledheaders.h"
32
33#include "floatercache.h"
34
35#include "llcheckboxctrl.h"
36#include "lluictrlfactory.h"
37
38#include "llviewercontrol.h"
39
40
41FloaterCache::FloaterCache(const LLSD& seed) : LLFloater("Clear Cache")
42{
43 LLUICtrlFactory::getInstance()->buildFloater(this, "floater_clear_cache.xml");
44}
45
46FloaterCache::~FloaterCache()
47{
48}
49
50BOOL FloaterCache::postBuild()
51{
52 getChild<LLCheckBoxCtrl>("texture_cache")->setValue(gSavedSettings.getBOOL("ClearTextureCache"));
53 getChild<LLCheckBoxCtrl>("object_cache")->setValue(gSavedSettings.getBOOL("ClearObjectCache"));
54 getChild<LLCheckBoxCtrl>("inv_cache")->setValue(gSavedSettings.getBOOL("ClearInvCache"));
55 getChild<LLCheckBoxCtrl>("name_cache")->setValue(gSavedSettings.getBOOL("ClearNameCache"));
56
57 childSetAction("btn_ok", onClickOK, this);
58 childSetAction("btn_cancel", onClickCancel, this);
59
60 return TRUE;
61}
62
63// static
64void FloaterCache::onClickOK(void* data)
65{
66 FloaterCache* self = (FloaterCache*)data;
67 if (self)
68 {
69 bool purge_textures = self->getChild<LLCheckBoxCtrl>("texture_cache")->getValue().asBoolean();
70 bool purge_objects = self->getChild<LLCheckBoxCtrl>("object_cache")->getValue().asBoolean();
71 bool purge_inv = self->getChild<LLCheckBoxCtrl>("inv_cache")->getValue().asBoolean();
72 bool purge_names = self->getChild<LLCheckBoxCtrl>("name_cache")->getValue().asBoolean();
73
74 gSavedSettings.setBOOL("ClearTextureCache", purge_textures);
75 gSavedSettings.setBOOL("ClearObjectCache", purge_objects);
76 gSavedSettings.setBOOL("ClearInvCache", purge_inv);
77 gSavedSettings.setBOOL("ClearNameCache", purge_names);
78
79 if (purge_textures || purge_objects || purge_inv || purge_names)
80 {
81 // flag client cache for clearing next time the client runs
82 gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE);
83 }
84
85 self->close();
86 }
87}
88
89// static
90void FloaterCache::onClickCancel(void* data)
91{
92 FloaterCache* self = (FloaterCache*)data;
93 if (self)
94 {
95 self->close();
96 }
97}
diff --git a/linden/indra/newview/floatercache.h b/linden/indra/newview/floatercache.h
new file mode 100644
index 0000000..ea3c53e
--- /dev/null
+++ b/linden/indra/newview/floatercache.h
@@ -0,0 +1,50 @@
1/**
2* @file floatercache.h
3* @brief clear cache window for Imprudence
4*
5* $LicenseInfo:firstyear=2009&license=viewergpl$
6*
7* Copyright (c) 2011, McCabe Maxsted
8*
9* Imprudence Viewer Source Code
10* The source code in this file ("Source Code") is provided to you
11* under the terms of the GNU General Public License, version 2.0
12* ("GPL"). Terms of the GPL can be found in doc/GPL-license.txt in
13* this distribution, or online at
14* http://secondlifegrid.net/programs/open_source/licensing/gplv2
15*
16* There are special exceptions to the terms and conditions of the GPL as
17* it is applied to this Source Code. View the full text of the exception
18* in the file doc/FLOSS-exception.txt in this software distribution, or
19* online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
20*
21* By copying, modifying or distributing this software, you acknowledge
22* that you have read and understood your obligations described above,
23* and agree to abide by those obligations.
24*
25* ALL SOURCE CODE IS PROVIDED "AS IS." THE AUTHOR MAKES NO
26* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
27* COMPLETENESS OR PERFORMANCE.
28* $/LicenseInfo$
29*/
30
31#ifndef floatercache_h
32#define floatercache_h
33
34#include "llfloater.h"
35
36class FloaterCache : public LLFloater, public LLFloaterSingleton<FloaterCache>
37{
38public:
39
40 FloaterCache(const LLSD& seed);
41 virtual ~FloaterCache();
42 BOOL postBuild();
43
44private:
45
46 static void onClickOK(void* data);
47 static void onClickCancel(void* data);
48};
49
50#endif //floatercache_h
diff --git a/linden/indra/newview/llappviewer.cpp b/linden/indra/newview/llappviewer.cpp
index c9ab291..2fab25b 100644
--- a/linden/indra/newview/llappviewer.cpp
+++ b/linden/indra/newview/llappviewer.cpp
@@ -2963,10 +2963,11 @@ bool LLAppViewer::initCache()
2963{ 2963{
2964 mPurgeCache = false; 2964 mPurgeCache = false;
2965 // Purge cache if user requested it 2965 // Purge cache if user requested it
2966 if (gSavedSettings.getBOOL("PurgeCacheOnStartup") || 2966 if (gSavedSettings.getBOOL("PurgeCacheOnStartup") || // cmd-line -- MC
2967 gSavedSettings.getBOOL("PurgeCacheOnNextStartup")) 2967 gSavedSettings.getBOOL("PurgeCacheOnNextStartup")) // ui -- MC
2968 { 2968 {
2969 gSavedSettings.setBOOL("PurgeCacheOnNextStartup", false); 2969 gSavedSettings.setBOOL("PurgeCacheOnNextStartup", false);
2970 gSavedSettings.setBOOL("PurgeCacheOnStartup", FALSE);
2970 mPurgeCache = true; 2971 mPurgeCache = true;
2971 } 2972 }
2972 // Purge cache if it belongs to an old version 2973 // Purge cache if it belongs to an old version
@@ -3175,10 +3176,61 @@ bool LLAppViewer::initCache()
3175 3176
3176void LLAppViewer::purgeCache() 3177void LLAppViewer::purgeCache()
3177{ 3178{
3178 LL_INFOS("AppCache") << "Purging Cache and Texture Cache..." << llendl; 3179 LL_INFOS("AppCache") << "Begin purging cachees..." << llendl;
3179 LLAppViewer::getTextureCache()->purgeCache(LL_PATH_CACHE); 3180 if (gSavedSettings.getBOOL("PurgeCacheOnStartup")) // purging from cmd line
3180 std::string mask = gDirUtilp->getDirDelimiter() + "*.*"; 3181 {
3181 gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""),mask); 3182 LLAppViewer::getTextureCache()->purgeCache(LL_PATH_CACHE);
3183 std::string mask = gDirUtilp->getDirDelimiter() + "*.*";
3184 gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""), mask);
3185 }
3186 else // purging cache from ui
3187 {
3188 if (gSavedSettings.getBOOL("ClearTextureCache"))
3189 {
3190 LLAppViewer::getTextureCache()->purgeCache(LL_PATH_CACHE);
3191 gSavedSettings.setBOOL("ClearTextureCache", FALSE);
3192 }
3193
3194 if (gSavedSettings.getBOOL("ClearObjectCache"))
3195 {
3196 std::string mask = gDirUtilp->getDirDelimiter() + "*.slc";
3197 gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""), mask);
3198 gSavedSettings.setBOOL("ClearObjectCache", FALSE);
3199 }
3200
3201 if (gSavedSettings.getBOOL("ClearInvCache"))
3202 {
3203 std::vector<std::string> masks;
3204 masks.push_back(gDirUtilp->getDirDelimiter() + "*.inv.gz");
3205 masks.push_back(gDirUtilp->getDirDelimiter() + VFS_DATA_FILE_BASE + "*");
3206 masks.push_back(gDirUtilp->getDirDelimiter() + VFS_INDEX_FILE_BASE + "*");
3207
3208 for (std::vector<std::string>::iterator vIt = masks.begin();
3209 vIt != masks.end(); ++vIt)
3210 {
3211 gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""), (*vIt));
3212 }
3213
3214 gSavedSettings.setBOOL("ClearInvCache", FALSE);
3215 }
3216
3217 if (gSavedSettings.getBOOL("ClearNameCache"))
3218 {
3219 // ick @ not making these variables -- MC
3220 std::vector<std::string> masks;
3221 masks.push_back(gDirUtilp->getDirDelimiter() + "name.cache");
3222 masks.push_back(gDirUtilp->getDirDelimiter() + "avatar_name_cache.xml");
3223 masks.push_back(gDirUtilp->getDirDelimiter() + "*.cached_mute");
3224
3225 for (std::vector<std::string>::iterator vIt = masks.begin();
3226 vIt != masks.end(); ++vIt)
3227 {
3228 gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""), (*vIt));
3229 }
3230
3231 gSavedSettings.setBOOL("ClearNameCache", FALSE);
3232 }
3233 }
3182} 3234}
3183 3235
3184const std::string& LLAppViewer::getSecondLifeTitle() const 3236const std::string& LLAppViewer::getSecondLifeTitle() const
diff --git a/linden/indra/newview/llpanelnetwork.cpp b/linden/indra/newview/llpanelnetwork.cpp
index b4ebe42..70d88d9 100644
--- a/linden/indra/newview/llpanelnetwork.cpp
+++ b/linden/indra/newview/llpanelnetwork.cpp
@@ -45,6 +45,7 @@
45#include "llviewerwindow.h" 45#include "llviewerwindow.h"
46 46
47// project includes 47// project includes
48#include "floatercache.h"
48#include "llcheckboxctrl.h" 49#include "llcheckboxctrl.h"
49#include "hippogridmanager.h" 50#include "hippogridmanager.h"
50#include "lluictrlfactory.h" 51#include "lluictrlfactory.h"
@@ -267,9 +268,8 @@ void LLPanelNetwork::refresh()
267// static 268// static
268void LLPanelNetwork::onClickClearDiskCache(void*) 269void LLPanelNetwork::onClickClearDiskCache(void*)
269{ 270{
270 // flag client cache for clearing next time the client runs 271 FloaterCache::getInstance()->open();
271 gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE); 272 FloaterCache::getInstance()->center();
272 LLNotifications::instance().add("CacheWillClear");
273} 273}
274 274
275// static 275// static
diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_clear_cache.xml b/linden/indra/newview/skins/default/xui/en-us/floater_clear_cache.xml
new file mode 100644
index 0000000..e965b28
--- /dev/null
+++ b/linden/indra/newview/skins/default/xui/en-us/floater_clear_cache.xml
@@ -0,0 +1,28 @@
1<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
2<floater bottom="-175" can_close="true" can_drag_on_left="false" can_minimize="true"
3 can_resize="false" follows="left|top" mouse_opaque="true" height="175" width="200"
4 name="Clear Cache" title="Clear Disk Cache">
5 <text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
6 bottom="-39" drop_shadow_visible="true" follows="left|top" font-style="BOLD|SHADOW"
7 font="SansSerifSmall" h_pad="0" halign="left" height="16" left_delta="20"
8 mouse_opaque="true" name="cache_label" v_pad="0" width="185">
9Cache Will Be Cleared After
10You Restart Imprudence
11 </text>
12 <check_box bottom_delta="-37" follows="left|top" font="SansSerifSmall" height="20"
13 initial_value="false" label="Clear texture cache" left="10"
14 mouse_opaque="true" name="texture_cache" width="185" />
15 <check_box bottom_delta="-22" follows="left|top" font="SansSerifSmall" height="20"
16 initial_value="false" label="Clear object cache" left_delta="0"
17 mouse_opaque="true" name="object_cache" width="185" />
18 <check_box bottom_delta="-22" follows="left|top" font="SansSerifSmall" height="20"
19 initial_value="false" label="Clear inventory cache" left_delta="0"
20 mouse_opaque="true" name="inv_cache" width="185" />
21 <check_box bottom_delta="-22" follows="left|top" font="SansSerifSmall" height="20"
22 initial_value="false" label="Clear avatar name cache" left_delta="0"
23 mouse_opaque="true" name="name_cache" width="185" />
24 <button bottom_delta="-30" follows="right|top" font="SansSerif" halign="center" height="22"
25 label="OK" left="-170" mouse_opaque="true" name="btn_ok" width="80" />
26 <button bottom_delta="0" follows="right|top" font="SansSerif" halign="center" height="22"
27 label="Cancel" left="-85" mouse_opaque="true" name="btn_cancel" width="80" />
28</floater> \ No newline at end of file
diff --git a/linden/indra/newview/skins/default/xui/en-us/notifications.xml b/linden/indra/newview/skins/default/xui/en-us/notifications.xml
index 4474dad..033b01b 100644
--- a/linden/indra/newview/skins/default/xui/en-us/notifications.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/notifications.xml
@@ -903,13 +903,6 @@ Would you like to disable all popups which can be skipped?
903 903
904<notification 904<notification
905 icon="notify.tga" 905 icon="notify.tga"
906 name="CacheWillClear"
907 type="notify">
908Cache will be cleared after you restart [VIEWER_NAME].
909</notification>
910
911<notification
912 icon="notify.tga"
913 name="CacheWillBeMoved" 906 name="CacheWillBeMoved"
914 type="notify"> 907 type="notify">
915Cache will be moved after you restart [VIEWER_NAME]. 908Cache will be moved after you restart [VIEWER_NAME].