diff options
author | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
commit | 89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch) | |
tree | bcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/newview/llpanelnetwork.cpp | |
parent | Second Life viewer sources 1.13.3.2 (diff) | |
download | meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2 meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz |
Second Life viewer sources 1.14.0.0
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llpanelnetwork.cpp | 93 |
1 files changed, 75 insertions, 18 deletions
diff --git a/linden/indra/newview/llpanelnetwork.cpp b/linden/indra/newview/llpanelnetwork.cpp index c55dacb..ef538ba 100644 --- a/linden/indra/newview/llpanelnetwork.cpp +++ b/linden/indra/newview/llpanelnetwork.cpp | |||
@@ -37,19 +37,25 @@ | |||
37 | 37 | ||
38 | // project includes | 38 | // project includes |
39 | #include "llbutton.h" | 39 | #include "llbutton.h" |
40 | #include "lldirpicker.h" | ||
40 | #include "llui.h" | 41 | #include "llui.h" |
41 | #include "lluictrlfactory.h" | 42 | #include "lluictrlfactory.h" |
42 | #include "llresmgr.h" | 43 | #include "llresmgr.h" |
43 | #include "llsliderctrl.h" | 44 | #include "llsliderctrl.h" |
45 | #include "llspinctrl.h" | ||
46 | #include "llcheckboxctrl.h" | ||
44 | #include "lltextbox.h" | 47 | #include "lltextbox.h" |
45 | #include "llviewerregion.h" | 48 | #include "llviewerregion.h" |
46 | #include "llviewerthrottle.h" | 49 | #include "llviewerthrottle.h" |
47 | #include "llworld.h" | 50 | #include "llworld.h" |
48 | #include "llviewercontrol.h" | 51 | #include "llviewercontrol.h" |
49 | #include "llvieweruictrlfactory.h" | 52 | #include "llvieweruictrlfactory.h" |
50 | #include "llmozlib.h" | ||
51 | #include "llviewerwindow.h" | 53 | #include "llviewerwindow.h" |
52 | 54 | ||
55 | #if LL_LIBXUL_ENABLED | ||
56 | #include "llmozlib.h" | ||
57 | #endif // LL_LIBXUL_ENABLED | ||
58 | |||
53 | 59 | ||
54 | LLPanelNetwork::LLPanelNetwork() | 60 | LLPanelNetwork::LLPanelNetwork() |
55 | { | 61 | { |
@@ -58,22 +64,17 @@ LLPanelNetwork::LLPanelNetwork() | |||
58 | 64 | ||
59 | BOOL LLPanelNetwork::postBuild() | 65 | BOOL LLPanelNetwork::postBuild() |
60 | { | 66 | { |
61 | requires("disk cache", WIDGET_TYPE_RADIO_GROUP); | 67 | LLString cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""); |
62 | requires("max_bandwidth", WIDGET_TYPE_SLIDER); | 68 | childSetText("cache_location", cache_location); |
63 | requires("clear_cache", WIDGET_TYPE_BUTTON); | 69 | |
64 | 70 | childSetAction("clear_cache", onClickClearCache, this); | |
65 | if (!checkRequirements()) | 71 | childSetAction("set_cache", onClickSetCache, this); |
66 | { | 72 | childSetAction("reset_cache", onClickResetCache, this); |
67 | return FALSE; | 73 | |
68 | } | 74 | childSetEnabled("connection_port", |
75 | gSavedSettings.getBOOL("ConnectionPortEnabled")); | ||
76 | childSetCommitCallback("connection_port_enabled", onCommitPort, this); | ||
69 | 77 | ||
70 | // retrieve controls | ||
71 | mDiskCacheRadio = LLUICtrlFactory::getRadioGroupByName(this, "disk cache"); | ||
72 | mCtrlBandwidth = LLUICtrlFactory::getSliderByName(this, "max_bandwidth"); | ||
73 | |||
74 | mClearCacheBtn = LLUICtrlFactory::getButtonByName(this, "clear_cache"); | ||
75 | mClearCacheBtn->setClickedCallback(onClickClearCache); | ||
76 | mClearCacheBtn->setCallbackUserData(this); | ||
77 | 78 | ||
78 | refresh(); | 79 | refresh(); |
79 | 80 | ||
@@ -94,14 +95,18 @@ void LLPanelNetwork::refresh() | |||
94 | { | 95 | { |
95 | LLPanel::refresh(); | 96 | LLPanel::refresh(); |
96 | 97 | ||
97 | mCacheSetting = gSavedSettings.getU32("VFSSize"); | 98 | mCacheSetting = gSavedSettings.getU32("CacheSize"); |
98 | mBandwidthBPS = gSavedSettings.getF32("ThrottleBandwidthKBPS")*1024; | 99 | mBandwidthBPS = gSavedSettings.getF32("ThrottleBandwidthKBPS")*1024; |
100 | mConnectionPortEnabled = gSavedSettings.getBOOL("ConnectionPortEnabled"); | ||
101 | mConnectionPort = gSavedSettings.getU32("ConnectionPort"); | ||
99 | } | 102 | } |
100 | 103 | ||
101 | void LLPanelNetwork::cancel() | 104 | void LLPanelNetwork::cancel() |
102 | { | 105 | { |
103 | gSavedSettings.setU32("VFSSize", mCacheSetting); | 106 | gSavedSettings.setU32("CacheSize", mCacheSetting); |
104 | gSavedSettings.setF32("ThrottleBandwidthKBPS", mBandwidthBPS/1024); | 107 | gSavedSettings.setF32("ThrottleBandwidthKBPS", mBandwidthBPS/1024); |
108 | gSavedSettings.setBOOL("ConnectionPortEnabled", mConnectionPortEnabled); | ||
109 | gSavedSettings.setU32("ConnectionPort", mConnectionPort); | ||
105 | } | 110 | } |
106 | 111 | ||
107 | // static | 112 | // static |
@@ -116,3 +121,55 @@ void LLPanelNetwork::onClickClearCache(void*) | |||
116 | gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE); | 121 | gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE); |
117 | gViewerWindow->alertXml("CacheWillClear"); | 122 | gViewerWindow->alertXml("CacheWillClear"); |
118 | } | 123 | } |
124 | |||
125 | // static | ||
126 | void LLPanelNetwork::onClickSetCache(void* user_data) | ||
127 | { | ||
128 | LLPanelNetwork* self = (LLPanelNetwork*)user_data; | ||
129 | |||
130 | LLString cur_name(gSavedSettings.getString("CacheLocation")); | ||
131 | LLString proposed_name(cur_name); | ||
132 | |||
133 | LLDirPicker& picker = LLDirPicker::instance(); | ||
134 | if (! picker.getDir(&proposed_name ) ) | ||
135 | { | ||
136 | return; //Canceled! | ||
137 | } | ||
138 | |||
139 | LLString dir_name = picker.getDirName(); | ||
140 | if (!dir_name.empty() && dir_name != cur_name) | ||
141 | { | ||
142 | self->childSetText("cache_location", dir_name); | ||
143 | gViewerWindow->alertXml("CacheWillBeMoved"); | ||
144 | gSavedSettings.setString("NewCacheLocation", dir_name); | ||
145 | } | ||
146 | else | ||
147 | { | ||
148 | LLString cache_location = gDirUtilp->getCacheDir(); | ||
149 | self->childSetText("cache_location", cache_location); | ||
150 | } | ||
151 | } | ||
152 | |||
153 | // static | ||
154 | void LLPanelNetwork::onClickResetCache(void* user_data) | ||
155 | { | ||
156 | LLPanelNetwork* self = (LLPanelNetwork*)user_data; | ||
157 | if (!gSavedSettings.getString("CacheLocation").empty()) | ||
158 | { | ||
159 | gSavedSettings.setString("NewCacheLocation", ""); | ||
160 | gViewerWindow->alertXml("CacheWillBeMoved"); | ||
161 | } | ||
162 | LLString cache_location = gDirUtilp->getCacheDir(true); | ||
163 | self->childSetText("cache_location", cache_location); | ||
164 | } | ||
165 | |||
166 | // static | ||
167 | void LLPanelNetwork::onCommitPort(LLUICtrl* ctrl, void* data) | ||
168 | { | ||
169 | LLPanelNetwork* self = (LLPanelNetwork*)data; | ||
170 | LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)ctrl; | ||
171 | |||
172 | if (!self || !check) return; | ||
173 | self->childSetEnabled("connection_port", check->get()); | ||
174 | gViewerWindow->alertXml("ChangeConnectionPort"); | ||
175 | } | ||