Skip to content

Commit

Permalink
Moved time zone to different setting
Browse files Browse the repository at this point in the history
Added UTC Time zone
Added UTC time offset slider
Added translation in stringtable
  • Loading branch information
Daniel-H123 committed Jan 9, 2023
1 parent 1537255 commit 9b5ee1b
Show file tree
Hide file tree
Showing 3 changed files with 211 additions and 93 deletions.
113 changes: 68 additions & 45 deletions addons/markers/functions/fnc_onButtonClickConfirm.sqf
Original file line number Diff line number Diff line change
@@ -1,58 +1,81 @@
#include "script_component.hpp"
/*
* Author: Freddo
* When the confirm button is pressed.
*
* Arguments:
* 0: Confirm button <CONTROL>
*
* Return Value:
* None
*
* Example:
* [_buttonOk] call ACE_markers_fnc_onButtonClickConfirm
*
* Public: No
* Author: Freddo
* When the confirm button is pressed.
*
* Arguments:
* 0: Confirm button <CONTROL>
*
* Return Value:
* None
*
* Example:
* [_buttonOk] call ACE_markers_fnc_onButtonClickConfirm
*
* Public: No
*/
params ["_buttonOk"];

private _display = ctrlParent _buttonOk;
private _description = _display displayctrl IDC_INSERT_MARKER;
private _description = _display displayCtrl IDC_INSERT_MARKER;
private _aceTimestamp = _display displayCtrl IDC_ACE_INSERT_MARKER_TIMESTAMP;

// handle timestamp
if (cbChecked _aceTimestamp && {ACE_player call FUNC(canTimestamp)}) then {
private _time = daytime;
if (cbChecked _aceTimestamp && {
ACE_player call FUNC(canTimestamp)
}) then {
private _time = [];

// add timestamp suffix
private _periodPostfix = "";
if (GVAR(timestampHourFormat) == 12) then {
if (floor _time == 0) exitWith {
_time = _time + 12;
_periodPostfix = " am";
};
switch (GVAR(timestampTimezone)) do
{
default
{
_time = dayTime;
};
case 1:
{
systemTime params ["", "", "", "_hour", "_min", "_sec"];
_time = _hour + _min/60 + _sec/3600;
};
case 2:
{
_offset = GVAR(timestampUTCOffset);
systemTimeUTC params["", "", "", "_hour", "_min", "_sec"];
_hour = _hour + _offset;
if (_hour < 0) then {
_hour= 24 - (_hour + _offset);
};
if (_hour > 24) then {
_hour = 0 + ((_hour + _offset) - 24);
};
_time = _hour + _min/60 + _sec/3600;
};
};

if (floor _time == 12) exitWith {
_periodPostfix = " pm";
};
// add timestamp suffix
private _periodPostfix = "";
if (GVAR(timestampHourFormat) == 12) then {
if (floor _time == 0) exitWith {
_time = _time + 12;
_periodPostfix = " am";
};

if (_time < 12) then {
_periodPostfix = " am";
} else {
_time = _time - 12;
_periodPostfix = " pm";
};
} else {
if (GVAR(timestampHourFormat) == 0) then {
systemTime params ["", "", "", "_hour", "_min", "_sec"];
_time = _hour + _min/60 + _sec/3600;
};
};
if (floor _time == 12) exitWith {
_periodPostfix = " pm";
};

_description ctrlSetText format [
"%1 [%2%3]",
ctrlText _description,
[_time, GVAR(timestampFormat)] call BIS_fnc_timeToString,
_periodPostfix
];
};
if (_time < 12) then {
_periodPostfix = " am";
} else {
_time = _time - 12;
_periodPostfix = " pm";
};
};

_description ctrlSetText format [
"%1 [%2%3]",
ctrlText _description,
[_time, GVAR(timestampFormat)] call BIS_fnc_timeToString,
_periodPostfix
];
};
114 changes: 66 additions & 48 deletions addons/markers/initSettings.sqf
Original file line number Diff line number Diff line change
@@ -1,63 +1,81 @@
private _categoryName = format ["ACE %1", localize ELSTRING(map,Module_DisplayName)];

