Newer
Older
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
icon_cell_params.font_halign = LLFontGL::LEFT;
icon_cell_params.type = "icontext";
LLScrollListCell::Params cell_params;
// init basic cell params
cell_params.font = LLFontGL::getFontSansSerif();
cell_params.font_halign = LLFontGL::LEFT;
std::string control_name = LLKeyConflictHandler::getControlName((LLKeyConflictHandler::EControlTypes)index);
std::string label;
if (hasString(control_name))
{
label = getString(control_name);
}
else
{
label = control_name;
}
icon_cell_params.column = "lst_action";
icon_cell_params.text = label;
icon_cell_params.value = icon;
item_params.columns.add(icon_cell_params);
//dummy cells
cell_params.column = "lst_ctrl1";
cell_params.value = "";
item_params.columns.add(cell_params);
cell_params.column = "lst_ctrl2";
cell_params.value = "";
item_params.columns.add(cell_params);
cell_params.column = "lst_ctrl3";
cell_params.value = "";
item_params.columns.add(cell_params);
pControlsTable->addRow(item_params, EAddPosition::ADD_BOTTOM);
}
void LLPanelPreferenceControls::regenerateControls()
{
mEditingMode = pKeyModeBox->getValue().asInteger();
mConflictHandler[mEditingMode].loadFromSettings((LLKeyConflictHandler::ESourceMode)mEditingMode);
populateControlTable();
}
void LLPanelPreferenceControls::populateControlTable()
{
pControlsTable->clearRows();
if (mHighlightedCell)
{
mHighlightedCell->setHighlighted(false);
mHighlightedCell = NULL;
}
std::string label, control_name;
LLScrollListCell::Params cell_params;
// init basic cell params
cell_params.font = LLFontGL::getFontSansSerif();
cell_params.font_halign = LLFontGL::LEFT;
cell_params.column = "";
cell_params.value = label;
S32 start = mEditingMode == LLKeyConflictHandler::MODE_GENERAL ? LLKeyConflictHandler::CONTROL_VIEW_ACTIONS : LLKeyConflictHandler::CONTROL_MOVEMENTS;
S32 end = mEditingMode == LLKeyConflictHandler::MODE_GENERAL ? LLKeyConflictHandler::CONTROL_NUM_INDICES : LLKeyConflictHandler::CONTROL_RESERVED;
for (S32 i = start; i < end; i++)
LLKeyConflictHandler::EControlTypes type = (LLKeyConflictHandler::EControlTypes)i;
switch (type)
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
case LLKeyConflictHandler::CONTROL_VIEW_ACTIONS:
addSeparator();
addGroupRow("Search_Icon", i);
break;
case LLKeyConflictHandler::CONTROL_INTERACTIONS:
addSeparator();
addGroupRow("Command_Gestures_Icon", i);
break;
case LLKeyConflictHandler::CONTROL_MOVEMENTS:
addSeparator();
addGroupRow("Move_Walk_Off", i);
break;
case LLKeyConflictHandler::CONTROL_MEDIACONTENT:
addSeparator();
addGroupRow("Audio_Press", i);
break;
case LLKeyConflictHandler::CONTROL_CAMERA:
addSeparator();
addGroupRow("Cam_FreeCam_Off", i);
break;
case LLKeyConflictHandler::CONTROL_EDIT_TITLE:
addSeparator();
addGroupRow("Tool_Dozer", i);
break;
case LLKeyConflictHandler::CONTROL_RESERVED:
addSeparator();
addGroupRow("Info_Small", i);
break;
default:
{
//default insert
LLScrollListItem::Params item_params;
item_params.value = LLSD::Integer(i);
cell_params.column = "lst_action";
bool enabled = mConflictHandler[mEditingMode].canAssignControl(type);
control_name = LLKeyConflictHandler::getControlName(type);
if (hasString(control_name))
{
label = getString(control_name);
}
else
{
label = control_name;
}
cell_params.value = label;
item_params.columns.add(cell_params);
cell_params.column = "lst_ctrl1";
cell_params.value = mConflictHandler[mEditingMode].getControlString(type, 0);
cell_params.enabled = enabled;
item_params.columns.add(cell_params);
cell_params.column = "lst_ctrl2";
cell_params.value = mConflictHandler[mEditingMode].getControlString(type, 1);
cell_params.enabled = enabled;
item_params.columns.add(cell_params);
cell_params.column = "lst_ctrl3";
cell_params.value = mConflictHandler[mEditingMode].getControlString(type, 2);
cell_params.enabled = enabled;
item_params.columns.add(cell_params);
pControlsTable->addRow(item_params, EAddPosition::ADD_BOTTOM);
break;
}
}
}
}
// Just a workaround to not care about first separator before headers (we can start from random header)
void LLPanelPreferenceControls::addSeparator()
if (pControlsTable->getItemCount() > 0)
{
pControlsTable->addSeparator(EAddPosition::ADD_BOTTOM);
}
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
void LLPanelPreferenceControls::updateTable()
{
std::vector<LLScrollListItem*> list = pControlsTable->getAllData();
for (S32 i = 0; i < list.size(); ++i)
{
S32 value = list[i]->getValue().asInteger();
if (value > 0)
{
LLKeyConflictHandler::EControlTypes control = (LLKeyConflictHandler::EControlTypes)value;
LLScrollListCell* cell = list[i]->getColumn(1);
cell->setValue(mConflictHandler[mEditingMode].getControlString(control, 0));
cell = list[i]->getColumn(2);
cell->setValue(mConflictHandler[mEditingMode].getControlString(control, 1));
cell = list[i]->getColumn(3);
cell->setValue(mConflictHandler[mEditingMode].getControlString(control, 2));
}
}
if (mHighlightedCell)
{
mHighlightedCell->setHighlighted(false);
mHighlightedCell = NULL;
}
}
void LLPanelPreferenceControls::apply()
for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i)
{
if (mConflictHandler[i].hasUnsavedChanges())
{
mConflictHandler[i].saveToSettings();
}
}
if (mHighlightedCell)
{
mHighlightedCell->setHighlighted(false);
mHighlightedCell = NULL;
}
void LLPanelPreferenceControls::cancel()
for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i)
{
if (mConflictHandler[i].hasUnsavedChanges())
{
mConflictHandler[i].clear();
}
}
pControlsTable->clear();
if (mHighlightedCell)
{
mHighlightedCell->setHighlighted(false);
mHighlightedCell = NULL;
}
void LLPanelPreferenceControls::saveSettings()
for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i)
{
if (mConflictHandler[i].hasUnsavedChanges())
{
mConflictHandler[i].saveToSettings();
}
}
S32 mode = pKeyModeBox->getValue().asInteger();
if (mConflictHandler[mode].empty())
{
regenerateControls();
}
else if (mHighlightedCell)
{
mHighlightedCell->setHighlighted(false);
mHighlightedCell = NULL;
}
}
void LLPanelPreferenceControls::resetDirtyChilds()
{
regenerateControls();
}
void LLPanelPreferenceControls::onListCommit()
{
LLScrollListItem* item = pControlsTable->getFirstSelected();
if (item == NULL)
{
return;
}
S32 control = item->getValue().asInteger();
if (!mConflictHandler[mEditingMode].canAssignControl((LLKeyConflictHandler::EControlTypes)control))
// List does not tell us what cell was clicked, so we have to figure it out manually, but
// fresh mouse coordinates are not yet accessible during onCommit() and there are other issues,
// so we cheat: remember item user clicked at, trigger 'key dialog' on hover that comes next,
// use coordinates from hover to calculate cell
mEditingIndex = control;
mShowKeyDialog = true;
if (mHighlightedCell)
{
mHighlightedCell->setHighlighted(false);
mHighlightedCell = NULL;
}
void LLPanelPreferenceControls::onModeCommit()
regenerateControls();
}
// todo: copy onSetKeyBind to interface and inherit from interface
void LLPanelPreferenceControls::onSetKeyBind(EMouseClickType click, KEY key, MASK mask, bool ignore_mask)
{
LLKeyConflictHandler::EControlTypes control = (LLKeyConflictHandler::EControlTypes)mEditingIndex;
if (!mConflictHandler[mEditingMode].canAssignControl(control))
pControlsTable->deselectAllItems();
pControlsTable->selectByValue(mEditingIndex);
mConflictHandler[mEditingMode].registerControl(control, mEditingColumn - 1, click, key, mask, ignore_mask);
void LLPanelPreferenceControls::onRestoreDefaults()
{
for (U32 i = 0; i < LLKeyConflictHandler::MODE_COUNT - 1; ++i)
{
mConflictHandler[mEditingMode].resetToDefaults();
}
void LLPanelPreferenceControls::onDefaultKeyBind()
LLKeyConflictHandler::EControlTypes control = (LLKeyConflictHandler::EControlTypes)mEditingIndex;
if (!mConflictHandler[mEditingMode].canAssignControl(control))
pControlsTable->deselectAllItems();
pControlsTable->selectByValue(mEditingIndex);
mConflictHandler[mEditingMode].resetToDefault(control, mEditingColumn - 1);
}
updateTable();
}
void LLPanelPreferenceControls::onCancelKeyBind()
{
if (mHighlightedCell)
{
mHighlightedCell->setHighlighted(false);
mHighlightedCell = NULL;
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()
{
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
// 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()
{
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
// 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()
{
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
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
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
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
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 );
}
}