Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
gViewerWindow->mWindow->setNativeAspectRatio(0.f);
fractionFromDecimal(gViewerWindow->mWindow->getNativeAspectRatio(), numerator, denominator);
std::string aspect;
if (numerator != 0)
{
aspect = llformat("%d:%d", numerator, denominator);
}
else
{
aspect = llformat("%.3f", gViewerWindow->mWindow->getNativeAspectRatio());
}
getChild<LLComboBox>( "aspect_ratio")->setLabel(aspect);
ratio = gViewerWindow->mWindow->getNativeAspectRatio();
gSavedSettings.setF32("FullScreenAspectRatio", ratio);
}
}
void LLFloaterPreference::refresh()
{
LLPanel::refresh();
// sliders and their text boxes
// mPostProcess = gSavedSettings.getS32("RenderGlowResolutionPow");
// slider text boxes
James Cook
committed
updateSliderText(getChild<LLSliderCtrl>("ObjectMeshDetail", true), getChild<LLTextBox>("ObjectMeshDetailText", true));
updateSliderText(getChild<LLSliderCtrl>("FlexibleMeshDetail", true), getChild<LLTextBox>("FlexibleMeshDetailText", true));
updateSliderText(getChild<LLSliderCtrl>("TreeMeshDetail", true), getChild<LLTextBox>("TreeMeshDetailText", true));
updateSliderText(getChild<LLSliderCtrl>("AvatarMeshDetail", true), getChild<LLTextBox>("AvatarMeshDetailText", true));
updateSliderText(getChild<LLSliderCtrl>("TerrainMeshDetail", true), getChild<LLTextBox>("TerrainMeshDetailText", true));
updateSliderText(getChild<LLSliderCtrl>("RenderPostProcess", true), getChild<LLTextBox>("PostProcessText", true));
updateSliderText(getChild<LLSliderCtrl>("SkyMeshDetail", true), getChild<LLTextBox>("SkyMeshDetailText", true));
refreshEnabledState();
}
void LLFloaterPreference::onCommitWindowedMode()
{
refresh();
}
void LLFloaterPreference::onChangeQuality(const LLSD& data)
{
U32 level = (U32)(data.asReal());
LLFeatureManager::getInstance()->setGraphicsLevel(level, true);
refreshEnabledGraphics();
refresh();
}
// 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()
{
LLNotificationsUtil::add("SkipShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_skip_dialogs, _1, _2, this));
void LLFloaterPreference::onClickResetDialogs()
LLNotificationsUtil::add("ResetShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_reset_dialogs, _1, _2, this));
}
void LLFloaterPreference::onClickEnablePopup()
{
LLScrollListCtrl& disabled_popups = getChildRef<LLScrollListCtrl>("disabled_popups");
std::vector<LLScrollListItem*> items = disabled_popups.getAllSelected();
std::vector<LLScrollListItem*>::iterator itor;
for (itor = items.begin(); itor != items.end(); ++itor)
LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate(*(std::string*)((*itor)->getUserdata()));
//gSavedSettings.setWarning(templatep->mName, TRUE);
std::string notification_name = templatep->mName;
LLUI::sSettingGroups["ignores"]->setBOOL(notification_name, TRUE);
}
buildPopupLists();
James Cook
committed
void LLFloaterPreference::onClickDisablePopup()
{
LLScrollListCtrl& enabled_popups = getChildRef<LLScrollListCtrl>("enabled_popups");
std::vector<LLScrollListItem*> items = enabled_popups.getAllSelected();
std::vector<LLScrollListItem*>::iterator itor;
for (itor = items.begin(); itor != items.end(); ++itor)
{
LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate(*(std::string*)((*itor)->getUserdata()));
//gSavedSettings.setWarning(templatep->mName, TRUE);
std::string notification_name = templatep->mName;
LLUI::sSettingGroups["ignores"]->setBOOL(notification_name, FALSE);
}
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)
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::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);
Sergey Borushevsky
committed
childEnable("plain_text_chat_history");
childSetValue("plain_text_chat_history", gSavedSettings.getBOOL("PlainTextChatHistory"));
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"));
childEnable("log_nearby_chat");
childEnable("log_instant_messages");
childEnable("show_timestamps_check_im");
childEnable("log_path_string");
childEnable("log_path_button");
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))
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
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
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"));
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...
James Cook
committed
const U32 height = gViewerWindow->getWindowHeightRaw();
const U32 width = gViewerWindow->getWindowWidthRaw();
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
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);
}
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()));
}
//----------------------------------------------------------------------------
static LLRegisterPanelClassWrapper<LLPanelPreference> t_places("panel_preference");
LLPanelPreference::LLPanelPreference()
: LLPanel()
mCommitCallbackRegistrar.add("Pref.setControlFalse", boost::bind(&LLPanelPreference::setControlFalse,this, _2));
James Cook
committed
}
//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);
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
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
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);
}
}
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
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();
}
apply();
return true;
void LLPanelPreference::apply()
{
// no-op
}
void LLPanelPreference::saveSettings()
{
// Save the value of all controls in the hierarchy
mSavedValues.clear();
std::list<LLView*> view_stack;
view_stack.push_back(this);
while(!view_stack.empty())
{
// Process view on top of the stack
LLView* curview = view_stack.front();
view_stack.pop_front();
James Cook
committed
LLColorSwatchCtrl* color_swatch = dynamic_cast<LLColorSwatchCtrl *>(curview);
if (color_swatch)
{
mSavedColors[color_swatch->getName()] = color_swatch->get();
}
else
James Cook
committed
LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(curview);
if (ctrl)
James Cook
committed
LLControlVariable* control = ctrl->getControlVariable();
if (control)
{
mSavedValues[control] = control->getValue();
}
James Cook
committed
// Push children onto the end of the work stack
for (child_list_t::const_iterator iter = curview->getChildList()->begin();
iter != curview->getChildList()->end(); ++iter)
{
view_stack.push_back(*iter);
}
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));