[
QGVAR(moveRestriction), "LIST",
[LSTRING(MoveRestriction), LSTRING(MoveRestriction_Description)],
[_categoryName, LLSTRING(Module_DisplayName)],
[
[
MOVE_RESTRICTION_NOBODY,
MOVE_RESTRICTION_ALL,
MOVE_RESTRICTION_ADMINS,
MOVE_RESTRICTION_GROUP_LEADERS,
MOVE_RESTRICTION_GROUP_LEADERS_ADMINS,
MOVE_RESTRICTION_OWNER
],
[
LSTRING(MoveRestriction_Nobody),
LSTRING(MoveRestriction_All),
LSTRING(MoveRestriction_Admins),
LSTRING(MoveRestriction_GroupLeaders),
LSTRING(MoveRestriction_GroupLeadersAndAdmins),
LSTRING(MoveRestriction_Owner)
],
1
]
QGVAR(moveRestriction), "LIST",
[LSTRING(MoveRestriction), LSTRING(MoveRestriction_Description)],
[_categoryName, LLSTRING(Module_DisplayName)],
[
[
MOVE_RESTRICTION_NOBODY,
MOVE_RESTRICTION_ALL,
MOVE_RESTRICTION_ADMINS,
MOVE_RESTRICTION_GROUP_LEADERS,
MOVE_RESTRICTION_GROUP_LEADERS_ADMINS,
MOVE_RESTRICTION_OWNER
],
[
LSTRING(MoveRestriction_Nobody),
LSTRING(MoveRestriction_All),
LSTRING(MoveRestriction_Admins),
LSTRING(MoveRestriction_GroupLeaders),
LSTRING(MoveRestriction_GroupLeadersAndAdmins),
LSTRING(MoveRestriction_Owner)
],
1
]
] call CBA_fnc_addSetting;

[
QGVAR(timestampEnabled), "CHECKBOX",
[LSTRING(TimestampEnabled), LSTRING(TimestampEnabledDescription)],
[_categoryName, LLSTRING(Module_DisplayName)],
true
QGVAR(timestampEnabled), "CHECKBOX",
[LSTRING(TimestampEnabled), LSTRING(TimestampEnabledDescription)],
[_categoryName, LLSTRING(Module_DisplayName)],
true
] call CBA_fnc_addSetting;

[
QGVAR(timestampHourFormat), "LIST",
[LSTRING(TimestampHourFormat), LSTRING(TimestampHourFormatDescription)],
[_categoryName, LLSTRING(Module_DisplayName)],
[
[24, 12, 0],
[LSTRING(TimestampHourFormat24), LSTRING(TimestampHourFormat12), "System"],
0
]
QGVAR(timestampTimezone), "LIST",
[LSTRING(TimestampTimezone), LSTRING(TimestampTimezoneDescription)],
[_categoryName, LLSTRING(Module_DisplayName)],
[
[0, 1, 2],
[LSTRING(TimestampTimezoneIngameTime), LSTRING(TimestampTimezoneSystemTime), LSTRING(TimestampTimezoneUTCTime)],
0
]
] call CBA_fnc_addSetting;

[
QGVAR(timestampUTCOffset), "SLIDER",
[LSTRING(TimestampUTCOffset), LSTRING(TimestampUTCOffsetDescription)],
[_categoryName, LLSTRING(Module_DisplayName)],
[-12, 12, 0, 0]
] call CBA_fnc_addSetting;

[
QGVAR(timestampHourFormat), "LIST",
[LSTRING(TimestampHourFormat), LSTRING(TimestampHourFormatDescription)],
[_categoryName, LLSTRING(Module_DisplayName)],
[
[24, 12],
[LSTRING(TimestampHourFormat24), LSTRING(TimestampHourFormat12)],
0
]
] call CBA_fnc_addSetting;

private _formatDescription = [
LLSTRING(TimestampFormatDescription0),
LLSTRING(TimestampFormatDescription1),
LLSTRING(TimestampFormatDescription2),
LLSTRING(TimestampFormatDescription3),
LLSTRING(TimestampFormatDescription4)
LLSTRING(TimestampFormatDescription0),
LLSTRING(TimestampFormatDescription1),
LLSTRING(TimestampFormatDescription2),
LLSTRING(TimestampFormatDescription3),
LLSTRING(TimestampFormatDescription4)
] joinString endl;

