Newer
Older
{
//localizing if push2talk button is set to middle mouse
if (MIDDLE_MOUSE_CV == getChild<LLUICtrl>("modifier_combo")->getValue().asString())
getChild<LLUICtrl>("modifier_combo")->setValue(getString("middle_mouse"));
}
}
Paul ProductEngine
committed
//////////////////////PanelSetup ///////////////////
AlexanderP ProductEngine
committed
if (hasChild("max_bandwidth"), TRUE)
Paul ProductEngine
committed
{
mBandWidthUpdater = new LLPanelPreference::Updater(boost::bind(&handleBandwidthChanged, _1), BANDWIDTH_UPDATER_TIMEOUT);
Paul ProductEngine
committed
gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&LLPanelPreference::Updater::update, mBandWidthUpdater, _2));
}
apply();
return true;
Paul ProductEngine
committed
LLPanelPreference::~LLPanelPreference()
{
if (mBandWidthUpdater)
{
delete mBandWidthUpdater;
}
}
void LLPanelPreference::apply()
{
// no-op
}
void LLPanelPreference::saveSettings()
{
// Save the value of all controls in the hierarchy
mSavedValues.clear();
std::list<LLView*> view_stack;
view_stack.push_back(this);
while(!view_stack.empty())
{
// Process view on top of the stack
LLView* curview = view_stack.front();
view_stack.pop_front();
James Cook
committed
LLColorSwatchCtrl* color_swatch = dynamic_cast<LLColorSwatchCtrl *>(curview);
if (color_swatch)
{
mSavedColors[color_swatch->getName()] = color_swatch->get();
}
else
James Cook
committed
LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview);
if (ctrl)
James Cook
committed
LLControlVariable* control = ctrl->getControlVariable();
if (control)
{
mSavedValues[control] = control->getValue();
}
James Cook
committed
// Push children onto the end of the work stack
for (child_list_t::const_iterator iter = curview->getChildList()->begin();
iter != curview->getChildList()->end(); ++iter)
{
view_stack.push_back(*iter);
}
Igor Borovkov
committed
void LLPanelPreference::showFriendsOnlyWarning(LLUICtrl* checkbox, const LLSD& value)
{
if (checkbox && checkbox->getValue())
{
LLNotificationsUtil::add("FriendsAndGroupsOnly");
}
}
Andrew Productengine
committed
void LLPanelPreference::showFavoritesOnLoginWarning(LLUICtrl* checkbox, const LLSD& value)
{
if (checkbox && checkbox->getValue())
{
LLNotificationsUtil::add("FavoritesOnLogin");
}
}
void LLPanelPreference::cancel()
for (control_values_map_t::iterator iter = mSavedValues.begin();
iter != mSavedValues.end(); ++iter)
LLControlVariable* control = iter->first;
LLSD ctrl_value = iter->second;
control->set(ctrl_value);
James Cook
committed
for (string_color_map_t::iterator iter = mSavedColors.begin();
iter != mSavedColors.end(); ++iter)
{
LLColorSwatchCtrl* color_swatch = findChild<LLColorSwatchCtrl>(iter->first);
James Cook
committed
{
color_swatch->set(iter->second);
color_swatch->onCommit();
}
}
void LLPanelPreference::setControlFalse(const LLSD& user_data)
{
std::string control_name = user_data.asString();
LLControlVariable* control = findControl(control_name);
if (control)
control->set(LLSD(FALSE));
paul_productengine
committed
}
void LLPanelPreference::updateMediaAutoPlayCheckbox(LLUICtrl* ctrl)
{
std::string name = ctrl->getName();
// Disable "Allow Media to auto play" only when both
// "Streaming Music" and "Media" are unchecked. STORM-513.
if ((name == "enable_music") || (name == "enable_media"))
{
bool music_enabled = getChild<LLCheckBoxCtrl>("enable_music")->get();
bool media_enabled = getChild<LLCheckBoxCtrl>("enable_media")->get();
getChild<LLCheckBoxCtrl>("media_auto_play_btn")->setEnabled(music_enabled || media_enabled);
}
}
Ychebotarev ProductEngine
committed
void LLPanelPreference::DeletePreset(const LLSD& user_data)
std::string subdirectory = user_data.asString();
LLFloaterReg::showInstance("delete_pref_preset", subdirectory);
void LLPanelPreference::SavePreset(const LLSD& user_data)
std::string subdirectory = user_data.asString();
LLFloaterReg::showInstance("save_pref_preset", subdirectory);
}
void LLPanelPreference::onChangePreset(const LLSD& user_data)
{
std::string subdirectory = user_data.asString();
LLComboBox* combo = getChild<LLComboBox>(subdirectory + "_preset_combo");
std::string name = combo->getSimple();
LLPresetsManager::getInstance()->loadPreset(subdirectory, name);
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
if (instance)
{
instance->refreshEnabledGraphics();
}
}
void LLPanelPreference::setHardwareDefaults()
{
}
Vadim ProductEngine
committed
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
class LLPanelPreferencePrivacy : public LLPanelPreference
{
public:
LLPanelPreferencePrivacy()
{
mAccountIndependentSettings.push_back("VoiceCallsFriendsOnly");
mAccountIndependentSettings.push_back("AutoDisengageMic");
}
/*virtual*/ void saveSettings()
{
LLPanelPreference::saveSettings();
// Don't save (=erase from the saved values map) per-account privacy settings
// if we're not logged in, otherwise they will be reset to defaults on log off.
if (LLStartUp::getStartupState() != STATE_STARTED)
{
// Erase only common settings, assuming there are no color settings on Privacy page.
for (control_values_map_t::iterator it = mSavedValues.begin(); it != mSavedValues.end(); )
{
const std::string setting = it->first->getName();
maksymsproductengine
committed
if (find(mAccountIndependentSettings.begin(),
Vadim ProductEngine
committed
mAccountIndependentSettings.end(), setting) == mAccountIndependentSettings.end())
{
mSavedValues.erase(it++);
}
else
{
++it;
}
}
}
}
private:
std::list<std::string> mAccountIndependentSettings;
};
static LLPanelInjector<LLPanelPreferenceGraphics> t_pref_graph("panel_preference_graphics");
static LLPanelInjector<LLPanelPreferencePrivacy> t_pref_privacy("panel_preference_privacy");
Ychebotarev ProductEngine
committed
BOOL LLPanelPreferenceGraphics::postBuild()
{
// Don't do this on Mac as their braindead GL versioning
// sets this when 8x and 16x are indeed available
//
#if !LL_DARWIN
if (gGLManager.mIsIntel || gGLManager.mGLVersion < 3.f)
{ //remove FSAA settings above "4x"
LLComboBox* combo = getChild<LLComboBox>("fsaa");
combo->remove("8x");
combo->remove("16x");
}
#endif
LLComboBox* combo = getChild<LLComboBox>("graphic_preset_combo");
combo->setLabel(LLTrans::getString("preset_combo_label"));
LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLPanelPreferenceGraphics::onPresetsListChange, this));
return LLPanelPreference::postBuild();
}
void LLPanelPreferenceGraphics::onPresetsListChange()
{
void LLPanelPreferenceGraphics::setPresetNamesInComboBox()
{
LLComboBox* combo = getChild<LLComboBox>("graphic_preset_combo");
EDefaultOptions option = DEFAULT_SHOW;
LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_GRAPHIC, combo, option);
Ychebotarev ProductEngine
committed
}
Ychebotarev ProductEngine
committed
bool LLPanelPreferenceGraphics::hasDirtyChilds()
{
std::list<LLView*> view_stack;
view_stack.push_back(this);
while(!view_stack.empty())
{
// Process view on top of the stack
LLView* curview = view_stack.front();
view_stack.pop_front();
LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview);
if (ctrl)
{
Ychebotarev ProductEngine
committed
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
return true;
}
// Push children onto the end of the work stack
for (child_list_t::const_iterator iter = curview->getChildList()->begin();
iter != curview->getChildList()->end(); ++iter)
{
view_stack.push_back(*iter);
}
}
return false;
}
void LLPanelPreferenceGraphics::resetDirtyChilds()
{
std::list<LLView*> view_stack;
view_stack.push_back(this);
while(!view_stack.empty())
{
// Process view on top of the stack
LLView* curview = view_stack.front();
view_stack.pop_front();
LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview);
if (ctrl)
{
ctrl->resetDirty();
}
// Push children onto the end of the work stack
for (child_list_t::const_iterator iter = curview->getChildList()->begin();
iter != curview->getChildList()->end(); ++iter)
{
view_stack.push_back(*iter);
}
}
}
Ychebotarev ProductEngine
committed
void LLPanelPreferenceGraphics::cancel()
{
resetDirtyChilds();
LLPanelPreference::cancel();
}
void LLPanelPreferenceGraphics::saveSettings()
{
resetDirtyChilds();
LLPanelPreference::saveSettings();
}
void LLPanelPreferenceGraphics::setHardwareDefaults()
{
resetDirtyChilds();
LLPanelPreference::setHardwareDefaults();
}
LLFloaterPreferenceProxy::LLFloaterPreferenceProxy(const LLSD& key)
Logan Dethrow
committed
: LLFloater(key),
mSocksSettingsDirty(false)
Logan Dethrow
committed
mCommitCallbackRegistrar.add("Proxy.OK", boost::bind(&LLFloaterPreferenceProxy::onBtnOk, this));
mCommitCallbackRegistrar.add("Proxy.Cancel", boost::bind(&LLFloaterPreferenceProxy::onBtnCancel, this));
mCommitCallbackRegistrar.add("Proxy.Change", boost::bind(&LLFloaterPreferenceProxy::onChangeSocksSettings, this));
}
LLFloaterPreferenceProxy::~LLFloaterPreferenceProxy()
{
}
BOOL LLFloaterPreferenceProxy::postBuild()
{
Logan Dethrow
committed
LLRadioGroup* socksAuth = getChild<LLRadioGroup>("socks5_auth_type");
if (!socksAuth)
{
return FALSE;
}
if (socksAuth->getSelectedValue().asString() == "None")
Logan Dethrow
committed
{
getChild<LLLineEditor>("socks5_username")->setEnabled(false);
getChild<LLLineEditor>("socks5_password")->setEnabled(false);
}
else
{
// Populate the SOCKS 5 credential fields with protected values.
LLPointer<LLCredential> socks_cred = gSecAPIHandler->loadCredential("SOCKS5");
getChild<LLLineEditor>("socks5_username")->setValue(socks_cred->getIdentifier()["username"].asString());
getChild<LLLineEditor>("socks5_password")->setValue(socks_cred->getAuthenticator()["creds"].asString());
}
Logan Dethrow
committed
return TRUE;
}
void LLFloaterPreferenceProxy::onOpen(const LLSD& key)
{
Logan Dethrow
committed
saveSettings();
}
void LLFloaterPreferenceProxy::onClose(bool app_quitting)
{
Logan Dethrow
committed
{
Logan Dethrow
committed
// If the user plays with the Socks proxy settings after login, it's only fair we let them know
// it will not be updated until next restart.
if (LLStartUp::getStartupState()>STATE_LOGIN_WAIT)
Logan Dethrow
committed
{
LLNotifications::instance().add("ChangeProxySettings", LLSD(), LLSD());
mSocksSettingsDirty = false; // we have notified the user now be quiet again
Logan Dethrow
committed
}
}
}
void LLFloaterPreferenceProxy::saveSettings()
{
Logan Dethrow
committed
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
// Save the value of all controls in the hierarchy
mSavedValues.clear();
std::list<LLView*> view_stack;
view_stack.push_back(this);
while(!view_stack.empty())
{
// Process view on top of the stack
LLView* curview = view_stack.front();
view_stack.pop_front();
LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview);
if (ctrl)
{
LLControlVariable* control = ctrl->getControlVariable();
if (control)
{
mSavedValues[control] = control->getValue();
}
}
// Push children onto the end of the work stack
for (child_list_t::const_iterator iter = curview->getChildList()->begin();
iter != curview->getChildList()->end(); ++iter)
{
view_stack.push_back(*iter);
}
}
}
void LLFloaterPreferenceProxy::onBtnOk()
{
Logan Dethrow
committed
// commit any outstanding text entry
if (hasFocus())
{
LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
if (cur_focus && cur_focus->acceptsTextInput())
{
cur_focus->onCommit();
}
}
// Save SOCKS proxy credentials securely if password auth is enabled
LLRadioGroup* socksAuth = getChild<LLRadioGroup>("socks5_auth_type");
if (socksAuth->getSelectedValue().asString() == "UserPass")
{
LLSD socks_id = LLSD::emptyMap();
socks_id["type"] = "SOCKS5";
socks_id["username"] = getChild<LLLineEditor>("socks5_username")->getValue().asString();
LLSD socks_authenticator = LLSD::emptyMap();
socks_authenticator["type"] = "SOCKS5";
socks_authenticator["creds"] = getChild<LLLineEditor>("socks5_password")->getValue().asString();
// Using "SOCKS5" as the "grid" argument since the same proxy
// settings will be used for all grids and because there is no
// way to specify the type of credential.
LLPointer<LLCredential> socks_cred = gSecAPIHandler->createCredential("SOCKS5", socks_id, socks_authenticator);
gSecAPIHandler->saveCredential(socks_cred, true);
}
else
{
// Clear SOCKS5 credentials since they are no longer needed.
LLPointer<LLCredential> socks_cred = new LLCredential("SOCKS5");
gSecAPIHandler->deleteCredential(socks_cred);
}
Logan Dethrow
committed
closeFloater(false);
}
void LLFloaterPreferenceProxy::onBtnCancel()
{
Logan Dethrow
committed
if (hasFocus())
{
LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
if (cur_focus && cur_focus->acceptsTextInput())
{
cur_focus->onCommit();
}
refresh();
}
cancel();
void LLFloaterPreferenceProxy::cancel()
{
Logan Dethrow
committed
for (control_values_map_t::iterator iter = mSavedValues.begin();
iter != mSavedValues.end(); ++iter)
{
LLControlVariable* control = iter->first;
LLSD ctrl_value = iter->second;
control->set(ctrl_value);
}
closeFloater();
}
void LLFloaterPreferenceProxy::onChangeSocksSettings()
{
Logan Dethrow
committed
mSocksSettingsDirty = true;
Logan Dethrow
committed
LLRadioGroup* socksAuth = getChild<LLRadioGroup>("socks5_auth_type");
if (socksAuth->getSelectedValue().asString() == "None")
Logan Dethrow
committed
{
getChild<LLLineEditor>("socks5_username")->setEnabled(false);
getChild<LLLineEditor>("socks5_password")->setEnabled(false);
}
else
{
getChild<LLLineEditor>("socks5_username")->setEnabled(true);
getChild<LLLineEditor>("socks5_password")->setEnabled(true);
}
// Check for invalid states for the other HTTP proxy radio
Logan Dethrow
committed
LLRadioGroup* otherHttpProxy = getChild<LLRadioGroup>("other_http_proxy_type");
if ((otherHttpProxy->getSelectedValue().asString() == "Socks" &&
Logan Dethrow
committed
getChild<LLCheckBoxCtrl>("socks_proxy_enabled")->get() == FALSE )||(
otherHttpProxy->getSelectedValue().asString() == "Web" &&
getChild<LLCheckBoxCtrl>("web_proxy_enabled")->get() == FALSE ) )
{
otherHttpProxy->selectFirstItem();
}
maksymsproductengine
committed
}