Save graphic/camera presets floater: Save upon pressing enter when entering a new name

master
Ansariel 2020-07-28 12:32:06 +02:00
parent 6a50b3e02a
commit b0ecec1cae
3 changed files with 20 additions and 2 deletions

View File

@ -54,6 +54,7 @@ BOOL LLFloaterSaveCameraPreset::postBuild()
mNameEditor = getChild<LLLineEditor>("preset_txt_editor");
mNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterSaveCameraPreset::onPresetNameEdited, this), NULL);
mNameEditor->setCommitCallback(boost::bind(&LLFloaterSaveCameraPreset::onBtnSave, this)); // <FS:Ansariel> Save on pressing enter
mSaveButton = getChild<LLButton>("save");
mSaveButton->setCommitCallback(boost::bind(&LLFloaterSaveCameraPreset::onBtnSave, this));
@ -99,6 +100,13 @@ void LLFloaterSaveCameraPreset::onBtnSave()
bool is_saving_new = mSaveRadioGroup->getSelectedIndex() == 0;
std::string name = is_saving_new ? mNameEditor->getText() : mPresetCombo->getSimple();
// <FS:Ansariel> Save on pressing enter
if (name.empty())
{
return;
}
// </FS:Ansariel>
if ((name == LLTrans::getString(PRESETS_DEFAULT)) || (name == PRESETS_DEFAULT))
{
LLNotificationsUtil::add("DefaultPresetNotSaved");

View File

@ -51,7 +51,10 @@ BOOL LLFloaterSavePrefPreset::postBuild()
}
getChild<LLComboBox>("preset_combo")->setTextEntryCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this));
getChild<LLComboBox>("preset_combo")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this));
// <FS:Ansariel> Save on pressing enter
//getChild<LLComboBox>("preset_combo")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this));
getChild<LLComboBox>("preset_combo")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnSave, this));
// </FS:Ansariel>
getChild<LLButton>("save")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnSave, this));
getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnCancel, this));
@ -86,6 +89,13 @@ void LLFloaterSavePrefPreset::onBtnSave()
{
std::string name = mPresetCombo->getSimple();
// <FS:Ansariel> Save on pressing enter
if (name.empty())
{
return;
}
// </FS:Ansariel>
if ((name == LLTrans::getString(PRESETS_DEFAULT)) || (name == PRESETS_DEFAULT))
{
LLNotificationsUtil::add("DefaultPresetNotSaved");

View File

@ -34,7 +34,7 @@
value="1"/>
</radio_group>
<line_editor
commit_on_focus_lost = "true"
commit_on_focus_lost="false"
follows="top|left"
height="23"
layout="topleft"