fix tags pausing/resuming, give back owner the same rights as mod

This commit is contained in:
rootdarkarchon
2023-01-29 18:05:12 +01:00
parent d47b4f52ec
commit d7cad81eb0
3 changed files with 17 additions and 17 deletions

View File

@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<Authors></Authors> <Authors></Authors>
<Company></Company> <Company></Company>
<Version>0.7.5</Version> <Version>0.7.6</Version>
<Description></Description> <Description></Description>
<Copyright></Copyright> <Copyright></Copyright>
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl> <PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>

View File

@@ -49,7 +49,7 @@ namespace MareSynchronos.UI.Components
if (visiblePairsInThisTag.Any() || onlinePairsInThisTag.Any() || offlinePairsInThisTag.Any()) if (visiblePairsInThisTag.Any() || onlinePairsInThisTag.Any() || offlinePairsInThisTag.Any())
{ {
DrawName(tag); DrawName(tag);
UiShared.DrawWithID($"group-{tag}-buttons", () => DrawButtons(tag, visiblePairsInThisTag)); UiShared.DrawWithID($"group-{tag}-buttons", () => DrawButtons(tag, visiblePairsInThisTag.Concat(onlinePairsInThisTag).Concat(offlinePairsInThisTag).ToList()));
if (_tagHandler.IsTagOpen(tag)) if (_tagHandler.IsTagOpen(tag))
{ {
ImGui.Indent(20); ImGui.Indent(20);

View File

@@ -736,16 +736,16 @@ namespace MareSynchronos.UI
} }
} }
private void DrawSyncshellPairedClient(Pair pair, GroupPairFullInfoDto entry, string ownerUid, bool isOwner, bool isModerator) private void DrawSyncshellPairedClient(Pair pair, GroupPairFullInfoDto entry, string ownerUid, bool userIsOwner, bool userIsModerator)
{ {
var plusButtonSize = UiShared.GetIconButtonSize(FontAwesomeIcon.Plus); var plusButtonSize = UiShared.GetIconButtonSize(FontAwesomeIcon.Plus);
var barButtonSize = UiShared.GetIconButtonSize(FontAwesomeIcon.Bars); var barButtonSize = UiShared.GetIconButtonSize(FontAwesomeIcon.Bars);
var entryUID = entry.UserAliasOrUID; var entryUID = entry.UserAliasOrUID;
var textSize = ImGui.CalcTextSize(entryUID); var textSize = ImGui.CalcTextSize(entryUID);
var originalY = ImGui.GetCursorPosY(); var originalY = ImGui.GetCursorPosY();
var userIsMod = entry.GroupPairStatusInfo.IsModerator(); var entryIsMod = entry.GroupPairStatusInfo.IsModerator();
var userIsOwner = string.Equals(pair.UserData.UID, ownerUid, StringComparison.Ordinal); var entryIsOwner = string.Equals(pair.UserData.UID, ownerUid, StringComparison.Ordinal);
var isPinned = entry.GroupPairStatusInfo.IsPinned(); var entryIsPinned = entry.GroupPairStatusInfo.IsPinned();
var isPaused = pair.IsPaused; var isPaused = pair.IsPaused;
var presenceIcon = pair.IsVisible ? FontAwesomeIcon.Eye : (pair.IsOnline ? FontAwesomeIcon.Link : FontAwesomeIcon.Unlink); var presenceIcon = pair.IsVisible ? FontAwesomeIcon.Eye : (pair.IsOnline ? FontAwesomeIcon.Link : FontAwesomeIcon.Unlink);
var presenceColor = (pair.IsOnline || pair.IsVisible) ? ImGuiColors.ParsedGreen : ImGuiColors.DalamudRed; var presenceColor = (pair.IsOnline || pair.IsVisible) ? ImGuiColors.ParsedGreen : ImGuiColors.DalamudRed;
@@ -787,7 +787,7 @@ namespace MareSynchronos.UI
ImGui.PopFont(); ImGui.PopFont();
UiShared.AttachToolTip(presenceText); UiShared.AttachToolTip(presenceText);
if (userIsOwner) if (entryIsOwner)
{ {
ImGui.SameLine(); ImGui.SameLine();
ImGui.SetCursorPosY(textPos); ImGui.SetCursorPosY(textPos);
@@ -796,7 +796,7 @@ namespace MareSynchronos.UI
ImGui.PopFont(); ImGui.PopFont();
UiShared.AttachToolTip("User is owner of this Syncshell"); UiShared.AttachToolTip("User is owner of this Syncshell");
} }
else if (userIsMod) else if (entryIsMod)
{ {
ImGui.SameLine(); ImGui.SameLine();
ImGui.SetCursorPosY(textPos); ImGui.SetCursorPosY(textPos);
@@ -805,7 +805,7 @@ namespace MareSynchronos.UI
ImGui.PopFont(); ImGui.PopFont();
UiShared.AttachToolTip("User is moderator of this Syncshell"); UiShared.AttachToolTip("User is moderator of this Syncshell");
} }
else if (isPinned) else if (entryIsPinned)
{ {
ImGui.SameLine(); ImGui.SameLine();
ImGui.SetCursorPosY(textPos); ImGui.SetCursorPosY(textPos);
@@ -886,7 +886,7 @@ namespace MareSynchronos.UI
if (plusButtonShown) if (plusButtonShown)
{ {
var barWidth = isOwner || (isModerator && !userIsMod && !userIsOwner) var barWidth = userIsOwner || (userIsModerator && !entryIsMod && !entryIsOwner)
? barButtonSize.X + ImGui.GetStyle().ItemSpacing.X ? barButtonSize.X + ImGui.GetStyle().ItemSpacing.X
: 0; : 0;
ImGui.SameLine(ImGui.GetWindowContentRegionMin().X + UiShared.GetWindowContentRegionWidth() - plusButtonSize.X - barWidth); ImGui.SameLine(ImGui.GetWindowContentRegionMin().X + UiShared.GetWindowContentRegionWidth() - plusButtonSize.X - barWidth);
@@ -899,7 +899,7 @@ namespace MareSynchronos.UI
UiShared.AttachToolTip("Pair with " + entryUID + " individually"); UiShared.AttachToolTip("Pair with " + entryUID + " individually");
} }
if (isOwner || (isModerator && !userIsMod && !userIsOwner)) if (userIsOwner || (userIsModerator && !entryIsMod && !entryIsOwner))
{ {
ImGui.SameLine(ImGui.GetWindowContentRegionMin().X + UiShared.GetWindowContentRegionWidth() - barButtonSize.X); ImGui.SameLine(ImGui.GetWindowContentRegionMin().X + UiShared.GetWindowContentRegionWidth() - barButtonSize.X);
ImGui.SetCursorPosY(originalY); ImGui.SetCursorPosY(originalY);
@@ -914,7 +914,7 @@ namespace MareSynchronos.UI
if ((animDisabled || soundsDisabled) && pair.UserPair == null) if ((animDisabled || soundsDisabled) && pair.UserPair == null)
{ {
var infoIconPosDist = (plusButtonShown ? plusButtonSize.X + ImGui.GetStyle().ItemSpacing.X : 0) var infoIconPosDist = (plusButtonShown ? plusButtonSize.X + ImGui.GetStyle().ItemSpacing.X : 0)
+ ((isOwner || (isModerator && !userIsMod && !userIsOwner)) ? barButtonSize.X + ImGui.GetStyle().ItemSpacing.X : 0); + ((userIsOwner || (userIsModerator && !entryIsMod && !entryIsOwner)) ? barButtonSize.X + ImGui.GetStyle().ItemSpacing.X : 0);
var icon = FontAwesomeIcon.InfoCircle; var icon = FontAwesomeIcon.InfoCircle;
var iconwidth = UiShared.GetIconSize(icon); var iconwidth = UiShared.GetIconSize(icon);
@@ -949,7 +949,7 @@ namespace MareSynchronos.UI
} }
} }
if (!plusButtonShown && !(isOwner || (isModerator && !userIsMod && !userIsOwner))) if (!plusButtonShown && !(userIsOwner || (userIsModerator && !entryIsMod && !entryIsOwner)))
{ {
ImGui.SameLine(); ImGui.SameLine();
ImGui.Dummy(barButtonSize with { X = 0 }); ImGui.Dummy(barButtonSize with { X = 0 });
@@ -957,9 +957,9 @@ namespace MareSynchronos.UI
if (ImGui.BeginPopup("Popup")) if (ImGui.BeginPopup("Popup"))
{ {
if ((isModerator) && !(userIsMod || userIsOwner)) if ((userIsModerator || userIsOwner) && !(entryIsMod || entryIsOwner))
{ {
var pinText = isPinned ? "Unpin user" : "Pin user"; var pinText = entryIsPinned ? "Unpin user" : "Pin user";
if (UiShared.IconTextButton(FontAwesomeIcon.Thumbtack, pinText)) if (UiShared.IconTextButton(FontAwesomeIcon.Thumbtack, pinText))
{ {
ImGui.CloseCurrentPopup(); ImGui.CloseCurrentPopup();
@@ -986,9 +986,9 @@ namespace MareSynchronos.UI
UiShared.AttachToolTip("Ban user from this Syncshell"); UiShared.AttachToolTip("Ban user from this Syncshell");
} }
if (isOwner) if (userIsOwner)
{ {
string modText = userIsMod ? "Demod user" : "Mod user"; string modText = entryIsMod ? "Demod user" : "Mod user";
if (UiShared.IconTextButton(FontAwesomeIcon.UserShield, modText)) if (UiShared.IconTextButton(FontAwesomeIcon.UserShield, modText))
{ {
if (UiShared.CtrlPressed()) if (UiShared.CtrlPressed())