From 787d38b3678b01894d1ff657530c242971dd7158 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Thu, 12 Oct 2023 03:14:46 +0200 Subject: [PATCH] Add warning in UI --- addons/settings/fnc_gui_sourceChanged.sqf | 1 + addons/settings/gui.hpp | 9 +++++++++ addons/settings/initSettings.sqf | 5 +++-- addons/settings/script_component.hpp | 1 + addons/settings/stringtable.xml | 8 ++++++++ 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/addons/settings/fnc_gui_sourceChanged.sqf b/addons/settings/fnc_gui_sourceChanged.sqf index c9bd5e2a27..56f35bfe12 100644 --- a/addons/settings/fnc_gui_sourceChanged.sqf +++ b/addons/settings/fnc_gui_sourceChanged.sqf @@ -32,6 +32,7 @@ private _selectedAddon = uiNamespace getVariable QGVAR(addon); (_display displayCtrl IDC_TXT_OVERWRITE_CLIENT) ctrlShow (_selectedSource isNotEqualTo "client"); (_display displayCtrl IDC_TXT_OVERWRITE_MISSION) ctrlShow (_selectedSource isEqualTo "server"); +(_display displayCtrl IDC_TXT_VOLATILE_WARNING) ctrlShow (_selectedSource isEqualTo "server" && GVAR(volatile)); // enable / disable IMPORT and LOAD buttons private _ctrlButtonImport = _display displayCtrl IDC_BTN_IMPORT; diff --git a/addons/settings/gui.hpp b/addons/settings/gui.hpp index a5c5e30311..a5eb4aef7c 100644 --- a/addons/settings/gui.hpp +++ b/addons/settings/gui.hpp @@ -85,6 +85,15 @@ class RscDisplayGameOptions { idc = IDC_TXT_OVERWRITE_MISSION; x = QUOTE(POS_W(33)); }; + class VolatileWarningText: OverwriteClientText { + onLoad = QUOTE((_this select 0) ctrlEnable true;); + idc = IDC_TXT_VOLATILE_WARNING; + style = ST_LEFT; + text = CSTRING(volatile); + tooltip = CSTRING(volatile_tooltip); + x = QUOTE(POS_W(1)); + w = QUOTE(POS_W(24)); + }; }; }; }; diff --git a/addons/settings/initSettings.sqf b/addons/settings/initSettings.sqf index 56e3d3c3c0..ff269d675b 100644 --- a/addons/settings/initSettings.sqf +++ b/addons/settings/initSettings.sqf @@ -1,6 +1,8 @@ // inline function, don't include script_component.hpp if (isNil QGVAR(default)) then { + private _volatile = uiNamespace getVariable QGVAR(volatile); + GVAR(allSettings) = []; GVAR(default) = [] call CBA_fnc_createNamespace; @@ -10,13 +12,12 @@ if (isNil QGVAR(default)) then { if (isNil QGVAR(server)) then { GVAR(server) = NAMESPACE_NULL; - - private _volatile = uiNamespace getVariable QGVAR(volatile); GVAR(serverHashNamespace) = [profileNamespace, uiNamespace] select _volatile; }; if (isServer) then { missionNamespace setVariable [QGVAR(server), true call CBA_fnc_createNamespace, true]; + missionNamespace setVariable [QGVAR(volatile), _volatile, true]; }; // --- read userconfig file diff --git a/addons/settings/script_component.hpp b/addons/settings/script_component.hpp index 131fdb723d..234740a1c6 100644 --- a/addons/settings/script_component.hpp +++ b/addons/settings/script_component.hpp @@ -32,6 +32,7 @@ #define IDC_BTN_CONFIGURE 9030 #define IDC_TXT_OVERWRITE_CLIENT 9040 #define IDC_TXT_OVERWRITE_MISSION 9041 +#define IDC_TXT_VOLATILE_WARNING 9042 #define IDC_SETTING_CONTROLS_GROUP 5000 #define IDC_SETTING_BACKGROUND 5001 diff --git a/addons/settings/stringtable.xml b/addons/settings/stringtable.xml index d42661da15..3235b7782c 100644 --- a/addons/settings/stringtable.xml +++ b/addons/settings/stringtable.xml @@ -315,6 +315,14 @@ Resetovat na původní hodnotu. 기본값으로 초기화합니다. + + Changes will not persist after server restart + Zmiany nie zostaną zachowane po restarcie serwera + + + The server is configured to discard all changes to its setting after it will be restarted.\nChanges will persist between mission restarts. + Serwer jest skonfigurowany tak, aby odrzucać wszystkie zmiany w ustawieniach gdy zostanie zrestartowany.\nZmiany zostaną zachowane między restartami misji. + Overwrite\nClients Clients\nüberschreiben