aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/floatercache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/floatercache.cpp')
-rw-r--r--linden/indra/newview/floatercache.cpp97
1 files changed, 97 insertions, 0 deletions
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}