diff --git a/MareSynchronos/Configuration.cs b/MareSynchronos/Configuration.cs index 5c2a6cf..a7010ff 100644 --- a/MareSynchronos/Configuration.cs +++ b/MareSynchronos/Configuration.cs @@ -57,6 +57,8 @@ namespace MareSynchronos public Dictionary CustomServerList { get; set; } = new(); public int MaxLocalCacheInGiB { get; set; } = 20; + public bool ReverseUserSort { get; set; } = true; + public bool InitialScanComplete { get; set; } = false; public int MaxParallelScan { diff --git a/MareSynchronos/MareSynchronos.csproj b/MareSynchronos/MareSynchronos.csproj index 8adc409..296dcdd 100644 --- a/MareSynchronos/MareSynchronos.csproj +++ b/MareSynchronos/MareSynchronos.csproj @@ -3,7 +3,7 @@ - 0.1.0.0 + 0.1.1.0 https://github.com/Penumbra-Sync/client diff --git a/MareSynchronos/UI/CompactUI.cs b/MareSynchronos/UI/CompactUI.cs index 0175589..b794d71 100644 --- a/MareSynchronos/UI/CompactUI.cs +++ b/MareSynchronos/UI/CompactUI.cs @@ -41,7 +41,7 @@ namespace MareSynchronos.UI SizeConstraints = new WindowSizeConstraints() { - MinimumSize = new Vector2(300, 200), + MinimumSize = new Vector2(300, 400), MaximumSize = new Vector2(300, 2000), }; @@ -98,7 +98,27 @@ namespace MareSynchronos.UI private void DrawFilter() { ImGui.PushID("filter"); - ImGui.SetNextItemWidth(_windowContentWidth); + var buttonSize = GetIconButtonSize(FontAwesomeIcon.ArrowUp); + if (!_configuration.ReverseUserSort) + { + if (ImGuiComponents.IconButton(FontAwesomeIcon.ArrowDown)) + { + _configuration.ReverseUserSort = true; + _configuration.Save(); + } + AttachToolTip("Sort by newest additions first"); + } + else + { + if (ImGuiComponents.IconButton(FontAwesomeIcon.ArrowUp)) + { + _configuration.ReverseUserSort = false; + _configuration.Save(); + } + AttachToolTip("Sort by oldest additions first"); + } + ImGui.SameLine(); + ImGui.SetNextItemWidth(_windowContentWidth - buttonSize.X - ImGui.GetStyle().ItemSpacing.X); ImGui.InputTextWithHint("##filter", "Filter for UID/notes", ref _characterOrCommentFilter, 255); ImGui.PopID(); } @@ -178,7 +198,7 @@ namespace MareSynchronos.UI } AttachToolTip("Hold CTRL to unpair permanently from " + entry.OtherUID); - ImGuiHelpers.ScaledDummy(5); + ImGuiHelpers.ScaledDummy(1); ImGui.PopID(); } @@ -208,13 +228,18 @@ namespace MareSynchronos.UI var ySize = _transferPartHeight == 0 ? 1 : (ImGui.GetWindowContentRegionMax().Y - ImGui.GetWindowContentRegionMin().Y) - _transferPartHeight - ImGui.GetCursorPosY(); + var users = _apiController.PairedClients.Where(p => + { + if (_characterOrCommentFilter.IsNullOrEmpty()) return true; + _configuration.GetCurrentServerUidComments().TryGetValue(p.OtherUID, out string? comment); + return p.OtherUID.ToLower().Contains(_characterOrCommentFilter.ToLower()) || + (comment?.ToLower().Contains(_characterOrCommentFilter.ToLower()) ?? false); + }); + + if (_configuration.ReverseUserSort) users = users.Reverse(); + ImGui.BeginChild("list", new Vector2(_windowContentWidth, ySize), false); - foreach (var entry in _apiController.PairedClients.Where(p => - { - if (_characterOrCommentFilter.IsNullOrEmpty()) return true; - _configuration.GetCurrentServerUidComments().TryGetValue(p.OtherUID, out string? comment); - return p.OtherUID.ToLower().Contains(_characterOrCommentFilter.ToLower()) || (comment?.ToLower().Contains(_characterOrCommentFilter.ToLower()) ?? false); - }).ToList()) + foreach (var entry in users.ToList()) { DrawPairedClient(entry); }