Added online filter like visible, seperated them for now. need to refactor.
This commit is contained in:
@@ -169,11 +169,16 @@ public class DrawFolderTag : DrawFolderBase
|
||||
|
||||
protected override float DrawRightSide(float currentRightSideX)
|
||||
{
|
||||
if (_id == TagHandler.CustomVisibleTag)
|
||||
if (string.Equals(_id, TagHandler.CustomVisibleTag, StringComparison.Ordinal))
|
||||
{
|
||||
return DrawVisibleFilter(currentRightSideX);
|
||||
}
|
||||
|
||||
if (string.Equals(_id, TagHandler.CustomOnlineTag, StringComparison.Ordinal))
|
||||
{
|
||||
return DrawOnlineFilter(currentRightSideX);
|
||||
}
|
||||
|
||||
if (!RenderPause)
|
||||
{
|
||||
return currentRightSideX;
|
||||
@@ -254,7 +259,7 @@ public class DrawFolderTag : DrawFolderBase
|
||||
foreach (VisiblePairSortMode mode in Enum.GetValues<VisiblePairSortMode>())
|
||||
{
|
||||
var selected = _configService.Current.VisiblePairSortMode == mode;
|
||||
if (ImGui.MenuItem(GetSortLabel(mode), string.Empty, selected))
|
||||
if (ImGui.MenuItem(GetSortVisibleLabel(mode), string.Empty, selected))
|
||||
{
|
||||
if (!selected)
|
||||
{
|
||||
@@ -273,7 +278,49 @@ public class DrawFolderTag : DrawFolderBase
|
||||
return buttonStart - spacingX;
|
||||
}
|
||||
|
||||
private static string GetSortLabel(VisiblePairSortMode mode) => mode switch
|
||||
private float DrawOnlineFilter(float currentRightSideX)
|
||||
{
|
||||
var buttonSize = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Filter);
|
||||
var spacingX = ImGui.GetStyle().ItemSpacing.X;
|
||||
var buttonStart = currentRightSideX - buttonSize.X;
|
||||
|
||||
ImGui.SameLine(buttonStart);
|
||||
if (_uiSharedService.IconButton(FontAwesomeIcon.Filter))
|
||||
{
|
||||
SuppressNextRowToggle();
|
||||
ImGui.OpenPopup($"online-filter-{_id}");
|
||||
}
|
||||
|
||||
UiSharedService.AttachToolTip("Adjust how online pairs are ordered.");
|
||||
|
||||
if (ImGui.BeginPopup($"online-filter-{_id}"))
|
||||
{
|
||||
ImGui.TextUnformatted("Online Pair Ordering");
|
||||
ImGui.Separator();
|
||||
|
||||
foreach (OnlinePairSortMode mode in Enum.GetValues<OnlinePairSortMode>())
|
||||
{
|
||||
var selected = _configService.Current.OnlinePairSortMode == mode;
|
||||
if (ImGui.MenuItem(GetSortOnlineLabel(mode), string.Empty, selected))
|
||||
{
|
||||
if (!selected)
|
||||
{
|
||||
_configService.Current.OnlinePairSortMode = mode;
|
||||
_configService.Save();
|
||||
_mediator.Publish(new RefreshUiMessage());
|
||||
}
|
||||
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.EndPopup();
|
||||
}
|
||||
|
||||
return buttonStart - spacingX;
|
||||
}
|
||||
|
||||
private static string GetSortVisibleLabel(VisiblePairSortMode mode) => mode switch
|
||||
{
|
||||
VisiblePairSortMode.Alphabetical => "Alphabetical",
|
||||
VisiblePairSortMode.VramUsage => "VRAM usage (descending)",
|
||||
@@ -282,4 +329,11 @@ public class DrawFolderTag : DrawFolderBase
|
||||
VisiblePairSortMode.PreferredDirectPairs => "Preferred permissions & Direct pairs",
|
||||
_ => "Default",
|
||||
};
|
||||
|
||||
private static string GetSortOnlineLabel(OnlinePairSortMode mode) => mode switch
|
||||
{
|
||||
OnlinePairSortMode.Alphabetical => "Alphabetical",
|
||||
OnlinePairSortMode.PreferredDirectPairs => "Preferred permissions & Direct pairs",
|
||||
_ => "Default",
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user