Only show transfers while active

This commit is contained in:
Loporrit
2023-12-12 01:57:11 +00:00
parent c1b21383ef
commit 36945ad5b3
2 changed files with 21 additions and 16 deletions

View File

@@ -458,13 +458,14 @@ public class CompactUi : WindowMediatorSubscriberBase
private void DrawTransfers() private void DrawTransfers()
{ {
var currentUploads = _fileTransferManager.CurrentUploads.ToList(); var currentUploads = _fileTransferManager.CurrentUploads.ToList();
ImGui.PushFont(UiBuilder.IconFont);
ImGui.TextUnformatted(FontAwesomeIcon.Upload.ToIconString());
ImGui.PopFont();
ImGui.SameLine(35 * ImGuiHelpers.GlobalScale);
if (currentUploads.Any()) if (currentUploads.Any())
{ {
ImGui.PushFont(UiBuilder.IconFont);
ImGui.TextUnformatted(FontAwesomeIcon.Upload.ToIconString());
ImGui.PopFont();
ImGui.SameLine(35 * ImGuiHelpers.GlobalScale);
var totalUploads = currentUploads.Count; var totalUploads = currentUploads.Count;
var doneUploads = currentUploads.Count(c => c.IsTransferred); var doneUploads = currentUploads.Count(c => c.IsTransferred);
@@ -477,19 +478,16 @@ public class CompactUi : WindowMediatorSubscriberBase
ImGui.SameLine(WindowContentWidth - textSize.X); ImGui.SameLine(WindowContentWidth - textSize.X);
ImGui.TextUnformatted(uploadText); ImGui.TextUnformatted(uploadText);
} }
else
{
ImGui.TextUnformatted("No uploads in progress");
}
var currentDownloads = _currentDownloads.SelectMany(d => d.Value.Values).ToList(); var currentDownloads = _currentDownloads.SelectMany(d => d.Value.Values).ToList();
ImGui.PushFont(UiBuilder.IconFont);
ImGui.TextUnformatted(FontAwesomeIcon.Download.ToIconString());
ImGui.PopFont();
ImGui.SameLine(35 * ImGuiHelpers.GlobalScale);
if (currentDownloads.Any()) if (currentDownloads.Any())
{ {
ImGui.PushFont(UiBuilder.IconFont);
ImGui.TextUnformatted(FontAwesomeIcon.Download.ToIconString());
ImGui.PopFont();
ImGui.SameLine(35 * ImGuiHelpers.GlobalScale);
var totalDownloads = currentDownloads.Sum(c => c.TotalFiles); var totalDownloads = currentDownloads.Sum(c => c.TotalFiles);
var doneDownloads = currentDownloads.Sum(c => c.TransferredFiles); var doneDownloads = currentDownloads.Sum(c => c.TransferredFiles);
var totalDownloaded = currentDownloads.Sum(c => c.TransferredBytes); var totalDownloaded = currentDownloads.Sum(c => c.TransferredBytes);
@@ -502,10 +500,6 @@ public class CompactUi : WindowMediatorSubscriberBase
ImGui.SameLine(WindowContentWidth - textSize.X); ImGui.SameLine(WindowContentWidth - textSize.X);
ImGui.TextUnformatted(downloadText); ImGui.TextUnformatted(downloadText);
} }
else
{
ImGui.TextUnformatted("No downloads in progress");
}
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.PersonCircleQuestion, "Mare Character Data Analysis", WindowContentWidth)) if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.PersonCircleQuestion, "Mare Character Data Analysis", WindowContentWidth))
{ {

View File

@@ -1,5 +1,6 @@
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Components; using Dalamud.Interface.Components;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Utility.Raii;
using ImGuiNET; using ImGuiNET;
using MareSynchronos.API.Data.Extensions; using MareSynchronos.API.Data.Extensions;
@@ -116,6 +117,16 @@ public class PairGroupsUi
{ {
using (ImRaii.PushId($"group-{tag}-buttons")) DrawButtons(tag, allUsers.Cast<DrawUserPair>().Where(p => otherUidsTaggedWithTag!.Contains(p.UID)).ToList()); using (ImRaii.PushId($"group-{tag}-buttons")) DrawButtons(tag, allUsers.Cast<DrawUserPair>().Where(p => otherUidsTaggedWithTag!.Contains(p.UID)).ToList());
} }
else
{
// Avoid uncomfortably close group names
if (!_tagHandler.IsTagOpen(tag))
{
var size = ImGui.CalcTextSize("").Y + ImGui.GetStyle().FramePadding.Y * 2f;
ImGui.SameLine();
ImGui.Dummy(new(size, size));
}
}
if (!_tagHandler.IsTagOpen(tag)) return; if (!_tagHandler.IsTagOpen(tag)) return;