minor refactoring
This commit is contained in:
@@ -13,17 +13,19 @@ public abstract class DrawFolderBase : IDrawFolder
|
||||
protected readonly string _id;
|
||||
protected readonly IImmutableList<Pair> _allPairs;
|
||||
protected readonly TagHandler _tagHandler;
|
||||
protected readonly UiSharedService _uiSharedService;
|
||||
private float _menuWidth = -1;
|
||||
public int OnlinePairs => DrawPairs.Count(u => u.Pair.IsOnline);
|
||||
public int TotalPairs => _allPairs.Count;
|
||||
|
||||
protected DrawFolderBase(string id, IImmutableList<DrawUserPair> drawPairs,
|
||||
IImmutableList<Pair> allPairs, TagHandler tagHandler)
|
||||
IImmutableList<Pair> allPairs, TagHandler tagHandler, UiSharedService uiSharedService)
|
||||
{
|
||||
_id = id;
|
||||
DrawPairs = drawPairs;
|
||||
_allPairs = allPairs;
|
||||
_tagHandler = tagHandler;
|
||||
_uiSharedService = uiSharedService;
|
||||
}
|
||||
|
||||
protected abstract bool RenderIfEmpty { get; }
|
||||
@@ -40,7 +42,7 @@ public abstract class DrawFolderBase : IDrawFolder
|
||||
|
||||
ImGui.AlignTextToFramePadding();
|
||||
|
||||
UiSharedService.NormalizedIcon(icon);
|
||||
_uiSharedService.IconText(icon);
|
||||
if (ImGui.IsItemClicked())
|
||||
{
|
||||
_tagHandler.SetTagOpen(_id, !_tagHandler.IsTagOpen(_id));
|
||||
@@ -60,7 +62,7 @@ public abstract class DrawFolderBase : IDrawFolder
|
||||
// if opened draw content
|
||||
if (_tagHandler.IsTagOpen(_id))
|
||||
{
|
||||
using var indent = ImRaii.PushIndent(UiSharedService.GetIconData(FontAwesomeIcon.Bars).NormalizedIconScale.Y + ImGui.GetStyle().ItemSpacing.X, false);
|
||||
using var indent = ImRaii.PushIndent(_uiSharedService.GetIconData(FontAwesomeIcon.Bars).X + ImGui.GetStyle().ItemSpacing.X, false);
|
||||
if (DrawPairs.Any())
|
||||
{
|
||||
foreach (var item in DrawPairs)
|
||||
@@ -87,7 +89,7 @@ public abstract class DrawFolderBase : IDrawFolder
|
||||
|
||||
private float DrawRightSideInternal()
|
||||
{
|
||||
var barButtonSize = UiSharedService.NormalizedIconButtonSize(FontAwesomeIcon.Bars);
|
||||
var barButtonSize = _uiSharedService.IconButtonSize(FontAwesomeIcon.Bars);
|
||||
var spacingX = ImGui.GetStyle().ItemSpacing.X;
|
||||
var windowEndX = ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth();
|
||||
|
||||
@@ -97,7 +99,7 @@ public abstract class DrawFolderBase : IDrawFolder
|
||||
if (RenderMenu)
|
||||
{
|
||||
ImGui.SameLine(windowEndX - barButtonSize.X);
|
||||
if (UiSharedService.NormalizedIconButton(FontAwesomeIcon.Bars))
|
||||
if (UiSharedService.IconButton(FontAwesomeIcon.Bars))
|
||||
{
|
||||
ImGui.OpenPopup("User Flyout Menu");
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
|
||||
public DrawFolderGroup(string id, GroupFullInfoDto groupFullInfoDto, ApiController apiController,
|
||||
IImmutableList<DrawUserPair> drawPairs, IImmutableList<Pair> allPairs, TagHandler tagHandler, IdDisplayHandler idDisplayHandler,
|
||||
MareMediator mareMediator) :
|
||||
base(id, drawPairs, allPairs, tagHandler)
|
||||
MareMediator mareMediator, UiSharedService uiSharedService) :
|
||||
base(id, drawPairs, allPairs, tagHandler, uiSharedService)
|
||||
{
|
||||
_groupFullInfoDto = groupFullInfoDto;
|
||||
_apiController = apiController;
|
||||
@@ -41,7 +41,7 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
{
|
||||
ImGui.AlignTextToFramePadding();
|
||||
|
||||
UiSharedService.NormalizedIcon(_groupFullInfoDto.GroupPermissions.IsDisableInvites() ? FontAwesomeIcon.Lock : FontAwesomeIcon.Users);
|
||||
_uiSharedService.IconText(_groupFullInfoDto.GroupPermissions.IsDisableInvites() ? FontAwesomeIcon.Lock : FontAwesomeIcon.Users);
|
||||
if (_groupFullInfoDto.GroupPermissions.IsDisableInvites())
|
||||
{
|
||||
UiSharedService.AttachToolTip("Syncshell " + _groupFullInfoDto.GroupAliasOrGID + " is closed for invites");
|
||||
@@ -60,19 +60,19 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
if (IsOwner)
|
||||
{
|
||||
ImGui.AlignTextToFramePadding();
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.Crown);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Crown);
|
||||
UiSharedService.AttachToolTip("You are the owner of " + _groupFullInfoDto.GroupAliasOrGID);
|
||||
}
|
||||
else if (IsModerator)
|
||||
{
|
||||
ImGui.AlignTextToFramePadding();
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.UserShield);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.UserShield);
|
||||
UiSharedService.AttachToolTip("You are a moderator in " + _groupFullInfoDto.GroupAliasOrGID);
|
||||
}
|
||||
else if (IsPinned)
|
||||
{
|
||||
ImGui.AlignTextToFramePadding();
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.Thumbtack);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Thumbtack);
|
||||
UiSharedService.AttachToolTip("You are pinned in " + _groupFullInfoDto.GroupAliasOrGID);
|
||||
}
|
||||
ImGui.SameLine();
|
||||
@@ -85,21 +85,21 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
ImGui.Separator();
|
||||
|
||||
ImGui.TextUnformatted("General Syncshell Actions");
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Copy, "Copy ID", menuWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Copy, "Copy ID", menuWidth, true))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
ImGui.SetClipboardText(_groupFullInfoDto.GroupAliasOrGID);
|
||||
}
|
||||
UiSharedService.AttachToolTip("Copy Syncshell ID to Clipboard");
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.StickyNote, "Copy Notes", menuWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.StickyNote, "Copy Notes", menuWidth, true))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
ImGui.SetClipboardText(UiSharedService.GetNotes(DrawPairs.Select(k => k.Pair).ToList()));
|
||||
}
|
||||
UiSharedService.AttachToolTip("Copies all your notes for all users in this Syncshell to the clipboard." + Environment.NewLine + "They can be imported via Settings -> Privacy -> Import Notes from Clipboard");
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.ArrowCircleLeft, "Leave Syncshell", menuWidth, true) && UiSharedService.CtrlPressed())
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.ArrowCircleLeft, "Leave Syncshell", menuWidth, true) && UiSharedService.CtrlPressed())
|
||||
{
|
||||
_ = _apiController.GroupLeave(_groupFullInfoDto);
|
||||
ImGui.CloseCurrentPopup();
|
||||
@@ -117,7 +117,7 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
if ((_groupFullInfoDto.GroupPermissions.IsPreferDisableAnimations() != disableAnims
|
||||
|| _groupFullInfoDto.GroupPermissions.IsPreferDisableSounds() != disableSounds
|
||||
|| _groupFullInfoDto.GroupPermissions.IsPreferDisableVFX() != disableVfx)
|
||||
&& UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Check, "Align with suggested permissions", menuWidth, true))
|
||||
&& UiSharedService.IconTextButton(FontAwesomeIcon.Check, "Align with suggested permissions", menuWidth, true))
|
||||
{
|
||||
perm.SetDisableVFX(_groupFullInfoDto.GroupPermissions.IsPreferDisableVFX());
|
||||
perm.SetDisableSounds(_groupFullInfoDto.GroupPermissions.IsPreferDisableSounds());
|
||||
@@ -126,24 +126,21 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(disableSounds ? FontAwesomeIcon.VolumeUp : FontAwesomeIcon.VolumeOff, disableSounds ? "Enable Sound Sync" : "Disable Sound Sync",
|
||||
menuWidth, true))
|
||||
if (UiSharedService.IconTextButton(disableSounds ? FontAwesomeIcon.VolumeUp : FontAwesomeIcon.VolumeOff, disableSounds ? "Enable Sound Sync" : "Disable Sound Sync", menuWidth, true))
|
||||
{
|
||||
perm.SetDisableSounds(!disableSounds);
|
||||
_ = _apiController.GroupChangeIndividualPermissionState(new(_groupFullInfoDto.Group, new(_apiController.UID), perm));
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(disableAnims ? FontAwesomeIcon.Running : FontAwesomeIcon.Stop, disableAnims ? "Enable Animation Sync" : "Disable Animation Sync",
|
||||
menuWidth, true))
|
||||
if (UiSharedService.IconTextButton(disableAnims ? FontAwesomeIcon.Running : FontAwesomeIcon.Stop, disableAnims ? "Enable Animation Sync" : "Disable Animation Sync", menuWidth, true))
|
||||
{
|
||||
perm.SetDisableAnimations(!disableAnims);
|
||||
_ = _apiController.GroupChangeIndividualPermissionState(new(_groupFullInfoDto.Group, new(_apiController.UID), perm));
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(disableVfx ? FontAwesomeIcon.Sun : FontAwesomeIcon.Circle, disableVfx ? "Enable VFX Sync" : "Disable VFX Sync",
|
||||
menuWidth, true))
|
||||
if (UiSharedService.IconTextButton(disableVfx ? FontAwesomeIcon.Sun : FontAwesomeIcon.Circle, disableVfx ? "Enable VFX Sync" : "Disable VFX Sync", menuWidth, true))
|
||||
{
|
||||
perm.SetDisableVFX(!disableVfx);
|
||||
_ = _apiController.GroupChangeIndividualPermissionState(new(_groupFullInfoDto.Group, new(_apiController.UID), perm));
|
||||
@@ -154,7 +151,7 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
{
|
||||
ImGui.Separator();
|
||||
ImGui.TextUnformatted("Syncshell Admin Functions");
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Cog, "Open Admin Panel", menuWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Cog, "Open Admin Panel", menuWidth, true))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
_mareMediator.Publish(new OpenSyncshellAdminPanel(_groupFullInfoDto));
|
||||
@@ -172,9 +169,9 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
var spacingX = ImGui.GetStyle().ItemSpacing.X;
|
||||
|
||||
FontAwesomeIcon pauseIcon = _groupFullInfoDto.GroupUserPermissions.IsPaused() ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
|
||||
var pauseButtonSize = UiSharedService.NormalizedIconButtonSize(pauseIcon);
|
||||
var pauseButtonSize = _uiSharedService.IconButtonSize(pauseIcon);
|
||||
|
||||
var userCogButtonSize = UiSharedService.GetIconData(FontAwesomeIcon.UsersCog).NormalizedIconScale;
|
||||
var userCogButtonSize = _uiSharedService.GetIconData(FontAwesomeIcon.UsersCog);
|
||||
|
||||
var individualSoundsDisabled = _groupFullInfoDto.GroupUserPermissions.IsDisableSounds();
|
||||
var individualAnimDisabled = _groupFullInfoDto.GroupUserPermissions.IsDisableAnimations();
|
||||
@@ -186,7 +183,7 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
|
||||
ImGui.AlignTextToFramePadding();
|
||||
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.UsersCog, (_groupFullInfoDto.GroupPermissions.IsPreferDisableAnimations() != individualAnimDisabled
|
||||
_uiSharedService.IconText(FontAwesomeIcon.UsersCog, (_groupFullInfoDto.GroupPermissions.IsPreferDisableAnimations() != individualAnimDisabled
|
||||
|| _groupFullInfoDto.GroupPermissions.IsPreferDisableSounds() != individualSoundsDisabled
|
||||
|| _groupFullInfoDto.GroupPermissions.IsPreferDisableVFX() != individualVFXDisabled) ? ImGuiColors.DalamudYellow : null);
|
||||
if (ImGui.IsItemHovered())
|
||||
@@ -196,17 +193,17 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
ImGui.TextUnformatted("Syncshell Permissions");
|
||||
ImGuiHelpers.ScaledDummy(2f);
|
||||
|
||||
UiSharedService.BooleanToColoredIcon(!individualSoundsDisabled, inline: false);
|
||||
_uiSharedService.BooleanToColoredIcon(!individualSoundsDisabled, inline: false);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("Sound Sync");
|
||||
|
||||
UiSharedService.BooleanToColoredIcon(!individualAnimDisabled, inline: false);
|
||||
_uiSharedService.BooleanToColoredIcon(!individualAnimDisabled, inline: false);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("Animation Sync");
|
||||
|
||||
UiSharedService.BooleanToColoredIcon(!individualVFXDisabled, inline: false);
|
||||
_uiSharedService.BooleanToColoredIcon(!individualVFXDisabled, inline: false);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("VFX Sync");
|
||||
@@ -217,17 +214,17 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
ImGui.TextUnformatted("Suggested Permissions");
|
||||
ImGuiHelpers.ScaledDummy(2f);
|
||||
|
||||
UiSharedService.BooleanToColoredIcon(!_groupFullInfoDto.GroupPermissions.IsPreferDisableSounds(), inline: false);
|
||||
_uiSharedService.BooleanToColoredIcon(!_groupFullInfoDto.GroupPermissions.IsPreferDisableSounds(), inline: false);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("Sound Sync");
|
||||
|
||||
UiSharedService.BooleanToColoredIcon(!_groupFullInfoDto.GroupPermissions.IsPreferDisableAnimations(), inline: false);
|
||||
_uiSharedService.BooleanToColoredIcon(!_groupFullInfoDto.GroupPermissions.IsPreferDisableAnimations(), inline: false);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("Animation Sync");
|
||||
|
||||
UiSharedService.BooleanToColoredIcon(!_groupFullInfoDto.GroupPermissions.IsPreferDisableVFX(), inline: false);
|
||||
_uiSharedService.BooleanToColoredIcon(!_groupFullInfoDto.GroupPermissions.IsPreferDisableVFX(), inline: false);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("VFX Sync");
|
||||
@@ -236,7 +233,7 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
if (UiSharedService.NormalizedIconButton(pauseIcon))
|
||||
if (UiSharedService.IconButton(pauseIcon))
|
||||
{
|
||||
var perm = _groupFullInfoDto.GroupUserPermissions;
|
||||
perm.SetPaused(!perm.IsPaused());
|
||||
|
||||
@@ -15,8 +15,8 @@ public class DrawFolderTag : DrawFolderBase
|
||||
private readonly SelectPairForTagUi _selectPairForTagUi;
|
||||
|
||||
public DrawFolderTag(string id, IImmutableList<DrawUserPair> drawPairs, IImmutableList<Pair> allPairs,
|
||||
TagHandler tagHandler, ApiController apiController, SelectPairForTagUi selectPairForTagUi)
|
||||
: base(id, drawPairs, allPairs, tagHandler)
|
||||
TagHandler tagHandler, ApiController apiController, SelectPairForTagUi selectPairForTagUi, UiSharedService uiSharedService)
|
||||
: base(id, drawPairs, allPairs, tagHandler, uiSharedService)
|
||||
{
|
||||
_apiController = apiController;
|
||||
_selectPairForTagUi = selectPairForTagUi;
|
||||
@@ -80,7 +80,7 @@ public class DrawFolderTag : DrawFolderBase
|
||||
};
|
||||
|
||||
ImGui.AlignTextToFramePadding();
|
||||
UiSharedService.NormalizedIcon(icon);
|
||||
_uiSharedService.IconText(icon);
|
||||
|
||||
if (RenderCount)
|
||||
{
|
||||
@@ -100,12 +100,12 @@ public class DrawFolderTag : DrawFolderBase
|
||||
protected override void DrawMenu(float menuWidth)
|
||||
{
|
||||
ImGui.TextUnformatted("Group Menu");
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Users, "Select Pairs", menuWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Users, "Select Pairs", menuWidth, true))
|
||||
{
|
||||
_selectPairForTagUi.Open(_id);
|
||||
}
|
||||
UiSharedService.AttachToolTip("Select Individual Pairs for this Pair Group");
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Trash, "Delete Pair Group", menuWidth, true) && UiSharedService.CtrlPressed())
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Delete Pair Group", menuWidth, true) && UiSharedService.CtrlPressed())
|
||||
{
|
||||
_tagHandler.RemoveTag(_id);
|
||||
}
|
||||
@@ -137,11 +137,11 @@ public class DrawFolderTag : DrawFolderBase
|
||||
|
||||
var allArePaused = _allPairs.All(pair => pair.UserPair!.OwnPermissions.IsPaused());
|
||||
var pauseButton = allArePaused ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
|
||||
var pauseButtonX = UiSharedService.NormalizedIconButtonSize(pauseButton).X;
|
||||
var pauseButtonX = _uiSharedService.IconButtonSize(pauseButton).X;
|
||||
|
||||
var buttonPauseOffset = currentRightSideX - pauseButtonX;
|
||||
ImGui.SameLine(buttonPauseOffset);
|
||||
if (UiSharedService.NormalizedIconButton(pauseButton))
|
||||
if (UiSharedService.IconButton(pauseButton))
|
||||
{
|
||||
if (allArePaused)
|
||||
{
|
||||
|
||||
@@ -11,14 +11,17 @@ public class DrawGroupedGroupFolder : IDrawFolder
|
||||
{
|
||||
private readonly IEnumerable<IDrawFolder> _groups;
|
||||
private readonly TagHandler _tagHandler;
|
||||
private readonly UiSharedService _uiSharedService;
|
||||
|
||||
public IImmutableList<DrawUserPair> DrawPairs => throw new NotSupportedException();
|
||||
public int OnlinePairs => _groups.SelectMany(g => g.DrawPairs).Where(g => g.Pair.IsOnline).DistinctBy(g => g.Pair.UserData.UID).Count();
|
||||
public int TotalPairs => _groups.Sum(g => g.TotalPairs);
|
||||
|
||||
public DrawGroupedGroupFolder(IEnumerable<IDrawFolder> groups, TagHandler tagHandler)
|
||||
public DrawGroupedGroupFolder(IEnumerable<IDrawFolder> groups, TagHandler tagHandler, UiSharedService uiSharedService)
|
||||
{
|
||||
_groups = groups;
|
||||
_tagHandler = tagHandler;
|
||||
_uiSharedService = uiSharedService;
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
@@ -33,14 +36,14 @@ public class DrawGroupedGroupFolder : IDrawFolder
|
||||
ImGui.SameLine();
|
||||
|
||||
var icon = _tagHandler.IsTagOpen(_id) ? FontAwesomeIcon.CaretDown : FontAwesomeIcon.CaretRight;
|
||||
UiSharedService.NormalizedIcon(icon);
|
||||
_uiSharedService.IconText(icon);
|
||||
if (ImGui.IsItemClicked())
|
||||
{
|
||||
_tagHandler.SetTagOpen(_id, !_tagHandler.IsTagOpen(_id));
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.UsersRectangle);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.UsersRectangle);
|
||||
using (ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, ImGui.GetStyle().ItemSpacing with { X = ImGui.GetStyle().ItemSpacing.X / 2f }))
|
||||
{
|
||||
ImGui.SameLine();
|
||||
|
||||
@@ -25,13 +25,15 @@ public class DrawUserPair
|
||||
private readonly string _id;
|
||||
private readonly SelectTagForPairUi _selectTagForPairUi;
|
||||
private readonly ServerConfigurationManager _serverConfigurationManager;
|
||||
private float _menuRenderWidth = -1;
|
||||
private readonly UiSharedService _uiSharedService;
|
||||
private float _menuWidth = -1;
|
||||
|
||||
public DrawUserPair(string id, Pair entry, List<GroupFullInfoDto> syncedGroups,
|
||||
GroupFullInfoDto? currentGroup,
|
||||
ApiController apiController, IdDisplayHandler uIDDisplayHandler,
|
||||
MareMediator mareMediator, SelectTagForPairUi selectTagForPairUi,
|
||||
ServerConfigurationManager serverConfigurationManager)
|
||||
ServerConfigurationManager serverConfigurationManager,
|
||||
UiSharedService uiSharedService)
|
||||
{
|
||||
_id = id;
|
||||
_pair = entry;
|
||||
@@ -42,6 +44,7 @@ public class DrawUserPair
|
||||
_mediator = mareMediator;
|
||||
_selectTagForPairUi = selectTagForPairUi;
|
||||
_serverConfigurationManager = serverConfigurationManager;
|
||||
_uiSharedService = uiSharedService;
|
||||
}
|
||||
|
||||
public Pair Pair => _pair;
|
||||
@@ -62,7 +65,7 @@ public class DrawUserPair
|
||||
{
|
||||
if (!_pair.IsPaused)
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.User, "Open Profile", _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.User, "Open Profile", _menuWidth, true))
|
||||
{
|
||||
_displayHandler.OpenProfile(_pair);
|
||||
ImGui.CloseCurrentPopup();
|
||||
@@ -71,7 +74,7 @@ public class DrawUserPair
|
||||
}
|
||||
if (_pair.IsVisible)
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Sync, "Reload last data", _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Sync, "Reload last data", _menuWidth, true))
|
||||
{
|
||||
_pair.ApplyLastReceivedData(forced: true);
|
||||
ImGui.CloseCurrentPopup();
|
||||
@@ -79,7 +82,7 @@ public class DrawUserPair
|
||||
UiSharedService.AttachToolTip("This reapplies the last received character data to this character");
|
||||
}
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.PlayCircle, "Cycle pause state", _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.PlayCircle, "Cycle pause state", _menuWidth, true))
|
||||
{
|
||||
_ = _apiController.CyclePause(_pair.UserData);
|
||||
ImGui.CloseCurrentPopup();
|
||||
@@ -87,7 +90,7 @@ public class DrawUserPair
|
||||
ImGui.Separator();
|
||||
|
||||
ImGui.TextUnformatted("Pair Permission Functions");
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.WindowMaximize, "Open Permissions Window", _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.WindowMaximize, "Open Permissions Window", _menuWidth, true))
|
||||
{
|
||||
_mediator.Publish(new OpenPermissionWindow(_pair));
|
||||
ImGui.CloseCurrentPopup();
|
||||
@@ -97,7 +100,7 @@ public class DrawUserPair
|
||||
var isSticky = _pair.UserPair!.OwnPermissions.IsSticky();
|
||||
string stickyText = isSticky ? "Disable Preferred Permissions" : "Enable Preferred Permissions";
|
||||
var stickyIcon = isSticky ? FontAwesomeIcon.ArrowCircleDown : FontAwesomeIcon.ArrowCircleUp;
|
||||
if (UiSharedService.NormalizedIconTextButton(stickyIcon, stickyText, _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(stickyIcon, stickyText, _menuWidth, true))
|
||||
{
|
||||
var permissions = _pair.UserPair.OwnPermissions;
|
||||
permissions.SetSticky(!isSticky);
|
||||
@@ -113,7 +116,7 @@ public class DrawUserPair
|
||||
var isDisableSounds = _pair.UserPair!.OwnPermissions.IsDisableSounds();
|
||||
string disableSoundsText = isDisableSounds ? "Enable sound sync" : "Disable sound sync";
|
||||
var disableSoundsIcon = isDisableSounds ? FontAwesomeIcon.VolumeUp : FontAwesomeIcon.VolumeMute;
|
||||
if (UiSharedService.NormalizedIconTextButton(disableSoundsIcon, disableSoundsText, _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(disableSoundsIcon, disableSoundsText, _menuWidth, true))
|
||||
{
|
||||
var permissions = _pair.UserPair.OwnPermissions;
|
||||
permissions.SetDisableSounds(!isDisableSounds);
|
||||
@@ -124,7 +127,7 @@ public class DrawUserPair
|
||||
var isDisableAnims = _pair.UserPair!.OwnPermissions.IsDisableAnimations();
|
||||
string disableAnimsText = isDisableAnims ? "Enable animation sync" : "Disable animation sync";
|
||||
var disableAnimsIcon = isDisableAnims ? FontAwesomeIcon.Running : FontAwesomeIcon.Stop;
|
||||
if (UiSharedService.NormalizedIconTextButton(disableAnimsIcon, disableAnimsText, _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(disableAnimsIcon, disableAnimsText, _menuWidth, true))
|
||||
{
|
||||
var permissions = _pair.UserPair.OwnPermissions;
|
||||
permissions.SetDisableAnimations(!isDisableAnims);
|
||||
@@ -135,7 +138,7 @@ public class DrawUserPair
|
||||
var isDisableVFX = _pair.UserPair!.OwnPermissions.IsDisableVFX();
|
||||
string disableVFXText = isDisableVFX ? "Enable VFX sync" : "Disable VFX sync";
|
||||
var disableVFXIcon = isDisableVFX ? FontAwesomeIcon.Sun : FontAwesomeIcon.Circle;
|
||||
if (UiSharedService.NormalizedIconTextButton(disableVFXIcon, disableVFXText, _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(disableVFXIcon, disableVFXText, _menuWidth, true))
|
||||
{
|
||||
var permissions = _pair.UserPair.OwnPermissions;
|
||||
permissions.SetDisableVFX(!isDisableVFX);
|
||||
@@ -147,7 +150,7 @@ public class DrawUserPair
|
||||
{
|
||||
ImGui.Separator();
|
||||
ImGui.TextUnformatted("Pair reporting");
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.ExclamationTriangle, "Report Mare Profile", _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.ExclamationTriangle, "Report Mare Profile", _menuWidth, true))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
_mediator.Publish(new OpenReportPopupMessage(_pair));
|
||||
@@ -163,12 +166,12 @@ public class DrawUserPair
|
||||
|
||||
if (_pair.IndividualPairStatus != API.Data.Enum.IndividualPairStatus.None)
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Folder, "Pair Groups", _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Folder, "Pair Groups", _menuWidth, true))
|
||||
{
|
||||
_selectTagForPairUi.Open(_pair);
|
||||
}
|
||||
UiSharedService.AttachToolTip("Choose pair groups for " + entryUID);
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Trash, "Unpair Permanently", _menuRenderWidth, true) && UiSharedService.CtrlPressed())
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Unpair Permanently", _menuWidth, true) && UiSharedService.CtrlPressed())
|
||||
{
|
||||
_ = _apiController.UserRemovePair(new(_pair.UserData));
|
||||
}
|
||||
@@ -176,7 +179,7 @@ public class DrawUserPair
|
||||
}
|
||||
else
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Plus, "Pair individually", _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Plus, "Pair individually", _menuWidth, true))
|
||||
{
|
||||
_ = _apiController.UserAddPair(new(_pair.UserData));
|
||||
}
|
||||
@@ -193,13 +196,13 @@ public class DrawUserPair
|
||||
if (_pair.IsPaused)
|
||||
{
|
||||
using var _ = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudYellow);
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.PauseCircle);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.PauseCircle);
|
||||
userPairText = _pair.UserData.AliasOrUID + " is paused";
|
||||
}
|
||||
else if (!_pair.IsOnline)
|
||||
{
|
||||
using var _ = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed);
|
||||
UiSharedService.NormalizedIcon(_pair.IndividualPairStatus == API.Data.Enum.IndividualPairStatus.OneSided
|
||||
_uiSharedService.IconText(_pair.IndividualPairStatus == API.Data.Enum.IndividualPairStatus.OneSided
|
||||
? FontAwesomeIcon.ArrowsLeftRight
|
||||
: (_pair.IndividualPairStatus == API.Data.Enum.IndividualPairStatus.Bidirectional
|
||||
? FontAwesomeIcon.User : FontAwesomeIcon.Users));
|
||||
@@ -207,7 +210,7 @@ public class DrawUserPair
|
||||
}
|
||||
else if (_pair.IsVisible)
|
||||
{
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.Eye, ImGuiColors.ParsedGreen);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Eye, ImGuiColors.ParsedGreen);
|
||||
userPairText = _pair.UserData.AliasOrUID + " is visible: " + _pair.PlayerName + Environment.NewLine + "Click to target this player";
|
||||
if (ImGui.IsItemClicked())
|
||||
{
|
||||
@@ -217,7 +220,7 @@ public class DrawUserPair
|
||||
else
|
||||
{
|
||||
using var _ = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.HealerGreen);
|
||||
UiSharedService.NormalizedIcon(_pair.IndividualPairStatus == API.Data.Enum.IndividualPairStatus.Bidirectional
|
||||
_uiSharedService.IconText(_pair.IndividualPairStatus == API.Data.Enum.IndividualPairStatus.Bidirectional
|
||||
? FontAwesomeIcon.User : FontAwesomeIcon.Users);
|
||||
userPairText = _pair.UserData.AliasOrUID + " is online";
|
||||
}
|
||||
@@ -286,22 +289,22 @@ public class DrawUserPair
|
||||
private float DrawRightSide()
|
||||
{
|
||||
var pauseIcon = _pair.UserPair!.OwnPermissions.IsPaused() ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
|
||||
var pauseIconSize = UiSharedService.NormalizedIconButtonSize(pauseIcon);
|
||||
var barButtonSize = UiSharedService.NormalizedIconButtonSize(FontAwesomeIcon.Bars);
|
||||
var pauseIconSize = _uiSharedService.IconButtonSize(pauseIcon);
|
||||
var barButtonSize = _uiSharedService.IconButtonSize(FontAwesomeIcon.Bars);
|
||||
var spacingX = ImGui.GetStyle().ItemSpacing.X;
|
||||
var windowEndX = ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth();
|
||||
float currentRightSide = windowEndX - barButtonSize.X;
|
||||
|
||||
ImGui.SameLine(currentRightSide);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
if (UiSharedService.NormalizedIconButton(FontAwesomeIcon.Bars))
|
||||
if (UiSharedService.IconButton(FontAwesomeIcon.Bars))
|
||||
{
|
||||
ImGui.OpenPopup("User Flyout Menu");
|
||||
}
|
||||
|
||||
currentRightSide -= (pauseIconSize.X + spacingX);
|
||||
ImGui.SameLine(currentRightSide);
|
||||
if (UiSharedService.NormalizedIconButton(pauseIcon))
|
||||
if (UiSharedService.IconButton(pauseIcon))
|
||||
{
|
||||
var perm = _pair.UserPair!.OwnPermissions;
|
||||
perm.SetPaused(!perm.IsPaused());
|
||||
@@ -321,11 +324,11 @@ public class DrawUserPair
|
||||
|
||||
if (individualAnimDisabled || individualSoundsDisabled || individualVFXDisabled || individualIsSticky)
|
||||
{
|
||||
currentRightSide -= (UiSharedService.GetIconData(individualIcon).NormalizedIconScale.X + spacingX);
|
||||
currentRightSide -= (_uiSharedService.GetIconData(individualIcon).X + spacingX);
|
||||
|
||||
ImGui.SameLine(currentRightSide);
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudYellow, individualAnimDisabled || individualSoundsDisabled || individualVFXDisabled))
|
||||
UiSharedService.NormalizedIcon(individualIcon);
|
||||
_uiSharedService.IconText(individualIcon);
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
ImGui.BeginTooltip();
|
||||
@@ -335,7 +338,7 @@ public class DrawUserPair
|
||||
|
||||
if (individualIsSticky)
|
||||
{
|
||||
UiSharedService.NormalizedIcon(individualIcon);
|
||||
_uiSharedService.IconText(individualIcon);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("Preferred permissions enabled");
|
||||
@@ -346,7 +349,7 @@ public class DrawUserPair
|
||||
if (individualSoundsDisabled)
|
||||
{
|
||||
var userSoundsText = "Sound sync";
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.VolumeOff);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.VolumeOff);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted(userSoundsText);
|
||||
@@ -354,17 +357,17 @@ public class DrawUserPair
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("You");
|
||||
UiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OwnPermissions.IsDisableSounds());
|
||||
_uiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OwnPermissions.IsDisableSounds());
|
||||
ImGui.SameLine();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("They");
|
||||
UiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OtherPermissions.IsDisableSounds());
|
||||
_uiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OtherPermissions.IsDisableSounds());
|
||||
}
|
||||
|
||||
if (individualAnimDisabled)
|
||||
{
|
||||
var userAnimText = "Animation sync";
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.Stop);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Stop);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted(userAnimText);
|
||||
@@ -372,17 +375,17 @@ public class DrawUserPair
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("You");
|
||||
UiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OwnPermissions.IsDisableAnimations());
|
||||
_uiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OwnPermissions.IsDisableAnimations());
|
||||
ImGui.SameLine();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("They");
|
||||
UiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OtherPermissions.IsDisableAnimations());
|
||||
_uiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OtherPermissions.IsDisableAnimations());
|
||||
}
|
||||
|
||||
if (individualVFXDisabled)
|
||||
{
|
||||
var userVFXText = "VFX sync";
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.Circle);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Circle);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted(userVFXText);
|
||||
@@ -390,11 +393,11 @@ public class DrawUserPair
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("You");
|
||||
UiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OwnPermissions.IsDisableVFX());
|
||||
_uiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OwnPermissions.IsDisableVFX());
|
||||
ImGui.SameLine();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("They");
|
||||
UiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OtherPermissions.IsDisableVFX());
|
||||
_uiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OtherPermissions.IsDisableVFX());
|
||||
}
|
||||
|
||||
ImGui.EndTooltip();
|
||||
@@ -427,9 +430,9 @@ public class DrawUserPair
|
||||
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
{
|
||||
currentRightSide -= (UiSharedService.GetIconData(icon).NormalizedIconScale.X + spacingX);
|
||||
currentRightSide -= (_uiSharedService.GetIconData(icon).X + spacingX);
|
||||
ImGui.SameLine(currentRightSide);
|
||||
UiSharedService.NormalizedIcon(icon);
|
||||
_uiSharedService.IconText(icon);
|
||||
UiSharedService.AttachToolTip(text);
|
||||
}
|
||||
}
|
||||
@@ -442,9 +445,9 @@ public class DrawUserPair
|
||||
DrawCommonClientMenu();
|
||||
ImGui.Separator();
|
||||
DrawPairedClientMenu();
|
||||
if (_menuRenderWidth <= 0)
|
||||
if (_menuWidth <= 0)
|
||||
{
|
||||
_menuRenderWidth = ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X;
|
||||
_menuWidth = ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,7 +463,7 @@ public class DrawUserPair
|
||||
{
|
||||
ImGui.TextUnformatted("Syncshell Moderator Functions");
|
||||
var pinText = userIsPinned ? "Unpin user" : "Pin user";
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Thumbtack, pinText, _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Thumbtack, pinText, _menuWidth, true))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
if (!group.GroupPairUserInfos.TryGetValue(_pair.UserData.UID, out var userinfo))
|
||||
@@ -475,14 +478,14 @@ public class DrawUserPair
|
||||
}
|
||||
UiSharedService.AttachToolTip("Pin this user to the Syncshell. Pinned users will not be deleted in case of a manually initiated Syncshell clean");
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Trash, "Remove user", _menuRenderWidth, true) && UiSharedService.CtrlPressed())
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Remove user", _menuWidth, true) && UiSharedService.CtrlPressed())
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
_ = _apiController.GroupRemoveUser(new(group.Group, _pair.UserData));
|
||||
}
|
||||
UiSharedService.AttachToolTip("Hold CTRL and click to remove user " + (_pair.UserData.AliasOrUID) + " from Syncshell");
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.UserSlash, "Ban User", _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.UserSlash, "Ban User", _menuWidth, true))
|
||||
{
|
||||
_mediator.Publish(new OpenBanUserPopupMessage(_pair, group));
|
||||
ImGui.CloseCurrentPopup();
|
||||
@@ -496,7 +499,7 @@ public class DrawUserPair
|
||||
{
|
||||
ImGui.TextUnformatted("Syncshell Owner Functions");
|
||||
string modText = userIsModerator ? "Demod user" : "Mod user";
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.UserShield, modText, _menuRenderWidth, true) && UiSharedService.CtrlPressed())
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.UserShield, modText, _menuWidth, true) && UiSharedService.CtrlPressed())
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
if (!group.GroupPairUserInfos.TryGetValue(_pair.UserData.UID, out var userinfo))
|
||||
@@ -513,7 +516,7 @@ public class DrawUserPair
|
||||
UiSharedService.AttachToolTip("Hold CTRL to change the moderator status for " + (_pair.UserData.AliasOrUID) + Environment.NewLine +
|
||||
"Moderators can kick, ban/unban, pin/unpin users and clear the Syncshell.");
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Crown, "Transfer Ownership", _menuRenderWidth, true) && UiSharedService.CtrlPressed() && UiSharedService.ShiftPressed())
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Crown, "Transfer Ownership", _menuWidth, true) && UiSharedService.CtrlPressed() && UiSharedService.ShiftPressed())
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
_ = _apiController.GroupChangeOwnership(new(group.Group, _pair.UserData));
|
||||
|
||||
@@ -11,13 +11,15 @@ namespace MareSynchronos.UI.Components.Popup;
|
||||
public class BanUserPopupHandler : IPopupHandler
|
||||
{
|
||||
private readonly ApiController _apiController;
|
||||
private readonly UiSharedService _uiSharedService;
|
||||
private string _banReason = string.Empty;
|
||||
private GroupFullInfoDto _group = null!;
|
||||
private Pair _reportedPair = null!;
|
||||
|
||||
public BanUserPopupHandler(ApiController apiController)
|
||||
public BanUserPopupHandler(ApiController apiController, UiSharedService uiSharedService)
|
||||
{
|
||||
_apiController = apiController;
|
||||
_uiSharedService = uiSharedService;
|
||||
}
|
||||
|
||||
public Vector2 PopupSize => new(500, 250);
|
||||
@@ -29,7 +31,7 @@ public class BanUserPopupHandler : IPopupHandler
|
||||
UiSharedService.TextWrapped("User " + (_reportedPair.UserData.AliasOrUID) + " will be banned and removed from this Syncshell.");
|
||||
ImGui.InputTextWithHint("##banreason", "Ban Reason", ref _banReason, 255);
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.UserSlash, "Ban User"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.UserSlash, "Ban User"))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
var reason = _banReason;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using ImGuiNET;
|
||||
using MareSynchronos.Services.ServerConfiguration;
|
||||
using System.Numerics;
|
||||
@@ -25,7 +24,7 @@ public class CensusPopupHandler : IPopupHandler
|
||||
public void DrawContent()
|
||||
{
|
||||
var start = 0f;
|
||||
using (ImRaii.PushFont(_uiSharedService.UidFont))
|
||||
using (_uiSharedService.UidFont.Push())
|
||||
{
|
||||
start = ImGui.GetCursorPosY() - ImGui.CalcTextSize("Mare Census Data").Y;
|
||||
UiSharedService.TextWrapped("Mare Census Participation");
|
||||
|
||||
@@ -13,9 +13,11 @@ public class PopupHandler : WindowMediatorSubscriberBase
|
||||
{
|
||||
protected bool _openPopup = false;
|
||||
private readonly HashSet<IPopupHandler> _handlers;
|
||||
private readonly UiSharedService _uiSharedService;
|
||||
private IPopupHandler? _currentHandler = null;
|
||||
|
||||
public PopupHandler(ILogger<PopupHandler> logger, MareMediator mediator, IEnumerable<IPopupHandler> popupHandlers, PerformanceCollectorService performanceCollectorService)
|
||||
public PopupHandler(ILogger<PopupHandler> logger, MareMediator mediator, IEnumerable<IPopupHandler> popupHandlers, PerformanceCollectorService performanceCollectorService,
|
||||
UiSharedService uiSharedService)
|
||||
: base(logger, mediator, "MarePopupHandler", performanceCollectorService)
|
||||
{
|
||||
Flags = ImGuiWindowFlags.NoBringToFrontOnFocus
|
||||
@@ -52,6 +54,7 @@ public class PopupHandler : WindowMediatorSubscriberBase
|
||||
_currentHandler = _handlers.OfType<CensusPopupHandler>().Single();
|
||||
IsOpen = true;
|
||||
});
|
||||
_uiSharedService = uiSharedService;
|
||||
}
|
||||
|
||||
protected override void DrawInternal()
|
||||
@@ -73,7 +76,7 @@ public class PopupHandler : WindowMediatorSubscriberBase
|
||||
if (_currentHandler.ShowClose)
|
||||
{
|
||||
ImGui.Separator();
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Times, "Close"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Times, "Close"))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ internal class ReportPopupHandler : IPopupHandler
|
||||
|
||||
public void DrawContent()
|
||||
{
|
||||
using (ImRaii.PushFont(_uiSharedService.UidFont))
|
||||
using (_uiSharedService.UidFont.Push())
|
||||
UiSharedService.TextWrapped("Report " + _reportedPair!.UserData.AliasOrUID + " Mare Profile");
|
||||
|
||||
ImGui.InputTextMultiline("##reportReason", ref _reportReason, 500, new Vector2(500 - ImGui.GetStyle().ItemSpacing.X * 2, 200));
|
||||
@@ -42,7 +42,7 @@ internal class ReportPopupHandler : IPopupHandler
|
||||
|
||||
using (ImRaii.Disabled(string.IsNullOrEmpty(_reportReason)))
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.ExclamationTriangle, "Send Report"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.ExclamationTriangle, "Send Report"))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
var reason = _reportReason;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility;
|
||||
using ImGuiNET;
|
||||
using MareSynchronos.PlayerData.Pairs;
|
||||
using MareSynchronos.UI.Handlers;
|
||||
@@ -48,7 +47,8 @@ public class SelectPairForTagUi
|
||||
ImGui.SetNextWindowSizeConstraints(minSize, maxSize);
|
||||
if (ImGui.BeginPopupModal(popupName, ref _show, ImGuiWindowFlags.Popup | ImGuiWindowFlags.Modal))
|
||||
{
|
||||
UiSharedService.FontText($"Select users for group {_tag}", UiBuilder.DefaultFont);
|
||||
ImGui.TextUnformatted($"Select users for group {_tag}");
|
||||
|
||||
ImGui.InputTextWithHint("##filter", "Filter", ref _filter, 255, ImGuiInputTextFlags.None);
|
||||
foreach (var item in pairs
|
||||
.Where(p => string.IsNullOrEmpty(_filter) || PairName(p).Contains(_filter, StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
@@ -14,6 +14,7 @@ public class SelectTagForPairUi
|
||||
{
|
||||
private readonly TagHandler _tagHandler;
|
||||
private readonly IdDisplayHandler _uidDisplayHandler;
|
||||
private readonly UiSharedService _uiSharedService;
|
||||
|
||||
/// <summary>
|
||||
/// The group UI is always open for a specific pair. This defines which pair the UI is open for.
|
||||
@@ -31,12 +32,13 @@ public class SelectTagForPairUi
|
||||
/// </summary>
|
||||
private string _tagNameToAdd = "";
|
||||
|
||||
public SelectTagForPairUi(TagHandler tagHandler, IdDisplayHandler uidDisplayHandler)
|
||||
public SelectTagForPairUi(TagHandler tagHandler, IdDisplayHandler uidDisplayHandler, UiSharedService uiSharedService)
|
||||
{
|
||||
_show = false;
|
||||
_pair = null;
|
||||
_tagHandler = tagHandler;
|
||||
_uidDisplayHandler = uidDisplayHandler;
|
||||
_uiSharedService = uiSharedService;
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
@@ -61,7 +63,7 @@ public class SelectTagForPairUi
|
||||
var childHeight = tags.Count != 0 ? tags.Count * 25 : 1;
|
||||
var childSize = new Vector2(0, childHeight > 100 ? 100 : childHeight) * ImGuiHelpers.GlobalScale;
|
||||
|
||||
UiSharedService.FontText($"Select the groups you want {name} to be in.", UiBuilder.DefaultFont);
|
||||
ImGui.TextUnformatted($"Select the groups you want {name} to be in.");
|
||||
if (ImGui.BeginChild(name + "##listGroups", childSize))
|
||||
{
|
||||
foreach (var tag in tags)
|
||||
@@ -72,8 +74,8 @@ public class SelectTagForPairUi
|
||||
}
|
||||
|
||||
ImGui.Separator();
|
||||
UiSharedService.FontText($"Create a new group for {name}.", UiBuilder.DefaultFont);
|
||||
if (UiSharedService.NormalizedIconButton(FontAwesomeIcon.Plus))
|
||||
ImGui.TextUnformatted($"Create a new group for {name}.");
|
||||
if (UiSharedService.IconButton(FontAwesomeIcon.Plus))
|
||||
{
|
||||
HandleAddTag();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user