diff --git a/MareSynchronos/MareConfiguration/Configurations/MareConfig.cs b/MareSynchronos/MareConfiguration/Configurations/MareConfig.cs index 46a8adc..d661200 100644 --- a/MareSynchronos/MareConfiguration/Configurations/MareConfig.cs +++ b/MareSynchronos/MareConfiguration/Configurations/MareConfig.cs @@ -10,6 +10,7 @@ public class MareConfig : IMareConfiguration public string CacheFolder { get; set; } = string.Empty; public bool DisableOptionalPluginWarnings { get; set; } = false; public bool EnableDtrEntry { get; set; } = false; + public int DtrStyle { get; set; } = 0; public bool ShowUidInDtrTooltip { get; set; } = true; public bool PreferNoteInDtrTooltip { get; set; } = false; public bool EnableRightClickMenus { get; set; } = true; diff --git a/MareSynchronos/UI/DtrEntry.cs b/MareSynchronos/UI/DtrEntry.cs index 530b64b..0dae83f 100644 --- a/MareSynchronos/UI/DtrEntry.cs +++ b/MareSynchronos/UI/DtrEntry.cs @@ -12,6 +12,22 @@ namespace MareSynchronos.UI; public sealed class DtrEntry : IDisposable, IHostedService { + private enum DtrStyle + { + Default, + Style1, + Style2, + Style3, + Style4, + Style5, + Style6, + Style7, + Style8, + Style9 + } + + public const int NumStyles = 10; + private readonly ApiController _apiController; private readonly CancellationTokenSource _cancellationTokenSource = new(); private readonly ConfigurationServiceBase _configService; @@ -119,7 +135,8 @@ public sealed class DtrEntry : IDisposable, IHostedService if (_apiController.IsConnected) { var pairCount = _pairManager.GetVisibleUserCount(); - text = $"\uE044 {pairCount}"; + + text = RenderDtrStyle(_configService.Current.DtrStyle, pairCount.ToString()); if (pairCount > 0) { IEnumerable visiblePairs; @@ -145,7 +162,7 @@ public sealed class DtrEntry : IDisposable, IHostedService } else { - text = "\uE044 \uE04C"; + text = RenderDtrStyle(_configService.Current.DtrStyle, "\uE04C"); tooltip = "Loporrit: Not Connected"; } @@ -156,4 +173,22 @@ public sealed class DtrEntry : IDisposable, IHostedService _entry.Value.Tooltip = tooltip; } } + + public static string RenderDtrStyle(int styleNum, string text) + { + var style = (DtrStyle)styleNum; + + return style switch { + DtrStyle.Style1 => $"\xE039 {text}", + DtrStyle.Style2 => $"\xE0BC {text}", + DtrStyle.Style3 => $"\xE0BD {text}", + DtrStyle.Style4 => $"\xE03A {text}", + DtrStyle.Style5 => $"\xE033 {text}", + DtrStyle.Style6 => $"\xE038 {text}", + DtrStyle.Style7 => $"\xE05D {text}", + DtrStyle.Style8 => $"\xE03C{text}", + DtrStyle.Style9 => $"\xE040 {text} \xE041", + _ => $"\uE044 {text}" + }; + } } diff --git a/MareSynchronos/UI/SettingsUi.cs b/MareSynchronos/UI/SettingsUi.cs index 0ff952f..e80635a 100644 --- a/MareSynchronos/UI/SettingsUi.cs +++ b/MareSynchronos/UI/SettingsUi.cs @@ -92,8 +92,8 @@ public class SettingsUi : WindowMediatorSubscriberBase SizeConstraints = new WindowSizeConstraints() { - MinimumSize = new Vector2(800, 400), - MaximumSize = new Vector2(800, 2000), + MinimumSize = new Vector2(700, 400), + MaximumSize = new Vector2(700, 2000), }; Mediator.Subscribe(this, (_) => Toggle()); @@ -193,6 +193,7 @@ public class SettingsUi : WindowMediatorSubscriberBase ImGui.AlignTextToFramePadding(); ImGui.TextUnformatted("0 = No limit/infinite"); + ImGui.SetNextItemWidth(250); if (ImGui.SliderInt("Maximum Parallel Downloads", ref maxParallelDownloads, 1, 10)) { _configService.Current.ParallelDownloads = maxParallelDownloads; @@ -248,6 +249,7 @@ public class SettingsUi : WindowMediatorSubscriberBase } UiSharedService.DrawHelpText("Shows download text (amount of MiB downloaded) in the transfer bars"); int transferBarWidth = _configService.Current.TransferBarsWidth; + ImGui.SetNextItemWidth(250); if (ImGui.SliderInt("Transfer Bar Width", ref transferBarWidth, 10, 500)) { _configService.Current.TransferBarsWidth = transferBarWidth; @@ -255,6 +257,7 @@ public class SettingsUi : WindowMediatorSubscriberBase } UiSharedService.DrawHelpText("Width of the displayed transfer bars (will never be less wide than the displayed text)"); int transferBarHeight = _configService.Current.TransferBarsHeight; + ImGui.SetNextItemWidth(250); if (ImGui.SliderInt("Transfer Bar Height", ref transferBarHeight, 2, 50)) { _configService.Current.TransferBarsHeight = transferBarHeight; @@ -500,7 +503,7 @@ public class SettingsUi : WindowMediatorSubscriberBase } UiSharedService.DrawHelpText("The file compactor can massively reduce your saved files. It might incur a minor penalty on loading files on a slow CPU." + Environment.NewLine + "It is recommended to leave it enabled to save on space."); - ImGui.SameLine(); + if (!_fileCompactor.MassCompactRunning) { if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.FileArchive, "Compact all files in storage")) @@ -694,6 +697,14 @@ public class SettingsUi : WindowMediatorSubscriberBase _configService.Current.PreferNoteInDtrTooltip = preferNoteInDtrTooltip; _configService.Save(); } + + ImGui.SetNextItemWidth(250); + _uiShared.DrawCombo("Server Info Bar style", Enumerable.Range(0, DtrEntry.NumStyles), (i) => DtrEntry.RenderDtrStyle(i, "123"), + (i) => + { + _configService.Current.DtrStyle = i; + _configService.Save(); + }, _configService.Current.DtrStyle); } if (ImGui.Checkbox("Show separate Visible group", ref showVisibleSeparate)) @@ -744,6 +755,7 @@ public class SettingsUi : WindowMediatorSubscriberBase Mediator.Publish(new CompactUiChange(Vector2.Zero, Vector2.Zero)); } UiSharedService.DrawHelpText("Will show profiles on the right side of the main UI"); + ImGui.SetNextItemWidth(250); if (ImGui.SliderFloat("Hover Delay", ref profileDelay, 1, 10)) { _configService.Current.ProfileDelay = profileDelay; @@ -768,6 +780,7 @@ public class SettingsUi : WindowMediatorSubscriberBase var onlineNotifsNamedOnly = _configService.Current.ShowOnlineNotificationsOnlyForNamedPairs; UiSharedService.FontText("Notifications", _uiShared.UidFont); + ImGui.SetNextItemWidth(250); _uiShared.DrawCombo("Info Notification Display##settingsUi", (NotificationLocation[])Enum.GetValues(typeof(NotificationLocation)), (i) => i.ToString(), (i) => { @@ -780,6 +793,7 @@ public class SettingsUi : WindowMediatorSubscriberBase + Environment.NewLine + "'Toast' will show Warning toast notifications in the bottom right corner" + Environment.NewLine + "'Both' will show chat as well as the toast notification"); + ImGui.SetNextItemWidth(250); _uiShared.DrawCombo("Warning Notification Display##settingsUi", (NotificationLocation[])Enum.GetValues(typeof(NotificationLocation)), (i) => i.ToString(), (i) => { @@ -792,6 +806,7 @@ public class SettingsUi : WindowMediatorSubscriberBase + Environment.NewLine + "'Toast' will show Warning toast notifications in the bottom right corner" + Environment.NewLine + "'Both' will show chat as well as the toast notification"); + ImGui.SetNextItemWidth(250); _uiShared.DrawCombo("Error Notification Display##settingsUi", (NotificationLocation[])Enum.GetValues(typeof(NotificationLocation)), (i) => i.ToString(), (i) => { @@ -817,19 +832,22 @@ public class SettingsUi : WindowMediatorSubscriberBase } UiSharedService.DrawHelpText("Enabling this will show a small notification (type: Info) in the bottom right corner when pairs go online."); - using var disabled = ImRaii.Disabled(!onlineNotifs); - if (ImGui.Checkbox("Notify only for individual pairs", ref onlineNotifsPairsOnly)) + using (ImRaii.Disabled(!onlineNotifs)) { - _configService.Current.ShowOnlineNotificationsOnlyForIndividualPairs = onlineNotifsPairsOnly; - _configService.Save(); + using var indent = ImRaii.PushIndent(); + if (ImGui.Checkbox("Notify only for individual pairs", ref onlineNotifsPairsOnly)) + { + _configService.Current.ShowOnlineNotificationsOnlyForIndividualPairs = onlineNotifsPairsOnly; + _configService.Save(); + } + UiSharedService.DrawHelpText("Enabling this will only show online notifications (type: Info) for individual pairs."); + if (ImGui.Checkbox("Notify only for named pairs", ref onlineNotifsNamedOnly)) + { + _configService.Current.ShowOnlineNotificationsOnlyForNamedPairs = onlineNotifsNamedOnly; + _configService.Save(); + } + UiSharedService.DrawHelpText("Enabling this will only show online notifications (type: Info) for pairs where you have set an individual note."); } - UiSharedService.DrawHelpText("Enabling this will only show online notifications (type: Info) for individual pairs."); - if (ImGui.Checkbox("Notify only for named pairs", ref onlineNotifsNamedOnly)) - { - _configService.Current.ShowOnlineNotificationsOnlyForNamedPairs = onlineNotifsNamedOnly; - _configService.Save(); - } - UiSharedService.DrawHelpText("Enabling this will only show online notifications (type: Info) for pairs where you have set an individual note."); } private void DrawServerConfiguration() diff --git a/MareSynchronos/UI/UISharedService.cs b/MareSynchronos/UI/UISharedService.cs index 501dc65..475c0de 100644 --- a/MareSynchronos/UI/UISharedService.cs +++ b/MareSynchronos/UI/UISharedService.cs @@ -568,6 +568,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase { ColorTextWrapped("Note: The storage folder should be somewhere close to root (i.e. C:\\LoporritStorage) in a new empty folder. DO NOT point this to your game folder. DO NOT point this to your Penumbra folder.", ImGuiColors.DalamudYellow); var cacheDirectory = _configService.Current.CacheFolder; + ImGui.SetNextItemWidth(400); ImGui.InputText("Storage Folder##cache", ref cacheDirectory, 255, ImGuiInputTextFlags.ReadOnly); ImGui.SameLine(); @@ -618,7 +619,8 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase } float maxCacheSize = (float)_configService.Current.MaxLocalCacheInGiB; - if (ImGui.SliderFloat("Maximum Storage Size in GiB", ref maxCacheSize, 1f, 200f, "%.2f GiB")) + ImGui.SetNextItemWidth(250); + if (ImGui.SliderFloat("Maximum Storage Size", ref maxCacheSize, 1f, 200f, "%.2f GiB")) { _configService.Current.MaxLocalCacheInGiB = maxCacheSize; _configService.Save(); @@ -813,6 +815,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase if (string.Equals(_serverConfigurationManager.CurrentServer?.ServerName, comboEntries[i], StringComparison.OrdinalIgnoreCase)) comboEntries[i] += " [Current]"; } + ImGui.SetNextItemWidth(250); if (ImGui.BeginCombo("Select Service", comboEntries[_serverSelectionIndex])) { for (int i = 0; i < comboEntries.Length; i++) @@ -876,6 +879,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase public void DrawTimeSpanBetweenScansSetting() { var timeSpan = _configService.Current.TimeSpanBetweenScansInSeconds; + ImGui.SetNextItemWidth(250); if (ImGui.SliderInt("Seconds between scans##timespan", ref timeSpan, 20, 60)) { _configService.Current.TimeSpanBetweenScansInSeconds = timeSpan;