Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change color of overwritten settings equal to overwrite to orange #1285

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions addons/settings/fnc_gui_settingCheckbox.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ _ctrlCheckbox ctrlAddEventHandler ["CheckedChanged", {

// automatically check "overwrite client" for mission makers qol
[_controlsGroup, _source] call (_controlsGroup getVariable QFUNC(auto_check_overwrite));
// refresh priority to update overwrite color if current value is equal to overwrite
[_controlsGroup] call (_controlsGroup getVariable QFUNC(updateUI_locked));
}];

// set setting ui manually to new value
Expand Down
4 changes: 4 additions & 0 deletions addons/settings/fnc_gui_settingColor.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ for "_index" from 0 to ((count _currentValue max 3 min 4) - 1) do {

// automatically check "overwrite client" for mission makers qol
[_controlsGroup, _source] call (_controlsGroup getVariable QFUNC(auto_check_overwrite));
// refresh priority to update overwrite color if current value is equal to overwrite
[_controlsGroup] call (_controlsGroup getVariable QFUNC(updateUI_locked));
}];

private _ctrlColorEdit = _controlsGroup controlsGroupCtrl (IDCS_SETTING_COLOR_EDIT select _index);
Expand Down Expand Up @@ -75,6 +77,8 @@ for "_index" from 0 to ((count _currentValue max 3 min 4) - 1) do {

// automatically check "overwrite client" for mission makers qol
[_controlsGroup, _source] call (_controlsGroup getVariable QFUNC(auto_check_overwrite));
// refresh priority to update overwrite color if current value is equal to overwrite
[_controlsGroup] call (_controlsGroup getVariable QFUNC(updateUI_locked));
}];

