Skip to content

Commit

Permalink
Merge pull request #1279 from veteran29/feature/default-value-in-sett…
Browse files Browse the repository at this point in the history
…ings-tooltip

Add default value to tooltip of "Reset to default" button in settings
  • Loading branch information
commy2 authored Jan 11, 2020
2 parents 4e6845e + 2be1500 commit d1113f3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
1 change: 0 additions & 1 deletion addons/settings/gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ class GVAR(Row_Base): RscControlsGroupNoScrollbars {
idc = IDC_SETTING_DEFAULT;
style = ST_PICTURE;
text = ICON_DEFAULT;
tooltip = CSTRING(default_tooltip);
x = POS_W(26.5);
y = POS_H(0) + TABLE_LINE_SPACING/2;
w = POS_W(1);
Expand Down
18 changes: 18 additions & 0 deletions addons/settings/gui_createCategory.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,24 @@ private _lastSubCategory = "$START";
default {controlNull};
};

// ----- determine display string for default value
private _defaultValueToolTip = switch (toUpper _settingType) do {
case "LIST": {
(_settingData param [1, []]) param [_defaultValue, ""]
};
case "COLOR": {
private _template = (["R: %1","%G: %2", "B: %3", "A: %4"] select [0, count _defaultValue]) joinString "\n";
format ([_template] + _defaultValue)
};
case "TIME": {
_defaultValue call CBA_fnc_formatElapsedTime
};
default {_defaultValue};
};

// ----- set tooltip on "Reset to default" button
(_ctrlSettingGroup controlsGroupCtrl IDC_SETTING_DEFAULT) ctrlSetTooltip (format ["%1\n%2", localize LSTRING(default_tooltip), _defaultValueToolTip]);

_ctrlSettingGroup setVariable [QGVAR(setting), _setting];
_ctrlSettingGroup setVariable [QGVAR(source), _source];
_ctrlSettingGroup setVariable [QGVAR(params), _settingData];
Expand Down

0 comments on commit d1113f3

Please sign in to comment.