SL-16627 add auto-adjustment warning for affected settings

master
Mnikolenko Productengine 2022-01-25 19:43:32 +02:00
parent 0c70f9d91a
commit b50de18162
11 changed files with 32 additions and 48 deletions

View File

@ -78,6 +78,7 @@ LLComboBox::Params::Params()
combo_button("combo_button"),
combo_list("combo_list"),
combo_editor("combo_editor"),
mouse_down_callback("mouse_down_callback"),
drop_down_button("drop_down_button")
{
addSynonym(items, "combo_item");
@ -97,7 +98,8 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
mTextChangedCallback(p.text_changed_callback()),
mListPosition(p.list_position),
mLastSelectedIndex(-1),
mLabel(p.label)
mLabel(p.label),
mMouseDownSignal(NULL)
{
// Text label button
@ -153,6 +155,11 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
createLineEditor(p);
if (p.mouse_down_callback.isProvided())
{
setMouseDownCallback(initCommitCallback(p.mouse_down_callback));
}
mTopLostSignalConnection = setTopLostCallback(boost::bind(&LLComboBox::hideList, this));
}
@ -183,6 +190,7 @@ LLComboBox::~LLComboBox()
// explicitly disconect this signal, since base class destructor might fire top lost
mTopLostSignalConnection.disconnect();
delete mMouseDownSignal;
}
@ -709,6 +717,9 @@ void LLComboBox::hideList()
void LLComboBox::onButtonMouseDown()
{
if (mMouseDownSignal)
(*mMouseDownSignal)( this, 0 );
if (!mList->getVisible())
{
// this might change selection, so do it first
@ -1183,6 +1194,11 @@ BOOL LLComboBox::selectItemRange( S32 first, S32 last )
return mList->selectItemRange(first, last);
}
boost::signals2::connection LLComboBox::setMouseDownCallback( const commit_signal_t::slot_type& cb )
{
if (!mMouseDownSignal) mMouseDownSignal = new commit_signal_t();
return mMouseDownSignal->connect(cb);
}
static LLDefaultChildRegistry::Register<LLIconsComboBox> register_icons_combo_box("icons_combo_box");

View File

@ -78,6 +78,8 @@ public:
text_entry_callback,
text_changed_callback;
Optional<CommitCallbackParam> mouse_down_callback;
Optional<EPreferredPosition, PreferredPositionValues> list_position;
// components
@ -207,6 +209,8 @@ public:
void setTextEntryCallback( commit_callback_t cb ) { mTextEntryCallback = cb; }
void setTextChangedCallback( commit_callback_t cb ) { mTextChangedCallback = cb; }
boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb );
/**
* Connects callback to signal called when Return key is pressed.
*/
@ -244,6 +248,7 @@ private:
commit_callback_t mTextChangedCallback;
commit_callback_t mSelectionCallback;
boost::signals2::connection mTopLostSignalConnection;
commit_signal_t* mMouseDownSignal;
commit_signal_t mOnReturnSignal;
S32 mLastSelectedIndex;
};

View File

@ -80,7 +80,7 @@ LLFloaterPerformance::LLFloaterPerformance(const LLSD& key)
{
mContextMenu = new LLExceptionsContextMenu(this);
mCommitCallbackRegistrar.add("Pref.MouseDown", boost::bind(&LLFloaterPerformance::onUICtrlMouseDown, this));
mCommitCallbackRegistrar.add("Pref.AutoAdjustWarning", boost::bind(&LLFloaterPreference::showAutoAdjustWarning));
}
LLFloaterPerformance::~LLFloaterPerformance()
@ -540,21 +540,4 @@ void LLFloaterPerformance::onAvatarListRightClick(LLUICtrl* ctrl, S32 x, S32 y)
}
}
void LLFloaterPerformance::onUICtrlMouseDown()
{
static LLCachedControl<bool> use_auto_adjust(gSavedSettings,"AutoFPS");
if (use_auto_adjust)
{
LLNotificationsUtil::add("AutoFPSConfirmDisable", LLSD(), LLSD(),
[](const LLSD&notif, const LLSD&resp)
{
S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp);
if (opt == 0)
{
gSavedSettings.setBOOL("AutoFPS", FALSE);
}
});
}
}
// EOF

View File

@ -63,8 +63,6 @@ private:
void onClickHideAvatars();
void onClickExceptions();
void onUICtrlMouseDown();
void updateMaxComplexity();
void updateComplexityText();

View File

