Allow changing server info bar style

This commit is contained in:
Loporrit
2023-12-03 16:22:34 +00:00
parent 247008e13d
commit 186c14267c
4 changed files with 75 additions and 17 deletions

View File

@@ -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<OpenSettingsUiMessage>(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()