Clean code

This commit is contained in:
2025-09-14 00:21:30 +02:00
parent 4a388dcfa9
commit 1755b5cb54
8 changed files with 3 additions and 74 deletions

View File

@@ -44,10 +44,6 @@ public class DrawGroupPair : DrawPairBase
var presenceText = entryUID + " is offline";
ImGui.SetCursorPosY(textPosY);
// We'll draw an optional prefix icon (pause or paired-moon). If we draw one,
// we add a SameLine() before drawing the presence icon. Otherwise, we draw
// the presence icon directly at the current cursor position to avoid gaps.
bool drewPrefixIcon = false;
if (_pair.IsPaused)
@@ -65,9 +61,6 @@ public class DrawGroupPair : DrawPairBase
{
bool individuallyPaired = _pair.UserPair != null;
var violet = new Vector4(0.63f, 0.25f, 1f, 1f);
// Show a violet moon only when individually paired AND online/visible.
// If offline or not individually paired, do not draw a moon at all.
if (individuallyPaired && (_pair.IsOnline || _pair.IsVisible))
{
ImGui.PushFont(UiBuilder.IconFont);
@@ -77,8 +70,6 @@ public class DrawGroupPair : DrawPairBase
drewPrefixIcon = true;
}
}
// Presence status icon (eye when visible, cloud-moon otherwise)
if (drewPrefixIcon)
ImGui.SameLine();

View File

@@ -38,9 +38,7 @@ public class DrawUserPair : DrawPairBase
protected override void DrawLeftSide(float textPosY, float originalY)
{
// Primary presence indicator: moon (online = violet, offline = grey)
var online = _pair.IsOnline;
// Violet accent (#BA70EF)
var violet = new Vector4(0.69f, 0.27f, 0.93f, 1f);
var offlineGrey = ImGuiColors.DalamudGrey3;
@@ -51,9 +49,6 @@ public class DrawUserPair : DrawPairBase
UiSharedService.AttachToolTip(online
? "User is online"
: "User is offline");
// Secondary pairing state badges (only if needed)
// Not mutually paired -> red ArrowUp
if (!(_pair.UserPair!.OwnPermissions.IsPaired() && _pair.UserPair!.OtherPermissions.IsPaired()))
{
ImGui.SameLine();
@@ -63,7 +58,6 @@ public class DrawUserPair : DrawPairBase
ImGui.PopFont();
UiSharedService.AttachToolTip(_pair.UserData.AliasOrUID + " has not added you back");
}
// Paused (either side) -> yellow PauseCircle
else if (_pair.UserPair!.OwnPermissions.IsPaused() || _pair.UserPair!.OtherPermissions.IsPaused())
{
ImGui.SameLine();
@@ -149,8 +143,6 @@ public class DrawUserPair : DrawPairBase
var individualSoundsDisabled = (_pair.UserPair?.OwnPermissions.IsDisableSounds() ?? false) || (_pair.UserPair?.OtherPermissions.IsDisableSounds() ?? false);
var individualAnimDisabled = (_pair.UserPair?.OwnPermissions.IsDisableAnimations() ?? false) || (_pair.UserPair?.OtherPermissions.IsDisableAnimations() ?? false);
var individualVFXDisabled = (_pair.UserPair?.OwnPermissions.IsDisableVFX() ?? false) || (_pair.UserPair?.OtherPermissions.IsDisableVFX() ?? false);
// Icon for individually applied permissions
if (individualSoundsDisabled || individualAnimDisabled || individualVFXDisabled)
{
var icon = FontAwesomeIcon.ExclamationTriangle;
@@ -205,8 +197,6 @@ public class DrawUserPair : DrawPairBase
}
}
}
// Icon for shared character data
if (_charaDataManager.SharedWithYouData.TryGetValue(_pair.UserData, out var sharedData))
{
var icon = FontAwesomeIcon.Running;

View File

@@ -54,17 +54,12 @@ public class PairGroupsUi
ImGui.SameLine(buttonPauseOffset);
if (_uiSharedService.IconButton(pauseButton))
{
// If all of the currently visible pairs (after applying filters to the pairs)
// are paused we display a resume button to resume all currently visible (after filters)
// pairs. Otherwise, we just pause all the remaining pairs.
if (allArePaused)
{
// If all are paused => resume all
ResumeAllPairs(availablePairsInThisTag);
}
else
{
// otherwise pause all remaining
PauseRemainingPairs(availablePairsInThisTag);
}
}
@@ -120,7 +115,6 @@ public class PairGroupsUi
}
else
{
// Avoid uncomfortably close group names
if (!_tagHandler.IsTagOpen(tag))
{
var size = ImGui.CalcTextSize("").Y + ImGui.GetStyle().FramePadding.Y * 2f;
@@ -163,8 +157,6 @@ public class PairGroupsUi
};
string resultFolderName = !isSpecialTag ? $"{displayedName} ({visible}/{online}/{total} Pairs)" : $"{displayedName} ({online} Pairs)";
// FontAwesomeIcon.CaretSquareDown : FontAwesomeIcon.CaretSquareRight
var icon = _tagHandler.IsTagOpen(tag) ? FontAwesomeIcon.CaretSquareDown : FontAwesomeIcon.CaretSquareRight;
_uiSharedService.IconText(icon);
if (ImGui.IsItemClicked(ImGuiMouseButton.Left))

View File

@@ -15,20 +15,8 @@ public class SelectGroupForPairUi
private readonly UidDisplayHandler _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.
/// </summary>
/// <returns></returns>
private Pair? _pair;
/// <summary>
/// Should the panel show, yes/no
/// </summary>
private bool _show;
/// <summary>
/// For the add category option, this stores the currently typed in tag name
/// </summary>
private string _tagNameToAdd = "";
public SelectGroupForPairUi(TagHandler tagHandler, UidDisplayHandler uidDisplayHandler, UiSharedService uiSharedService)
@@ -49,7 +37,6 @@ public class SelectGroupForPairUi
var name = PairName(_pair);
var popupName = $"Choose Groups for {name}";
// Is the popup supposed to show but did not open yet? Open it
if (_show)
{
ImGui.OpenPopup(popupName);
@@ -91,10 +78,6 @@ public class SelectGroupForPairUi
public void Open(Pair pair)
{
_pair = pair;
// Using "_show" here to de-couple the opening of the popup
// The popup name is derived from the name the user currently sees, which is
// based on the showUidForEntry dictionary.
// We'd have to derive the name here to open it popup modal here, when the Open() is called
_show = true;
}