_ctrlColorEdit ctrlAddEventHandler ["KillFocus", {
Expand Down
2 changes: 2 additions & 0 deletions addons/settings/fnc_gui_settingDefault.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ _ctrlDefault ctrlAddEventHandler ["ButtonClick", {

private _controlsGroup = ctrlParentControlsGroup _ctrlDefault;
[_controlsGroup, _defaultValue] call (_controlsGroup getVariable QFUNC(updateUI));
// refresh priority to update overwrite color if current value is equal to overwrite
[_controlsGroup] call (_controlsGroup getVariable QFUNC(updateUI_locked));

private _ctrlSettingName = _controlsGroup controlsGroupCtrl IDC_SETTING_NAME;
_ctrlSettingName ctrlSetTextColor COLOR_TEXT_ENABLED_WAS_EDITED;
Expand Down
2 changes: 2 additions & 0 deletions addons/settings/fnc_gui_settingEditbox.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ _ctrlEditbox ctrlAddEventHandler ["KeyUp", {

// automatically check "overwrite client" for mission makers qol
[_controlsGroup, _source] call (_controlsGroup getVariable QFUNC(auto_check_overwrite));
// refresh priority to update overwrite color if current value is equal to overwrite
[_controlsGroup] call (_controlsGroup getVariable QFUNC(updateUI_locked));
}];

// set setting ui manually to new value
Expand Down
2 changes: 2 additions & 0 deletions addons/settings/fnc_gui_settingList.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ _ctrlList ctrlAddEventHandler ["LBSelChanged", {

// automatically check "overwrite client" for mission makers qol
[_controlsGroup, _source] call (_controlsGroup getVariable QFUNC(auto_check_overwrite));
// refresh priority to update overwrite color if current value is equal to overwrite
[_controlsGroup] call (_controlsGroup getVariable QFUNC(updateUI_locked));
}];

// set setting ui manually to new value
Expand Down
17 changes: 11 additions & 6 deletions addons/settings/fnc_gui_settingOverwrite.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,11 @@ _controlsGroup setVariable [QFUNC(updateUI_locked), {
params ["_controlsGroup"];
private _setting = _controlsGroup getVariable QGVAR(setting);
private _priority = TEMP_PRIORITY(_setting);
private _tempValue = TEMP_VALUE(_setting);

{
private _source = _x getVariable QGVAR(source);
private _sourceValue = TEMP_VALUE_SOURCE(_setting,_source);
private _ctrlLocked = _x controlsGroupCtrl IDC_SETTING_LOCKED;

if (_source isEqualTo _priority) then {
Expand All @@ -123,23 +125,26 @@ _controlsGroup setVariable [QFUNC(updateUI_locked), {
_ctrlLocked ctrlSetTooltip LLSTRING(applies);
};
} else {
private _overwriteEqual = _sourceValue isEqualTo _tempValue;
private _overwriteColor = [COLOR_OVERWRITTEN, COLOR_OVERWRITTEN_EQUAL] select _overwriteEqual;

switch [_source, _priority] do {
case ["client", "server"];
case ["mission", "server"]: {
_ctrlLocked ctrlSetText ICON_OVERWRITTEN;
_ctrlLocked ctrlSetTextColor COLOR_OVERWRITTEN;
_ctrlLocked ctrlSetTooltip LLSTRING(overwritten_by_server_tooltip);
_ctrlLocked ctrlSetTextColor _overwriteColor;
_ctrlLocked ctrlSetTooltip [LLSTRING(overwritten_by_server_tooltip), LLSTRING(overwritten_by_server_equal_tooltip)] select _overwriteEqual;
};
case ["client", "mission"];
case ["server", "mission"]: {
_ctrlLocked ctrlSetText ICON_OVERWRITTEN;
_ctrlLocked ctrlSetTextColor COLOR_OVERWRITTEN;
_ctrlLocked ctrlSetTooltip LLSTRING(overwritten_by_mission_tooltip);
_ctrlLocked ctrlSetTextColor _overwriteColor;
_ctrlLocked ctrlSetTooltip [LLSTRING(overwritten_by_mission_tooltip), LLSTRING(overwritten_by_mission_equal_tooltip)] select _overwriteEqual;
};
case ["mission", "client"]: {
_ctrlLocked ctrlSetText ICON_OVERWRITTEN;
_ctrlLocked ctrlSetTextColor COLOR_OVERWRITTEN;
_ctrlLocked ctrlSetTooltip LLSTRING(overwritten_by_client_tooltip);
_ctrlLocked ctrlSetTextColor _overwriteColor;
_ctrlLocked ctrlSetTooltip [LLSTRING(overwritten_by_client_tooltip), LLSTRING(overwritten_by_client_equal_tooltip)] select _overwriteEqual;
};
case ["server", "client"]: {
if (isServer) then {
Expand Down
4 changes: 4 additions & 0 deletions addons/settings/fnc_gui_settingSlider.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ _ctrlSlider ctrlAddEventHandler ["SliderPosChanged", {

// automatically check "overwrite client" for mission makers qol
[_controlsGroup, _source] call (_controlsGroup getVariable QFUNC(auto_check_overwrite));
// refresh priority to update overwrite color if current value is equal to overwrite
[_controlsGroup] call (_controlsGroup getVariable QFUNC(updateUI_locked));
}];

private _ctrlSliderEdit = _controlsGroup controlsGroupCtrl IDC_SETTING_SLIDER_EDIT;
Expand Down Expand Up @@ -63,6 +65,8 @@ _ctrlSliderEdit ctrlAddEventHandler ["KeyUp", {

// automatically check "overwrite client" for mission makers qol
[_controlsGroup, _source] call (_controlsGroup getVariable QFUNC(auto_check_overwrite));
// refresh priority to update overwrite color if current value is equal to overwrite
[_controlsGroup] call (_controlsGroup getVariable QFUNC(updateUI_locked));
}];

_ctrlSliderEdit ctrlAddEventHandler ["KillFocus", {
Expand Down
4 changes: 4 additions & 0 deletions addons/settings/fnc_gui_settingTime.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ _ctrlSlider ctrlAddEventHandler ["SliderPosChanged", {

// automatically check "overwrite client" for mission makers qol
[_controlsGroup, _source] call (_controlsGroup getVariable QFUNC(auto_check_overwrite));
// refresh priority to update overwrite color if current value is equal to overwrite
[_controlsGroup] call (_controlsGroup getVariable QFUNC(updateUI_locked));
}];

{
Expand Down Expand Up @@ -66,6 +68,8 @@ _ctrlSlider ctrlAddEventHandler ["SliderPosChanged", {

// automatically check "overwrite client" for mission makers qol
[_controlsGroup, _source] call (_controlsGroup getVariable QFUNC(auto_check_overwrite));
// refresh priority to update overwrite color if current value is equal to overwrite
[_controlsGroup] call (_controlsGroup getVariable QFUNC(updateUI_locked));
}];
} forEach [
[IDC_SETTING_TIME_HOURS, floor (_currentValue / 3600)],
Expand Down
7 changes: 5 additions & 2 deletions addons/settings/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@

#define COLOR_APPLIES [0, 0.95, 0, 1]
#define COLOR_OVERWRITTEN [0.95, 0, 0, 1]
#define COLOR_OVERWRITTEN_EQUAL [0.95, 0.55, 0, 1]
#define COLOR_NEED_RESTART [0.95, 0.95, 0, 1]

#define CAN_SET_SERVER_SETTINGS ((isServer || FUNC(whitelisted)) && {!isNull GVAR(server)}) // in single player, as host (local server) or as logged in (not voted) admin connected to a dedicated server
Expand Down Expand Up @@ -132,11 +133,13 @@
(uiNamespace getVariable QGVAR(serverTemp)) getVariable [setting, [nil, [setting, "server"] call FUNC(priority)]] select 1\
]; ["client", "mission", "server"] select (_arr find selectMax _arr)})

#define TEMP_VALUE(setting) ([\
#define TEMP_VALUE_SOURCE(setting,source) ([\
(uiNamespace getVariable QGVAR(clientTemp)) getVariable [setting, [[setting, "client"] call FUNC(get), nil]] select 0,\
(uiNamespace getVariable QGVAR(missionTemp)) getVariable [setting, [[setting, "mission"] call FUNC(get), nil]] select 0,\
(uiNamespace getVariable QGVAR(serverTemp)) getVariable [setting, [[setting, "server"] call FUNC(get), nil]] select 0\
] select (["client", "mission", "server"] find TEMP_PRIORITY(setting)))
] select (["client", "mission", "server"] find (source)))

#define TEMP_VALUE(setting) TEMP_VALUE_SOURCE(setting,TEMP_PRIORITY(setting))
commy2 marked this conversation as resolved.
Show resolved Hide resolved

#define ASCII_NEWLINE 10
#define ASCII_CARRIAGE_RETURN 13
Expand Down
20 changes: 19 additions & 1 deletion addons/settings/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -406,12 +406,30 @@
<Chinesesimp>此项设定被客户端给覆写并仅适用于伺服器。</Chinesesimp>
<Portuguese>Esta configuração é sobrescrita pelos clientes e é apenas aplicada no servidor.</Portuguese>
<Russian>Этот параметр перезаписан клиентом и применяется исключительно к серверу.</Russian>
<Polish>Ta wartość zostałą nadpisana przez klientów i ma zastosowanie tylko na serwerze.</Polish>
<Polish>Ta wartość została nadpisana przez klientów i ma zastosowanie tylko na serwerze.</Polish>
<French>Ce paramètre est écrasé par les clients et ne s'applique qu'au serveur.</French>
<Turkish>Oyuncular tarafından bu ayarın üstüne yazılmış, ayar sadece sunucuda geçerli.</Turkish>
<Italian>Questa impostazione è sovrascritta dai client e si applica solo al server.</Italian>
<Czech>Toto nastavení je přepsáno klienty a platí pouze na serveru.</Czech>
</Key>
<Key ID="STR_cba_settings_overwritten_by_client_equal_tooltip">
<English>Overwritten by client with the same value.</English>
<German>Mit gleichem Wert durch Client überschrieben.</German>
<Polish>Nadpisane przez klienta z taką samą wartością.</Polish>
<French>Écrasé par le client, avec la même valeur.</French>
</Key>
<Key ID="STR_cba_settings_overwritten_by_mission_equal_tooltip">
<English>Overwritten by mission with the same value.</English>
<German>Mit gleichem Wert durch Mission überschrieben.</German>
<Polish>Nadpisane przez misję z taką samą wartością.</Polish>
veteran29 marked this conversation as resolved.
Show resolved Hide resolved
<French>Écrasé par la mission, avec la même valeur.</French>
</Key>
<Key ID="STR_cba_settings_overwritten_by_server_equal_tooltip">
<English>Overwritten by server with the same value.</English>
<German>Mit gleichem Wert durch Server überschrieben.</German>
<Polish>Nadpisane przez serwer z taką samą wartością.</Polish>
veteran29 marked this conversation as resolved.
Show resolved Hide resolved
<French>Écrasé par le serveur, avec la même valeur.</French>
</Key>
<Key ID="STR_cba_settings_copy_to_clipboard">
<English>Copy to clipboard</English>
<German>In Zwischenablage</German>
Expand Down