[
QGVAR(timestampFormat), "LIST",
[LSTRING(timestampFormat), _formatDescription],
[_categoryName, LLSTRING(Module_DisplayName)],
[
["HH", "HH:MM", "HH:MM:SS", "HH:MM:SS:MM"],
["HH", "HH:MM", "HH:MM:SS", "HH:MM:SS:MM"],
1
]
] call CBA_fnc_addSetting;
QGVAR(timestampFormat), "LIST",
[LSTRING(timestampFormat), _formatDescription],
[_categoryName, LLSTRING(Module_DisplayName)],
[
["HH", "HH:MM", "HH:MM:SS", "HH:MM:SS:MM"],
["HH", "HH:MM", "HH:MM:SS", "HH:MM:SS:MM"],
1
]
] call CBA_fnc_addSetting;
77 changes: 77 additions & 0 deletions addons/markers/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,83 @@
<Chinesesimp>需要手表</Chinesesimp>
<Korean>시계 필요함</Korean>
</Key>
<Key ID="STR_ACE_Markers_TimestampTimezone">
<English>Time Zone</English>
<Russian>Часовой пояс</Russian>
<French>Fuseau horaire</French>
<Japanese>時間帯</Japanese>
<Spanish>Zona horaria</Spanish>
<Polish>Strefa czasowa</Polish>
<German>Zeitzone</German>
<Chinesesimp>时区</Chinesesimp>
<Korean>시간대</Korean>
</Key>
<Key ID="STR_ACE_Markers_TimestampTimezoneDescription">
<English>Change the time zone for the timestamp</English>
<Russian>Измените часовой пояс для метки времени</Russian>
<French>Modifiez le fuseau horaire pour l'horodatage</French>
<Japanese>タイムスタンプの時間帯を変更します</Japanese>
<Spanish>Cambie la zona horaria para la marca de tiempo</Spanish>
<Polish>Zmień strefę czasową dla znaczników czasu</Polish>
<German>Ändern Sie die Zeitzone für den Zeitstempel</German>
<Chinesesimp>更改时间戳的时区</Chinesesimp>
<Korean>타임스탬프의 시간대를 변경하십시오</Korean>
</Key>
<Key ID="STR_ACE_Markers_TimestampTimezoneIngameTime">
<English>In-game Time</English>
<Russian>Время в игре</Russian>
<French>Heure de jeu</French>
<Japanese>ゲーム内時刻</Japanese>
<Spanish>Hora del juego</Spanish>
<Polish>Czas gry</Polish>
<German>Ingame-Zeit</German>
<Chinesesimp>游戏内时间</Chinesesimp>
<Korean>게임 시간</Korean>
</Key>
<Key ID="STR_ACE_Markers_TimestampTimezoneSystemTime">
<English>System Time</English>
<Russian>Системное время</Russian>
<French>Heure système</French>
<Japanese>システム時刻</Japanese>
<Spanish>Hora del sistema</Spanish>
<Polish>Czas systemowy</Polish>
<German>Systemzeit</German>
<Chinesesimp>系统时间</Chinesesimp>
<Korean>시스템 시간</Korean>
</Key>
<Key ID="STR_ACE_Markers_TimestampTimezoneUTCTime">
<English>UTC Time</English>
<Russian>Время UTC</Russian>
<French>Heure UTC</French>
<Japanese>UTC時刻</Japanese>
<Spanish>Hora UTC</Spanish>
<Polish>Czas UTC</Polish>
<German>UTC-Zeit</German>
<Chinesesimp>UTC时间</Chinesesimp>
<Korean>UTC 시간</Korean>
</Key>
<Key ID="STR_ACE_Markers_TimestampUTCOffset">
<English>UTC Offset</English>
<Russian>Смещение UTC</Russian>
<French>Décalage UTC</French>
<Japanese>UTCオフセット</Japanese>
<Spanish>Desplazamiento UTC</Spanish>
<Polish>Przesunięcie UTC</Polish>
<German>UTC-Verschiebung</German>
<Chinesesimp>UTC偏移量</Chinesesimp>
<Korean>UTC 오프셋</Korean>
</Key>
<Key ID="STR_ACE_Markers_TimestampUTCOffsetDescription">
<English>Change the time offset for the UTC timestamp</English>
<Russian>Измените смещение времени для метки времени UTC</Russian>
<French>Modifier le décalage horaire pour l'horodatage UTC</French>
<Japanese>UTCタイムスタンプの時差を変更する</Japanese>
<Spanish>Cambiar el desplazamiento horario para la marca de tiempo UTC</Spanish>
<Polish>Zmień przesunięcie czasu dla sygnatury czasowej UTC</Polish>
<German>Ändere die Zeitverschiebung für den UTC-Zeitstempel</German>
<Chinesesimp>更改UTC时间戳的时间偏移量</Chinesesimp>
<Korean>UTC 타임 스탬프의 시간 오프셋을 변경하십시오</Korean>
</Key>
<Key ID="STR_ACE_Markers_TimestampFormat">
<English>Timestamp Format</English>
<Russian>Формат времени</Russian>
Expand Down

0 comments on commit 9b5ee1b

Please sign in to comment.