minor refactoring

This commit is contained in:
rootdarkarchon 2024-03-17 14:43:34 +01:00
parent 142c65cc9d
commit 7baca3565a
34 changed files with 554 additions and 627 deletions

View file

@ -158,7 +158,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
private void DrawCurrentTransfers()
{
_lastTab = "Transfers";
UiSharedService.FontText("Transfer Settings", _uiShared.UidFont);
_uiShared.BigText("Transfer Settings");
int maxParallelDownloads = _configService.Current.ParallelDownloads;
bool useAlternativeUpload = _configService.Current.UseAlternativeFileUpload;
@ -204,10 +204,10 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Current.UseAlternativeFileUpload = useAlternativeUpload;
_configService.Save();
}
UiSharedService.DrawHelpText("This will attempt to upload files in one go instead of a stream. Typically not necessary to enable. Use if you have upload issues.");
_uiShared.DrawHelpText("This will attempt to upload files in one go instead of a stream. Typically not necessary to enable. Use if you have upload issues.");
ImGui.Separator();
UiSharedService.FontText("Transfer UI", _uiShared.UidFont);
_uiShared.BigText("Transfer UI");
bool showTransferWindow = _configService.Current.ShowTransferWindow;
if (ImGui.Checkbox("Show separate transfer window", ref showTransferWindow))
@ -215,7 +215,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Current.ShowTransferWindow = showTransferWindow;
_configService.Save();
}
UiSharedService.DrawHelpText($"The download window will show the current progress of outstanding downloads.{Environment.NewLine}{Environment.NewLine}" +
_uiShared.DrawHelpText($"The download window will show the current progress of outstanding downloads.{Environment.NewLine}{Environment.NewLine}" +
$"What do W/Q/P/D stand for?{Environment.NewLine}W = Waiting for Slot (see Maximum Parallel Downloads){Environment.NewLine}" +
$"Q = Queued on Server, waiting for queue ready signal{Environment.NewLine}" +
$"P = Processing download (aka downloading){Environment.NewLine}" +
@ -236,7 +236,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Current.ShowTransferBars = showTransferBars;
_configService.Save();
}
UiSharedService.DrawHelpText("This will render a progress bar during the download at the feet of the player you are downloading from.");
_uiShared.DrawHelpText("This will render a progress bar during the download at the feet of the player you are downloading from.");
if (!showTransferBars) ImGui.BeginDisabled();
ImGui.Indent();
@ -246,28 +246,28 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Current.TransferBarsShowText = transferBarShowText;
_configService.Save();
}
UiSharedService.DrawHelpText("Shows download text (amount of MiB downloaded) in the transfer bars");
_uiShared.DrawHelpText("Shows download text (amount of MiB downloaded) in the transfer bars");
int transferBarWidth = _configService.Current.TransferBarsWidth;
if (ImGui.SliderInt("Transfer Bar Width", ref transferBarWidth, 10, 500))
{
_configService.Current.TransferBarsWidth = transferBarWidth;
_configService.Save();
}
UiSharedService.DrawHelpText("Width of the displayed transfer bars (will never be less wide than the displayed text)");
_uiShared.DrawHelpText("Width of the displayed transfer bars (will never be less wide than the displayed text)");
int transferBarHeight = _configService.Current.TransferBarsHeight;
if (ImGui.SliderInt("Transfer Bar Height", ref transferBarHeight, 2, 50))
{
_configService.Current.TransferBarsHeight = transferBarHeight;
_configService.Save();
}
UiSharedService.DrawHelpText("Height of the displayed transfer bars (will never be less tall than the displayed text)");
_uiShared.DrawHelpText("Height of the displayed transfer bars (will never be less tall than the displayed text)");
bool showUploading = _configService.Current.ShowUploading;
if (ImGui.Checkbox("Show 'Uploading' text below players that are currently uploading", ref showUploading))
{
_configService.Current.ShowUploading = showUploading;
_configService.Save();
}
UiSharedService.DrawHelpText("This will render an 'Uploading' text at the feet of the player that is in progress of uploading data.");
_uiShared.DrawHelpText("This will render an 'Uploading' text at the feet of the player that is in progress of uploading data.");
ImGui.Unindent();
if (!showUploading) ImGui.BeginDisabled();
@ -278,7 +278,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Current.ShowUploadingBigText = showUploadingBigText;
_configService.Save();
}
UiSharedService.DrawHelpText("This will render an 'Uploading' text in a larger font.");
_uiShared.DrawHelpText("This will render an 'Uploading' text in a larger font.");
ImGui.Unindent();
@ -286,7 +286,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
if (!showTransferBars) ImGui.EndDisabled();
ImGui.Separator();
UiSharedService.FontText("Current Transfers", _uiShared.UidFont);
_uiShared.BigText("Current Transfers");
if (ImGui.BeginTabBar("TransfersTabBar"))
{
@ -366,7 +366,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
{
_lastTab = "Debug";
UiSharedService.FontText("Debug", _uiShared.UidFont);
_uiShared.BigText("Debug");
#if DEBUG
if (LastCreatedCharacterData != null && ImGui.TreeNode("Last created character data"))
{
@ -378,7 +378,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.TreePop();
}
#endif
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Copy, "[DEBUG] Copy Last created Character Data to clipboard"))
if (UiSharedService.IconTextButton(FontAwesomeIcon.Copy, "[DEBUG] Copy Last created Character Data to clipboard"))
{
if (LastCreatedCharacterData != null)
{
@ -403,15 +403,15 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Current.LogPerformance = logPerformance;
_configService.Save();
}
UiSharedService.DrawHelpText("Enabling this can incur a (slight) performance impact. Enabling this for extended periods of time is not recommended.");
_uiShared.DrawHelpText("Enabling this can incur a (slight) performance impact. Enabling this for extended periods of time is not recommended.");
using var disabled = ImRaii.Disabled(!logPerformance);
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.StickyNote, "Print Performance Stats to /xllog"))
if (UiSharedService.IconTextButton(FontAwesomeIcon.StickyNote, "Print Performance Stats to /xllog"))
{
_performanceCollector.PrintPerformanceStats();
}
ImGui.SameLine();
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.StickyNote, "Print Performance Stats (last 60s) to /xllog"))
if (UiSharedService.IconTextButton(FontAwesomeIcon.StickyNote, "Print Performance Stats (last 60s) to /xllog"))
{
_performanceCollector.PrintPerformanceStats(60);
}
@ -421,7 +421,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
{
_lastTab = "FileCache";
UiSharedService.FontText("Export MCDF", _uiShared.UidFont);
_uiShared.BigText("Export MCDF");
UiSharedService.TextWrapped("This feature allows you to pack your character into a MCDF file and manually send it to other people. MCDF files can officially only be imported during GPose through Mare. " +
"Be aware that the possibility exists that people write unofficial custom exporters to extract the containing data.");
@ -437,7 +437,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
if (!_mareCharaFileManager.CurrentlyWorking)
{
ImGui.InputTextWithHint("Export Descriptor", "This description will be shown on loading the data", ref _exportDescription, 255);
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Save, "Export Character as MCDF"))
if (UiSharedService.IconTextButton(FontAwesomeIcon.Save, "Export Character as MCDF"))
{
string defaultFileName = string.IsNullOrEmpty(_exportDescription)
? "export.mcdf"
@ -478,11 +478,11 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Current.OpenGposeImportOnGposeStart = openInGpose;
_configService.Save();
}
UiSharedService.DrawHelpText("This will automatically open the import menu when loading into Gpose. If unchecked you can open the menu manually with /mare gpose");
_uiShared.DrawHelpText("This will automatically open the import menu when loading into Gpose. If unchecked you can open the menu manually with /mare gpose");
ImGui.Separator();
UiSharedService.FontText("Storage", _uiShared.UidFont);
_uiShared.BigText("Storage");
UiSharedService.TextWrapped("Mare stores downloaded files from paired people permanently. This is to improve loading performance and requiring less downloads. " +
"The storage governs itself by clearing data beyond the set storage size. Please set the storage size accordingly. It is not necessary to manually clear the storage.");
@ -494,7 +494,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
{
ImGui.SameLine();
using var id = ImRaii.PushId("penumbraMonitor");
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.ArrowsToCircle, "Try to reinitialize Monitor"))
if (UiSharedService.IconTextButton(FontAwesomeIcon.ArrowsToCircle, "Try to reinitialize Monitor"))
{
_cacheMonitor.StartPenumbraWatcher(_ipcManager.Penumbra.ModDirectory);
}
@ -506,14 +506,14 @@ public class SettingsUi : WindowMediatorSubscriberBase
{
ImGui.SameLine();
using var id = ImRaii.PushId("mareMonitor");
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.ArrowsToCircle, "Try to reinitialize Monitor"))
if (UiSharedService.IconTextButton(FontAwesomeIcon.ArrowsToCircle, "Try to reinitialize Monitor"))
{
_cacheMonitor.StartMareWatcher(_configService.Current.CacheFolder);
}
}
if (_cacheMonitor.MareWatcher == null || _cacheMonitor.PenumbraWatcher == null)
{
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Play, "Resume Monitoring"))
if (UiSharedService.IconTextButton(FontAwesomeIcon.Play, "Resume Monitoring"))
{
_cacheMonitor.StartMareWatcher(_configService.Current.CacheFolder);
_cacheMonitor.StartPenumbraWatcher(_ipcManager.Penumbra.ModDirectory);
@ -527,7 +527,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
{
using (ImRaii.Disabled(!UiSharedService.CtrlPressed()))
{
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Stop, "Stop Monitoring"))
if (UiSharedService.IconTextButton(FontAwesomeIcon.Stop, "Stop Monitoring"))
{
_cacheMonitor.StopMonitoring();
}
@ -557,12 +557,12 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Current.UseCompactor = useFileCompactor;
_configService.Save();
}
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
_uiShared.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"))
if (UiSharedService.IconTextButton(FontAwesomeIcon.FileArchive, "Compact all files in storage"))
{
_ = Task.Run(() =>
{
@ -573,12 +573,11 @@ public class SettingsUi : WindowMediatorSubscriberBase
UiSharedService.AttachToolTip("This will run compression on all files in your current Mare Storage." + Environment.NewLine
+ "You do not need to run this manually if you keep the file compactor enabled.");
ImGui.SameLine();
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.File, "Decompact all files in storage"))
if (UiSharedService.IconTextButton(FontAwesomeIcon.File, "Decompact all files in storage"))
{
_ = Task.Run(() =>
{
_fileCompactor.CompactStorage(compress: false);
CancellationTokenSource cts = new();
_cacheMonitor.RecalculateFileCacheSize(CancellationToken.None);
});
}
@ -601,7 +600,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
"This operation, depending on how many files you have in your storage, can take a while and will be CPU and drive intensive.");
using (ImRaii.Disabled(_validationTask != null && !_validationTask.IsCompleted))
{
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Check, "Start File Storage Validation"))
if (UiSharedService.IconTextButton(FontAwesomeIcon.Check, "Start File Storage Validation"))
{
_validationCts?.Cancel();
_validationCts?.Dispose();
@ -613,7 +612,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
if (_validationTask != null && !_validationTask.IsCompleted)
{
ImGui.SameLine();
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Times, "Cancel"))
if (UiSharedService.IconTextButton(FontAwesomeIcon.Times, "Cancel"))
{
_validationCts?.Cancel();
}
@ -647,7 +646,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
+ Environment.NewLine + "- This can make the situation of not getting other players data worse in situations of heavy file server load.");
if (!_readClearCache)
ImGui.BeginDisabled();
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Trash, "Clear local storage") && UiSharedService.CtrlPressed() && _readClearCache)
if (UiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Clear local storage") && UiSharedService.CtrlPressed() && _readClearCache)
{
_ = Task.Run(() =>
{
@ -677,12 +676,12 @@ public class SettingsUi : WindowMediatorSubscriberBase
//UiSharedService.FontText("Experimental", _uiShared.UidFont);
//ImGui.Separator();
UiSharedService.FontText("Notes", _uiShared.UidFont);
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.StickyNote, "Export all your user notes to clipboard"))
_uiShared.BigText("Notes");
if (UiSharedService.IconTextButton(FontAwesomeIcon.StickyNote, "Export all your user notes to clipboard"))
{
ImGui.SetClipboardText(UiSharedService.GetNotes(_pairManager.DirectPairs.UnionBy(_pairManager.GroupPairs.SelectMany(p => p.Value), p => p.UserData, UserDataComparer.Instance).ToList()));
}
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.FileImport, "Import notes from clipboard"))
if (UiSharedService.IconTextButton(FontAwesomeIcon.FileImport, "Import notes from clipboard"))
{
_notesSuccessfullyApplied = null;
var notes = ImGui.GetClipboardText();
@ -691,7 +690,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.SameLine();
ImGui.Checkbox("Overwrite existing notes", ref _overwriteExistingLabels);
UiSharedService.DrawHelpText("If this option is selected all already existing notes for UIDs will be overwritten by the imported notes.");
_uiShared.DrawHelpText("If this option is selected all already existing notes for UIDs will be overwritten by the imported notes.");
if (_notesSuccessfullyApplied.HasValue && _notesSuccessfullyApplied.Value)
{
UiSharedService.ColorTextWrapped("User Notes successfully imported", ImGuiColors.HealerGreen);
@ -708,10 +707,10 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Current.OpenPopupOnAdd = openPopupOnAddition;
_configService.Save();
}
UiSharedService.DrawHelpText("This will open a popup that allows you to set the notes for a user after successfully adding them to your individual pairs.");
_uiShared.DrawHelpText("This will open a popup that allows you to set the notes for a user after successfully adding them to your individual pairs.");
ImGui.Separator();
UiSharedService.FontText("UI", _uiShared.UidFont);
_uiShared.BigText("UI");
var showNameInsteadOfNotes = _configService.Current.ShowCharacterNameInsteadOfNotesForVisible;
var showVisibleSeparate = _configService.Current.ShowVisibleUsersSeparately;
var showOfflineSeparate = _configService.Current.ShowOfflineUsersSeparately;
@ -733,14 +732,14 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Current.EnableRightClickMenus = enableRightClickMenu;
_configService.Save();
}
UiSharedService.DrawHelpText("This will add Mare related right click menu entries in the game UI on paired players.");
_uiShared.DrawHelpText("This will add Mare related right click menu entries in the game UI on paired players.");
if (ImGui.Checkbox("Display status and visible pair count in Server Info Bar", ref enableDtrEntry))
{
_configService.Current.EnableDtrEntry = enableDtrEntry;
_configService.Save();
}
UiSharedService.DrawHelpText("This will add Mare connection status and visible pair count in the Server Info Bar.\nYou can further configure this through your Dalamud Settings.");
_uiShared.DrawHelpText("This will add Mare connection status and visible pair count in the Server Info Bar.\nYou can further configure this through your Dalamud Settings.");
using (ImRaii.Disabled(!enableDtrEntry))
{
@ -764,7 +763,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Save();
Mediator.Publish(new RefreshUiMessage());
}
UiSharedService.DrawHelpText("This will show all currently visible users in a special 'Visible' group in the main UI.");
_uiShared.DrawHelpText("This will show all currently visible users in a special 'Visible' group in the main UI.");
using (ImRaii.Disabled(!showVisibleSeparate))
{
@ -783,7 +782,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Save();
Mediator.Publish(new RefreshUiMessage());
}
UiSharedService.DrawHelpText("This will show all currently offline users in a special 'Offline' group in the main UI.");
_uiShared.DrawHelpText("This will show all currently offline users in a special 'Offline' group in the main UI.");
using (ImRaii.Disabled(!showOfflineSeparate))
{
@ -802,7 +801,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Save();
Mediator.Publish(new RefreshUiMessage());
}
UiSharedService.DrawHelpText("This will group up all Syncshells in a special 'All Syncshells' folder in the main UI.");
_uiShared.DrawHelpText("This will group up all Syncshells in a special 'All Syncshells' folder in the main UI.");
if (ImGui.Checkbox("Show player name for visible players", ref showNameInsteadOfNotes))
{
@ -810,7 +809,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Save();
Mediator.Publish(new RefreshUiMessage());
}
UiSharedService.DrawHelpText("This will show the character name instead of custom set note when a character is visible");
_uiShared.DrawHelpText("This will show the character name instead of custom set note when a character is visible");
ImGui.Indent();
if (!_configService.Current.ShowCharacterNameInsteadOfNotesForVisible) ImGui.BeginDisabled();
@ -820,7 +819,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Save();
Mediator.Publish(new RefreshUiMessage());
}
UiSharedService.DrawHelpText("If you set a note for a player it will be shown instead of the player name");
_uiShared.DrawHelpText("If you set a note for a player it will be shown instead of the player name");
if (!_configService.Current.ShowCharacterNameInsteadOfNotesForVisible) ImGui.EndDisabled();
ImGui.Unindent();
@ -830,7 +829,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Current.ProfilesShow = showProfiles;
_configService.Save();
}
UiSharedService.DrawHelpText("This will show the configured user profile after a set delay");
_uiShared.DrawHelpText("This will show the configured user profile after a set delay");
ImGui.Indent();
if (!showProfiles) ImGui.BeginDisabled();
if (ImGui.Checkbox("Popout profiles on the right", ref profileOnRight))
@ -839,13 +838,13 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Save();
Mediator.Publish(new CompactUiChange(Vector2.Zero, Vector2.Zero));
}
UiSharedService.DrawHelpText("Will show profiles on the right side of the main UI");
_uiShared.DrawHelpText("Will show profiles on the right side of the main UI");
if (ImGui.SliderFloat("Hover Delay", ref profileDelay, 1, 10))
{
_configService.Current.ProfileDelay = profileDelay;
_configService.Save();
}
UiSharedService.DrawHelpText("Delay until the profile should be displayed");
_uiShared.DrawHelpText("Delay until the profile should be displayed");
if (!showProfiles) ImGui.EndDisabled();
ImGui.Unindent();
if (ImGui.Checkbox("Show profiles marked as NSFW", ref showNsfwProfiles))
@ -854,7 +853,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Current.ProfilesAllowNsfw = showNsfwProfiles;
_configService.Save();
}
UiSharedService.DrawHelpText("Will show profiles that have the NSFW tag enabled");
_uiShared.DrawHelpText("Will show profiles that have the NSFW tag enabled");
ImGui.Separator();
@ -862,7 +861,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
var onlineNotifs = _configService.Current.ShowOnlineNotifications;
var onlineNotifsPairsOnly = _configService.Current.ShowOnlineNotificationsOnlyForIndividualPairs;
var onlineNotifsNamedOnly = _configService.Current.ShowOnlineNotificationsOnlyForNamedPairs;
UiSharedService.FontText("Notifications", _uiShared.UidFont);
_uiShared.BigText("Notifications");
_uiShared.DrawCombo("Info Notification Display##settingsUi", (NotificationLocation[])Enum.GetValues(typeof(NotificationLocation)), (i) => i.ToString(),
(i) =>
@ -870,7 +869,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Current.InfoNotification = i;
_configService.Save();
}, _configService.Current.InfoNotification);
UiSharedService.DrawHelpText("The location where \"Info\" notifications will display."
_uiShared.DrawHelpText("The location where \"Info\" notifications will display."
+ Environment.NewLine + "'Nowhere' will not show any Info notifications"
+ Environment.NewLine + "'Chat' will print Info notifications in chat"
+ Environment.NewLine + "'Toast' will show Warning toast notifications in the bottom right corner"
@ -882,7 +881,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Current.WarningNotification = i;
_configService.Save();
}, _configService.Current.WarningNotification);
UiSharedService.DrawHelpText("The location where \"Warning\" notifications will display."
_uiShared.DrawHelpText("The location where \"Warning\" notifications will display."
+ Environment.NewLine + "'Nowhere' will not show any Warning notifications"
+ Environment.NewLine + "'Chat' will print Warning notifications in chat"
+ Environment.NewLine + "'Toast' will show Warning toast notifications in the bottom right corner"
@ -894,7 +893,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Current.ErrorNotification = i;
_configService.Save();
}, _configService.Current.ErrorNotification);
UiSharedService.DrawHelpText("The location where \"Error\" notifications will display."
_uiShared.DrawHelpText("The location where \"Error\" notifications will display."
+ Environment.NewLine + "'Nowhere' will not show any Error notifications"
+ Environment.NewLine + "'Chat' will print Error notifications in chat"
+ Environment.NewLine + "'Toast' will show Error toast notifications in the bottom right corner"
@ -905,13 +904,13 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Current.DisableOptionalPluginWarnings = disableOptionalPluginWarnings;
_configService.Save();
}
UiSharedService.DrawHelpText("Enabling this will not show any \"Warning\" labeled messages for missing optional plugins.");
_uiShared.DrawHelpText("Enabling this will not show any \"Warning\" labeled messages for missing optional plugins.");
if (ImGui.Checkbox("Enable online notifications", ref onlineNotifs))
{
_configService.Current.ShowOnlineNotifications = onlineNotifs;
_configService.Save();
}
UiSharedService.DrawHelpText("Enabling this will show a small notification (type: Info) in the bottom right corner when pairs go online.");
_uiShared.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))
@ -919,13 +918,13 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Current.ShowOnlineNotificationsOnlyForIndividualPairs = onlineNotifsPairsOnly;
_configService.Save();
}
UiSharedService.DrawHelpText("Enabling this will only show online notifications (type: Info) for individual pairs.");
_uiShared.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.");
_uiShared.DrawHelpText("Enabling this will only show online notifications (type: Info) for pairs where you have set an individual note.");
}
private void DrawServerConfiguration()
@ -933,7 +932,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_lastTab = "Service Settings";
if (ApiController.ServerAlive)
{
UiSharedService.FontText("Service Actions", _uiShared.UidFont);
_uiShared.BigText("Service Actions");
ImGuiHelpers.ScaledDummy(new Vector2(5, 5));
if (ImGui.Button("Delete all my files"))
{
@ -941,7 +940,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.OpenPopup("Delete all your files?");
}
UiSharedService.DrawHelpText("Completely deletes all your uploaded files on the service.");
_uiShared.DrawHelpText("Completely deletes all your uploaded files on the service.");
if (ImGui.BeginPopupModal("Delete all your files?", ref _deleteFilesPopupModalShown, UiSharedService.PopupWindowFlags))
{
@ -977,7 +976,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.OpenPopup("Delete your account?");
}
UiSharedService.DrawHelpText("Completely deletes your account and all uploaded files to the service.");
_uiShared.DrawHelpText("Completely deletes your account and all uploaded files to the service.");
if (ImGui.BeginPopupModal("Delete your account?", ref _deleteAccountPopupModalShown, UiSharedService.PopupWindowFlags))
{
@ -1011,14 +1010,14 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.Separator();
}
UiSharedService.FontText("Service & Character Settings", _uiShared.UidFont);
_uiShared.BigText("Service & Character Settings");
ImGuiHelpers.ScaledDummy(new Vector2(5, 5));
var sendCensus = _serverConfigurationManager.SendCensusData;
if (ImGui.Checkbox("Send Statistical Census Data", ref sendCensus))
{
_serverConfigurationManager.SendCensusData = sendCensus;
}
UiSharedService.DrawHelpText("This will allow sending census data to the currently connected service." + UiSharedService.TooltipSeparator
_uiShared.DrawHelpText("This will allow sending census data to the currently connected service." + UiSharedService.TooltipSeparator
+ "Census data contains:" + Environment.NewLine
+ "- Current World" + Environment.NewLine
+ "- Current Gender" + Environment.NewLine
@ -1095,7 +1094,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
}
}, EqualityComparer<KeyValuePair<int, SecretKey>>.Default.Equals(keys.FirstOrDefault(f => f.Key == item.SecretKeyIdx), default) ? keys.First() : keys.First(f => f.Key == item.SecretKeyIdx));
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Trash, "Delete Character") && UiSharedService.CtrlPressed())
if (UiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Delete Character") && UiSharedService.CtrlPressed())
_serverConfigurationManager.RemoveCharacterFromServer(idx, item);
UiSharedService.AttachToolTip("Hold CTRL to delete this entry.");
@ -1109,14 +1108,14 @@ public class SettingsUi : WindowMediatorSubscriberBase
if (!selectedServer.Authentications.Exists(c => string.Equals(c.CharacterName, _uiShared.PlayerName, StringComparison.Ordinal)
&& c.WorldId == _uiShared.WorldId))
{
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.User, "Add current character"))
if (UiSharedService.IconTextButton(FontAwesomeIcon.User, "Add current character"))
{
_serverConfigurationManager.AddCurrentCharacterToServer(idx);
}
ImGui.SameLine();
}
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Plus, "Add new character"))
if (UiSharedService.IconTextButton(FontAwesomeIcon.Plus, "Add new character"))
{
_serverConfigurationManager.AddEmptyCharacterToServer(idx);
}
@ -1148,7 +1147,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
}
if (!selectedServer.Authentications.Exists(p => p.SecretKeyIdx == item.Key))
{
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Trash, "Delete Secret Key") && UiSharedService.CtrlPressed())
if (UiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Delete Secret Key") && UiSharedService.CtrlPressed())
{
selectedServer.SecretKeys.Remove(item.Key);
_serverConfigurationManager.Save();
@ -1165,7 +1164,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
}
ImGui.Separator();
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Plus, "Add new Secret Key"))
if (UiSharedService.IconTextButton(FontAwesomeIcon.Plus, "Add new Secret Key"))
{
selectedServer.SecretKeys.Add(selectedServer.SecretKeys.Any() ? selectedServer.SecretKeys.Max(p => p.Key) + 1 : 0, new SecretKey()
{
@ -1190,7 +1189,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
}
if (isMain)
{
UiSharedService.DrawHelpText("You cannot edit the URI of the main service.");
_uiShared.DrawHelpText("You cannot edit the URI of the main service.");
}
if (ImGui.InputText("Service Name", ref serverName, 255, flags))
@ -1200,23 +1199,23 @@ public class SettingsUi : WindowMediatorSubscriberBase
}
if (isMain)
{
UiSharedService.DrawHelpText("You cannot edit the name of the main service.");
_uiShared.DrawHelpText("You cannot edit the name of the main service.");
}
if (!isMain && selectedServer != _serverConfigurationManager.CurrentServer)
{
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Trash, "Delete Service") && UiSharedService.CtrlPressed())
if (UiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Delete Service") && UiSharedService.CtrlPressed())
{
_serverConfigurationManager.DeleteServer(selectedServer);
}
UiSharedService.DrawHelpText("Hold CTRL to delete this service");
_uiShared.DrawHelpText("Hold CTRL to delete this service");
}
ImGui.EndTabItem();
}
if (ImGui.BeginTabItem("Permission Settings"))
{
UiSharedService.FontText("Default Permission Settings", _uiShared.UidFont);
_uiShared.BigText("Default Permission Settings");
if (selectedServer == _serverConfigurationManager.CurrentServer && _apiController.IsConnected)
{
UiSharedService.TextWrapped("Note: The default permissions settings here are not applied retroactively to existing pairs or joined Syncshells.");
@ -1232,7 +1231,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
perms.IndividualIsSticky = individualIsSticky;
_ = _apiController.UserUpdateDefaultPermissions(perms);
}
UiSharedService.DrawHelpText("The preferred attribute means that the permissions to that user will never change through any of your permission changes to Syncshells " +
_uiShared.DrawHelpText("The preferred attribute means that the permissions to that user will never change through any of your permission changes to Syncshells " +
"(i.e. if you have paused one specific user in a Syncshell and they become preferred permissions, then pause and unpause the same Syncshell, the user will remain paused - " +
"if a user does not have preferred permissions, it will follow the permissions of the Syncshell and be unpaused)." + Environment.NewLine + Environment.NewLine +
"This setting means:" + Environment.NewLine +
@ -1247,19 +1246,19 @@ public class SettingsUi : WindowMediatorSubscriberBase
perms.DisableIndividualSounds = disableIndividualSounds;
_ = _apiController.UserUpdateDefaultPermissions(perms);
}
UiSharedService.DrawHelpText("This setting will disable sound sync for all new individual pairs.");
_uiShared.DrawHelpText("This setting will disable sound sync for all new individual pairs.");
if (ImGui.Checkbox("Disable individual pair animations", ref disableIndividualAnimations))
{
perms.DisableIndividualAnimations = disableIndividualAnimations;
_ = _apiController.UserUpdateDefaultPermissions(perms);
}
UiSharedService.DrawHelpText("This setting will disable animation sync for all new individual pairs.");
_uiShared.DrawHelpText("This setting will disable animation sync for all new individual pairs.");
if (ImGui.Checkbox("Disable individual pair VFX", ref disableIndividualVFX))
{
perms.DisableIndividualVFX = disableIndividualVFX;
_ = _apiController.UserUpdateDefaultPermissions(perms);
}
UiSharedService.DrawHelpText("This setting will disable VFX sync for all new individual pairs.");
_uiShared.DrawHelpText("This setting will disable VFX sync for all new individual pairs.");
ImGuiHelpers.ScaledDummy(5f);
bool disableGroundSounds = perms.DisableGroupSounds;
bool disableGroupAnimations = perms.DisableGroupAnimations;
@ -1269,19 +1268,19 @@ public class SettingsUi : WindowMediatorSubscriberBase
perms.DisableGroupSounds = disableGroundSounds;
_ = _apiController.UserUpdateDefaultPermissions(perms);
}
UiSharedService.DrawHelpText("This setting will disable sound sync for all non-sticky pairs in newly joined syncshells.");
_uiShared.DrawHelpText("This setting will disable sound sync for all non-sticky pairs in newly joined syncshells.");
if (ImGui.Checkbox("Disable Syncshell pair animations", ref disableGroupAnimations))
{
perms.DisableGroupAnimations = disableGroupAnimations;
_ = _apiController.UserUpdateDefaultPermissions(perms);
}
UiSharedService.DrawHelpText("This setting will disable animation sync for all non-sticky pairs in newly joined syncshells.");
_uiShared.DrawHelpText("This setting will disable animation sync for all non-sticky pairs in newly joined syncshells.");
if (ImGui.Checkbox("Disable Syncshell pair VFX", ref disableGroupVFX))
{
perms.DisableGroupVFX = disableGroupVFX;
_ = _apiController.UserUpdateDefaultPermissions(perms);
}
UiSharedService.DrawHelpText("This setting will disable VFX sync for all non-sticky pairs in newly joined syncshells.");
_uiShared.DrawHelpText("This setting will disable VFX sync for all non-sticky pairs in newly joined syncshells.");
}
else
{