@ -304,7 +304,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
mCommitCallbackRegistrar.add("Pref.RememberedUsernames", boost::bind(&LLFloaterPreference::onClickRememberedUsernames, this));
mCommitCallbackRegistrar.add("Pref.SpellChecker", boost::bind(&LLFloaterPreference::onClickSpellChecker, this));
mCommitCallbackRegistrar.add("Pref.Advanced", boost::bind(&LLFloaterPreference::onClickAdvanced, this));
mCommitCallbackRegistrar.add("Pref.MouseDown", boost::bind(&LLFloaterPreference::onUICtrlMouseDown, this));
mCommitCallbackRegistrar.add("Pref.AutoAdjustWarning", boost::bind(&LLFloaterPreference::showAutoAdjustWarning));
sSkin = gSavedSettings.getString("SkinCurrent");
@ -1783,7 +1783,7 @@ void LLFloaterPreference::updateSearchableItems()
mSearchDataDirty = true;
}
void LLFloaterPreference::onUICtrlMouseDown()
void LLFloaterPreference::showAutoAdjustWarning()
{
static LLCachedControl<bool> use_auto_adjust(gSavedSettings,"AutoFPS");
if (use_auto_adjust)

View File

@ -110,7 +110,7 @@ public:
void updateClickActionViews();
void updateSearchableItems();
void onUICtrlMouseDown();
static void showAutoAdjustWarning();
void onBtnOK(const LLSD& userdata);
void onBtnCancel(const LLSD& userdata);

View File

@ -49,7 +49,7 @@ LLFloaterPreferenceGraphicsAdvanced::LLFloaterPreferenceGraphicsAdvanced(const L
mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxNonImpostors", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxNonImpostors,this));
mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity,this));
mCommitCallbackRegistrar.add("Pref.MouseDown", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onUICtrlMouseDown, this));
mCommitCallbackRegistrar.add("Pref.AutoAdjustWarning", boost::bind(&LLFloaterPreference::showAutoAdjustWarning));
mCommitCallbackRegistrar.add("Pref.Cancel", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onBtnCancel, this, _2));
mCommitCallbackRegistrar.add("Pref.OK", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onBtnOK, this, _2));
@ -195,23 +195,6 @@ void LLFloaterPreferenceGraphicsAdvanced::updateSliderText(LLSliderCtrl* ctrl, L
}
}
void LLFloaterPreferenceGraphicsAdvanced::onUICtrlMouseDown()
{
static LLCachedControl<bool> use_auto_adjust(gSavedSettings,"AutoFPS");
if (use_auto_adjust)
{
LLNotificationsUtil::add("AutoFPSConfirmDisable", LLSD(), LLSD(),
[](const LLSD&notif, const LLSD&resp)
{
S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp);
if (opt == 0)
{
gSavedSettings.setBOOL("AutoFPS", FALSE);
}
});
}
}
void LLFloaterPreferenceGraphicsAdvanced::updateMaxNonImpostors()
{
// Called when the IndirectMaxNonImpostors control changes

View File

@ -46,7 +46,6 @@ public:
void updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box);
void updateMaxNonImpostors();
void updateIndirectMaxNonImpostors(const LLSD& newvalue);
void onUICtrlMouseDown();
void setMaxNonImpostorsText(U32 value, LLTextBox* text_box);
void updateMaxComplexity();
void updateComplexityText();

View File

@ -41,7 +41,7 @@
top_delta="16"
width="330">
<slider.mouse_down_callback
function="Pref.MouseDown" />
function="Pref.AutoAdjustWarning" />
</slider>
<text
type="string"
@ -186,7 +186,7 @@
function="Pref.UpdateIndirectMaxNonImpostors"
parameter="IndirectNonImpostorsText" />
<slider.mouse_down_callback
function="Pref.MouseDown" />
function="Pref.AutoAdjustWarning" />
</slider>
<text
type="string"
@ -856,7 +856,7 @@
name="ShadowDetail"
width="150">
<combo_box.mouse_down_callback
function="Pref.MouseDown" />
function="Pref.AutoAdjustWarning" />
<combo_box.item
label="None"
name="0"

View File

@ -208,7 +208,7 @@
left_pad="5"
width="250">
<slider.mouse_down_callback
function="Pref.MouseDown" />
function="Pref.AutoAdjustWarning" />
</slider>
<text
type="string"

View File

@ -219,7 +219,7 @@
top_delta="40"
width="330">
<slider.mouse_down_callback
function="Pref.MouseDown" />
function="Pref.AutoAdjustWarning" />
</slider>
<text
type="string"