Translate phase 1
This commit is contained in:
@@ -22,7 +22,9 @@ public class PermissionWindowUI : WindowMediatorSubscriberBase
|
||||
|
||||
public PermissionWindowUI(ILogger<PermissionWindowUI> logger, Pair pair, MareMediator mediator, UiSharedService uiSharedService,
|
||||
ApiController apiController, PerformanceCollectorService performanceCollectorService)
|
||||
: base(logger, mediator, "Permissions for " + pair.UserData.AliasOrUID + "###UmbraSyncPermissions" + pair.UserData.UID, performanceCollectorService)
|
||||
: base(logger, mediator,
|
||||
uiSharedService.Localize("PermissionWindow.Title", "Permissions for {0}", pair.UserData.AliasOrUID) + "###UmbraSyncPermissions" + pair.UserData.UID,
|
||||
performanceCollectorService)
|
||||
{
|
||||
Pair = pair;
|
||||
_uiSharedService = uiSharedService;
|
||||
@@ -37,6 +39,8 @@ public class PermissionWindowUI : WindowMediatorSubscriberBase
|
||||
IsOpen = true;
|
||||
}
|
||||
|
||||
private string L(string key, string fallback, params object[] args) => _uiSharedService.Localize(key, fallback, args);
|
||||
|
||||
protected override void DrawInternal()
|
||||
{
|
||||
var paused = _ownPermissions.IsPaused();
|
||||
@@ -46,18 +50,19 @@ public class PermissionWindowUI : WindowMediatorSubscriberBase
|
||||
var style = ImGui.GetStyle();
|
||||
var indentSize = ImGui.GetFrameHeight() + style.ItemSpacing.X;
|
||||
|
||||
_uiSharedService.BigText("Permissions for " + Pair.UserData.AliasOrUID);
|
||||
_uiSharedService.BigText(L("PermissionWindow.Title", "Permissions for {0}", Pair.UserData.AliasOrUID));
|
||||
ImGuiHelpers.ScaledDummy(1f);
|
||||
|
||||
if (Pair.UserPair == null)
|
||||
return;
|
||||
|
||||
if (ImGui.Checkbox("Pause Sync", ref paused))
|
||||
if (ImGui.Checkbox(L("PermissionWindow.Pause.Label", "Pause Sync"), ref paused))
|
||||
{
|
||||
_ownPermissions.SetPaused(paused);
|
||||
}
|
||||
_uiSharedService.DrawHelpText("Pausing will completely cease any sync with this user." + UiSharedService.TooltipSeparator
|
||||
+ "Note: this is bidirectional, either user pausing will cease sync completely.");
|
||||
_uiSharedService.DrawHelpText(L("PermissionWindow.Pause.HelpMain", "Pausing will completely cease any sync with this user.")
|
||||
+ UiSharedService.TooltipSeparator
|
||||
+ L("PermissionWindow.Pause.HelpNote", "Note: this is bidirectional, either user pausing will cease sync completely."));
|
||||
var otherPerms = Pair.UserPair.OtherPermissions;
|
||||
|
||||
var otherIsPaused = otherPerms.IsPaused();
|
||||
@@ -70,53 +75,68 @@ public class PermissionWindowUI : WindowMediatorSubscriberBase
|
||||
_uiSharedService.BooleanToColoredIcon(!otherIsPaused, false);
|
||||
ImGui.SameLine();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted(Pair.UserData.AliasOrUID + " has " + (!otherIsPaused ? "not " : string.Empty) + "paused you");
|
||||
var pausedText = otherIsPaused
|
||||
? L("PermissionWindow.OtherPaused.True", "{0} has paused you", Pair.UserData.AliasOrUID)
|
||||
: L("PermissionWindow.OtherPaused.False", "{0} has not paused you", Pair.UserData.AliasOrUID);
|
||||
ImGui.TextUnformatted(pausedText);
|
||||
}
|
||||
|
||||
ImGuiHelpers.ScaledDummy(0.5f);
|
||||
ImGui.Separator();
|
||||
ImGuiHelpers.ScaledDummy(0.5f);
|
||||
|
||||
if (ImGui.Checkbox("Disable Sounds", ref disableSounds))
|
||||
if (ImGui.Checkbox(L("PermissionWindow.Sounds.Label", "Disable Sounds"), ref disableSounds))
|
||||
{
|
||||
_ownPermissions.SetDisableSounds(disableSounds);
|
||||
}
|
||||
_uiSharedService.DrawHelpText("Disabling sounds will remove all sounds synced with this user on both sides." + UiSharedService.TooltipSeparator
|
||||
+ "Note: this is bidirectional, either user disabling sound sync will stop sound sync on both sides.");
|
||||
_uiSharedService.DrawHelpText(L("PermissionWindow.Sounds.HelpMain", "Disabling sounds will remove all sounds synced with this user on both sides.")
|
||||
+ UiSharedService.TooltipSeparator
|
||||
+ L("PermissionWindow.Sounds.HelpNote", "Note: this is bidirectional, either user disabling sound sync will stop sound sync on both sides."));
|
||||
using (ImRaii.PushIndent(indentSize, false))
|
||||
{
|
||||
_uiSharedService.BooleanToColoredIcon(!otherDisableSounds, false);
|
||||
ImGui.SameLine();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted(Pair.UserData.AliasOrUID + " has " + (!otherDisableSounds ? "not " : string.Empty) + "disabled sound sync with you");
|
||||
var soundText = otherDisableSounds
|
||||
? L("PermissionWindow.OtherSoundDisabled.True", "{0} has disabled sound sync with you", Pair.UserData.AliasOrUID)
|
||||
: L("PermissionWindow.OtherSoundDisabled.False", "{0} has not disabled sound sync with you", Pair.UserData.AliasOrUID);
|
||||
ImGui.TextUnformatted(soundText);
|
||||
}
|
||||
|
||||
if (ImGui.Checkbox("Disable Animations", ref disableAnimations))
|
||||
if (ImGui.Checkbox(L("PermissionWindow.Animations.Label", "Disable Animations"), ref disableAnimations))
|
||||
{
|
||||
_ownPermissions.SetDisableAnimations(disableAnimations);
|
||||
}
|
||||
_uiSharedService.DrawHelpText("Disabling sounds will remove all animations synced with this user on both sides." + UiSharedService.TooltipSeparator
|
||||
+ "Note: this is bidirectional, either user disabling animation sync will stop animation sync on both sides.");
|
||||
_uiSharedService.DrawHelpText(L("PermissionWindow.Animations.HelpMain", "Disabling sounds will remove all animations synced with this user on both sides.")
|
||||
+ UiSharedService.TooltipSeparator
|
||||
+ L("PermissionWindow.Animations.HelpNote", "Note: this is bidirectional, either user disabling animation sync will stop animation sync on both sides."));
|
||||
using (ImRaii.PushIndent(indentSize, false))
|
||||
{
|
||||
_uiSharedService.BooleanToColoredIcon(!otherDisableAnimations, false);
|
||||
ImGui.SameLine();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted(Pair.UserData.AliasOrUID + " has " + (!otherDisableAnimations ? "not " : string.Empty) + "disabled animation sync with you");
|
||||
var animText = otherDisableAnimations
|
||||
? L("PermissionWindow.OtherAnimationDisabled.True", "{0} has disabled animation sync with you", Pair.UserData.AliasOrUID)
|
||||
: L("PermissionWindow.OtherAnimationDisabled.False", "{0} has not disabled animation sync with you", Pair.UserData.AliasOrUID);
|
||||
ImGui.TextUnformatted(animText);
|
||||
}
|
||||
|
||||
if (ImGui.Checkbox("Disable VFX", ref disableVfx))
|
||||
if (ImGui.Checkbox(L("PermissionWindow.Vfx.Label", "Disable VFX"), ref disableVfx))
|
||||
{
|
||||
_ownPermissions.SetDisableVFX(disableVfx);
|
||||
}
|
||||
_uiSharedService.DrawHelpText("Disabling sounds will remove all VFX synced with this user on both sides." + UiSharedService.TooltipSeparator
|
||||
+ "Note: this is bidirectional, either user disabling VFX sync will stop VFX sync on both sides.");
|
||||
_uiSharedService.DrawHelpText(L("PermissionWindow.Vfx.HelpMain", "Disabling sounds will remove all VFX synced with this user on both sides.")
|
||||
+ UiSharedService.TooltipSeparator
|
||||
+ L("PermissionWindow.Vfx.HelpNote", "Note: this is bidirectional, either user disabling VFX sync will stop VFX sync on both sides."));
|
||||
using (ImRaii.PushIndent(indentSize, false))
|
||||
{
|
||||
_uiSharedService.BooleanToColoredIcon(!otherDisableVFX, false);
|
||||
ImGui.SameLine();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted(Pair.UserData.AliasOrUID + " has " + (!otherDisableVFX ? "not " : string.Empty) + "disabled VFX sync with you");
|
||||
var vfxText = otherDisableVFX
|
||||
? L("PermissionWindow.OtherVfxDisabled.True", "{0} has disabled VFX sync with you", Pair.UserData.AliasOrUID)
|
||||
: L("PermissionWindow.OtherVfxDisabled.False", "{0} has not disabled VFX sync with you", Pair.UserData.AliasOrUID);
|
||||
ImGui.TextUnformatted(vfxText);
|
||||
}
|
||||
|
||||
ImGuiHelpers.ScaledDummy(0.5f);
|
||||
@@ -126,27 +146,27 @@ public class PermissionWindowUI : WindowMediatorSubscriberBase
|
||||
bool hasChanges = _ownPermissions != Pair.UserPair.OwnPermissions;
|
||||
|
||||
using (ImRaii.Disabled(!hasChanges))
|
||||
if (_uiSharedService.IconTextButton(Dalamud.Interface.FontAwesomeIcon.Save, "Save"))
|
||||
if (_uiSharedService.IconTextButton(Dalamud.Interface.FontAwesomeIcon.Save, L("PermissionWindow.Button.Save", "Save")))
|
||||
{
|
||||
_ = _apiController.UserSetPairPermissions(new(Pair.UserData, _ownPermissions));
|
||||
}
|
||||
UiSharedService.AttachToolTip("Save and apply all changes");
|
||||
UiSharedService.AttachToolTip(L("PermissionWindow.Tooltip.Save", "Save and apply all changes"));
|
||||
|
||||
var rightSideButtons = _uiSharedService.GetIconTextButtonSize(Dalamud.Interface.FontAwesomeIcon.Undo, "Revert") +
|
||||
_uiSharedService.GetIconTextButtonSize(Dalamud.Interface.FontAwesomeIcon.ArrowsSpin, "Reset to Default");
|
||||
var rightSideButtons = _uiSharedService.GetIconTextButtonSize(Dalamud.Interface.FontAwesomeIcon.Undo, L("PermissionWindow.Button.Revert", "Revert")) +
|
||||
_uiSharedService.GetIconTextButtonSize(Dalamud.Interface.FontAwesomeIcon.ArrowsSpin, L("PermissionWindow.Button.Reset", "Reset to Default"));
|
||||
var availableWidth = ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X;
|
||||
|
||||
ImGui.SameLine(availableWidth - rightSideButtons);
|
||||
|
||||
using (ImRaii.Disabled(!hasChanges))
|
||||
if (_uiSharedService.IconTextButton(Dalamud.Interface.FontAwesomeIcon.Undo, "Revert"))
|
||||
if (_uiSharedService.IconTextButton(Dalamud.Interface.FontAwesomeIcon.Undo, L("PermissionWindow.Button.Revert", "Revert")))
|
||||
{
|
||||
_ownPermissions = Pair.UserPair.OwnPermissions.DeepClone();
|
||||
}
|
||||
UiSharedService.AttachToolTip("Revert all changes");
|
||||
UiSharedService.AttachToolTip(L("PermissionWindow.Tooltip.Revert", "Revert all changes"));
|
||||
|
||||
ImGui.SameLine();
|
||||
if (_uiSharedService.IconTextButton(Dalamud.Interface.FontAwesomeIcon.ArrowsSpin, "Reset to Default"))
|
||||
if (_uiSharedService.IconTextButton(Dalamud.Interface.FontAwesomeIcon.ArrowsSpin, L("PermissionWindow.Button.Reset", "Reset to Default")))
|
||||
{
|
||||
_ownPermissions.SetPaused(false);
|
||||
_ownPermissions.SetDisableVFX(false);
|
||||
@@ -154,7 +174,7 @@ public class PermissionWindowUI : WindowMediatorSubscriberBase
|
||||
_ownPermissions.SetDisableAnimations(false);
|
||||
_ = _apiController.UserSetPairPermissions(new(Pair.UserData, _ownPermissions));
|
||||
}
|
||||
UiSharedService.AttachToolTip("This will set all permissions to their default setting");
|
||||
UiSharedService.AttachToolTip(L("PermissionWindow.Tooltip.Reset", "This will set all permissions to their default setting"));
|
||||
|
||||
var ySize = ImGui.GetCursorPosY() + style.FramePadding.Y * ImGuiHelpers.GlobalScale + style.FrameBorderSize;
|
||||
ImGui.SetWindowSize(new(400, ySize));
|
||||
|
||||
Reference in New Issue
Block a user