Newer
Older
LLSetKeyBindDialog* dialog = LLFloaterReg::getTypedInstance<LLSetKeyBindDialog>("keybind_dialog", LLSD());
if (dialog)
{
mEditingControl = control;
mEditingColumn = cell_ind;
andreykproductengine
committed
dialog->setParent(this, pControlsTable, DEFAULT_KEY_FILTER);
LLFloater* root_floater = gFloaterView->getParentFloater(this);
if (root_floater)
root_floater->addDependentFloater(dialog);
dialog->openFloater();
dialog->setFocus(TRUE);
}
}
else
pControlsTable->deselectAllItems();
void LLPanelPreferenceControls::onModeCommit()
mEditingMode = pKeyModeBox->getValue().asInteger();
if (mConflictHandler[mEditingMode].empty())
{
// opening for first time
mConflictHandler[mEditingMode].loadFromSettings((LLKeyConflictHandler::ESourceMode)mEditingMode);
}
populateControlTable();
andreykproductengine
committed
{
LLNotificationsUtil::add("PreferenceControlsDefaults", LLSD(), LLSD(), boost::bind(&LLPanelPreferenceControls::onRestoreDefaultsResponse, this, _1, _2));
}
void LLPanelPreferenceControls::onRestoreDefaultsResponse(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
switch(option)
andreykproductengine
committed
{
case 0: // All
for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i)
{
mConflictHandler[i].resetToDefaults();
// Apply changes to viewer as 'temporary'
mConflictHandler[i].saveToSettings(true);
Andrey Kleshchev
committed
// notify comboboxes in move&view about potential change
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
if (instance)
{
instance->updateClickActionViews();
}
}
updateTable();
break;
case 1: // Current
mConflictHandler[mEditingMode].resetToDefaults();
// Apply changes to viewer as 'temporary'
Andrey Kleshchev
committed
if (mEditingMode == LLKeyConflictHandler::MODE_THIRD_PERSON)
{
// notify comboboxes in move&view about potential change
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
if (instance)
{
instance->updateClickActionViews();
}
}
updateTable();
break;
case 2: // Cancel
default:
//exit;
break;
}
andreykproductengine
committed
}
Andrey Kleshchev
committed
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
// Bypass to let Move & view read values without need to create own key binding handler
// Assumes third person view
// Might be better idea to just move whole mConflictHandler into LLFloaterPreference
bool LLPanelPreferenceControls::canKeyBindHandle(const std::string &control, EMouseClickType click, KEY key, MASK mask)
{
S32 mode = LLKeyConflictHandler::MODE_THIRD_PERSON;
if (mConflictHandler[mode].empty())
{
// opening for first time
mConflictHandler[mode].loadFromSettings(LLKeyConflictHandler::MODE_THIRD_PERSON);
}
return mConflictHandler[mode].canHandleControl(control, click, key, mask);
}
// Bypass to let Move & view modify values without need to create own key binding handler
// Assumes third person view
// Might be better idea to just move whole mConflictHandler into LLFloaterPreference
void LLPanelPreferenceControls::setKeyBind(const std::string &control, EMouseClickType click, KEY key, MASK mask, bool set)
{
S32 mode = LLKeyConflictHandler::MODE_THIRD_PERSON;
if (mConflictHandler[mode].empty())
{
// opening for first time
mConflictHandler[mode].loadFromSettings(LLKeyConflictHandler::MODE_THIRD_PERSON);
}
if (!mConflictHandler[mode].canAssignControl(mEditingControl))
{
return;
}
bool already_recorded = mConflictHandler[mode].canHandleControl(control, click, key, mask);
if (set)
{
if (already_recorded)
{
// nothing to do
return;
}
// find free spot to add data, if no free spot, assign to first
S32 index = 0;
for (S32 i = 0; i < 3; i++)
{
if (mConflictHandler[mode].getControl(control, i).isEmpty())
{
index = i;
break;
}
}
mConflictHandler[mode].registerControl(control, index, click, key, mask, true);
}
else if (!set)
{
if (!already_recorded)
{
// nothing to do
return;
}
// find specific control and reset it
for (S32 i = 0; i < 3; i++)
{
LLKeyData data = mConflictHandler[mode].getControl(control, i);
if (data.mMouse == click && data.mKey == key && data.mMask == mask)
{
mConflictHandler[mode].clearControl(control, i);
}
}
}
}
void LLPanelPreferenceControls::updateAndApply()
{
S32 mode = LLKeyConflictHandler::MODE_THIRD_PERSON;
mConflictHandler[mode].saveToSettings(true);
updateTable();
}
Andrey Kleshchev
committed
// from LLSetKeybindDialog's interface
bool LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MASK mask, bool all_modes)
if (!mConflictHandler[mEditingMode].canAssignControl(mEditingControl))
return true;
if (all_modes)
{
for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i)
{
if (mConflictHandler[i].empty())
{
mConflictHandler[i].loadFromSettings((LLKeyConflictHandler::ESourceMode)i);
}
mConflictHandler[i].registerControl(mEditingControl, mEditingColumn - 1, click, key, mask, true);
// Apply changes to viewer as 'temporary'
mConflictHandler[i].saveToSettings(true);
}
}
else
{
mConflictHandler[mEditingMode].registerControl(mEditingControl, mEditingColumn - 1, click, key, mask, true);
// Apply changes to viewer as 'temporary'
mConflictHandler[mEditingMode].saveToSettings(true);
}
Andrey Kleshchev
committed
if ((mEditingMode == LLKeyConflictHandler::MODE_THIRD_PERSON || all_modes)
&& (mEditingControl == "walk_to"
|| mEditingControl == "teleport_to"
|| click == CLICK_LEFT
|| click == CLICK_DOUBLELEFT))
{
// notify comboboxes in move&view about potential change
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
if (instance)
{
instance->updateClickActionViews();
}
}
return true;
void LLPanelPreferenceControls::onDefaultKeyBind(bool all_modes)
if (!mConflictHandler[mEditingMode].canAssignControl(mEditingControl))
if (all_modes)
{
for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i)
{
if (mConflictHandler[i].empty())
{
mConflictHandler[i].loadFromSettings((LLKeyConflictHandler::ESourceMode)i);
}
mConflictHandler[i].resetToDefault(mEditingControl, mEditingColumn - 1);
// Apply changes to viewer as 'temporary'
mConflictHandler[i].saveToSettings(true);
}
}
else
{
mConflictHandler[mEditingMode].resetToDefault(mEditingControl, mEditingColumn - 1);
// Apply changes to viewer as 'temporary'
mConflictHandler[mEditingMode].saveToSettings(true);
}
Andrey Kleshchev
committed
if (mEditingMode == LLKeyConflictHandler::MODE_THIRD_PERSON || all_modes)
{
// notify comboboxes in move&view about potential change
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
if (instance)
{
instance->updateClickActionViews();
}
}
void LLPanelPreferenceControls::onCancelKeyBind()
{
pControlsTable->deselectAllItems();
LLFloaterPreferenceGraphicsAdvanced::LLFloaterPreferenceGraphicsAdvanced(const LLSD& 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)
: LLFloater(key),
mSocksSettingsDirty(false)
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();
}
AndreyL ProductEngine
committed
}
LLFloaterPreferenceProxy::~LLFloaterPreferenceProxy()
{
}
BOOL LLFloaterPreferenceProxy::postBuild()
{
LLRadioGroup* socksAuth = getChild<LLRadioGroup>("socks5_auth_type");
if (!socksAuth)
{
return FALSE;
}
if (socksAuth->getSelectedValue().asString() == "None")
{
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());
}
return TRUE;
}
void LLFloaterPreferenceProxy::onOpen(const LLSD& key)
{
}
void LLFloaterPreferenceProxy::onClose(bool app_quitting)
{
if(app_quitting)
{
cancel();
}
Mnikolenko ProductEngine
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)
{
LLNotifications::instance().add("ChangeProxySettings", LLSD(), LLSD());
mSocksSettingsDirty = false; // we have notified the user now be quiet again
}
}
}
void LLFloaterPreferenceProxy::saveSettings()
{
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
// 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()
{
3400
3401
3402
3403
3404
3405
3406
3407
3408
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
// 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);
}
closeFloater(false);
}
void LLFloaterPreferenceProxy::onBtnCancel()
{
if (hasFocus())
{
LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
if (cur_focus && cur_focus->acceptsTextInput())
{
cur_focus->onCommit();
}
refresh();
}
Logan Dethrow
committed
Mnikolenko ProductEngine
committed
void LLFloaterPreferenceProxy::onClickCloseBtn(bool app_quitting)
{
Mnikolenko ProductEngine
committed
}
void LLFloaterPreferenceProxy::cancel()
{
for (control_values_map_t::iterator iter = mSavedValues.begin();
iter != mSavedValues.end(); ++iter)
{
LLControlVariable* control = iter->first;
LLSD ctrl_value = iter->second;
control->set(ctrl_value);
}
mSocksSettingsDirty = false;
closeFloater();
}
void LLFloaterPreferenceProxy::onChangeSocksSettings()
{
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
mSocksSettingsDirty = true;
LLRadioGroup* socksAuth = getChild<LLRadioGroup>("socks5_auth_type");
if (socksAuth->getSelectedValue().asString() == "None")
{
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
LLRadioGroup* otherHttpProxy = getChild<LLRadioGroup>("other_http_proxy_type");
if ((otherHttpProxy->getSelectedValue().asString() == "Socks" &&
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
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
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 );
}
}