"git@git.alchemyviewer.org:logue/blackdragon.git" did not exist on "1e801c7eeaf6b37b08a647c1b55cb7298e16fce1"
Newer
Older
Melinda Green
committed
* @brief Global preferences with and without persistence.
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
*/
/*
* App-wide preferences. Note that these are not per-user,
* because we need to load many preferences before we have
* a login name.
*/
#include "llviewerprecompiledheaders.h"
#include "llfloaterpreference.h"
#include "message.h"
Oz Linden
committed
#include "llfloaterautoreplacesettings.h"
#include "llagent.h"
#include "llavatarconstants.h"
#include "llcheckboxctrl.h"
James Cook
committed
#include "llcolorswatch.h"
#include "llcombobox.h"
#include "llcommandhandler.h"
#include "lldirpicker.h"
Paul ProductEngine
committed
#include "lleventtimer.h"
#include "llfeaturemanager.h"
#include "llfocusmgr.h"
//#include "llfirstuse.h"
#include "llfloaterreg.h"
#include "llfloaterhardwaresettings.h"
#include "llfloatersidepanelcontainer.h"
Sergey Borushevsky
committed
#include "llimfloater.h"
#include "llkeyboard.h"
#include "llmodaldialog.h"
James Cook
committed
#include "llnavigationbar.h"
#include "llnotifications.h"
#include "llnotificationsutil.h"
#include "llnotificationtemplate.h"
#include "llpanellogin.h"
#include "llpanelvoicedevicesettings.h"
#include "llradiogroup.h"
#include "llsky.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "llsliderctrl.h"
#include "lltabcontainer.h"
#include "lltrans.h"
#include "llviewercamera.h"
#include "llviewermessage.h"
#include "llviewershadermgr.h"
Paul ProductEngine
committed
#include "llviewerthrottle.h"
#include "llvotree.h"
#include "llvosky.h"
prep@lindenlab.com
committed
#include "llfloaterpathfindingconsole.h"
// linden library includes
#include "llavatarnamecache.h"
#include "llerror.h"
#include "llfontgl.h"
#include "llrect.h"
#include "llstring.h"
// project includes
#include "llbutton.h"
#include "llflexibleobject.h"
#include "lllineeditor.h"
#include "llresmgr.h"
#include "llspinctrl.h"
#include "llstartup.h"
#include "lltextbox.h"
#include "llui.h"
#include "llviewerobjectlist.h"
#include "llvoavatar.h"
#include "llvovolume.h"
#include "llwindow.h"
#include "llworld.h"
#include "pipeline.h"
#include "lluictrlfactory.h"
#include "llviewermedia.h"
#include "llpluginclassmedia.h"
Eugene Mutavchi
committed
#include "lllogininstance.h" // to check if logged in yet
Andrew Productengine
committed
#include "llsdserialize.h"
Eugene Mutavchi
committed
const F32 MAX_USER_FAR_CLIP = 512.f;
const F32 MIN_USER_FAR_CLIP = 64.f;
//control value for middle mouse as talk2push button
const static std::string MIDDLE_MOUSE_CV = "MiddleMouse";
class LLVoiceSetKeyDialog : public LLModalDialog
{
public:
LLVoiceSetKeyDialog(const LLSD& key);
~LLVoiceSetKeyDialog();
/*virtual*/ BOOL postBuild();
void setParent(LLFloaterPreference* parent) { mParent = parent; }
BOOL handleKeyHere(KEY key, MASK mask);
static void onCancel(void* user_data);
private:
LLFloaterPreference* mParent;
};
LLVoiceSetKeyDialog::LLVoiceSetKeyDialog(const LLSD& key)
: LLModalDialog(key),
mParent(NULL)
{
}
Christian Goetze
committed
//virtual
BOOL LLVoiceSetKeyDialog::postBuild()
childSetAction("Cancel", onCancel, this);
getChild<LLUICtrl>("Cancel")->setFocus(TRUE);
gFocusMgr.setKeystrokesOnly(TRUE);
LLVoiceSetKeyDialog::~LLVoiceSetKeyDialog()
BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask)
BOOL result = TRUE;
if (key == 'Q' && mask == MASK_CONTROL)
{
result = FALSE;
}
{
mParent->setKey(key);
}
closeFloater();
return result;
}
//static
void LLVoiceSetKeyDialog::onCancel(void* user_data)
{
LLVoiceSetKeyDialog* self = (LLVoiceSetKeyDialog*)user_data;
self->closeFloater();
}
// global functions
// helper functions for getting/freeing the web browser media
// if creating/destroying these is too slow, we'll need to create
// a static member and update all our static callbacks
James Cook
committed
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);
if ( option == 0 ) // YES
Christian Goetze
committed
{
James Cook
committed
// clean web
LLViewerMedia::clearAllCaches();
LLViewerMedia::clearAllCookies();
James Cook
committed
// clean nav bar history
LLNavigationBar::getInstance()->clearHistoryCache();
// flag client texture cache for clearing next time the client runs
gSavedSettings.setBOOL("PurgeCacheOnNextStartup", TRUE);
LLNotificationsUtil::add("CacheWillClear");
LLSearchHistory::getInstance()->clearHistory();
LLSearchHistory::getInstance()->save();
LLSearchComboBox* search_ctrl = LLNavigationBar::getInstance()->getChild<LLSearchComboBox>("search_combo_box");
search_ctrl->clearHistory();
LLTeleportHistoryStorage::getInstance()->purgeItems();
LLTeleportHistoryStorage::getInstance()->save();
Christian Goetze
committed
}
James Cook
committed
return false;
}
Christian Goetze
committed
James Cook
committed
void handleNameTagOptionChanged(const LLSD& newvalue)
{
LLVOAvatar::invalidateNameTags();
James Cook
committed
}
void handleDisplayNamesOptionChanged(const LLSD& newvalue)
{
LLAvatarNameCache::setUseDisplayNames(newvalue.asBoolean());
LLVOAvatar::invalidateNameTags();
/*bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater)
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if (0 == option && floater )
if ( floater )
{
floater->setAllIgnored();
// LLFirstUse::disableFirstUse();
floater->buildPopupLists();
bool callback_reset_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater)
Don Kjer
committed
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if ( 0 == option && floater )
Don Kjer
committed
{
if ( floater )
{
floater->resetAllIgnored();
//LLFirstUse::resetFirstUse();
floater->buildPopupLists();
Don Kjer
committed
}
return false;
}
*/
void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator)
{
numerator = 0;
denominator = 0;
for (F32 test_denominator = 1.f; test_denominator < 30.f; test_denominator += 1.f)
{
if (fmodf((decimal_val * test_denominator) + 0.01f, 1.f) < 0.02f)
{
numerator = llround(decimal_val * test_denominator);
denominator = llround(test_denominator);
break;
}
}
}
// static
std::string LLFloaterPreference::sSkin = "";
//////////////////////////////////////////////
// LLFloaterPreference
LLFloaterPreference::LLFloaterPreference(const LLSD& key)
: LLFloater(key),
mGotPersonalInfo(false),
Andrew Productengine
committed
mOriginalIMViaEmail(false),
Vadim ProductEngine
committed
mLanguageChanged(false),
mClickActionDirty(false)
//Build Floater is now Called from LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>);
static bool registered_dialog = false;
if (!registered_dialog)
{
LLFloaterReg::add("voice_set_key", "floater_select_key.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLVoiceSetKeyDialog>);
registered_dialog = true;
}
mCommitCallbackRegistrar.add("Pref.Apply", boost::bind(&LLFloaterPreference::onBtnApply, this));
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));
James Cook
committed
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));
mCommitCallbackRegistrar.add("Pref.ClickSkin", boost::bind(&LLFloaterPreference::onClickSkin, this,_1, _2));
mCommitCallbackRegistrar.add("Pref.SelectSkin", boost::bind(&LLFloaterPreference::onSelectSkin, this));
mCommitCallbackRegistrar.add("Pref.VoiceSetKey", boost::bind(&LLFloaterPreference::onClickSetKey, this));
mCommitCallbackRegistrar.add("Pref.VoiceSetMiddleMouse", boost::bind(&LLFloaterPreference::onClickSetMiddleMouse, this));
mCommitCallbackRegistrar.add("Pref.SetSounds", boost::bind(&LLFloaterPreference::onClickSetSounds, this));
// mCommitCallbackRegistrar.add("Pref.ClickSkipDialogs", boost::bind(&LLFloaterPreference::onClickSkipDialogs, this));
// mCommitCallbackRegistrar.add("Pref.ClickResetDialogs", boost::bind(&LLFloaterPreference::onClickResetDialogs, this));
mCommitCallbackRegistrar.add("Pref.ClickEnablePopup", boost::bind(&LLFloaterPreference::onClickEnablePopup, this));
James Cook
committed
mCommitCallbackRegistrar.add("Pref.ClickDisablePopup", boost::bind(&LLFloaterPreference::onClickDisablePopup, this));
mCommitCallbackRegistrar.add("Pref.LogPath", boost::bind(&LLFloaterPreference::onClickLogPath, this));
mCommitCallbackRegistrar.add("Pref.HardwareSettings", boost::bind(&LLFloaterPreference::onOpenHardwareSettings, this));
mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this));
mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreference::onVertexShaderEnable, this));
mCommitCallbackRegistrar.add("Pref.WindowedMod", boost::bind(&LLFloaterPreference::onCommitWindowedMode, this));
mCommitCallbackRegistrar.add("Pref.UpdateSliderText", boost::bind(&LLFloaterPreference::onUpdateSliderText,this, _1,_2));
mCommitCallbackRegistrar.add("Pref.QualityPerformance", boost::bind(&LLFloaterPreference::onChangeQuality, this, _2));
mCommitCallbackRegistrar.add("Pref.applyUIColor", boost::bind(&LLFloaterPreference::applyUIColor, this ,_1, _2));
mCommitCallbackRegistrar.add("Pref.getUIColor", boost::bind(&LLFloaterPreference::getUIColor, this ,_1, _2));
mCommitCallbackRegistrar.add("Pref.MaturitySettings", boost::bind(&LLFloaterPreference::onChangeMaturity, this));
mCommitCallbackRegistrar.add("Pref.BlockList", boost::bind(&LLFloaterPreference::onClickBlockList, this));
mCommitCallbackRegistrar.add("Pref.Proxy", boost::bind(&LLFloaterPreference::onClickProxySettings, this));
mCommitCallbackRegistrar.add("Pref.TranslationSettings", boost::bind(&LLFloaterPreference::onClickTranslationSettings, this));
Oz Linden
committed
mCommitCallbackRegistrar.add("Pref.AutoReplace", boost::bind(&LLFloaterPreference::onClickAutoReplace, this));
Kitty Barnett
committed
mCommitCallbackRegistrar.add("Pref.SpellChecker", boost::bind(&LLFloaterPreference::onClickSpellChecker, this));
sSkin = gSavedSettings.getString("SkinCurrent");
Vadim ProductEngine
committed
mCommitCallbackRegistrar.add("Pref.ClickActionChange", boost::bind(&LLFloaterPreference::onClickActionChange, this));
gSavedSettings.getControl("NameTagShowUsernames")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2));
gSavedSettings.getControl("NameTagShowFriends")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2));
gSavedSettings.getControl("UseDisplayNames")->getCommitSignal()->connect(boost::bind(&handleDisplayNamesOptionChanged, _2));
LLAvatarPropertiesProcessor::getInstance()->addObserver( gAgent.getID(), this );
void LLFloaterPreference::processProperties( void* pData, EAvatarProcessorType type )
{
if ( APT_PROPERTIES == type )
{
const LLAvatarData* pAvatarData = static_cast<const LLAvatarData*>( pData );
Leslie Linden
committed
if (pAvatarData && (gAgent.getID() == pAvatarData->avatar_id) && (pAvatarData->avatar_id != LLUUID::null))
{
storeAvatarProperties( pAvatarData );
processProfileProperties( pAvatarData );
}
}
}
void LLFloaterPreference::storeAvatarProperties( const LLAvatarData* pAvatarData )
{
Leslie Linden
committed
if (LLStartUp::getStartupState() == STATE_STARTED)
Leslie Linden
committed
mAvatarProperties.avatar_id = pAvatarData->avatar_id;
mAvatarProperties.image_id = pAvatarData->image_id;
mAvatarProperties.fl_image_id = pAvatarData->fl_image_id;
mAvatarProperties.about_text = pAvatarData->about_text;
mAvatarProperties.fl_about_text = pAvatarData->fl_about_text;
mAvatarProperties.profile_url = pAvatarData->profile_url;
mAvatarProperties.flags = pAvatarData->flags;
mAvatarProperties.allow_publish = pAvatarData->flags & AVATAR_ALLOW_PUBLISH;
mAvatarDataInitialized = true;
}
}
void LLFloaterPreference::processProfileProperties(const LLAvatarData* pAvatarData )
{
getChild<LLUICtrl>("online_searchresults")->setValue( (bool)(pAvatarData->flags & AVATAR_ALLOW_PUBLISH) );
void LLFloaterPreference::saveAvatarProperties( void )
{
Leslie Linden
committed
const BOOL allowPublish = getChild<LLUICtrl>("online_searchresults")->getValue();
if (allowPublish)
Leslie Linden
committed
//
// NOTE: We really don't want to send the avatar properties unless we absolutely
// need to so we can avoid the accidental profile reset bug, so, if we're
// logged in, the avatar data has been initialized and we have a state change
// for the "allow publish" flag, then set the flag to its new value and send
// the properties update.
//
// NOTE: The only reason we can not remove this update altogether is because of the
// "allow publish" flag, the last remaining profile setting in the viewer
// that doesn't exist in the web profile.
//
if ((LLStartUp::getStartupState() == STATE_STARTED) && mAvatarDataInitialized && (allowPublish != mAvatarProperties.allow_publish))
Leslie Linden
committed
mAvatarProperties.allow_publish = allowPublish;
LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesUpdate( &mAvatarProperties );
}
}
BOOL LLFloaterPreference::postBuild()
{
Sergey Borushevsky
committed
gSavedSettings.getControl("PlainTextChatHistory")->getSignal()->connect(boost::bind(&LLIMFloater::processChatHistoryStyleUpdate, _2));
Yuri Chebotarev
committed
gSavedSettings.getControl("PlainTextChatHistory")->getSignal()->connect(boost::bind(&LLNearbyChat::processChatHistoryStyleUpdate, _2));
Sergey Borushevsky
committed
Eugene Mutavchi
committed
gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLIMFloater::processChatHistoryStyleUpdate, _2));
gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLNearbyChat::processChatHistoryStyleUpdate, _2));
Vadim ProductEngine
committed
gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLViewerChat::signalChatFontChanged));
Seth ProductEngine
committed
gSavedSettings.getControl("ChatBubbleOpacity")->getSignal()->connect(boost::bind(&LLFloaterPreference::onNameTagOpacityChange, this, _2));
Todd Stinson
committed
gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeMaturity, this));
LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
if (!tabcontainer->selectTab(gSavedSettings.getS32("LastPrefTab")))
tabcontainer->selectFirstTab();
Leyla Farazha
committed
Vadim ProductEngine
committed
getChild<LLUICtrl>("cache_location")->setEnabled(FALSE); // make it read-only but selectable (STORM-227)
std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "");
Vadim ProductEngine
committed
setCacheLocation(cache_location);
Leyla Farazha
committed
Vadim ProductEngine
committed
getChild<LLComboBox>("language_combobox")->setCommitCallback(boost::bind(&LLFloaterPreference::onLanguageChange, this));
Andrew Dyukov
committed
// if floater is opened before login set default localized busy message
if (LLStartUp::getStartupState() < STATE_STARTED)
{
gSavedPerAccountSettings.setString("BusyModeResponse", LLTrans::getString("BusyModeResponseDefault"));
}
return TRUE;
}
Andrew Dyukov
committed
void LLFloaterPreference::onBusyResponseChanged()
{
// set "BusyResponseChanged" TRUE if user edited message differs from default, FALSE otherwise
if (LLTrans::getString("BusyModeResponseDefault") != getChild<LLUICtrl>("busy_response")->getValue().asString())
Andrew Dyukov
committed
{
gSavedPerAccountSettings.setBOOL("BusyResponseChanged", TRUE );
}
else
{
gSavedPerAccountSettings.setBOOL("BusyResponseChanged", FALSE );
}
}
LLFloaterPreference::~LLFloaterPreference()
{
// clean up user data
LLComboBox* ctrl_window_size = getChild<LLComboBox>("windowsize combo");
for (S32 i = 0; i < ctrl_window_size->getItemCount(); i++)
{
ctrl_window_size->setCurrentByIndex(i);
}
void LLFloaterPreference::draw()
{
BOOL has_first_selected = (getChildRef<LLScrollListCtrl>("disabled_popups").getFirstSelected()!=NULL);
gSavedSettings.setBOOL("FirstSelectedDisabledPopups", has_first_selected);
James Cook
committed
has_first_selected = (getChildRef<LLScrollListCtrl>("enabled_popups").getFirstSelected()!=NULL);
gSavedSettings.setBOOL("FirstSelectedEnabledPopups", has_first_selected);
LLFloater::draw();
}
void LLFloaterPreference::saveSettings()
{
LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
child_list_t::const_iterator iter = tabcontainer->getChildList()->begin();
child_list_t::const_iterator end = tabcontainer->getChildList()->end();
for ( ; iter != end; ++iter)
{
LLView* view = *iter;
LLPanelPreference* panel = dynamic_cast<LLPanelPreference*>(view);
if (panel)
panel->saveSettings();
}
}
void LLFloaterPreference::apply()
{
LLAvatarPropertiesProcessor::getInstance()->addObserver( gAgent.getID(), this );
LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
if (sSkin != gSavedSettings.getString("SkinCurrent"))
Don Kjer
committed
{
LLNotificationsUtil::add("ChangeSkin");
refreshSkin(this);
Don Kjer
committed
}
// Call apply() on all panels that derive from LLPanelPreference
for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin();
iter != tabcontainer->getChildList()->end(); ++iter)
Don Kjer
committed
{
LLView* view = *iter;
LLPanelPreference* panel = dynamic_cast<LLPanelPreference*>(view);
if (panel)
panel->apply();
Don Kjer
committed
}
// hardware menu apply
LLFloaterHardwareSettings* hardware_settings = LLFloaterReg::getTypedInstance<LLFloaterHardwareSettings>("prefs_hardware_settings");
if (hardware_settings)
{
hardware_settings->apply();
}
gViewerWindow->requestResolutionUpdate(); // for UIScaleFactor
LLSliderCtrl* fov_slider = getChild<LLSliderCtrl>("camera_fov");
fov_slider->setMinValue(LLViewerCamera::getInstance()->getMinView());
fov_slider->setMaxValue(LLViewerCamera::getInstance()->getMaxView());
std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "");
Vadim ProductEngine
committed
setCacheLocation(cache_location);
LLViewerMedia::setCookiesEnabled(getChild<LLUICtrl>("cookies_enabled")->getValue());
if (hasChild("web_proxy_enabled") &&hasChild("web_proxy_editor") && hasChild("web_proxy_port"))
Don Kjer
committed
{
bool proxy_enable = getChild<LLUICtrl>("web_proxy_enabled")->getValue();
std::string proxy_address = getChild<LLUICtrl>("web_proxy_editor")->getValue();
int proxy_port = getChild<LLUICtrl>("web_proxy_port")->getValue();
LLViewerMedia::setProxyConfig(proxy_enable, proxy_address, proxy_port);
Don Kjer
committed
}
// LLWString busy_response = utf8str_to_wstring(getChild<LLUICtrl>("busy_response")->getValue().asString());
// LLWStringUtil::replaceTabsWithSpaces(busy_response, 4);
Sergey Borushevsky
committed
gSavedSettings.setBOOL("PlainTextChatHistory", getChild<LLUICtrl>("plain_text_chat_history")->getValue().asBoolean());
// gSavedSettings.setString("BusyModeResponse2", std::string(wstring_to_utf8str(busy_response)));
bool new_im_via_email = getChild<LLUICtrl>("send_im_to_email")->getValue().asBoolean();
bool new_hide_online = getChild<LLUICtrl>("online_visibility")->getValue().asBoolean();
if ((new_im_via_email != mOriginalIMViaEmail)
||(new_hide_online != mOriginalHideOnlineStatus))
{
// This hack is because we are representing several different
// possible strings with a single checkbox. Since most users
// can only select between 2 values, we represent it as a
// checkbox. This breaks down a little bit for liaisons, but
// works out in the end.
if (new_hide_online != mOriginalHideOnlineStatus)
{
if (new_hide_online) mDirectoryVisibility = VISIBILITY_HIDDEN;
else mDirectoryVisibility = VISIBILITY_DEFAULT;
//Update showonline value, otherwise multiple applys won't work
mOriginalHideOnlineStatus = new_hide_online;
gAgent.sendAgentUpdateUserInfo(new_im_via_email,mDirectoryVisibility);
}
}
Andrew Productengine
committed
saveAvatarProperties();
Andrew Productengine
committed
if (mClickActionDirty)
Andrew Productengine
committed
{
updateClickActionSettings();
mClickActionDirty = false;
Andrew Productengine
committed
}
}
void LLFloaterPreference::cancel()
{
LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
// Call cancel() on all panels that derive from LLPanelPreference
for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin();
iter != tabcontainer->getChildList()->end(); ++iter)
Don Kjer
committed
{
LLView* view = *iter;
LLPanelPreference* panel = dynamic_cast<LLPanelPreference*>(view);
if (panel)
panel->cancel();
Don Kjer
committed
}
// hide joystick pref floater
LLFloaterReg::hideInstance("pref_joystick");
// hide translation settings floater
LLFloaterReg::hideInstance("prefs_translation");
Oz Linden
committed
// hide translation settings floater
LLFloaterReg::hideInstance("prefs_autoreplace");
// cancel hardware menu
LLFloaterHardwareSettings* hardware_settings = LLFloaterReg::getTypedInstance<LLFloaterHardwareSettings>("prefs_hardware_settings");
if (hardware_settings)
{
hardware_settings->cancel();
}
// reverts any changes to current skin
gSavedSettings.setString("SkinCurrent", sSkin);
Andrew Productengine
committed
if (mClickActionDirty)
Andrew Productengine
committed
{
updateClickActionControls();
mClickActionDirty = false;
Andrew Productengine
committed
}
LLFloaterPreferenceProxy * advanced_proxy_settings = LLFloaterReg::findTypedInstance<LLFloaterPreferenceProxy>("prefs_proxy");
if (advanced_proxy_settings)
advanced_proxy_settings->cancel();
prep@lindenlab.com
committed
//Need to reload the navmesh if the pathing console is up
LLHandle<LLFloaterPathfindingConsole> pathfindingConsoleHandle = LLFloaterPathfindingConsole::getInstanceHandle();
if ( !pathfindingConsoleHandle.isDead() )
{
LLFloaterPathfindingConsole* pPathfindingConsole = pathfindingConsoleHandle.get();
pPathfindingConsole->onRegionBoundaryCross();
}
}
void LLFloaterPreference::onOpen(const LLSD& key)
{
Andrew Dyukov
committed
// this variable and if that follows it are used to properly handle busy mode response message
static bool initialized = FALSE;
// if user is logged in and we haven't initialized busy_response yet, do it
if (!initialized && LLStartUp::getStartupState() == STATE_STARTED)
{
// Special approach is used for busy response localization, because "BusyModeResponse" is
// in non-localizable xml, and also because it may be changed by user and in this case it shouldn't be localized.
// To keep track of whether busy response is default or changed by user additional setting BusyResponseChanged
// was added into per account settings.
// initialization should happen once,so setting variable to TRUE
initialized = TRUE;
// this connection is needed to properly set "BusyResponseChanged" setting when user makes changes in
// busy response message.
gSavedPerAccountSettings.getControl("BusyModeResponse")->getSignal()->connect(boost::bind(&LLFloaterPreference::onBusyResponseChanged, this));
}
gAgent.sendAgentUserInfoRequest();
/////////////////////////// From LLPanelGeneral //////////////////////////
// if we have no agent, we can't let them choose anything
// if we have an agent, then we only let them choose if they have a choice
bool can_choose_maturity =
gAgent.getID().notNull() &&
(gAgent.isMature() || gAgent.isGodlike());
LLComboBox* maturity_combo = getChild<LLComboBox>("maturity_desired_combobox");
LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest( gAgent.getID() );
if (can_choose_maturity)
{
// if they're not adult or a god, they shouldn't see the adult selection, so delete it
Sergei Litovchuk
committed
if (!gAgent.isAdult() && !gAgent.isGodlikeWithoutAdminMenuFakery())
{
Vadim Savchuk
committed
// we're going to remove the adult entry from the combo
LLScrollListCtrl* maturity_list = maturity_combo->findChild<LLScrollListCtrl>("ComboBox");
if (maturity_list)
{
maturity_list->deleteItems(LLSD(SIM_ACCESS_ADULT));
}
}
getChildView("maturity_desired_combobox")->setVisible( true);
getChildView("maturity_desired_textbox")->setVisible( false);
}
else
{
getChild<LLUICtrl>("maturity_desired_textbox")->setValue(maturity_combo->getSelectedItemLabel());
getChildView("maturity_desired_combobox")->setVisible( false);
}
Vadim ProductEngine
committed
// Forget previous language changes.
mLanguageChanged = false;
// Display selected maturity icons.
onChangeMaturity();
// Load (double-)click to walk/teleport settings.
updateClickActionControls();
// Enabled/disabled popups, might have been changed by user actions
// while preferences floater was closed.
buildPopupLists();
LLPanelLogin::setAlwaysRefresh(true);
James Cook
committed
refresh();
// Make sure the current state of prefs are saved away when
// when the floater is opened. That will make cancel do its
// job
saveSettings();
}
void LLFloaterPreference::onVertexShaderEnable()
{
refreshEnabledGraphics();
}
Andrew Dyukov
committed
//static
void LLFloaterPreference::initBusyResponse()
{
if (!gSavedPerAccountSettings.getBOOL("BusyResponseChanged"))
{
//LLTrans::getString("BusyModeResponseDefault") is used here for localization (EXT-5885)
gSavedPerAccountSettings.setString("BusyModeResponse", LLTrans::getString("BusyModeResponseDefault"));
}
}
void LLFloaterPreference::setHardwareDefaults()
{
LLFeatureManager::getInstance()->applyRecommendedSettings();
refreshEnabledGraphics();
Ychebotarev ProductEngine
committed
LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
child_list_t::const_iterator iter = tabcontainer->getChildList()->begin();
child_list_t::const_iterator end = tabcontainer->getChildList()->end();
for ( ; iter != end; ++iter)
{
LLView* view = *iter;
LLPanelPreference* panel = dynamic_cast<LLPanelPreference*>(view);
if (panel)
panel->setHardwareDefaults();
}
//virtual
void LLFloaterPreference::onClose(bool app_quitting)
{
gSavedSettings.setS32("LastPrefTab", getChild<LLTabContainer>("pref core")->getCurrentPanelIndex());
LLPanelLogin::setAlwaysRefresh(false);
void LLFloaterPreference::onOpenHardwareSettings()
{
LLFloater* floater = LLFloaterReg::showInstance("prefs_hardware_settings");
addDependentFloater(floater, FALSE);
}
// static
void LLFloaterPreference::onBtnOK()
{
// commit any outstanding text entry
if (hasFocus())
Don Kjer
committed
{
LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
{
cur_focus->onCommit();
}
Don Kjer
committed
}
if (canClose())
saveSettings();
apply();
closeFloater(false);
Dmitry Zaporozhan
committed
James Cook
committed
LLUIColorTable::instance().saveUserSettings();
Aaron Stone
committed
gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE);
// Show beep, pop up dialog, etc.
llinfos << "Can't close preferences!" << llendl;
prep@lindenlab.com
committed
LLPanelLogin::updateLocationSelectorsVisibility();
//Need to reload the navmesh if the pathing console is up
LLHandle<LLFloaterPathfindingConsole> pathfindingConsoleHandle = LLFloaterPathfindingConsole::getInstanceHandle();
if ( !pathfindingConsoleHandle.isDead() )
{
LLFloaterPathfindingConsole* pPathfindingConsole = pathfindingConsoleHandle.get();
pPathfindingConsole->onRegionBoundaryCross();
}
Don Kjer
committed
}
// static
void LLFloaterPreference::onBtnApply( )
if (hasFocus())
{
LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
{
cur_focus->onCommit();
}
}
apply();
saveSettings();
LLPanelLogin::updateLocationSelectorsVisibility();
// static
void LLFloaterPreference::onBtnCancel()
{
if (hasFocus())
Christian Goetze
committed
{
LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
{
cur_focus->onCommit();
}
James Cook
committed
refresh();
Christian Goetze
committed
}
cancel();
closeFloater();
// static
void LLFloaterPreference::updateUserInfo(const std::string& visibility, bool im_via_email, const std::string& email)
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
Christian Goetze
committed
{
instance->setPersonalInfo(visibility, im_via_email, email);
Christian Goetze
committed
}
void LLFloaterPreference::refreshEnabledGraphics()
{
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
instance->refresh();
//instance->refreshEnabledState();
LLFloaterHardwareSettings* hardware_settings = LLFloaterReg::getTypedInstance<LLFloaterHardwareSettings>("prefs_hardware_settings");
if (hardware_settings)
{
hardware_settings->refreshEnabledState();
}
void LLFloaterPreference::onClickClearCache()
{
LLNotificationsUtil::add("ConfirmClearCache", LLSD(), LLSD(), callback_clear_cache);
}
James Cook
committed
void LLFloaterPreference::onClickBrowserClearCache()
LLNotificationsUtil::add("ConfirmClearBrowserCache", LLSD(), LLSD(), callback_clear_browser_cache);
Vadim ProductEngine
committed
// Called when user changes language via the combobox.
void LLFloaterPreference::onLanguageChange()
{
// Let the user know that the change will only take effect after restart.
// Do it only once so that we're not too irritating.
if (!mLanguageChanged)
{
LLNotificationsUtil::add("ChangeLanguage");
mLanguageChanged = true;
}
}
Seth ProductEngine
committed
void LLFloaterPreference::onNameTagOpacityChange(const LLSD& newvalue)
{
LLColorSwatchCtrl* color_swatch = findChild<LLColorSwatchCtrl>("background");
if (color_swatch)
{
LLColor4 new_color = color_swatch->get();
color_swatch->set( new_color.setAlpha(newvalue.asReal()) );
}
}
void LLFloaterPreference::onClickSetCache()
std::string cur_name(gSavedSettings.getString("CacheLocation"));
James Cook
committed
// std::string cur_top_folder(gDirUtilp->getBaseFileName(cur_name));
std::string proposed_name(cur_name);
LLDirPicker& picker = LLDirPicker::instance();
if (! picker.getDir(&proposed_name ) )
return; //Canceled!
std::string dir_name = picker.getDirName();
if (!dir_name.empty() && dir_name != cur_name)
{
James Cook
committed
std::string new_top_folder(gDirUtilp->getBaseFileName(dir_name));
LLNotificationsUtil::add("CacheWillBeMoved");
gSavedSettings.setString("NewCacheLocation", dir_name);
James Cook
committed
gSavedSettings.setString("NewCacheLocationTopFolder", new_top_folder);
}
else
{
std::string cache_location = gDirUtilp->getCacheDir();
James Cook
committed
gSavedSettings.setString("CacheLocation", cache_location);
std::string top_folder(gDirUtilp->getBaseFileName(cache_location));
gSavedSettings.setString("CacheLocationTopFolder", top_folder);
void LLFloaterPreference::onClickResetCache()
Logan Dethrow
committed
if (gDirUtilp->getCacheDir(false) == gDirUtilp->getCacheDir(true))
Logan Dethrow
committed
// The cache location was already the default.
return;
Logan Dethrow
committed
gSavedSettings.setString("NewCacheLocation", "");
gSavedSettings.setString("NewCacheLocationTopFolder", "");
LLNotificationsUtil::add("CacheWillBeMoved");
Logan Dethrow
committed
std::string cache_location = gDirUtilp->getCacheDir(false);
James Cook
committed
gSavedSettings.setString("CacheLocation", cache_location);
std::string top_folder(gDirUtilp->getBaseFileName(cache_location));
gSavedSettings.setString("CacheLocationTopFolder", top_folder);
void LLFloaterPreference::onClickSkin(LLUICtrl* ctrl, const LLSD& userdata)
gSavedSettings.setString("SkinCurrent", userdata.asString());
ctrl->setValue(userdata.asString());
void LLFloaterPreference::onSelectSkin()
std::string skin_selection = getChild<LLRadioGroup>("skin_selection")->getValue().asString();
gSavedSettings.setString("SkinCurrent", skin_selection);
void LLFloaterPreference::refreshSkin(void* data)
{
LLPanel*self = (LLPanel*)data;
sSkin = gSavedSettings.getString("SkinCurrent");
self->getChild<LLRadioGroup>("skin_selection", true)->setValue(sSkin);
}
void LLFloaterPreference::buildPopupLists()
LLScrollListCtrl& disabled_popups =
getChildRef<LLScrollListCtrl>("disabled_popups");
LLScrollListCtrl& enabled_popups =
getChildRef<LLScrollListCtrl>("enabled_popups");
disabled_popups.deleteAllItems();
enabled_popups.deleteAllItems();
for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin();
iter != LLNotifications::instance().templatesEnd();
++iter)
LLNotificationTemplatePtr templatep = iter->second;
LLNotificationFormPtr formp = templatep->mForm;
LLNotificationForm::EIgnoreType ignore = formp->getIgnoreType();
if (ignore == LLNotificationForm::IGNORE_NO)
continue;
LLSD row;
row["columns"][0]["value"] = formp->getIgnoreMessage();
row["columns"][0]["font"] = "SANSSERIF_SMALL";
row["columns"][0]["width"] = 400;
LLScrollListItem* item = NULL;
bool show_popup = !formp->getIgnored();
if (!show_popup)
{
if (ignore == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE)
{
LLSD last_response = LLUI::sSettingGroups["config"]->getLLSD("Default" + templatep->mName);
if (!last_response.isUndefined())
{
for (LLSD::map_const_iterator it = last_response.beginMap();
it != last_response.endMap();
++it)
{
if (it->second.asBoolean())
{
row["columns"][1]["value"] = formp->getElement(it->first)["ignore"].asString();
break;
}
}
}
row["columns"][1]["font"] = "SANSSERIF_SMALL";
row["columns"][1]["width"] = 360;
}
Richard Nelson
committed
item = disabled_popups.addElement(row);
}
else
{
Richard Nelson
committed
item = enabled_popups.addElement(row);
}
if (item)
{
item->setUserdata((void*)&iter->first);
}
void LLFloaterPreference::refreshEnabledState()
LLComboBox* ctrl_reflections = getChild<LLComboBox>("Reflections");
LLRadioGroup* radio_reflection_detail = getChild<LLRadioGroup>("ReflectionDetailRadio");
// Reflections
BOOL reflections = gSavedSettings.getBOOL("VertexShaderEnable")
&& gGLManager.mHasCubeMap
&& LLCubeMap::sUseCubeMaps;
ctrl_reflections->setEnabled(reflections);
// Bump & Shiny
bool bumpshiny = gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump");
getChild<LLCheckBoxCtrl>("BumpShiny")->setEnabled(bumpshiny ? TRUE : FALSE);
radio_reflection_detail->setEnabled(reflections);
// Avatar Mode
// Enable Avatar Shaders
LLCheckBoxCtrl* ctrl_avatar_vp = getChild<LLCheckBoxCtrl>("AvatarVertexProgram");
// Avatar Render Mode
LLCheckBoxCtrl* ctrl_avatar_cloth = getChild<LLCheckBoxCtrl>("AvatarCloth");
bool avatar_vp_enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarVP");
if (LLViewerShaderMgr::sInitialized)
{
S32 max_avatar_shader = LLViewerShaderMgr::instance()->mMaxAvatarShaderLevel;
avatar_vp_enabled = (max_avatar_shader > 0) ? TRUE : FALSE;
}
ctrl_avatar_vp->setEnabled(avatar_vp_enabled);
if (gSavedSettings.getBOOL("VertexShaderEnable") == FALSE ||
gSavedSettings.getBOOL("RenderAvatarVP") == FALSE)
{
ctrl_avatar_cloth->setEnabled(false);
}
else
{
ctrl_avatar_cloth->setEnabled(true);
}
// Vertex Shaders
// Global Shader Enable
LLCheckBoxCtrl* ctrl_shader_enable = getChild<LLCheckBoxCtrl>("BasicShaders");
// radio set for terrain detail mode
LLRadioGroup* mRadioTerrainDetail = getChild<LLRadioGroup>("TerrainDetailRadio"); // can be linked with control var
ctrl_shader_enable->setEnabled(LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable"));
BOOL shaders = ctrl_shader_enable->get();
if (shaders)
{
mRadioTerrainDetail->setValue(1);
mRadioTerrainDetail->setEnabled(FALSE);
}
else
{
mRadioTerrainDetail->setEnabled(TRUE);
}
// WindLight
LLCheckBoxCtrl* ctrl_wind_light = getChild<LLCheckBoxCtrl>("WindLightUseAtmosShaders");
// *HACK just checks to see if we can use shaders...
// maybe some cards that use shaders, but don't support windlight
ctrl_wind_light->setEnabled(ctrl_shader_enable->getEnabled() && shaders);
//Deferred/SSAO/Shadows
LLCheckBoxCtrl* ctrl_deferred = getChild<LLCheckBoxCtrl>("UseLightShaders");
leyla_linden
committed
leyla_linden
committed
BOOL enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") &&
shaders &&
gGLManager.mHasFramebufferObject &&
gSavedSettings.getBOOL("RenderAvatarVP") &&
(ctrl_wind_light->get()) ? TRUE : FALSE;
leyla_linden
committed
ctrl_deferred->setEnabled(enabled);
leyla_linden
committed
LLCheckBoxCtrl* ctrl_ssao = getChild<LLCheckBoxCtrl>("UseSSAO");
LLCheckBoxCtrl* ctrl_dof = getChild<LLCheckBoxCtrl>("UseDoF");
leyla_linden
committed
LLComboBox* ctrl_shadow = getChild<LLComboBox>("ShadowDetail");
leyla_linden
committed
enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO") && (ctrl_deferred->get() ? TRUE : FALSE);
leyla_linden
committed
ctrl_ssao->setEnabled(enabled);
ctrl_dof->setEnabled(enabled);
leyla_linden
committed
enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderShadowDetail");
leyla_linden
committed
ctrl_shadow->setEnabled(enabled);
// now turn off any features that are unavailable
disableUnavailableSettings();
Eugene Mutavchi
committed
getChildView("block_list")->setEnabled(LLLoginInstance::getInstance()->authSuccess());
}
void LLFloaterPreference::disableUnavailableSettings()
{
LLComboBox* ctrl_reflections = getChild<LLComboBox>("Reflections");
LLCheckBoxCtrl* ctrl_avatar_vp = getChild<LLCheckBoxCtrl>("AvatarVertexProgram");
LLCheckBoxCtrl* ctrl_avatar_cloth = getChild<LLCheckBoxCtrl>("AvatarCloth");
LLCheckBoxCtrl* ctrl_shader_enable = getChild<LLCheckBoxCtrl>("BasicShaders");
LLCheckBoxCtrl* ctrl_wind_light = getChild<LLCheckBoxCtrl>("WindLightUseAtmosShaders");
LLCheckBoxCtrl* ctrl_avatar_impostors = getChild<LLCheckBoxCtrl>("AvatarImpostors");
LLCheckBoxCtrl* ctrl_deferred = getChild<LLCheckBoxCtrl>("UseLightShaders");
LLComboBox* ctrl_shadows = getChild<LLComboBox>("ShadowDetail");
LLCheckBoxCtrl* ctrl_ssao = getChild<LLCheckBoxCtrl>("UseSSAO");
LLCheckBoxCtrl* ctrl_dof = getChild<LLCheckBoxCtrl>("UseDoF");
// if vertex shaders off, disable all shader related products
if (!LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable"))
{
ctrl_shader_enable->setEnabled(FALSE);
ctrl_shader_enable->setValue(FALSE);
ctrl_wind_light->setEnabled(FALSE);
ctrl_wind_light->setValue(FALSE);
ctrl_reflections->setEnabled(FALSE);
ctrl_avatar_vp->setEnabled(FALSE);
ctrl_avatar_vp->setValue(FALSE);
ctrl_avatar_cloth->setEnabled(FALSE);
ctrl_avatar_cloth->setValue(FALSE);
ctrl_shadows->setEnabled(FALSE);
ctrl_shadows->setValue(0);
ctrl_ssao->setEnabled(FALSE);
ctrl_ssao->setValue(FALSE);
ctrl_dof->setEnabled(FALSE);
ctrl_dof->setValue(FALSE);
ctrl_deferred->setEnabled(FALSE);
ctrl_deferred->setValue(FALSE);
}
// disabled windlight
if (!LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders"))
{
ctrl_wind_light->setEnabled(FALSE);
ctrl_wind_light->setValue(FALSE);
//deferred needs windlight, disable deferred
ctrl_shadows->setEnabled(FALSE);
ctrl_shadows->setValue(0);
ctrl_ssao->setEnabled(FALSE);
ctrl_ssao->setValue(FALSE);
ctrl_dof->setEnabled(FALSE);
ctrl_dof->setValue(FALSE);
ctrl_deferred->setEnabled(FALSE);
ctrl_deferred->setValue(FALSE);
}
// disabled deferred
leyla_linden
committed
if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") ||
!gGLManager.mHasFramebufferObject)
{
ctrl_shadows->setEnabled(FALSE);
ctrl_shadows->setValue(0);
ctrl_ssao->setEnabled(FALSE);
ctrl_ssao->setValue(FALSE);
ctrl_dof->setEnabled(FALSE);
ctrl_dof->setValue(FALSE);
ctrl_deferred->setEnabled(FALSE);
ctrl_deferred->setValue(FALSE);
}
// disabled deferred SSAO
if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO"))
{
ctrl_ssao->setEnabled(FALSE);
ctrl_ssao->setValue(FALSE);
if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderShadowDetail"))
{
ctrl_shadows->setEnabled(FALSE);
ctrl_shadows->setValue(0);
}
// disabled reflections
if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderReflectionDetail"))
{
ctrl_reflections->setEnabled(FALSE);
ctrl_reflections->setValue(FALSE);
}
// disabled av
if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarVP"))
{
ctrl_avatar_vp->setEnabled(FALSE);
ctrl_avatar_vp->setValue(FALSE);
ctrl_avatar_cloth->setEnabled(FALSE);
ctrl_avatar_cloth->setValue(FALSE);
//deferred needs AvatarVP, disable deferred
ctrl_shadows->setEnabled(FALSE);
ctrl_shadows->setValue(0);
ctrl_ssao->setEnabled(FALSE);
ctrl_ssao->setValue(FALSE);
ctrl_dof->setEnabled(FALSE);
ctrl_dof->setValue(FALSE);
ctrl_deferred->setEnabled(FALSE);
ctrl_deferred->setValue(FALSE);
// disabled cloth
if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderAvatarCloth"))
{
ctrl_avatar_cloth->setEnabled(FALSE);
ctrl_avatar_cloth->setValue(FALSE);
}
// disabled impostors
if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderUseImpostors"))
{
ctrl_avatar_impostors->setEnabled(FALSE);
ctrl_avatar_impostors->setValue(FALSE);
}
}
void LLFloaterPreference::refresh()
{
LLPanel::refresh();
// sliders and their text boxes
// mPostProcess = gSavedSettings.getS32("RenderGlowResolutionPow");
// slider text boxes
James Cook
committed
updateSliderText(getChild<LLSliderCtrl>("ObjectMeshDetail", true), getChild<LLTextBox>("ObjectMeshDetailText", true));
updateSliderText(getChild<LLSliderCtrl>("FlexibleMeshDetail", true), getChild<LLTextBox>("FlexibleMeshDetailText", true));
updateSliderText(getChild<LLSliderCtrl>("TreeMeshDetail", true), getChild<LLTextBox>("TreeMeshDetailText", true));
updateSliderText(getChild<LLSliderCtrl>("AvatarMeshDetail", true), getChild<LLTextBox>("AvatarMeshDetailText", true));
updateSliderText(getChild<LLSliderCtrl>("AvatarPhysicsDetail", true), getChild<LLTextBox>("AvatarPhysicsDetailText", true));
James Cook
committed
updateSliderText(getChild<LLSliderCtrl>("TerrainMeshDetail", true), getChild<LLTextBox>("TerrainMeshDetailText", true));
updateSliderText(getChild<LLSliderCtrl>("RenderPostProcess", true), getChild<LLTextBox>("PostProcessText", true));
updateSliderText(getChild<LLSliderCtrl>("SkyMeshDetail", true), getChild<LLTextBox>("SkyMeshDetailText", true));
refreshEnabledState();
}
void LLFloaterPreference::onCommitWindowedMode()
{
refresh();
}
void LLFloaterPreference::onChangeQuality(const LLSD& data)
{
U32 level = (U32)(data.asReal());
LLFeatureManager::getInstance()->setGraphicsLevel(level, true);
refreshEnabledGraphics();
refresh();
}
void LLFloaterPreference::onClickSetKey()
{
LLVoiceSetKeyDialog* dialog = LLFloaterReg::showTypedInstance<LLVoiceSetKeyDialog>("voice_set_key", LLSD(), TRUE);
if (dialog)
{
dialog->setParent(this);
}
void LLFloaterPreference::setKey(KEY key)
{
getChild<LLUICtrl>("modifier_combo")->setValue(LLKeyboard::stringFromKey(key));
// update the control right away since we no longer wait for apply
getChild<LLUICtrl>("modifier_combo")->onCommit();
void LLFloaterPreference::onClickSetMiddleMouse()
LLUICtrl* p2t_line_editor = getChild<LLUICtrl>("modifier_combo");
// update the control right away since we no longer wait for apply
p2t_line_editor->setControlValue(MIDDLE_MOUSE_CV);
//push2talk button "middle mouse" control value is in English, need to localize it for presentation
LLPanel* advanced_preferences = dynamic_cast<LLPanel*>(p2t_line_editor->getParent());
if (advanced_preferences)
{
p2t_line_editor->setValue(advanced_preferences->getString("middle_mouse"));
}
void LLFloaterPreference::onClickSetSounds()
{
// Disable Enable gesture sounds checkbox if the master sound is disabled
// or if sound effects are disabled.
getChild<LLCheckBoxCtrl>("gesture_audio_play_btn")->setEnabled(!gSavedSettings.getBOOL("MuteSounds"));
}
/*
void LLFloaterPreference::onClickSkipDialogs()
{
LLNotificationsUtil::add("SkipShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_skip_dialogs, _1, _2, this));
void LLFloaterPreference::onClickResetDialogs()
LLNotificationsUtil::add("ResetShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_reset_dialogs, _1, _2, this));
*/
void LLFloaterPreference::onClickEnablePopup()
{
LLScrollListCtrl& disabled_popups = getChildRef<LLScrollListCtrl>("disabled_popups");
std::vector<LLScrollListItem*> items = disabled_popups.getAllSelected();
std::vector<LLScrollListItem*>::iterator itor;
for (itor = items.begin(); itor != items.end(); ++itor)
LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate(*(std::string*)((*itor)->getUserdata()));
//gSavedSettings.setWarning(templatep->mName, TRUE);
std::string notification_name = templatep->mName;
LLUI::sSettingGroups["ignores"]->setBOOL(notification_name, TRUE);
}
buildPopupLists();
James Cook
committed
void LLFloaterPreference::onClickDisablePopup()
{
LLScrollListCtrl& enabled_popups = getChildRef<LLScrollListCtrl>("enabled_popups");
std::vector<LLScrollListItem*> items = enabled_popups.getAllSelected();
std::vector<LLScrollListItem*>::iterator itor;
for (itor = items.begin(); itor != items.end(); ++itor)
{
LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate(*(std::string*)((*itor)->getUserdata()));
templatep->mForm->setIgnored(true);
James Cook
committed
}
buildPopupLists();
James Cook
committed
}
void LLFloaterPreference::resetAllIgnored()
{
for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin();
iter != LLNotifications::instance().templatesEnd();
++iter)
{
if (iter->second->mForm->getIgnoreType() != LLNotificationForm::IGNORE_NO)
iter->second->mForm->setIgnored(false);
}
}
}
void LLFloaterPreference::setAllIgnored()
{
for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin();
iter != LLNotifications::instance().templatesEnd();
++iter)
{
if (iter->second->mForm->getIgnoreType() != LLNotificationForm::IGNORE_NO)
{
iter->second->mForm->setIgnored(true);
void LLFloaterPreference::onClickLogPath()
{
James Cook
committed
std::string proposed_name(gSavedPerAccountSettings.getString("InstantMessageLogPath"));
LLDirPicker& picker = LLDirPicker::instance();
if (!picker.getDir(&proposed_name ) )
return; //Canceled!
}
gSavedPerAccountSettings.setString("InstantMessageLogPath", picker.getDirName());
void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email)
mGotPersonalInfo = true;
mOriginalIMViaEmail = im_via_email;
mDirectoryVisibility = visibility;
if (visibility == VISIBILITY_DEFAULT)
mOriginalHideOnlineStatus = false;
getChildView("online_visibility")->setEnabled(TRUE);
else if (visibility == VISIBILITY_HIDDEN)
{
mOriginalHideOnlineStatus = true;
getChildView("online_visibility")->setEnabled(TRUE);
else
{
mOriginalHideOnlineStatus = true;
}
Leslie Linden
committed
getChild<LLUICtrl>("online_searchresults")->setEnabled(TRUE);
getChildView("include_im_in_chat_history")->setEnabled(TRUE);
getChildView("show_timestamps_check_im")->setEnabled(TRUE);
getChildView("friends_online_notify_checkbox")->setEnabled(TRUE);
getChild<LLUICtrl>("online_visibility")->setValue(mOriginalHideOnlineStatus);
getChild<LLUICtrl>("online_visibility")->setLabelArg("[DIR_VIS]", mDirectoryVisibility);
getChildView("send_im_to_email")->setEnabled(TRUE);
getChild<LLUICtrl>("send_im_to_email")->setValue(im_via_email);
getChildView("plain_text_chat_history")->setEnabled(TRUE);
getChild<LLUICtrl>("plain_text_chat_history")->setValue(gSavedSettings.getBOOL("PlainTextChatHistory"));
getChildView("log_instant_messages")->setEnabled(TRUE);
// getChildView("log_chat")->setEnabled(TRUE);
// getChildView("busy_response")->setEnabled(TRUE);
// getChildView("log_instant_messages_timestamp")->setEnabled(TRUE);
// getChildView("log_chat_timestamp")->setEnabled(TRUE);
getChildView("log_chat_IM")->setEnabled(TRUE);
getChildView("log_date_timestamp")->setEnabled(TRUE);
// getChild<LLUICtrl>("busy_response")->setValue(gSavedSettings.getString("BusyModeResponse2"));
Andrew Productengine
committed
getChildView("favorites_on_login_check")->setEnabled(TRUE);
getChildView("log_nearby_chat")->setEnabled(TRUE);
getChildView("log_instant_messages")->setEnabled(TRUE);
getChildView("show_timestamps_check_im")->setEnabled(TRUE);
getChildView("log_path_string")->setEnabled(FALSE);// LineEditor becomes readonly in this case.
getChildView("log_path_button")->setEnabled(TRUE);
Wolfpup Lowenhar
committed
childEnable("logfile_name_datestamp");
std::string display_email(email);
getChild<LLUICtrl>("email_address")->setValue(display_email);
}
void LLFloaterPreference::onUpdateSliderText(LLUICtrl* ctrl, const LLSD& name)
{
James Cook
committed
std::string ctrl_name = name.asString();
if ((ctrl_name =="" )|| !hasChild(ctrl_name, true))
return;
LLTextBox* text_box = getChild<LLTextBox>(name.asString());
LLSliderCtrl* slider = dynamic_cast<LLSliderCtrl*>(ctrl);
updateSliderText(slider, text_box);
}
void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box)
{
if (text_box == NULL || ctrl== NULL)
return;
// get range and points when text should change
F32 value = (F32)ctrl->getValue().asReal();
F32 min = ctrl->getMinValue();
F32 max = ctrl->getMaxValue();
F32 range = max - min;
llassert(range > 0);
F32 midPoint = min + range / 3.0f;
F32 highPoint = min + (2.0f * range / 3.0f);
// choose the right text
{
text_box->setText(LLTrans::getString("GraphicsQualityLow"));
}
else if (value < highPoint)
{
text_box->setText(LLTrans::getString("GraphicsQualityMid"));
}
else
{
text_box->setText(LLTrans::getString("GraphicsQualityHigh"));
}
}
void LLFloaterPreference::onChangeMaturity()
{
U8 sim_access = gSavedSettings.getU32("PreferredMaturity");
getChild<LLIconCtrl>("rating_icon_general")->setVisible(sim_access == SIM_ACCESS_PG
|| sim_access == SIM_ACCESS_MATURE
|| sim_access == SIM_ACCESS_ADULT);
getChild<LLIconCtrl>("rating_icon_moderate")->setVisible(sim_access == SIM_ACCESS_MATURE
|| sim_access == SIM_ACCESS_ADULT);
getChild<LLIconCtrl>("rating_icon_adult")->setVisible(sim_access == SIM_ACCESS_ADULT);
}
// FIXME: this will stop you from spawning the sidetray from preferences dialog on login screen
// but the UI for this will still be enabled
void LLFloaterPreference::onClickBlockList()
{
LLFloaterSidePanelContainer::showPanel("people", "panel_block_list_sidetray", LLSD());
}
void LLFloaterPreference::onClickProxySettings()
Andrew Productengine
committed
{
LLFloaterReg::showInstance("prefs_proxy");
Andrew Productengine
committed
}
void LLFloaterPreference::onClickTranslationSettings()
Andrew Productengine
committed
{
LLFloaterReg::showInstance("prefs_translation");
Andrew Productengine
committed
}
Oz Linden
committed
void LLFloaterPreference::onClickAutoReplace()
{
LLFloaterReg::showInstance("prefs_autoreplace");
}
Kitty Barnett
committed
void LLFloaterPreference::onClickSpellChecker()
{
LLFloaterReg::showInstance("prefs_spellchecker");
Kitty Barnett
committed
}
Vadim ProductEngine
committed
void LLFloaterPreference::onClickActionChange()
{
mClickActionDirty = true;
}
void LLFloaterPreference::updateClickActionSettings()
{
Vadim ProductEngine
committed
const int single_clk_action = getChild<LLComboBox>("single_click_action_combo")->getValue().asInteger();
const int double_clk_action = getChild<LLComboBox>("double_click_action_combo")->getValue().asInteger();
Vadim ProductEngine
committed
gSavedSettings.setBOOL("ClickToWalk", single_clk_action == 1);
gSavedSettings.setBOOL("DoubleClickAutoPilot", double_clk_action == 1);
gSavedSettings.setBOOL("DoubleClickTeleport", double_clk_action == 2);
void LLFloaterPreference::updateClickActionControls()
Andrew Productengine
committed
{
const bool click_to_walk = gSavedSettings.getBOOL("ClickToWalk");
const bool dbl_click_to_walk = gSavedSettings.getBOOL("DoubleClickAutoPilot");
const bool dbl_click_to_teleport = gSavedSettings.getBOOL("DoubleClickTeleport");
Vadim ProductEngine
committed
getChild<LLComboBox>("single_click_action_combo")->setValue((int)click_to_walk);
getChild<LLComboBox>("double_click_action_combo")->setValue(dbl_click_to_teleport ? 2 : (int)dbl_click_to_walk);
Andrew Productengine
committed
}
void LLFloaterPreference::applyUIColor(LLUICtrl* ctrl, const LLSD& param)
{
LLUIColorTable::instance().setColor(param.asString(), LLColor4(ctrl->getValue()));
}
void LLFloaterPreference::getUIColor(LLUICtrl* ctrl, const LLSD& param)
{
LLColorSwatchCtrl* color_swatch = (LLColorSwatchCtrl*) ctrl;
color_swatch->setOriginal(LLUIColorTable::instance().getColor(param.asString()));
}
Vadim ProductEngine
committed
void LLFloaterPreference::setCacheLocation(const LLStringExplicit& location)
{
LLUICtrl* cache_location_editor = getChild<LLUICtrl>("cache_location");
cache_location_editor->setValue(location);
cache_location_editor->setToolTip(location);
}
Paul ProductEngine
committed
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
//------------------------------Updater---------------------------------------
static bool handleBandwidthChanged(const LLSD& newvalue)
{
gViewerThrottle.setMaxBandwidth((F32) newvalue.asReal());
return true;
}
class LLPanelPreference::Updater : public LLEventTimer
{
public:
typedef boost::function<bool(const LLSD&)> callback_t;
Updater(callback_t cb, F32 period)
:LLEventTimer(period),
mCallback(cb)
{
mEventTimer.stop();
}
virtual ~Updater(){}
void update(const LLSD& new_value)
{
mNewValue = new_value;
mEventTimer.start();
}
protected:
BOOL tick()
{
mCallback(mNewValue);
mEventTimer.stop();
return FALSE;
}
private:
LLSD mNewValue;
callback_t mCallback;
};
//----------------------------------------------------------------------------
static LLRegisterPanelClassWrapper<LLPanelPreference> t_places("panel_preference");
LLPanelPreference::LLPanelPreference()
Paul ProductEngine
committed
: LLPanel(),
mBandWidthUpdater(NULL)
mCommitCallbackRegistrar.add("Pref.setControlFalse", boost::bind(&LLPanelPreference::setControlFalse,this, _2));
paul_productengine
committed
mCommitCallbackRegistrar.add("Pref.updateMediaAutoPlayCheckbox", boost::bind(&LLPanelPreference::updateMediaAutoPlayCheckbox, this, _1));
James Cook
committed
}
//virtual
BOOL LLPanelPreference::postBuild()
{
////////////////////// PanelVoice ///////////////////
if (hasChild("voice_unavailable"))
BOOL voice_disabled = gSavedSettings.getBOOL("CmdLineDisableVoice");
getChildView("voice_unavailable")->setVisible( voice_disabled);
getChildView("enable_voice_check")->setVisible( !voice_disabled);
}
//////////////////////PanelSkins ///////////////////
if (hasChild("skin_selection"))
{
LLFloaterPreference::refreshSkin(this);
// if skin is set to a skin that no longer exists (silver) set back to default
if (getChild<LLRadioGroup>("skin_selection")->getSelectedIndex() < 0)
gSavedSettings.setString("SkinCurrent", "default");
LLFloaterPreference::refreshSkin(this);
if (hasChild("online_visibility") && hasChild("send_im_to_email"))
getChild<LLUICtrl>("email_address")->setValue(getString("log_in_to_change") );
// getChild<LLUICtrl>("busy_response")->setValue(getString("log_in_to_change"));
//////////////////////PanelPrivacy ///////////////////
{
bool media_enabled = gSavedSettings.getBOOL("AudioStreamingMedia");
Igor Borovkov
committed
getChild<LLCheckBoxCtrl>("media_enabled")->set(media_enabled);
getChild<LLCheckBoxCtrl>("autoplay_enabled")->setEnabled(media_enabled);
}
if (hasChild("music_enabled"))
{
getChild<LLCheckBoxCtrl>("music_enabled")->set(gSavedSettings.getBOOL("AudioStreamingMusic"));
Igor Borovkov
committed
if (hasChild("voice_call_friends_only_check"))
{
getChild<LLCheckBoxCtrl>("voice_call_friends_only_check")->setCommitCallback(boost::bind(&showFriendsOnlyWarning, _1, _2));
}
Andrew Productengine
committed
if (hasChild("favorites_on_login_check"))
{
getChild<LLCheckBoxCtrl>("favorites_on_login_check")->setCommitCallback(boost::bind(&showFavoritesOnLoginWarning, _1, _2));
}
Igor Borovkov
committed
// Panel Advanced
if (hasChild("modifier_combo"))
{
//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 ///////////////////
if (hasChild("max_bandwidth"))
{
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
Vadim ProductEngine
committed
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
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();
if (std::find(mAccountIndependentSettings.begin(),
mAccountIndependentSettings.end(), setting) == mAccountIndependentSettings.end())
{
mSavedValues.erase(it++);
}
else
{
++it;
}
}
}
}
private:
std::list<std::string> mAccountIndependentSettings;
};
Ychebotarev ProductEngine
committed
static LLRegisterPanelClassWrapper<LLPanelPreferenceGraphics> t_pref_graph("panel_preference_graphics");
Vadim ProductEngine
committed
static LLRegisterPanelClassWrapper<LLPanelPreferencePrivacy> t_pref_privacy("panel_preference_privacy");
Ychebotarev ProductEngine
committed
BOOL LLPanelPreferenceGraphics::postBuild()
{
return LLPanelPreference::postBuild();
}
void LLPanelPreferenceGraphics::draw()
{
LLPanelPreference::draw();
LLButton* button_apply = findChild<LLButton>("Apply");
if (button_apply && button_apply->getVisible())
Ychebotarev ProductEngine
committed
{
bool enable = hasDirtyChilds();
button_apply->setEnabled(enable);
}
}
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
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
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);
}
}
}
void LLPanelPreferenceGraphics::apply()
{
resetDirtyChilds();
LLPanelPreference::apply();
}
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
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
// 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();
}