Newer
Older
}
void LLFloaterPreference::onCommitWindowedMode()
{
refresh();
}
void LLFloaterPreference::onChangeQuality(const LLSD& data)
{
U32 level = (U32)(data.asReal());
LLFeatureManager::getInstance()->setGraphicsLevel(level, true);
refreshEnabledGraphics();
refresh();
}
// static
// DEV-24146 - needs to be removed at a later date. jan-2009
void LLFloaterPreference::cleanupBadSetting()
{
if (gSavedPerAccountSettings.getString("BusyModeResponse2") == "|TOKEN COPY BusyModeResponse|")
llwarns << "cleaning old BusyModeResponse" << llendl;
gSavedPerAccountSettings.setString("BusyModeResponse2", gSavedPerAccountSettings.getText("BusyModeResponse"));
void LLFloaterPreference::onClickSetKey()
{
LLVoiceSetKeyDialog* dialog = LLFloaterReg::showTypedInstance<LLVoiceSetKeyDialog>("voice_set_key", LLSD(), TRUE);
if (dialog)
{
dialog->setParent(this);
}
void LLFloaterPreference::setKey(KEY key)
{
childSetValue("modifier_combo", LLKeyboard::stringFromKey(key));
// update the control right away since we no longer wait for apply
getChild<LLUICtrl>("modifier_combo")->onCommit();
void LLFloaterPreference::onClickSetMiddleMouse()
childSetValue("modifier_combo", "MiddleMouse");
// update the control right away since we no longer wait for apply
getChild<LLUICtrl>("modifier_combo")->onCommit();
void LLFloaterPreference::onClickSkipDialogs()
{
LLNotifications::instance().add("SkipShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_skip_dialogs, _1, _2, this));
}
void LLFloaterPreference::onClickResetDialogs()
LLNotifications::instance().add("ResetShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_reset_dialogs, _1, _2, this));
}
void LLFloaterPreference::onClickEnablePopup()
{
LLScrollListCtrl& disabled_popups = getChildRef<LLScrollListCtrl>("disabled_popups");
std::vector<LLScrollListItem*> items = disabled_popups.getAllSelected();
std::vector<LLScrollListItem*>::iterator itor;
for (itor = items.begin(); itor != items.end(); ++itor)
LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate(*(std::string*)((*itor)->getUserdata()));
//gSavedSettings.setWarning(templatep->mName, TRUE);
std::string notification_name = templatep->mName;
LLUI::sSettingGroups["ignores"]->setBOOL(notification_name, TRUE);
}
buildLists(this);
}
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()));
//gSavedSettings.setWarning(templatep->mName, TRUE);
std::string notification_name = templatep->mName;
LLUI::sSettingGroups["ignores"]->setBOOL(notification_name, FALSE);
}
buildLists(this);
}
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)
LLUI::sSettingGroups["ignores"]->setBOOL(iter->first, TRUE);
}
}
}
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)
{
LLUI::sSettingGroups["ignores"]->setBOOL(iter->first, FALSE);
void LLFloaterPreference::onClickLogPath()
{
James Cook
committed
std::string proposed_name(gSavedPerAccountSettings.getString("InstantMessageLogPath"));
LLDirPicker& picker = LLDirPicker::instance();
if (!picker.getDir(&proposed_name ) )
return; //Canceled!
}
James Cook
committed
std::string chat_log_dir = picker.getDirName();
std::string chat_log_top_folder= gDirUtilp->getBaseFileName(chat_log_dir);
gSavedPerAccountSettings.setString("InstantMessageLogPath",chat_log_dir);
gSavedPerAccountSettings.setString("InstantMessageLogFolder",chat_log_top_folder);
void LLFloaterPreference::onCommitLogging()
{
enableHistory();
}
void LLFloaterPreference::enableHistory()
{
James Cook
committed
if (childGetValue("log_instant_messages").asBoolean())
James Cook
committed
childEnable("ChatIMLogs");
childEnable("log_path_button");
James Cook
committed
childEnable("show_timestamps_check_im");
James Cook
committed
childDisable("ChatIMLogs");
childDisable("log_path_button");
James Cook
committed
childDisable("show_timestamps_check_im");
void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email)
mGotPersonalInfo = true;
mOriginalIMViaEmail = im_via_email;
mDirectoryVisibility = visibility;
if(visibility == VISIBILITY_DEFAULT)
mOriginalHideOnlineStatus = false;
childEnable("online_visibility");
}
else if(visibility == VISIBILITY_HIDDEN)
{
mOriginalHideOnlineStatus = true;
childEnable("online_visibility");
else
{
mOriginalHideOnlineStatus = true;
}
childEnable("include_im_in_chat_history");
childEnable("show_timestamps_check_im");
childEnable("friends_online_notify_checkbox");
childSetValue("online_visibility", mOriginalHideOnlineStatus);
childSetLabelArg("online_visibility", "[DIR_VIS]", mDirectoryVisibility);
childEnable("send_im_to_email");
childSetValue("send_im_to_email", im_via_email);
childEnable("log_instant_messages");
James Cook
committed
// childEnable("log_chat");
// childEnable("busy_response");
James Cook
committed
// childEnable("log_instant_messages_timestamp");
// childEnable("log_chat_timestamp");
childEnable("log_chat_IM");
childEnable("log_date_timestamp");
// childSetText("busy_response", gSavedSettings.getString("BusyModeResponse2"));
enableHistory();
std::string display_email(email);
childSetText("email_address",display_email);
}
void LLFloaterPreference::onUpdateSliderText(LLUICtrl* ctrl, const LLSD& name)
{
James Cook
committed
std::string ctrl_name = name.asString();
if((ctrl_name =="" )|| !hasChild(ctrl_name, true))
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
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
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
return;
LLTextBox* text_box = getChild<LLTextBox>(name.asString());
LLSliderCtrl* slider = dynamic_cast<LLSliderCtrl*>(ctrl);
updateSliderText(slider, text_box);
}
void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box)
{
if(text_box == NULL || ctrl== NULL)
return;
// get range and points when text should change
F32 value = (F32)ctrl->getValue().asReal();
F32 min = ctrl->getMinValue();
F32 max = ctrl->getMaxValue();
F32 range = max - min;
llassert(range > 0);
F32 midPoint = min + range / 3.0f;
F32 highPoint = min + (2.0f * range / 3.0f);
// choose the right text
if(value < midPoint)
{
text_box->setText(LLTrans::getString("GraphicsQualityLow"));
}
else if (value < highPoint)
{
text_box->setText(LLTrans::getString("GraphicsQualityMid"));
}
else
{
text_box->setText(LLTrans::getString("GraphicsQualityHigh"));
}
}
void LLFloaterPreference::onKeystrokeAspectRatio()
{
getChild<LLCheckBoxCtrl>("aspect_auto_detect")->set(FALSE);
}
void LLFloaterPreference::applyWindowSize()
{
LLComboBox* ctrl_windowSize = getChild<LLComboBox>("windowsize combo");
if (ctrl_windowSize->getVisible() && (ctrl_windowSize->getCurrentIndex() != -1))
{
U32 width = 0;
U32 height = 0;
if (extractWindowSizeFromString(ctrl_windowSize->getValue().asString().c_str(), width,height))
{
LLViewerWindow::movieSize(width, height);
}
}
}
void LLFloaterPreference::applyResolution()
{
LLComboBox* ctrl_aspect_ratio = getChild<LLComboBox>( "aspect_ratio");
gGL.flush();
char aspect_ratio_text[ASPECT_RATIO_STR_LEN]; /*Flawfinder: ignore*/
if (ctrl_aspect_ratio->getCurrentIndex() == -1)
{
// *Can't pass const char* from c_str() into strtok
strncpy(aspect_ratio_text, ctrl_aspect_ratio->getSimple().c_str(), sizeof(aspect_ratio_text) -1); /*Flawfinder: ignore*/
aspect_ratio_text[sizeof(aspect_ratio_text) -1] = '\0';
char *element = strtok(aspect_ratio_text, ":/\\");
if (!element)
{
sAspectRatio = 0.f; // will be clamped later
}
else
{
LLLocale locale(LLLocale::USER_LOCALE);
sAspectRatio = (F32)atof(element);
}
// look for denominator
element = strtok(NULL, ":/\\");
if (element)
{
LLLocale locale(LLLocale::USER_LOCALE);
F32 denominator = (F32)atof(element);
if (denominator != 0.f)
{
sAspectRatio /= denominator;
}
}
}
else
{
sAspectRatio = (F32)ctrl_aspect_ratio->getValue().asReal();
}
// presumably, user entered a non-numeric value if aspect_ratio == 0.f
if (sAspectRatio != 0.f)
{
sAspectRatio = llclamp(sAspectRatio, 0.2f, 5.f);
gSavedSettings.setF32("FullScreenAspectRatio", sAspectRatio);
}
// Screen resolution
S32 num_resolutions;
LLWindow::LLWindowResolution* supported_resolutions =
gViewerWindow->getWindow()->getSupportedResolutions(num_resolutions);
Richard Nelson
committed
S32 resIndex = getChild<LLComboBox>("fullscreen combo")->getCurrentIndex();
if (resIndex == -1)
{
// use highest resolution if nothing selected
resIndex = num_resolutions - 1;
}
gSavedSettings.setS32("FullScreenWidth", supported_resolutions[resIndex].mWidth);
gSavedSettings.setS32("FullScreenHeight", supported_resolutions[resIndex].mHeight);
James Cook
committed
gViewerWindow->requestResolutionUpdate(gSavedSettings.getBOOL("WindowFullScreen"));
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
send_agent_update(TRUE);
// Update enable/disable
refresh();
}
void LLFloaterPreference::initWindowSizeControls(LLPanel* panelp)
{
// Window size
// mWindowSizeLabel = getChild<LLTextBox>("WindowSizeLabel");
LLComboBox* ctrl_window_size = panelp->getChild<LLComboBox>("windowsize combo");
// Look to see if current window size matches existing window sizes, if so then
// just set the selection value...
const U32 height = gViewerWindow->getWindowDisplayHeight();
const U32 width = gViewerWindow->getWindowDisplayWidth();
for (S32 i=0; i < ctrl_window_size->getItemCount(); i++)
{
U32 height_test = 0;
U32 width_test = 0;
ctrl_window_size->setCurrentByIndex(i);
if (extractWindowSizeFromString(ctrl_window_size->getValue().asString(), width_test, height_test))
{
if ((height_test == height) && (width_test == width))
{
return;
}
}
}
// ...otherwise, add a new entry with the current window height/width.
LLUIString resolution_label = panelp->getString("resolution_format");
resolution_label.setArg("[RES_X]", llformat("%d", width));
resolution_label.setArg("[RES_Y]", llformat("%d", height));
ctrl_window_size->add(resolution_label, ADD_TOP);
ctrl_window_size->setCurrentByIndex(0);
}
//----------------------------------------------------------------------------
static LLRegisterPanelClassWrapper<LLPanelPreference> t_places("panel_preference");
LLPanelPreference::LLPanelPreference()
: LLPanel()
mCommitCallbackRegistrar.add("Pref.setControlFalse", boost::bind(&LLPanelPreference::setControlFalse,this, _2));
James Cook
committed
static void applyUIColor(const std::string& color_name, LLUICtrl* ctrl, const LLSD& param)
{
LLUIColorTable::instance().setColor(color_name, LLColor4(param));
}
//virtual
BOOL LLPanelPreference::postBuild()
{
////////////////////// PanelVoice ///////////////////
if(hasChild("voice_unavailable"))
BOOL voice_disabled = gSavedSettings.getBOOL("CmdLineDisableVoice");
childSetVisible("voice_unavailable", voice_disabled);
childSetVisible("enable_voice_check", !voice_disabled);
}
//////////////////////PanelSkins ///////////////////
if (hasChild("skin_selection"))
{
LLFloaterPreference::refreshSkin(this);
// if skin is set to a skin that no longer exists (silver) set back to default
if (getChild<LLRadioGroup>("skin_selection")->getSelectedIndex() < 0)
gSavedSettings.setString("SkinCurrent", "default");
LLFloaterPreference::refreshSkin(this);
////////////////////////Panel Popups/////////////////
if(hasChild("disabled_popups") && hasChild("enabled_popups"))
{
LLFloaterPreference::buildLists(this);
}
//////
if(hasChild("online_visibility") && hasChild("send_im_to_email"))
{
childSetText("email_address",getString("log_in_to_change") );
// childSetText("busy_response", getString("log_in_to_change"));
if(hasChild("aspect_ratio"))
{
//============================================================================
// Resolution
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
S32 num_resolutions = 0;
LLWindow::LLWindowResolution* supported_resolutions = gViewerWindow->getWindow()->getSupportedResolutions(num_resolutions);
S32 fullscreen_mode = num_resolutions - 1;
LLComboBox*ctrl_full_screen = getChild<LLComboBox>( "fullscreen combo");
LLUIString resolution_label = getString("resolution_format");
for (S32 i = 0; i < num_resolutions; i++)
{
resolution_label.setArg("[RES_X]", llformat("%d", supported_resolutions[i].mWidth));
resolution_label.setArg("[RES_Y]", llformat("%d", supported_resolutions[i].mHeight));
ctrl_full_screen->add( resolution_label, ADD_BOTTOM );
}
{
BOOL targetFullscreen;
S32 targetWidth;
S32 targetHeight;
gViewerWindow->getTargetWindow(targetFullscreen, targetWidth, targetHeight);
if (targetFullscreen)
{
fullscreen_mode = 0; // default to 800x600
for (S32 i = 0; i < num_resolutions; i++)
{
if (targetWidth == supported_resolutions[i].mWidth
&& targetHeight == supported_resolutions[i].mHeight)
{
fullscreen_mode = i;
}
}
ctrl_full_screen->setCurrentByIndex(fullscreen_mode);
}
else
{
// set to windowed mode
//fullscreen_mode = mCtrlFullScreen->getItemCount() - 1;
ctrl_full_screen->setCurrentByIndex(0);
}
}
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
LLFloaterPreference::initWindowSizeControls(this);
if (gSavedSettings.getBOOL("FullScreenAutoDetectAspectRatio"))
{
LLFloaterPreference::sAspectRatio = gViewerWindow->getDisplayAspectRatio();
}
else
{
LLFloaterPreference::sAspectRatio = gSavedSettings.getF32("FullScreenAspectRatio");
}
getChild<LLComboBox>("aspect_ratio")->setTextEntryCallback(boost::bind(&LLPanelPreference::setControlFalse, this, LLSD("FullScreenAutoDetectAspectRatio") ));
S32 numerator = 0;
S32 denominator = 0;
fractionFromDecimal(LLFloaterPreference::sAspectRatio, numerator, denominator);
LLUIString aspect_ratio_text = getString("aspect_ratio_text");
if (numerator != 0)
{
aspect_ratio_text.setArg("[NUM]", llformat("%d", numerator));
aspect_ratio_text.setArg("[DEN]", llformat("%d", denominator));
}
else
{
aspect_ratio_text = llformat("%.3f", LLFloaterPreference::sAspectRatio);
}
LLComboBox* ctrl_aspect_ratio = getChild<LLComboBox>( "aspect_ratio");
//mCtrlAspectRatio->setCommitCallback(onSelectAspectRatio, this);
// add default aspect ratios
ctrl_aspect_ratio->add(aspect_ratio_text, &LLFloaterPreference::sAspectRatio, ADD_TOP);
ctrl_aspect_ratio->setCurrentByIndex(0);
refresh();
}
James Cook
committed
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
if(hasChild("user") && hasChild("agent") && hasChild("im")
&& hasChild("system") && hasChild("script_error") && hasChild("objects")
&& hasChild("owner") && hasChild("background") && hasChild("links"))
{
LLColorSwatchCtrl* color_swatch = getChild<LLColorSwatchCtrl>("user");
color_swatch->setCommitCallback(boost::bind(&applyUIColor, "UserChatColor", _1, _2));
color_swatch->setOriginal(LLUIColorTable::instance().getColor("UserChatColor"));
color_swatch = getChild<LLColorSwatchCtrl>("agent");
color_swatch->setCommitCallback(boost::bind(&applyUIColor, "AgentChatColor", _1, _2));
color_swatch->setOriginal(LLUIColorTable::instance().getColor("AgentChatColor"));
color_swatch = getChild<LLColorSwatchCtrl>("im");
color_swatch->setCommitCallback(boost::bind(&applyUIColor, "IMChatColor", _1, _2));
color_swatch->setOriginal(LLUIColorTable::instance().getColor("IMChatColor"));
color_swatch = getChild<LLColorSwatchCtrl>("system");
color_swatch->setCommitCallback(boost::bind(&applyUIColor, "SystemChatColor", _1, _2));
color_swatch->setOriginal(LLUIColorTable::instance().getColor("SystemChatColor"));
color_swatch = getChild<LLColorSwatchCtrl>("script_error");
color_swatch->setCommitCallback(boost::bind(&applyUIColor, "ScriptErrorColor", _1, _2));
color_swatch->setOriginal(LLUIColorTable::instance().getColor("ScriptErrorColor"));
color_swatch = getChild<LLColorSwatchCtrl>("objects");
color_swatch->setCommitCallback(boost::bind(&applyUIColor, "ObjectChatColor", _1, _2));
color_swatch->setOriginal(LLUIColorTable::instance().getColor("ObjectChatColor"));
color_swatch = getChild<LLColorSwatchCtrl>("owner");
color_swatch->setCommitCallback(boost::bind(&applyUIColor, "llOwnerSayChatColor", _1, _2));
color_swatch->setOriginal(LLUIColorTable::instance().getColor("llOwnerSayChatColor"));
color_swatch = getChild<LLColorSwatchCtrl>("background");
color_swatch->setCommitCallback(boost::bind(&applyUIColor, "BackgroundChatColor", _1, _2));
color_swatch->setOriginal(LLUIColorTable::instance().getColor("BackgroundChatColor"));
color_swatch = getChild<LLColorSwatchCtrl>("links");
color_swatch->setCommitCallback(boost::bind(&applyUIColor, "HTMLLinkColor", _1, _2));
color_swatch->setOriginal(LLUIColorTable::instance().getColor("HTMLLinkColor"));
}
if(hasChild("effect_color_swatch"))
{
LLColorSwatchCtrl* color_swatch = getChild<LLColorSwatchCtrl>("effect_color_swatch");
color_swatch->setCommitCallback(boost::bind(&applyUIColor, "EffectColor", _1, _2));
color_swatch->setOriginal(LLUIColorTable::instance().getColor("EffectColor"));
}
apply();
return true;
void LLPanelPreference::apply()
{
// Save the value of all controls in the hierarchy
mSavedValues.clear();
std::list<LLView*> view_stack;
view_stack.push_back(this);
while(!view_stack.empty())
{
// Process view on top of the stack
LLView* curview = view_stack.front();
view_stack.pop_front();
James Cook
committed
LLColorSwatchCtrl* color_swatch = dynamic_cast<LLColorSwatchCtrl *>(curview);
if (color_swatch)
{
mSavedColors[color_swatch->getName()] = color_swatch->get();
}
else
James Cook
committed
LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview);
if (ctrl)
James Cook
committed
LLControlVariable* control = ctrl->getControlVariable();
if (control)
{
mSavedValues[control] = control->getValue();
}
James Cook
committed
// Push children onto the end of the work stack
for (child_list_t::const_iterator iter = curview->getChildList()->begin();
iter != curview->getChildList()->end(); ++iter)
{
view_stack.push_back(*iter);
}
}
}
void LLPanelPreference::cancel()
for (control_values_map_t::iterator iter = mSavedValues.begin();
iter != mSavedValues.end(); ++iter)
LLControlVariable* control = iter->first;
LLSD ctrl_value = iter->second;
control->set(ctrl_value);
James Cook
committed
for (string_color_map_t::iterator iter = mSavedColors.begin();
iter != mSavedColors.end(); ++iter)
{
LLColorSwatchCtrl* color_swatch = findChild<LLColorSwatchCtrl>(iter->first);
if(color_swatch)
{
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));
}