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"
Mnikolenko ProductEngine
committed
#include "llagentcamera.h"
#include "llcheckboxctrl.h"
James Cook
committed
#include "llcolorswatch.h"
#include "llcombobox.h"
#include "llcommandhandler.h"
#include "lldiriterator.h"
#include "lldirpicker.h"
Paul ProductEngine
committed
#include "lleventtimer.h"
#include "llfeaturemanager.h"
#include "llfilepicker.h"
#include "llfocusmgr.h"
//#include "llfirstuse.h"
#include "llfloaterreg.h"
Mnikolenko ProductEngine
committed
#include "llfavoritesbar.h"
#include "llfloatersidepanelcontainer.h"
AlexanderP ProductEngine
committed
#include "llfloaterimsession.h"
#include "llkeyboard.h"
#include "llmodaldialog.h"
James Cook
committed
#include "llnavigationbar.h"
AlexanderP ProductEngine
committed
#include "llfloaterimnearbychat.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"
Mnikolenko ProductEngine
committed
#include "llvoavatarself.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"
#include "alunzip.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 "llversioninfo.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"
#include "llweb.h"
// [RLVa:KB] - Checked: 2010-03-18 (RLVa-1.2.0a)
#include "rlvactions.h"
Eugene Mutavchi
committed
#include "lllogininstance.h" // to check if logged in yet
Andrew Productengine
committed
#include "llsdserialize.h"
#include "llpresetsmanager.h"
#include "llviewercontrol.h"
#include "llviewertexturelist.h"
Eugene Mutavchi
committed
#include <utility>
#include "llsearchableui.h"
Richard Linden
committed
char const* const VISIBILITY_DEFAULT = "default";
char const* const VISIBILITY_HIDDEN = "hidden";
//control value for middle mouse as talk2push button
const static std::string MIDDLE_MOUSE_CV = "MiddleMouse"; // for voice client and redability
const static std::string MOUSE_BUTTON_4_CV = "MouseButton4";
const static std::string MOUSE_BUTTON_5_CV = "MouseButton5";
/// This must equal the maximum value set for the IndirectMaxComplexity slider in panel_preferences_graphics1.xml
static const U32 INDIRECT_MAX_ARC_OFF = 101; // all the way to the right == disabled
static const U32 MIN_INDIRECT_ARC_LIMIT = 1; // must match minimum of IndirectMaxComplexity in panel_preferences_graphics1.xml
static const U32 MAX_INDIRECT_ARC_LIMIT = INDIRECT_MAX_ARC_OFF-1; // one short of all the way to the right...
/// These are the effective range of values for RenderAvatarMaxComplexity
static const F32 MIN_ARC_LIMIT = 20000.0f;
static const F32 MAX_ARC_LIMIT = 350000.0f;
static const F32 MIN_ARC_LOG = log(MIN_ARC_LIMIT);
static const F32 MAX_ARC_LOG = log(MAX_ARC_LIMIT);
static const F32 ARC_LIMIT_MAP_SCALE = (MAX_ARC_LOG - MIN_ARC_LOG) / (MAX_INDIRECT_ARC_LIMIT - MIN_INDIRECT_ARC_LIMIT);
andreykproductengine
committed
struct LabelDef : public LLInitParam::Block<LabelDef>
{
Mandatory<std::string> name;
Mandatory<std::string> value;
LabelDef()
: name("name"),
value("value")
{}
};
struct LabelTable : public LLInitParam::Block<LabelTable>
{
Multiple<LabelDef> labels;
LabelTable()
: labels("label")
{}
};
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);
BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down);
static void onCancel(void* user_data);
private:
LLFloaterPreference* mParent;
};
std::string mAuthor = "Unknown";
std::string mUrl = "Unknown";
LLDate mDate = LLDate(0.0);
std::string mCompatVer = "Unknown";
std::string mNotes = LLStringUtil::null;
ESkinType mType = USER_SKIN;
} skin_t;
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;
}
BOOL LLVoiceSetKeyDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down)
{
BOOL result = FALSE;
if (down
&& (clicktype == LLMouseHandler::CLICK_MIDDLE || clicktype == LLMouseHandler::CLICK_BUTTON4 || clicktype == LLMouseHandler::CLICK_BUTTON5)
&& mask == 0)
{
mParent->setMouse(clicktype);
result = TRUE;
closeFloater();
}
else
{
result = LLMouseHandler::handleAnyMouseClick(x, y, mask, clicktype, down);
}
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::getInstance()->clearAllCaches();
LLViewerMedia::getInstance()->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)
{
LLAvatarNameCache::getInstance()->setUseUsernames(gSavedSettings.getBOOL("NameTagShowUsernames"));
LLVOAvatar::invalidateNameTags();
James Cook
committed
}
void handleDisplayNamesOptionChanged(const LLSD& newvalue)
{
LLAvatarNameCache::getInstance()->setUseDisplayNames(newvalue.asBoolean());
LLVOAvatar::invalidateNameTags();
Mnikolenko ProductEngine
committed
void handleAppearanceCameraMovementChanged(const LLSD& newvalue)
{
if(!newvalue.asBoolean() && gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR)
{
gAgentCamera.changeCameraToDefault();
gAgentCamera.resetView();
}
}
/*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)
{
callum_linden
committed
numerator = ll_round(decimal_val * test_denominator);
denominator = ll_round(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)
maksymsproductengine
committed
LLConversationLog::instance().addObserver(this);
//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.Cancel", boost::bind(&LLFloaterPreference::onBtnCancel, this, _2));
mCommitCallbackRegistrar.add("Pref.OK", boost::bind(&LLFloaterPreference::onBtnOK, this, _2));
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.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.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.RenderExceptions", boost::bind(&LLFloaterPreference::onClickRenderExceptions, this));
mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this));
mCommitCallbackRegistrar.add("Pref.AvatarImpostorsEnable", boost::bind(&LLFloaterPreference::onAvatarImpostorsEnable, this));
mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreference::updateMaxComplexity, this));
mCommitCallbackRegistrar.add("Pref.RenderOptionUpdate", boost::bind(&LLFloaterPreference::onRenderOptionEnable, this));
mCommitCallbackRegistrar.add("Pref.WindowedMod", boost::bind(&LLFloaterPreference::onCommitWindowedMode, this));
mCommitCallbackRegistrar.add("Pref.UpdateSliderText", boost::bind(&LLFloaterPreference::refreshUI,this));
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));
mCommitCallbackRegistrar.add("Pref.PermsDefault", boost::bind(&LLFloaterPreference::onClickPermsDefault, this));
mCommitCallbackRegistrar.add("Pref.RememberedUsernames", boost::bind(&LLFloaterPreference::onClickRememberedUsernames, this));
Kitty Barnett
committed
mCommitCallbackRegistrar.add("Pref.SpellChecker", boost::bind(&LLFloaterPreference::onClickSpellChecker, this));
mCommitCallbackRegistrar.add("Pref.Advanced", boost::bind(&LLFloaterPreference::onClickAdvanced, this));
sSkin = gSavedSettings.getString("SkinCurrent");
maksymsproductengine
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));
Mnikolenko ProductEngine
committed
gSavedSettings.getControl("AppearanceCameraMovement")->getCommitSignal()->connect(boost::bind(&handleAppearanceCameraMovementChanged, _2));
LLAvatarPropertiesProcessor::getInstance()->addObserver( gAgent.getID(), this );
maksymsproductengine
committed
mCommitCallbackRegistrar.add("Pref.ClearLog", boost::bind(&LLConversationLog::onClearLog, &LLConversationLog::instance()));
mCommitCallbackRegistrar.add("Pref.DeleteTranscripts", boost::bind(&LLFloaterPreference::onDeleteTranscripts, this));
mCommitCallbackRegistrar.add("UpdateFilter", boost::bind(&LLFloaterPreference::onUpdateFilterTerm, this, false)); // <FS:ND/> Hook up for filtering
mCommitCallbackRegistrar.add("Pref.AddSkin", boost::bind(&LLFloaterPreference::onAddSkin, this));
mCommitCallbackRegistrar.add("Pref.RemoveSkin", boost::bind(&LLFloaterPreference::onRemoveSkin, this));
mCommitCallbackRegistrar.add("Pref.ApplySkin", boost::bind(&LLFloaterPreference::onApplySkin, this));
mCommitCallbackRegistrar.add("Pref.SelectSkin", boost::bind(&LLFloaterPreference::onSelectSkin, this, _2));
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()
{
maksymsproductengine
committed
gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&LLFloaterIMSessionTab::processChatHistoryStyleUpdate, false));
Eugene Mutavchi
committed
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));
gSavedPerAccountSettings.getControl("ModelUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeModelFolder, this));
gSavedPerAccountSettings.getControl("TextureUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeTextureFolder, this));
gSavedPerAccountSettings.getControl("SoundUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeSoundFolder, this));
gSavedPerAccountSettings.getControl("AnimationUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeAnimationFolder, 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
Merov Linden
committed
getChild<LLUICtrl>("log_path_string")->setEnabled(FALSE); // make it read-only but selectable
Vadim ProductEngine
committed
getChild<LLComboBox>("language_combobox")->setCommitCallback(boost::bind(&LLFloaterPreference::onLanguageChange, this));
maxim_productengine
committed
getChild<LLComboBox>("FriendIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"FriendIMOptions"));
getChild<LLComboBox>("NonFriendIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"NonFriendIMOptions"));
getChild<LLComboBox>("ConferenceIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"ConferenceIMOptions"));
getChild<LLComboBox>("GroupChatOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"GroupChatOptions"));
getChild<LLComboBox>("NearbyChatOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"NearbyChatOptions"));
getChild<LLComboBox>("ObjectIMOptions")->setCommitCallback(boost::bind(&LLFloaterPreference::onNotificationsChange, this,"ObjectIMOptions"));
maxim_productengine
committed
William Todd Stinson
committed
// if floater is opened before login set default localized do not disturb message
Andrew Dyukov
committed
if (LLStartUp::getStartupState() < STATE_STARTED)
{
William Todd Stinson
committed
gSavedPerAccountSettings.setString("DoNotDisturbModeResponse", LLTrans::getString("DoNotDisturbModeResponseDefault"));
Andrew Dyukov
committed
}
maksymsproductengine
committed
// set 'enable' property for 'Clear log...' button
changed();
LLLogChat::getInstance()->setSaveHistorySignal(boost::bind(&LLFloaterPreference::onLogChatHistorySaved, this));
loadUserSkins();
maksymsproductengine
committed
Mnikolenko ProductEngine
committed
LLSliderCtrl* fov_slider = getChild<LLSliderCtrl>("camera_fov");
fov_slider->setMinValue(LLViewerCamera::getInstance()->getMinView());
fov_slider->setMaxValue(LLViewerCamera::getInstance()->getMaxView());
// Hook up and init for filtering
mFilterEdit = getChild<LLSearchEditor>("search_prefs_edit");
mFilterEdit->setKeystrokeCallback(boost::bind(&LLFloaterPreference::onUpdateFilterTerm, this, false));
andreykproductengine
committed
// Load and assign label for 'default language'
std::string user_filename = gDirUtilp->getExpandedFilename(LL_PATH_DEFAULT_SKIN, "default_languages.xml");
std::map<std::string, std::string> labels;
if (loadFromFilename(user_filename, labels))
{
std::string system_lang = gSavedSettings.getString("SystemLanguage");
std::map<std::string, std::string>::iterator iter = labels.find(system_lang);
if (iter != labels.end())
{
getChild<LLComboBox>("language_combobox")->add(iter->second, LLSD("default"), ADD_TOP, true);
}
else
{
LL_WARNS() << "Language \"" << system_lang << "\" is not in default_languages.xml" << LL_ENDL;
getChild<LLComboBox>("language_combobox")->add("System default", LLSD("default"), ADD_TOP, true);
}
}
else
{
LL_WARNS() << "Failed to load labels from " << user_filename << ". Using default." << LL_ENDL;
getChild<LLComboBox>("language_combobox")->add("System default", LLSD("default"), ADD_TOP, true);
}
return TRUE;
}
maksymsproductengine
committed
void LLFloaterPreference::updateDeleteTranscriptsButton()
{
std::vector<std::string> list_of_transcriptions_file_names;
LLLogChat::getListOfTranscriptFiles(list_of_transcriptions_file_names);
getChild<LLButton>("delete_transcripts")->setEnabled(list_of_transcriptions_file_names.size() > 0);
}
William Todd Stinson
committed
void LLFloaterPreference::onDoNotDisturbResponseChanged()
Andrew Dyukov
committed
{
William Todd Stinson
committed
// set "DoNotDisturbResponseChanged" TRUE if user edited message differs from default, FALSE otherwise
bool response_changed_flag =
LLTrans::getString("DoNotDisturbModeResponseDefault")
!= getChild<LLUICtrl>("do_not_disturb_response")->getValue().asString();
AlexanderP ProductEngine
committed
William Todd Stinson
committed
gSavedPerAccountSettings.setBOOL("DoNotDisturbResponseChanged", response_changed_flag );
Andrew Dyukov
committed
}
////////////////////////////////////////////////////
// Skins panel
skin_t manifestFromJson(const std::string& filename, const ESkinType type)
{
skin_t skin;
llifstream in;
in.open(filename);
if (in.is_open())
{
in >> root;
skin.mName = root.value("name", "Unknown");
skin.mAuthor = root.value("author", "Unknown");
skin.mUrl = root.value("url", "Unknown");
skin.mCompatVer = root.value("compatibility", "Unknown");
skin.mDate = LLDate(root.value("date", "1983-04-20T00:00:00Z"));
skin.mNotes = root.value("notes", "");
// If it's a system skin, the compatability version is always the current build
if (type == SYSTEM_SKIN)
{
skin.mCompatVer = LLVersionInfo::instance().getShortVersion();
LL_WARNS() << "Failed to parse " << filename << ": " << e.what() << LL_ENDL;
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
}
in.close();
}
skin.mType = type;
return skin;
}
void LLFloaterPreference::loadUserSkins()
{
mUserSkins.clear();
LLDirIterator sysiter(gDirUtilp->getSkinBaseDir(), "*");
bool found = true;
while (found)
{
std::string dir;
if ((found = sysiter.next(dir)))
{
const std::string& fullpath = gDirUtilp->add(gDirUtilp->getSkinBaseDir(), dir);
if (!LLFile::isdir(fullpath)) continue; // only directories!
const std::string& manifestpath = gDirUtilp->add(fullpath, "manifest.json");
skin_t skin = manifestFromJson(manifestpath, SYSTEM_SKIN);
mUserSkins.emplace(dir, skin);
}
}
const std::string userskindir = gDirUtilp->add(gDirUtilp->getOSUserAppDir(), "skins");
if (LLFile::isdir(userskindir))
{
LLDirIterator iter(userskindir, "*");
found = true;
while (found)
{
std::string dir;
if ((found = iter.next(dir)))
{
const std::string& fullpath = gDirUtilp->add(userskindir, dir);
if (!LLFile::isdir(fullpath)) continue; // only directories!
const std::string& manifestpath = gDirUtilp->add(fullpath, "manifest.json");
skin_t skin = manifestFromJson(manifestpath, USER_SKIN);
mUserSkins.emplace(dir, skin);
}
}
}
reloadSkinList();
}
void LLFloaterPreference::reloadSkinList()
{
LLScrollListCtrl* skin_list = getChild<LLScrollListCtrl>("skin_list");
const std::string current_skin = gSavedSettings.getString("SkinCurrent");
skin_list->clearRows();
// User Downloaded Skins
for (const auto& skin : mUserSkins)
{
LLSD row;
row["id"] = skin.first;
row["columns"][0]["value"] = skin.second.mName == "Unknown" ? skin.first : skin.second.mName;
row["columns"][0]["font"]["style"] = current_skin == skin.first ? "BOLD" : "NORMAL";
skin_list->addElement(row);
}
skin_list->setSelectedByValue(current_skin, TRUE);
onSelectSkin(skin_list->getSelectedValue());
}
void LLFloaterPreference::onAddSkin()
{
LLFilePicker& filepicker = LLFilePicker::instance();
if (filepicker.getOpenFile(LLFilePicker::FFLOAD_ZIP))
{
const std::string& package = filepicker.getFirstFile();
auto zip = std::make_unique<ALUnZip>(package);
if (zip->isValid())
{
size_t buf_size = zip->getSizeFile("manifest.json");
if (buf_size)
{
buf_size++;
buf_size *= sizeof(char);
auto buf = std::make_unique<char[]>(buf_size);
zip->extractFile("manifest.json", buf.get(), buf_size);
buf[buf_size - 1] = '\0'; // force.
std::stringstream ss;
ss << std::string(const_cast<const char*>(buf.get()), buf_size);
buf.reset();
ss >> root;
const std::string& name = root.value("name", "Unknown");
std::string pathname = gDirUtilp->add(gDirUtilp->getOSUserAppDir(), "skins");
if (!gDirUtilp->fileExists(pathname))
{
LLFile::mkdir(pathname);
}
pathname = gDirUtilp->add(pathname, name);
if (!LLFile::isdir(pathname) && (LLFile::mkdir(pathname) != 0))
{
LLNotificationsUtil::add("AddSkinUnpackFailed");
}
else if (!zip->extract(pathname))
{
LLNotificationsUtil::add("AddSkinUnpackFailed");
}
else
{
loadUserSkins();
LLNotificationsUtil::add("AddSkinSuccess", LLSD().with("PACKAGE", name));
}
}
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
{
LLNotificationsUtil::add("AddSkinCantParseManifest", LLSD().with("PACKAGE", package));
}
}
else
{
LLNotificationsUtil::add("AddSkinNoManifest", LLSD().with("PACKAGE", package));
}
}
}
}
void LLFloaterPreference::onRemoveSkin()
{
LLScrollListCtrl* skin_list = findChild<LLScrollListCtrl>("skin_list");
if (skin_list)
{
LLSD args;
args["SKIN"] = skin_list->getSelectedValue().asString();
LLNotificationsUtil::add("ConfirmRemoveSkin", args, args,
boost::bind(&LLFloaterPreference::callbackRemoveSkin, this, _1, _2));
}
}
void LLFloaterPreference::callbackRemoveSkin(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if (option == 0) // YES
{
const std::string& skin = notification["payload"]["SKIN"].asString();
std::string dir = gDirUtilp->add(gDirUtilp->getOSUserAppDir(), "skins");
dir = gDirUtilp->add(dir, skin);
if (gDirUtilp->deleteDirAndContents(dir) > 0)
{
skinmap_t::iterator iter = mUserSkins.find(skin);
if (iter != mUserSkins.end())
mUserSkins.erase(iter);
// If we just deleted the current skin, reset to default. It might not even be a good
// idea to allow this, but we'll see!
if (gSavedSettings.getString("SkinCurrent") == skin)
{
gSavedSettings.setString("SkinCurrent", DEFAULT_SKIN);
}
LLNotificationsUtil::add("RemoveSkinSuccess", LLSD().with("SKIN", skin));
}
else
{
LLNotificationsUtil::add("RemoveSkinFailure", LLSD().with("SKIN", skin));
}
reloadSkinList();
}
}
void LLFloaterPreference::callbackApplySkin(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
switch (option)
{
case 0: // Yes
gSavedSettings.setBOOL("ResetUserColorsOnLogout", TRUE);
break;
case 1: // No
gSavedSettings.setBOOL("ResetUserColorsOnLogout", FALSE);
break;
case 2: // Cancel
gSavedSettings.setString("SkinCurrent", sSkin);
reloadSkinList();
break;
default:
LL_WARNS() << "Unhandled option! How could this be?" << LL_ENDL;
break;
}
}
void LLFloaterPreference::onApplySkin()
{
LLScrollListCtrl* skin_list = findChild<LLScrollListCtrl>("skin_list");
if (skin_list)
{
gSavedSettings.setString("SkinCurrent", skin_list->getSelectedValue().asString());
reloadSkinList();
}
if (sSkin != gSavedSettings.getString("SkinCurrent"))
{
LLNotificationsUtil::add("ChangeSkin", LLSD(), LLSD(),
boost::bind(&LLFloaterPreference::callbackApplySkin, this, _1, _2));
}
}
void LLFloaterPreference::onSelectSkin(const LLSD& data)
{
bool userskin = false;
skinmap_t::iterator iter = mUserSkins.find(data.asString());
if (iter != mUserSkins.end())
{
refreshSkinInfo(iter->second);
userskin = (iter->second.mType == USER_SKIN);
}
getChild<LLUICtrl>("remove_skin")->setEnabled(userskin);
}
void LLFloaterPreference::refreshSkinInfo(const skin_t& skin)
{
getChild<LLTextBase>("skin_name")->setText(skin.mName);
getChild<LLTextBase>("skin_author")->setText(skin.mAuthor);
getChild<LLTextBase>("skin_homepage")->setText(skin.mUrl);
getChild<LLTextBase>("skin_date")->setText(skin.mDate.toHTTPDateString("%A, %d %b %Y"));
getChild<LLTextBase>("skin_compatibility")->setText(skin.mCompatVer);
getChild<LLTextBase>("skin_notes")->setText(skin.mNotes);
}
LLFloaterPreference::~LLFloaterPreference()
{
maksymsproductengine
committed
LLConversationLog::instance().removeObserver(this);
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
{
sSkin = gSavedSettings.getString("SkinCurrent");
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
}
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::getInstance()->setCookiesEnabled(getChild<LLUICtrl>("cookies_enabled")->getValue());
AlexanderP ProductEngine
committed
if (hasChild("web_proxy_enabled", TRUE) &&hasChild("web_proxy_editor", TRUE) && hasChild("web_proxy_port", TRUE))
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::getInstance()->setProxyConfig(proxy_enable, proxy_address, proxy_port);
Don Kjer
committed
}
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");
¡Cinder! ㊝
committed
// hide autoreplace settings floater
Oz Linden
committed
LLFloaterReg::hideInstance("prefs_autoreplace");
¡Cinder! ㊝
committed
// hide spellchecker settings folder
LLFloaterReg::hideInstance("prefs_spellchecker");
LLFloaterReg::hideInstance("prefs_graphics_advanced");
¡Cinder! ㊝
committed
// 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();
}
AndreyL ProductEngine
committed
if (!mSavedGraphicsPreset.empty())
{
gSavedSettings.setString("PresetGraphicActive", mSavedGraphicsPreset);
LLPresetsManager::getInstance()->triggerChangeSignal();
}
}
void LLFloaterPreference::onOpen(const LLSD& key)
{
William Todd Stinson
committed
// this variable and if that follows it are used to properly handle do not disturb mode response message
Andrew Dyukov
committed
static bool initialized = FALSE;
William Todd Stinson
committed
// if user is logged in and we haven't initialized do not disturb mode response yet, do it
Andrew Dyukov
committed
if (!initialized && LLStartUp::getStartupState() == STATE_STARTED)
{
William Todd Stinson
committed
// Special approach is used for do not disturb response localization, because "DoNotDisturbModeResponse" is
Andrew Dyukov
committed
// in non-localizable xml, and also because it may be changed by user and in this case it shouldn't be localized.
William Todd Stinson
committed
// To keep track of whether do not disturb response is default or changed by user additional setting DoNotDisturbResponseChanged
Andrew Dyukov
committed
// was added into per account settings.
// initialization should happen once,so setting variable to TRUE
initialized = TRUE;
William Todd Stinson
committed
// this connection is needed to properly set "DoNotDisturbResponseChanged" setting when user makes changes in
// do not disturb response message.
gSavedPerAccountSettings.getControl("DoNotDisturbModeResponse")->getSignal()->connect(boost::bind(&LLFloaterPreference::onDoNotDisturbResponseChanged, this));
Andrew Dyukov
committed
}
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));
}
}
Mnikolenko ProductEngine
committed
getChildView("maturity_desired_combobox")->setEnabled( true);
getChildView("maturity_desired_textbox")->setVisible( false);
}
else
{
getChild<LLUICtrl>("maturity_desired_textbox")->setValue(maturity_combo->getSelectedItemLabel());
Mnikolenko ProductEngine
committed
getChildView("maturity_desired_combobox")->setEnabled( false);
}
Vadim ProductEngine
committed
// Forget previous language changes.
mLanguageChanged = false;
// Display selected maturity icons.
onChangeMaturity();
onChangeModelFolder();
onChangeTextureFolder();
onChangeSoundFolder();
onChangeAnimationFolder();
// Load (double-)click to walk/teleport settings.
updateClickActionControls();
// Enabled/disabled popups, might have been changed by user actions
// while preferences floater was closed.
buildPopupLists();
//get the options that were checked
onNotificationsChange("FriendIMOptions");
onNotificationsChange("NonFriendIMOptions");
onNotificationsChange("ConferenceIMOptions");
onNotificationsChange("GroupChatOptions");
onNotificationsChange("NearbyChatOptions");
onNotificationsChange("ObjectIMOptions");
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();
// Make sure there is a default preference file
LLPresetsManager::getInstance()->createMissingDefault(PRESETS_CAMERA);
LLPresetsManager::getInstance()->createMissingDefault(PRESETS_GRAPHIC);
bool started = (LLStartUp::getStartupState() == STATE_STARTED);
LLButton* load_btn = findChild<LLButton>("PrefLoadButton");
LLButton* save_btn = findChild<LLButton>("PrefSaveButton");
LLButton* delete_btn = findChild<LLButton>("PrefDeleteButton");
LLButton* exceptions_btn = findChild<LLButton>("RenderExceptionsButton");
if (load_btn && save_btn && delete_btn && exceptions_btn)
{
load_btn->setEnabled(started);
save_btn->setEnabled(started);
delete_btn->setEnabled(started);
exceptions_btn->setEnabled(started);
}
if (!mFilterEdit->getText().empty())
{
mFilterEdit->setText(LLStringExplicit(""));
onUpdateFilterTerm(true);
}
void LLFloaterPreference::onRenderOptionEnable()
{
refreshEnabledGraphics();
}
void LLFloaterPreferenceGraphicsAdvanced::onRenderOptionEnable()
{
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
if (instance)
{
instance->refresh();
}
refreshEnabledGraphics();
}
Graham Linden
committed
void LLFloaterPreferenceGraphicsAdvanced::onAdvancedAtmosphericsEnable()
{
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
if (instance)
{
instance->refresh();
}
refreshEnabledGraphics();
}
void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledGraphics()
{
refreshEnabledState();
}
void LLFloaterPreference::onAvatarImpostorsEnable()
{
refreshEnabledGraphics();
}
Andrew Dyukov
committed
//static
William Todd Stinson
committed
void LLFloaterPreference::initDoNotDisturbResponse()
Andrew Dyukov
committed
{
William Todd Stinson
committed
if (!gSavedPerAccountSettings.getBOOL("DoNotDisturbResponseChanged"))
Andrew Dyukov
committed
{
William Todd Stinson
committed
//LLTrans::getString("DoNotDisturbModeResponseDefault") is used here for localization (EXT-5885)
gSavedPerAccountSettings.setString("DoNotDisturbModeResponse", LLTrans::getString("DoNotDisturbModeResponseDefault"));
Andrew Dyukov
committed
}
}
callum_linden
committed
//static
void LLFloaterPreference::updateShowFavoritesCheckbox(bool val)
{
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
if (instance)
{
instance->getChild<LLUICtrl>("favorites_on_login_check")->setValue(val);
}
}
void LLFloaterPreference::setHardwareDefaults()
{
AndreyL ProductEngine
committed
std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive");
if (!preset_graphic_active.empty())
{
saveGraphicsPreset(preset_graphic_active);
saveSettings(); // save here to be able to return to the previous preset by Cancel
}
LLFeatureManager::getInstance()->applyRecommendedSettings();
// reset indirects before refresh because we may have changed what they control
LLAvatarComplexityControls::setIndirectControls();
refreshEnabledGraphics();
gSavedSettings.setString("PresetGraphicActive", "");
LLPresetsManager::getInstance()->triggerChangeSignal();
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)
Ychebotarev ProductEngine
committed
panel->setHardwareDefaults();
Ychebotarev ProductEngine
committed
}
Jonathan Yap
committed
void LLFloaterPreference::getControlNames(std::vector<std::string>& names)
{
LLView* view = findChild<LLView>("display");
LLFloater* advanced = LLFloaterReg::findTypedInstance<LLFloater>("prefs_graphics_advanced");
if (view && advanced)
Jonathan Yap
committed
{
std::list<LLView*> stack;
stack.push_back(view);
stack.push_back(advanced);
Jonathan Yap
committed
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
while(!stack.empty())
{
// Process view on top of the stack
LLView* curview = stack.front();
stack.pop_front();
LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview);
if (ctrl)
{
LLControlVariable* control = ctrl->getControlVariable();
if (control)
{
std::string control_name = control->getName();
if (std::find(names.begin(), names.end(), control_name) == names.end())
{
names.push_back(control_name);
}
}
}
for (child_list_t::const_iterator iter = curview->getChildList()->begin();
iter != curview->getChildList()->end(); ++iter)
{
stack.push_back(*iter);
}
}
}
}
//virtual
void LLFloaterPreference::onClose(bool app_quitting)
{
gSavedSettings.setS32("LastPrefTab", getChild<LLTabContainer>("pref core")->getCurrentPanelIndex());
LLPanelLogin::setAlwaysRefresh(false);
David Parks
committed
if (!app_quitting)
{
cancel();
}
void LLFloaterPreference::onBtnOK(const LLSD& userdata)
{
// 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();
if (userdata.asString() == "closeadvanced")
{
LLFloaterReg::hideInstance("prefs_graphics_advanced");
}
else
{
closeFloater(false);
}
Dmitry Zaporozhan
committed
Gilbert Gonzales
committed
//Conversation transcript and log path changed so reload conversations based on new location
Gilbert Gonzales
committed
if(mPriorInstantMessageLogPath.length())
Gilbert Gonzales
committed
{
Gilbert Gonzales
committed
if(moveTranscriptsAndLog())
{
//When floaters are empty but have a chat history files, reload chat history into them
LLFloaterIMSessionTab::reloadEmptyFloaters();
}
Gilbert Gonzales
committed
//Couldn't move files so restore the old path and show a notification
Gilbert Gonzales
committed
else
Gilbert Gonzales
committed
{
gSavedPerAccountSettings.setString("InstantMessageLogPath", mPriorInstantMessageLogPath);
LLNotificationsUtil::add("PreferenceChatPathChanged");
}
mPriorInstantMessageLogPath.clear();
Gilbert Gonzales
committed
}
James Cook
committed
LLUIColorTable::instance().saveUserSettings();
Aaron Stone
committed
gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE);
Gilbert Gonzales
committed
//Only save once logged in and loaded per account settings
if(mGotPersonalInfo)
{
gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE);
// Show beep, pop up dialog, etc.
LL_INFOS() << "Can't close preferences!" << LL_ENDL;
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();
}
void LLFloaterPreference::onBtnCancel(const LLSD& userdata)
{
if (hasFocus())
Christian Goetze
committed
{
LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
{
cur_focus->onCommit();
}
James Cook
committed
refresh();
Christian Goetze
committed
}
cancel();
if (userdata.asString() == "closeadvanced")
{
LLFloaterReg::hideInstance("prefs_graphics_advanced");
Mnikolenko Productengine
committed
updateMaxComplexity();
}
else
{
closeFloater();
}
Rider Linden
committed
void LLFloaterPreference::updateUserInfo(const std::string& visibility, bool im_via_email, bool is_verified_email)
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
Christian Goetze
committed
{
Rider Linden
committed
instance->setPersonalInfo(visibility, im_via_email, is_verified_email);
Christian Goetze
committed
}
void LLFloaterPreference::refreshEnabledGraphics()
{
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
instance->refresh();
LLFloater* advanced = LLFloaterReg::findTypedInstance<LLFloater>("prefs_graphics_advanced");
if (advanced)
{
advanced->refresh();
}
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;
}
}
maxim_productengine
committed
void LLFloaterPreference::onNotificationsChange(const std::string& OptionName)
{
mNotificationOptions[OptionName] = getChild<LLComboBox>(OptionName)->getSelectedItemLabel();
bool show_notifications_alert = true;
for (notifications_map::iterator it_notification = mNotificationOptions.begin(); it_notification != mNotificationOptions.end(); it_notification++)
{
if(it_notification->second != "No action")
maxim_productengine
committed
{
show_notifications_alert = false;
break;
}
}
getChild<LLTextBox>("notifications_alert")->setVisible(show_notifications_alert);
}
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);
maxim_productengine
committed
(new LLDirPickerThread(boost::bind(&LLFloaterPreference::changeCachePath, this, _1, _2), proposed_name))->getFile();
}
maxim_productengine
committed
void LLFloaterPreference::changeCachePath(const std::vector<std::string>& filenames, std::string proposed_name)
{
std::string dir_name = filenames[0];
if (!dir_name.empty() && dir_name != proposed_name)
maxim_productengine
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::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::getInstance()->mSettingGroups["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();
maxim_productengine
committed
row["columns"][1]["font"] = "SANSSERIF_SMALL";
row["columns"][1]["width"] = 360;
break;
}
}
}
}
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()
{
LLCheckBoxCtrl* ctrl_wind_light = getChild<LLCheckBoxCtrl>("WindLightUseAtmosShaders");
LLCheckBoxCtrl* ctrl_deferred = getChild<LLCheckBoxCtrl>("UseLightShaders");
// if vertex shaders off, disable all shader related products
if (!LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders"))
{
ctrl_wind_light->setEnabled(FALSE);
ctrl_wind_light->setValue(FALSE);
}
else
{
// [RLVa:KB] - Checked: 2010-03-18 (RLVa-1.2.0a) | Modified: RLVa-0.2.0a
// "Atmospheric Shaders" can't be disabled - but can be enabled - under @setenv=n
ctrl_wind_light->setEnabled( (RlvActions::canChangeEnvironment()) || (!gSavedSettings.getBOOL("WindLightUseAtmosShaders")));
// [/RLVa:KB]
// ctrl_wind_light->setEnabled(TRUE);
}
//Deferred/SSAO/Shadows
BOOL bumpshiny = gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump") && gSavedSettings.getBOOL("RenderObjectBump");
BOOL transparent_water = LLFeatureManager::getInstance()->isFeatureAvailable("RenderTransparentWater") && gSavedSettings.getBOOL("RenderTransparentWater");
BOOL shaders = gSavedSettings.getBOOL("WindLightUseAtmosShaders");
BOOL enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") &&
bumpshiny &&
transparent_water &&
shaders &&
gGLManager.mHasFramebufferObject &&
gSavedSettings.getBOOL("RenderAvatarVP") &&
(ctrl_wind_light->get()) ? TRUE : FALSE;
ctrl_deferred->setEnabled(enabled);
Mnikolenko Productengine
committed
// Cannot have floater active until caps have been received
getChild<LLButton>("default_creation_permissions")->setEnabled(LLStartUp::getStartupState() < STATE_STARTED ? false : true);
andreykproductengine
committed
getChildView("block_list")->setEnabled(LLLoginInstance::getInstance()->authSuccess());
}
void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState()
{
LLComboBox* ctrl_reflections = getChild<LLComboBox>("Reflections");
Jonathan Yap
committed
LLTextBox* reflections_text = getChild<LLTextBox>("ReflectionsText");
// [RLVa:KB] - Checked: 2013-05-11 (RLVa-1.4.9)
if (RlvActions::isRlvEnabled())
{
getChild<LLUICtrl>("do_not_disturb_response")->setEnabled(!RlvActions::hasBehaviour(RLV_BHVR_SENDIM));
}
BOOL reflections = gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps;
ctrl_reflections->setEnabled(reflections);
Jonathan Yap
committed
reflections_text->setEnabled(reflections);
// Transparent Water
LLCheckBoxCtrl* transparent_water_ctrl = getChild<LLCheckBoxCtrl>("TransparentWater");
Graham Madarasz (Graham)
committed
LLCheckBoxCtrl* bumpshiny_ctrl = getChild<LLCheckBoxCtrl>("BumpShiny");
bool bumpshiny = gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump");
Graham Madarasz (Graham)
committed
bumpshiny_ctrl->setEnabled(bumpshiny ? TRUE : FALSE);
// 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("RenderAvatarVP") == FALSE)
{
ctrl_avatar_cloth->setEnabled(FALSE);
}
else
{
ctrl_avatar_cloth->setEnabled(TRUE);
}
// Vertex Shaders, Global Shader Enable
// SL-12594 Basic shaders are always enabled. DJH TODO clean up now-orphaned state handling code
LLSliderCtrl* terrain_detail = getChild<LLSliderCtrl>("TerrainDetail"); // can be linked with control var
LLTextBox* terrain_text = getChild<LLTextBox>("TerrainDetailText");
terrain_detail->setEnabled(FALSE);
terrain_text->setEnabled(FALSE);
Jonathan Yap
committed
// WindLight
LLCheckBoxCtrl* ctrl_wind_light = getChild<LLCheckBoxCtrl>("WindLightUseAtmosShaders");
LLSliderCtrl* sky = getChild<LLSliderCtrl>("SkyMeshDetail");
LLTextBox* sky_text = getChild<LLTextBox>("SkyMeshDetailText");
// [RLVa:KB] - Checked: 2010-03-18 (RLVa-1.2.0a) | Modified: RLVa-0.2.0a
// "Atmospheric Shaders" can't be disabled - but can be enabled - under @setenv=n
ctrl_wind_light->setEnabled( (RlvActions::canChangeEnvironment()) || (!gSavedSettings.getBOOL("WindLightUseAtmosShaders")));
// ctrl_wind_light->setEnabled(TRUE);
sky->setEnabled(TRUE);
sky_text->setEnabled(TRUE);
//Deferred/SSAO/Shadows
LLCheckBoxCtrl* ctrl_deferred = getChild<LLCheckBoxCtrl>("UseLightShaders");
BOOL enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") &&
((bumpshiny_ctrl && bumpshiny_ctrl->get()) ? TRUE : FALSE) &&
((transparent_water_ctrl && transparent_water_ctrl->get()) ? TRUE : FALSE) &&
gGLManager.mHasFramebufferObject &&
gSavedSettings.getBOOL("RenderAvatarVP") &&
(ctrl_wind_light->get()) ? TRUE : FALSE;
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");
Jonathan Yap
committed
LLTextBox* shadow_text = getChild<LLTextBox>("RenderShadowDetailText");
// note, okay here to get from ctrl_deferred as it's twin, ctrl_deferred2 will alway match it
leyla_linden
committed
enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO") && (ctrl_deferred->get() ? TRUE : FALSE);
Graham Madarasz
committed
ctrl_deferred->set(gSavedSettings.getBOOL("RenderDeferred"));
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);
Jonathan Yap
committed
shadow_text->setEnabled(enabled);
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
// Hardware settings
F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple");
S32Megabytes min_tex_mem = LLViewerTextureList::getMinVideoRamSetting();
S32Megabytes max_tex_mem = LLViewerTextureList::getMaxVideoRamSetting(false, mem_multiplier);
getChild<LLSliderCtrl>("GraphicsCardTextureMemory")->setMinValue(min_tex_mem.value());
getChild<LLSliderCtrl>("GraphicsCardTextureMemory")->setMaxValue(max_tex_mem.value());
if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderVBOEnable") ||
!gGLManager.mHasVertexBufferObject)
{
getChildView("vbo")->setEnabled(FALSE);
}
if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderCompressTextures") ||
!gGLManager.mHasVertexBufferObject)
{
getChildView("texture compression")->setEnabled(FALSE);
}
// if no windlight shaders, turn off nighttime brightness, gamma, and fog distance
LLUICtrl* gamma_ctrl = getChild<LLUICtrl>("gamma");
gamma_ctrl->setEnabled(!gPipeline.canUseWindLightShaders());
getChildView("(brightness, lower is brighter)")->setEnabled(!gPipeline.canUseWindLightShaders());
getChildView("fog")->setEnabled(!gPipeline.canUseWindLightShaders());
Jonathan Yap
committed
getChildView("antialiasing restart")->setVisible(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred"));
// now turn off any features that are unavailable
disableUnavailableSettings();
}
void LLAvatarComplexityControls::setIndirectControls()
{
/*
* We have controls that have an indirect relationship between the control
* values and adjacent text and the underlying setting they influence.
* In each case, the control and its associated setting are named Indirect<something>
* This method interrogates the controlled setting and establishes the
* appropriate value for the indirect control. It must be called whenever the
* underlying setting may have changed other than through the indirect control,
* such as when the 'Reset all to recommended settings' button is used...
*/
setIndirectMaxNonImpostors();
setIndirectMaxArc();
}
// static
void LLAvatarComplexityControls::setIndirectMaxNonImpostors()
{
U32 max_non_impostors = gSavedSettings.getU32("RenderAvatarMaxNonImpostors");
// for this one, we just need to make zero, which means off, the max value of the slider
U32 indirect_max_non_impostors = (0 == max_non_impostors) ? LLVOAvatar::IMPOSTORS_OFF : max_non_impostors;
gSavedSettings.setU32("IndirectMaxNonImpostors", indirect_max_non_impostors);
}
void LLAvatarComplexityControls::setIndirectMaxArc()
{
U32 max_arc = gSavedSettings.getU32("RenderAvatarMaxComplexity");
U32 indirect_max_arc;
if (0 == max_arc)
{
// the off position is all the way to the right, so set to control max
indirect_max_arc = INDIRECT_MAX_ARC_OFF;
}
else
{
// This is the inverse of the calculation in updateMaxComplexity
indirect_max_arc = (U32)ll_round(((log(F32(max_arc)) - MIN_ARC_LOG) / ARC_LIMIT_MAP_SCALE)) + MIN_INDIRECT_ARC_LIMIT;
}
gSavedSettings.setU32("IndirectMaxComplexity", indirect_max_arc);
}
void LLFloaterPreferenceGraphicsAdvanced::disableUnavailableSettings()
LLComboBox* ctrl_reflections = getChild<LLComboBox>("Reflections");
Jonathan Yap
committed
LLTextBox* reflections_text = getChild<LLTextBox>("ReflectionsText");
LLCheckBoxCtrl* ctrl_avatar_vp = getChild<LLCheckBoxCtrl>("AvatarVertexProgram");
LLCheckBoxCtrl* ctrl_avatar_cloth = getChild<LLCheckBoxCtrl>("AvatarCloth");
LLCheckBoxCtrl* ctrl_wind_light = getChild<LLCheckBoxCtrl>("WindLightUseAtmosShaders");
LLCheckBoxCtrl* ctrl_deferred = getChild<LLCheckBoxCtrl>("UseLightShaders");
LLComboBox* ctrl_shadows = getChild<LLComboBox>("ShadowDetail");
Jonathan Yap
committed
LLTextBox* shadows_text = getChild<LLTextBox>("RenderShadowDetailText");
LLCheckBoxCtrl* ctrl_ssao = getChild<LLCheckBoxCtrl>("UseSSAO");
LLCheckBoxCtrl* ctrl_dof = getChild<LLCheckBoxCtrl>("UseDoF");
Jonathan Yap
committed
LLSliderCtrl* sky = getChild<LLSliderCtrl>("SkyMeshDetail");
LLTextBox* sky_text = getChild<LLTextBox>("SkyMeshDetailText");
// disabled windlight
if (!LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders"))
{
ctrl_wind_light->setEnabled(FALSE);
ctrl_wind_light->setValue(FALSE);
sky->setEnabled(FALSE);
sky_text->setEnabled(FALSE);
Jonathan Yap
committed
//deferred needs windlight, disable deferred
ctrl_shadows->setEnabled(FALSE);
ctrl_shadows->setValue(0);
shadows_text->setEnabled(FALSE);
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);
shadows_text->setEnabled(FALSE);
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);
shadows_text->setEnabled(FALSE);
// disabled reflections
if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderReflectionDetail"))
{
ctrl_reflections->setEnabled(FALSE);
ctrl_reflections->setValue(FALSE);
reflections_text->setEnabled(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);
shadows_text->setEnabled(FALSE);
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);
}
}
void LLFloaterPreference::refresh()
{
LLPanel::refresh();
LLAvatarComplexityControls::setText(
gSavedSettings.getU32("RenderAvatarMaxComplexity"),
getChild<LLTextBox>("IndirectMaxComplexityText", true));
refreshEnabledState();
LLFloater* advanced = LLFloaterReg::findTypedInstance<LLFloater>("prefs_graphics_advanced");
if (advanced)
{
advanced->refresh();
}
}
void LLFloaterPreferenceGraphicsAdvanced::refresh()
{
getChild<LLUICtrl>("fsaa")->setValue((LLSD::Integer) gSavedSettings.getU32("RenderFSAASamples"));
// 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));
Jonathan Yap
committed
updateSliderText(getChild<LLSliderCtrl>("TerrainDetail", true), getChild<LLTextBox>("TerrainDetailText", true));
LLAvatarComplexityControls::setIndirectControls();
setMaxNonImpostorsText(
gSavedSettings.getU32("RenderAvatarMaxNonImpostors"),
getChild<LLTextBox>("IndirectMaxNonImpostorsText", true));
LLAvatarComplexityControls::setText(
gSavedSettings.getU32("RenderAvatarMaxComplexity"),
getChild<LLTextBox>("IndirectMaxComplexityText", 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::setMouse(LLMouseHandler::EClickType click)
{
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
std::string bt_name;
std::string ctrl_value;
switch (click)
{
case LLMouseHandler::CLICK_MIDDLE:
bt_name = "middle_mouse";
ctrl_value = MIDDLE_MOUSE_CV;
break;
case LLMouseHandler::CLICK_BUTTON4:
bt_name = "button4_mouse";
ctrl_value = MOUSE_BUTTON_4_CV;
break;
case LLMouseHandler::CLICK_BUTTON5:
bt_name = "button5_mouse";
ctrl_value = MOUSE_BUTTON_5_CV;
break;
default:
break;
}
if (!ctrl_value.empty())
{
LLUICtrl* p2t_line_editor = getChild<LLUICtrl>("modifier_combo");
// We are using text control names for readability and compatibility with voice
p2t_line_editor->setControlValue(ctrl_value);
LLPanel* advanced_preferences = dynamic_cast<LLPanel*>(p2t_line_editor->getParent());
if (advanced_preferences)
{
p2t_line_editor->setValue(advanced_preferences->getString(bt_name));
}
}
}
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::getInstance()->mSettingGroups["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()
{
std::string proposed_name(gSavedPerAccountSettings.getString("InstantMessageLogPath"));
Gilbert Gonzales
committed
mPriorInstantMessageLogPath.clear();
maxim_productengine
committed
(new LLDirPickerThread(boost::bind(&LLFloaterPreference::changeLogPath, this, _1, _2), proposed_name))->getFile();
}
Gilbert Gonzales
committed
maxim_productengine
committed
void LLFloaterPreference::changeLogPath(const std::vector<std::string>& filenames, std::string proposed_name)
{
Gilbert Gonzales
committed
//Path changed
maxim_productengine
committed
if (proposed_name != filenames[0])
Gilbert Gonzales
committed
{
maxim_productengine
committed
gSavedPerAccountSettings.setString("InstantMessageLogPath", filenames[0]);
Gilbert Gonzales
committed
mPriorInstantMessageLogPath = proposed_name;
maxim_productengine
committed
// enable/disable 'Delete transcripts button
updateDeleteTranscriptsButton();
}
Mnikolenko ProductEngine
committed
}
Gilbert Gonzales
committed
bool LLFloaterPreference::moveTranscriptsAndLog()
Mnikolenko ProductEngine
committed
{
Gilbert Gonzales
committed
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
std::string instantMessageLogPath(gSavedPerAccountSettings.getString("InstantMessageLogPath"));
std::string chatLogPath = gDirUtilp->add(instantMessageLogPath, gDirUtilp->getUserName());
bool madeDirectory = false;
//Does the directory really exist, if not then make it
if(!LLFile::isdir(chatLogPath))
{
//mkdir success is defined as zero
if(LLFile::mkdir(chatLogPath) != 0)
{
return false;
}
madeDirectory = true;
}
std::string originalConversationLogDir = LLConversationLog::instance().getFileName();
std::string targetConversationLogDir = gDirUtilp->add(chatLogPath, "conversation.log");
//Try to move the conversation log
if(!LLConversationLog::instance().moveLog(originalConversationLogDir, targetConversationLogDir))
{
//Couldn't move the log and created a new directory so remove the new directory
if(madeDirectory)
{
LLFile::rmdir(chatLogPath);
}
return false;
}
//Attempt to move transcripts
std::vector<std::string> listOfTranscripts;
std::vector<std::string> listOfFilesMoved;
LLLogChat::getListOfTranscriptFiles(listOfTranscripts);
if(!LLLogChat::moveTranscripts(gDirUtilp->getChatLogsDir(),
instantMessageLogPath,
listOfTranscripts,
listOfFilesMoved))
{
//Couldn't move all the transcripts so restore those that moved back to their old location
LLLogChat::moveTranscripts(instantMessageLogPath,
gDirUtilp->getChatLogsDir(),
listOfFilesMoved);
//Move the conversation log back
LLConversationLog::instance().moveLog(targetConversationLogDir, originalConversationLogDir);
if(madeDirectory)
{
LLFile::rmdir(chatLogPath);
}
return false;
}
gDirUtilp->setChatLogsDir(instantMessageLogPath);
maksymsproductengine
committed
gDirUtilp->updatePerAccountChatLogsDir();
Gilbert Gonzales
committed
return true;
Rider Linden
committed
void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im_via_email, bool is_verified_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("friends_online_notify_checkbox")->setEnabled(TRUE);
getChild<LLUICtrl>("online_visibility")->setValue(mOriginalHideOnlineStatus);
getChild<LLUICtrl>("online_visibility")->setLabelArg("[DIR_VIS]", mDirectoryVisibility);
Rider Linden
committed
getChildView("send_im_to_email")->setEnabled(is_verified_email);
std::string tooltip;
if (!is_verified_email)
tooltip = getString("email_unverified_tooltip");
getChildView("send_im_to_email")->setToolTip(tooltip);
Rider Linden
committed
// *TODO: Show or hide verify email text here based on is_verified_email
getChild<LLUICtrl>("send_im_to_email")->setValue(im_via_email);
Andrew Productengine
committed
getChildView("favorites_on_login_check")->setEnabled(TRUE);
getChildView("log_path_button")->setEnabled(TRUE);
getChildView("chat_font_size")->setEnabled(TRUE);
getChildView("conversation_log_combo")->setEnabled(TRUE);
Mnikolenko Productengine
committed
getChild<LLUICtrl>("voice_call_friends_only_check")->setEnabled(TRUE);
getChild<LLUICtrl>("voice_call_friends_only_check")->setValue(gSavedPerAccountSettings.getBOOL("VoiceCallsFriendsOnly"));
}
callum_linden
committed
void LLFloaterPreference::refreshUI()
void LLFloaterPreferenceGraphicsAdvanced::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box)
if (text_box == NULL || ctrl== NULL)
// 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);
Jonathan Yap
committed
// 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 LLFloaterPreferenceGraphicsAdvanced::updateMaxNonImpostors()
// Called when the IndirectMaxNonImpostors control changes
// Responsible for fixing the slider label (IndirectMaxNonImpostorsText) and setting RenderAvatarMaxNonImpostors
LLSliderCtrl* ctrl = getChild<LLSliderCtrl>("IndirectMaxNonImpostors",true);
U32 value = ctrl->getValue().asInteger();
if (0 == value || LLVOAvatar::IMPOSTORS_OFF <= value)
gSavedSettings.setU32("RenderAvatarMaxNonImpostors", value);
LLVOAvatar::updateImpostorRendering(value); // make it effective immediately
setMaxNonImpostorsText(value, getChild<LLTextBox>("IndirectMaxNonImpostorsText"));
void LLFloaterPreferenceGraphicsAdvanced::setMaxNonImpostorsText(U32 value, LLTextBox* text_box)
{
text_box->setText(LLTrans::getString("no_limit"));
}
else
{
text_box->setText(llformat("%d", value));
void LLAvatarComplexityControls::updateMax(LLSliderCtrl* slider, LLTextBox* value_label)
Jonathan Yap
committed
{
// Called when the IndirectMaxComplexity control changes
// Responsible for fixing the slider label (IndirectMaxComplexityText) and setting RenderAvatarMaxComplexity
U32 indirect_value = slider->getValue().asInteger();
U32 max_arc;
if (INDIRECT_MAX_ARC_OFF == indirect_value)
{
// The 'off' position is when the slider is all the way to the right,
// which is a value of INDIRECT_MAX_ARC_OFF,
// so it is necessary to set max_arc to 0 disable muted avatars.
max_arc = 0;
}
else
{
// if this is changed, the inverse calculation in setIndirectMaxArc
// must be changed to match
max_arc = (U32)ll_round(exp(MIN_ARC_LOG + (ARC_LIMIT_MAP_SCALE * (indirect_value - MIN_INDIRECT_ARC_LIMIT))));
gSavedSettings.setU32("RenderAvatarMaxComplexity", (U32)max_arc);
setText(max_arc, value_label);
Jonathan Yap
committed
void LLAvatarComplexityControls::setText(U32 value, LLTextBox* text_box)
Jonathan Yap
committed
{
text_box->setText(LLTrans::getString("no_limit"));
Jonathan Yap
committed
}
else
{
text_box->setText(llformat("%d", value));
}
void LLFloaterPreference::updateMaxComplexity()
{
// Called when the IndirectMaxComplexity control changes
LLAvatarComplexityControls::updateMax(
getChild<LLSliderCtrl>("IndirectMaxComplexity"),
getChild<LLTextBox>("IndirectMaxComplexityText"));
LLFloaterPreferenceGraphicsAdvanced* floater_graphics_advanced = LLFloaterReg::findTypedInstance<LLFloaterPreferenceGraphicsAdvanced>("prefs_graphics_advanced");
if (floater_graphics_advanced)
{
LLAvatarComplexityControls::updateMax(
floater_graphics_advanced->getChild<LLSliderCtrl>("IndirectMaxComplexity"),
floater_graphics_advanced->getChild<LLTextBox>("IndirectMaxComplexityText"));
}
andreykproductengine
committed
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
bool LLFloaterPreference::loadFromFilename(const std::string& filename, std::map<std::string, std::string> &label_map)
{
LLXMLNodePtr root;
if (!LLXMLNode::parseFile(filename, root, NULL))
{
LL_WARNS() << "Unable to parse file " << filename << LL_ENDL;
return false;
}
if (!root->hasName("labels"))
{
LL_WARNS() << filename << " is not a valid definition file" << LL_ENDL;
return false;
}
LabelTable params;
LLXUIParser parser;
parser.readXUI(root, params, filename);
if (params.validateBlock())
{
for (LLInitParam::ParamIterator<LabelDef>::const_iterator it = params.labels.begin();
it != params.labels.end();
++it)
{
LabelDef label_entry = *it;
label_map[label_entry.name] = label_entry.value;
}
}
else
{
LL_WARNS() << filename << " failed to load" << LL_ENDL;
return false;
}
return true;
}
void LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity()
{
// Called when the IndirectMaxComplexity control changes
LLAvatarComplexityControls::updateMax(
getChild<LLSliderCtrl>("IndirectMaxComplexity"),
getChild<LLTextBox>("IndirectMaxComplexityText"));
LLFloaterPreference* floater_preferences = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
if (floater_preferences)
{
LLAvatarComplexityControls::updateMax(
floater_preferences->getChild<LLSliderCtrl>("IndirectMaxComplexity"),
floater_preferences->getChild<LLTextBox>("IndirectMaxComplexityText"));
}
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);
}
std::string get_category_path(LLUUID cat_id)
{
LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
std::string localized_cat_name;
if (!LLTrans::findString(localized_cat_name, "InvFolder " + cat->getName()))
{
localized_cat_name = cat->getName();
}
if (cat->getParentUUID().notNull())
{
return get_category_path(cat->getParentUUID()) + " > " + localized_cat_name;
}
else
{
}
}
std::string get_category_path(LLFolderType::EType cat_type)
{
LLUUID cat_id = gInventory.findUserDefinedCategoryUUIDForType(cat_type);
return get_category_path(cat_id);
}
void LLFloaterPreference::onChangeModelFolder()
{
if (gInventory.isInventoryUsable())
{
getChild<LLTextBox>("upload_models")->setText(get_category_path(LLFolderType::FT_OBJECT));
}
}
void LLFloaterPreference::onChangeTextureFolder()
{
if (gInventory.isInventoryUsable())
{
getChild<LLTextBox>("upload_textures")->setText(get_category_path(LLFolderType::FT_TEXTURE));
}
}
void LLFloaterPreference::onChangeSoundFolder()
{
if (gInventory.isInventoryUsable())
{
getChild<LLTextBox>("upload_sounds")->setText(get_category_path(LLFolderType::FT_SOUND));
}
}
void LLFloaterPreference::onChangeAnimationFolder()
{
if (gInventory.isInventoryUsable())
{
getChild<LLTextBox>("upload_animation")->setText(get_category_path(LLFolderType::FT_ANIMATION));
}
}
// 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_people",
LLSD().with("people_panel_tab_name", "blocked_panel"));
}
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
}
void LLFloaterPreference::onClickRenderExceptions()
{
LLFloaterReg::showInstance("avatar_render_settings");
}
void LLFloaterPreference::onClickAdvanced()
{
LLFloaterReg::showInstance("prefs_graphics_advanced");
AndreyL ProductEngine
committed
LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
for (child_list_t::const_iterator iter = tabcontainer->getChildList()->begin();
iter != tabcontainer->getChildList()->end(); ++iter)
{
LLView* view = *iter;
LLPanelPreferenceGraphics* panel = dynamic_cast<LLPanelPreferenceGraphics*>(view);
if (panel)
{
panel->resetDirtyChilds();
}
}
}
Vadim ProductEngine
committed
void LLFloaterPreference::onClickActionChange()
{
mClickActionDirty = true;
}
void LLFloaterPreference::onClickPermsDefault()
{
LLFloaterReg::showInstance("perms_default");
}
void LLFloaterPreference::onClickRememberedUsernames()
{
LLFloaterReg::showInstance("forget_username");
}
maksymsproductengine
committed
void LLFloaterPreference::onDeleteTranscripts()
{
Gilbert Gonzales
committed
LLSD args;
args["FOLDER"] = gDirUtilp->getUserName();
LLNotificationsUtil::add("PreferenceChatDeleteTranscripts", args, LLSD(), boost::bind(&LLFloaterPreference::onDeleteTranscriptsResponse, this, _1, _2));
maksymsproductengine
committed
}
void LLFloaterPreference::onDeleteTranscriptsResponse(const LLSD& notification, const LLSD& response)
{
if (0 == LLNotificationsUtil::getSelectedOption(notification, response))
{
maksymsproductengine
committed
LLLogChat::deleteTranscripts();
Mnikolenko ProductEngine
committed
updateDeleteTranscriptsButton();
maksymsproductengine
committed
}
}
void LLFloaterPreference::onLogChatHistorySaved()
{
LLButton * delete_transcripts_buttonp = getChild<LLButton>("delete_transcripts");
if (!delete_transcripts_buttonp->getEnabled())
{
delete_transcripts_buttonp->setEnabled(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);
}
void LLFloaterPreference::selectPanel(const LLSD& name)
{
LLTabContainer * tab_containerp = getChild<LLTabContainer>("pref core");
LLPanel * panel = tab_containerp->getPanelByName(name);
if (NULL != panel)
{
tab_containerp->selectTabPanel(panel);
}
}
void LLFloaterPreference::selectPrivacyPanel()
{
selectPanel("im");
}
void LLFloaterPreference::selectChatPanel()
{
selectPanel("chat");
}
maksymsproductengine
committed
void LLFloaterPreference::changed()
{
getChild<LLButton>("clear_log")->setEnabled(LLConversationLog::instance().getConversations().size() > 0);
Mnikolenko ProductEngine
committed
// set 'enable' property for 'Delete transcripts...' button
updateDeleteTranscriptsButton();
maksymsproductengine
committed
}
AndreyL ProductEngine
committed
void LLFloaterPreference::saveGraphicsPreset(std::string& preset)
{
mSavedGraphicsPreset = preset;
}
Paul ProductEngine
committed
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
//------------------------------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 LLPanelInjector<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));
mCommitCallbackRegistrar.add("Pref.PrefDelete", boost::bind(&LLPanelPreference::deletePreset, this, _2));
mCommitCallbackRegistrar.add("Pref.PrefSave", boost::bind(&LLPanelPreference::savePreset, this, _2));
mCommitCallbackRegistrar.add("Pref.PrefLoad", boost::bind(&LLPanelPreference::loadPreset, this, _2));
James Cook
committed
}
//virtual
BOOL LLPanelPreference::postBuild()
{
////////////////////// PanelGeneral ///////////////////
AlexanderP ProductEngine
committed
if (hasChild("display_names_check", TRUE))
{
BOOL use_people_api = gSavedSettings.getBOOL("UsePeopleAPI");
LLCheckBoxCtrl* ctrl_display_name = getChild<LLCheckBoxCtrl>("display_names_check");
ctrl_display_name->setEnabled(use_people_api);
if (!use_people_api)
{
ctrl_display_name->setValue(FALSE);
}
}
////////////////////// PanelVoice ///////////////////
AlexanderP ProductEngine
committed
if (hasChild("voice_unavailable", TRUE))
BOOL voice_disabled = gSavedSettings.getBOOL("CmdLineDisableVoice");
getChildView("voice_unavailable")->setVisible( voice_disabled);
getChildView("enable_voice_check")->setVisible( !voice_disabled);
//////////////////////PanelPrivacy ///////////////////
AlexanderP ProductEngine
committed
if (hasChild("media_enabled", TRUE))
{
bool media_enabled = gSavedSettings.getBOOL("AudioStreamingMedia");
Igor Borovkov
committed
getChild<LLCheckBoxCtrl>("media_enabled")->set(media_enabled);
getChild<LLCheckBoxCtrl>("autoplay_enabled")->setEnabled(media_enabled);
}
AlexanderP ProductEngine
committed
if (hasChild("music_enabled", TRUE))
{
getChild<LLCheckBoxCtrl>("music_enabled")->set(gSavedSettings.getBOOL("AudioStreamingMusic"));
AlexanderP ProductEngine
committed
if (hasChild("voice_call_friends_only_check", TRUE))
Igor Borovkov
committed
{
getChild<LLCheckBoxCtrl>("voice_call_friends_only_check")->setCommitCallback(boost::bind(&showFriendsOnlyWarning, _1, _2));
}
maxim_productengine
committed
if (hasChild("allow_multiple_viewer_check", TRUE))
{
getChild<LLCheckBoxCtrl>("allow_multiple_viewer_check")->setCommitCallback(boost::bind(&showMultipleViewersWarning, _1, _2));
}
AlexanderP ProductEngine
committed
if (hasChild("favorites_on_login_check", TRUE))
Andrew Productengine
committed
{
Mnikolenko ProductEngine
committed
getChild<LLCheckBoxCtrl>("favorites_on_login_check")->setCommitCallback(boost::bind(&handleFavoritesOnLoginChanged, _1, _2));
callum_linden
committed
bool show_favorites_at_login = LLPanelLogin::getShowFavorites();
getChild<LLCheckBoxCtrl>("favorites_on_login_check")->setValue(show_favorites_at_login);
Andrew Productengine
committed
}
maxim_productengine
committed
if (hasChild("mute_chb_label", TRUE))
{
getChild<LLTextBox>("mute_chb_label")->setShowCursorHand(false);
maxim_productengine
committed
getChild<LLTextBox>("mute_chb_label")->setSoundFlags(LLView::MOUSE_UP);
maxim_productengine
committed
getChild<LLTextBox>("mute_chb_label")->setClickedCallback(boost::bind(&toggleMuteWhenMinimized));
}
Igor Borovkov
committed
//////////////////////PanelAdvanced ///////////////////
AlexanderP ProductEngine
committed
if (hasChild("modifier_combo", TRUE))
{
//localizing if push2talk button is set to middle mouse
std::string modifier_value = getChild<LLUICtrl>("modifier_combo")->getValue().asString();
if (MIDDLE_MOUSE_CV == modifier_value)
getChild<LLUICtrl>("modifier_combo")->setValue(getString("middle_mouse"));
else if (MOUSE_BUTTON_4_CV == modifier_value)
{
getChild<LLUICtrl>("modifier_combo")->setValue(getString("button4_mouse"));
}
else if (MOUSE_BUTTON_5_CV == modifier_value)
{
getChild<LLUICtrl>("modifier_combo")->setValue(getString("button5_mouse"));
}
}
Paul ProductEngine
committed
//////////////////////PanelSetup ///////////////////
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));
}
#ifdef EXTERNAL_TOS
LLRadioGroup* ext_browser_settings = getChild<LLRadioGroup>("preferred_browser_behavior");
if (ext_browser_settings)
{
// turn off ability to set external/internal browser
ext_browser_settings->setSelectedByValue(LLWeb::BROWSER_EXTERNAL_ONLY, true);
ext_browser_settings->setEnabled(false);
}
#endif
apply();
return true;
Paul ProductEngine
committed
LLPanelPreference::~LLPanelPreference()
{
if (mBandWidthUpdater)
{
delete mBandWidthUpdater;
}
}
void LLPanelPreference::apply()
{
// no-op
}
void LLPanelPreference::saveSettings()
LLFloater* advanced = LLFloaterReg::findTypedInstance<LLFloater>("prefs_graphics_advanced");
// Save the value of all controls in the hierarchy
mSavedValues.clear();
std::list<LLView*> view_stack;
view_stack.push_back(this);
if (advanced)
{
view_stack.push_back(advanced);
}
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);
}
maxim_productengine
committed
void LLPanelPreference::showMultipleViewersWarning(LLUICtrl* checkbox, const LLSD& value)
{
if (checkbox && checkbox->getValue())
{
LLNotificationsUtil::add("AllowMultipleViewers");
}
}
Igor Borovkov
committed
void LLPanelPreference::showFriendsOnlyWarning(LLUICtrl* checkbox, const LLSD& value)
{
Mnikolenko Productengine
committed
if (checkbox)
Igor Borovkov
committed
{
Mnikolenko Productengine
committed
gSavedPerAccountSettings.setBOOL("VoiceCallsFriendsOnly", checkbox->getValue().asBoolean());
if (checkbox->getValue())
{
LLNotificationsUtil::add("FriendsAndGroupsOnly");
}
Igor Borovkov
committed
}
}
Mnikolenko ProductEngine
committed
void LLPanelPreference::handleFavoritesOnLoginChanged(LLUICtrl* checkbox, const LLSD& value)
Andrew Productengine
committed
{
Mnikolenko ProductEngine
committed
if (checkbox)
Andrew Productengine
committed
{
Mnikolenko ProductEngine
committed
LLFavoritesOrderStorage::instance().showFavoritesOnLoginChanged(checkbox->getValue().asBoolean());
if(checkbox->getValue())
{
LLNotificationsUtil::add("FavoritesOnLogin");
}
Andrew Productengine
committed
}
}
maxim_productengine
committed
void LLPanelPreference::toggleMuteWhenMinimized()
{
std::string mute("MuteWhenMinimized");
gSavedSettings.setBOOL(mute, !gSavedSettings.getBOOL(mute));
maxim_productengine
committed
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
if (instance)
{
instance->getChild<LLCheckBoxCtrl>("mute_when_minimized")->setBtnFocus();
}
maxim_productengine
committed
}
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;
Mnikolenko ProductEngine
committed
if((control->getName() == "InstantMessageLogPath") && (ctrl_value.asString() == ""))
{
continue;
}
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_combo")->setEnabled(music_enabled || media_enabled);
paul_productengine
committed
}
}
Ychebotarev ProductEngine
committed
void LLPanelPreference::deletePreset(const LLSD& user_data)
Mnikolenko Productengine
committed
LLFloaterReg::showInstance("delete_pref_preset", user_data.asString());
void LLPanelPreference::savePreset(const LLSD& user_data)
Mnikolenko Productengine
committed
LLFloaterReg::showInstance("save_pref_preset", user_data.asString());
void LLPanelPreference::loadPreset(const LLSD& user_data)
Mnikolenko Productengine
committed
LLFloaterReg::showInstance("load_pref_preset", user_data.asString());
void LLPanelPreference::setHardwareDefaults()
{
}
Vadim ProductEngine
committed
class LLPanelPreferencePrivacy : public LLPanelPreference
{
public:
LLPanelPreferencePrivacy()
{
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()
{
LLFloaterReg::showInstance("prefs_graphics_advanced");
LLFloaterReg::hideInstance("prefs_graphics_advanced");
Jonathan Yap
committed
resetDirtyChilds();
setPresetText();
Jonathan Yap
committed
Oz Linden
committed
LLPresetsManager* presetsMgr = LLPresetsManager::getInstance();
presetsMgr->setPresetListChangeCallback(boost::bind(&LLPanelPreferenceGraphics::onPresetsListChange, this));
presetsMgr->createMissingDefault(PRESETS_GRAPHIC); // a no-op after the first time, but that's ok
Oz Linden
committed
Ychebotarev ProductEngine
committed
return LLPanelPreference::postBuild();
}
Ychebotarev ProductEngine
committed
void LLPanelPreferenceGraphics::draw()
{
setPresetText();
Ychebotarev ProductEngine
committed
LLPanelPreference::draw();
void LLPanelPreferenceGraphics::onPresetsListChange()
{
resetDirtyChilds();
setPresetText();
AndreyL ProductEngine
committed
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
if (instance && !gSavedSettings.getString("PresetGraphicActive").empty())
{
instance->saveSettings(); //make cancel work correctly after changing the preset
}
void LLPanelPreferenceGraphics::setPresetText()
LLTextBox* preset_text = getChild<LLTextBox>("preset_text");
std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive");
AndreyL ProductEngine
committed
if (!preset_graphic_active.empty() && preset_graphic_active != preset_text->getText())
Ychebotarev ProductEngine
committed
{
AndreyL ProductEngine
committed
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
if (instance)
{
instance->saveGraphicsPreset(preset_graphic_active);
}
AndreyL ProductEngine
committed
}
if (hasDirtyChilds() && !preset_graphic_active.empty())
{
gSavedSettings.setString("PresetGraphicActive", "");
preset_graphic_active.clear();
Jonathan Yap
committed
// This doesn't seem to cause an infinite recursion. This trigger is needed to cause the pulldown
// panel to update.
LLPresetsManager::getInstance()->triggerChangeSignal();
Ychebotarev ProductEngine
committed
if (!preset_graphic_active.empty())
{
if (preset_graphic_active == PRESETS_DEFAULT)
{
Ansariel
committed
preset_graphic_active = LLTrans::getString(PRESETS_DEFAULT);
}
preset_text->setText(preset_graphic_active);
}
else
{
preset_text->setText(LLTrans::getString("none_paren_cap"));
Ychebotarev ProductEngine
committed
}
preset_text->resetDirty();
Ychebotarev ProductEngine
committed
}
Ychebotarev ProductEngine
committed
bool LLPanelPreferenceGraphics::hasDirtyChilds()
{
LLFloater* advanced = LLFloaterReg::findTypedInstance<LLFloater>("prefs_graphics_advanced");
Ychebotarev ProductEngine
committed
std::list<LLView*> view_stack;
view_stack.push_back(this);
if (advanced)
{
view_stack.push_back(advanced);
}
Ychebotarev ProductEngine
committed
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)
{
std::string control_name = control->getName();
if (!control_name.empty())
{
return true;
}
}
Ychebotarev ProductEngine
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);
}
Jonathan Yap
committed
}
Ychebotarev ProductEngine
committed
return false;
}
void LLPanelPreferenceGraphics::resetDirtyChilds()
{
LLFloater* advanced = LLFloaterReg::findTypedInstance<LLFloater>("prefs_graphics_advanced");
Ychebotarev ProductEngine
committed
std::list<LLView*> view_stack;
view_stack.push_back(this);
if (advanced)
{
view_stack.push_back(advanced);
}
Ychebotarev ProductEngine
committed
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()
{
LLPanelPreference::cancel();
}
void LLPanelPreferenceGraphics::saveSettings()
{
resetDirtyChilds();
std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive");
if (preset_graphic_active.empty())
maxim_productengine
committed
{
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
if (instance)
{
//don't restore previous preset after closing Preferences
instance->saveGraphicsPreset(preset_graphic_active);
maxim_productengine
committed
}
}
Ychebotarev ProductEngine
committed
LLPanelPreference::saveSettings();
}
void LLPanelPreferenceGraphics::setHardwareDefaults()
{
resetDirtyChilds();
}
LLFloaterPreferenceGraphicsAdvanced::LLFloaterPreferenceGraphicsAdvanced(const LLSD& key)
: LLFloater(key)
{
mCommitCallbackRegistrar.add("Pref.RenderOptionUpdate", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onRenderOptionEnable, this));
mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxNonImpostors", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxNonImpostors,this));
mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity,this));
}
LLFloaterPreferenceGraphicsAdvanced::~LLFloaterPreferenceGraphicsAdvanced()
{
}
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));
andreykproductengine
committed
BOOL LLFloaterPreferenceGraphicsAdvanced::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");
}
ruslantproductengine
committed
LLCheckBoxCtrl *use_HiDPI = getChild<LLCheckBoxCtrl>("use HiDPI");
use_HiDPI->setVisible(FALSE);
andreykproductengine
committed
#endif
return TRUE;
}
Mnikolenko ProductEngine
committed
void LLFloaterPreferenceGraphicsAdvanced::onOpen(const LLSD& key)
{
refresh();
}
AndreyL ProductEngine
committed
void LLFloaterPreferenceGraphicsAdvanced::onClickCloseBtn(bool app_quitting)
{
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
if (instance)
{
instance->cancel();
}
Mnikolenko Productengine
committed
updateMaxComplexity();
AndreyL ProductEngine
committed
}
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)
{
Mnikolenko ProductEngine
committed
if(app_quitting)
{
cancel();
}
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
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
// 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();
Mnikolenko ProductEngine
committed
void LLFloaterPreferenceProxy::onClickCloseBtn(bool app_quitting)
{
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);
}
Mnikolenko ProductEngine
committed
mSocksSettingsDirty = false;
Logan Dethrow
committed
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
}
Graham Madarasz (Graham)
committed
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
void LLFloaterPreference::onUpdateFilterTerm(bool force)
{
LLWString seachValue = utf8str_to_wstring( mFilterEdit->getValue() );
LLWStringUtil::toLower( seachValue );
if( !mSearchData || (mSearchData->mLastFilter == seachValue && !force))
return;
mSearchData->mLastFilter = seachValue;
if( !mSearchData->mRootTab )
return;
mSearchData->mRootTab->hightlightAndHide( seachValue );
LLTabContainer *pRoot = getChild< LLTabContainer >( "pref core" );
if( pRoot )
pRoot->selectFirstTab();
}
void collectChildren( LLView const *aView, ll::prefs::PanelDataPtr aParentPanel, ll::prefs::TabContainerDataPtr aParentTabContainer )
{
if( !aView )
return;
llassert_always( aParentPanel || aParentTabContainer );
LLView::child_list_const_iter_t itr = aView->beginChild();
LLView::child_list_const_iter_t itrEnd = aView->endChild();
while( itr != itrEnd )
{
LLView *pView = *itr;
ll::prefs::PanelDataPtr pCurPanelData = aParentPanel;
ll::prefs::TabContainerDataPtr pCurTabContainer = aParentTabContainer;
if( !pView )
continue;
LLPanel const *pPanel = dynamic_cast< LLPanel const *>( pView );
LLTabContainer const *pTabContainer = dynamic_cast< LLTabContainer const *>( pView );
ll::ui::SearchableControl const *pSCtrl = dynamic_cast< ll::ui::SearchableControl const *>( pView );
if( pTabContainer )
{
pCurPanelData.reset();
pCurTabContainer = ll::prefs::TabContainerDataPtr( new ll::prefs::TabContainerData );
pCurTabContainer->mTabContainer = const_cast< LLTabContainer *>( pTabContainer );
pCurTabContainer->mLabel = pTabContainer->getLabel();
pCurTabContainer->mPanel = 0;
if( aParentPanel )
aParentPanel->mChildPanel.push_back( pCurTabContainer );
if( aParentTabContainer )
aParentTabContainer->mChildPanel.push_back( pCurTabContainer );
}
else if( pPanel )
{
pCurTabContainer.reset();
pCurPanelData = ll::prefs::PanelDataPtr( new ll::prefs::PanelData );
pCurPanelData->mPanel = pPanel;
pCurPanelData->mLabel = pPanel->getLabel();
llassert_always( aParentPanel || aParentTabContainer );
if( aParentTabContainer )
aParentTabContainer->mChildPanel.push_back( pCurPanelData );
else if( aParentPanel )
aParentPanel->mChildPanel.push_back( pCurPanelData );
}
else if( pSCtrl && pSCtrl->getSearchText().size() )
{
ll::prefs::SearchableItemPtr item = ll::prefs::SearchableItemPtr( new ll::prefs::SearchableItem() );
item->mView = pView;
item->mCtrl = pSCtrl;
item->mLabel = utf8str_to_wstring( pSCtrl->getSearchText() );
LLWStringUtil::toLower( item->mLabel );
llassert_always( aParentPanel || aParentTabContainer );
if( aParentPanel )
aParentPanel->mChildren.push_back( item );
if( aParentTabContainer )
aParentTabContainer->mChildren.push_back( item );
}
collectChildren( pView, pCurPanelData, pCurTabContainer );
++itr;
}
}
void LLFloaterPreference::collectSearchableItems()
{
mSearchData.reset( nullptr );
LLTabContainer *pRoot = getChild< LLTabContainer >( "pref core" );
if( mFilterEdit && pRoot )
{
mSearchData.reset(new ll::prefs::SearchData() );
ll::prefs::TabContainerDataPtr pRootTabcontainer = ll::prefs::TabContainerDataPtr( new ll::prefs::TabContainerData );
pRootTabcontainer->mTabContainer = pRoot;
pRootTabcontainer->mLabel = pRoot->getLabel();
mSearchData->mRootTab = pRootTabcontainer;
collectChildren( this, ll::prefs::PanelDataPtr(), pRootTabcontainer );
}
}