Minor UI fixes

This commit is contained in:
Loporrit
2023-12-12 01:55:24 +00:00
parent 748d6184fc
commit c1b21383ef
6 changed files with 21 additions and 29 deletions

View File

@@ -111,6 +111,7 @@ public class CompactUi : WindowMediatorSubscriberBase
else else
UiSharedService.AccentColor = ImGuiColors.ParsedGreen; UiSharedService.AccentColor = ImGuiColors.ParsedGreen;
} }
ImGui.SetCursorPosY(ImGui.GetCursorPosY() - ImGui.GetStyle().WindowPadding.Y - 1f * ImGuiHelpers.GlobalScale + ImGui.GetStyle().ItemSpacing.Y);
WindowContentWidth = UiSharedService.GetWindowContentRegionWidth(); WindowContentWidth = UiSharedService.GetWindowContentRegionWidth();
if (!_apiController.IsCurrentVersion) if (!_apiController.IsCurrentVersion)
{ {
@@ -390,11 +391,7 @@ public class CompactUi : WindowMediatorSubscriberBase
var userCount = _apiController.OnlineUsers.ToString(CultureInfo.InvariantCulture); var userCount = _apiController.OnlineUsers.ToString(CultureInfo.InvariantCulture);
var userSize = ImGui.CalcTextSize(userCount); var userSize = ImGui.CalcTextSize(userCount);
var textSize = ImGui.CalcTextSize("Users Online"); var textSize = ImGui.CalcTextSize("Users Online");
#if DEBUG
string shardConnection = $"Shard: {_apiController.ServerInfo.ShardName}";
#else
string shardConnection = string.Equals(_apiController.ServerInfo.ShardName, "Main", StringComparison.OrdinalIgnoreCase) ? string.Empty : $"Shard: {_apiController.ServerInfo.ShardName}"; string shardConnection = string.Equals(_apiController.ServerInfo.ShardName, "Main", StringComparison.OrdinalIgnoreCase) ? string.Empty : $"Shard: {_apiController.ServerInfo.ShardName}";
#endif
var shardTextSize = ImGui.CalcTextSize(shardConnection); var shardTextSize = ImGui.CalcTextSize(shardConnection);
var printShard = !string.IsNullOrEmpty(_apiController.ServerInfo.ShardName) && shardConnection != string.Empty; var printShard = !string.IsNullOrEmpty(_apiController.ServerInfo.ShardName) && shardConnection != string.Empty;

View File

@@ -141,7 +141,7 @@ internal sealed class GroupPanel
if (ImGui.BeginPopupModal("Create Syncshell", ref _showModalCreateGroup, UiSharedService.PopupWindowFlags)) if (ImGui.BeginPopupModal("Create Syncshell", ref _showModalCreateGroup, UiSharedService.PopupWindowFlags))
{ {
UiSharedService.TextWrapped("Press the button below to create a new Syncshell."); UiSharedService.TextWrapped("Press the button below to create a new Syncshell.");
ImGui.SetNextItemWidth(200); ImGui.SetNextItemWidth(200 * ImGuiHelpers.GlobalScale);
if (ImGui.Button("Create Syncshell")) if (ImGui.Button("Create Syncshell"))
{ {
try try
@@ -473,7 +473,6 @@ internal sealed class GroupPanel
var userVFXIcon = userVFXDisabled ? FontAwesomeIcon.Circle : FontAwesomeIcon.Sun; var userVFXIcon = userVFXDisabled ? FontAwesomeIcon.Circle : FontAwesomeIcon.Sun;
var iconSize = UiSharedService.GetIconSize(infoIcon); var iconSize = UiSharedService.GetIconSize(infoIcon);
var diffLockUnlockIcons = showInfoIcon ? (UiSharedService.GetIconButtonSize(infoIcon).X - iconSize.X) / 2 : 0;
var barbuttonSize = UiSharedService.GetIconButtonSize(FontAwesomeIcon.Bars); var barbuttonSize = UiSharedService.GetIconButtonSize(FontAwesomeIcon.Bars);
var isOwner = string.Equals(groupDto.OwnerUID, ApiController.UID, StringComparison.Ordinal); var isOwner = string.Equals(groupDto.OwnerUID, ApiController.UID, StringComparison.Ordinal);
@@ -482,7 +481,7 @@ internal sealed class GroupPanel
var pauseIcon = groupDto.GroupUserPermissions.IsPaused() ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause; var pauseIcon = groupDto.GroupUserPermissions.IsPaused() ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
var pauseIconSize = UiSharedService.GetIconButtonSize(pauseIcon); var pauseIconSize = UiSharedService.GetIconButtonSize(pauseIcon);
ImGui.SameLine(windowEndX - barbuttonSize.X - (showInfoIcon ? iconSize.X : 0) - diffLockUnlockIcons - (showInfoIcon ? spacingX : 0) - pauseIconSize.X - spacingX); ImGui.SameLine(windowEndX - barbuttonSize.X - (showInfoIcon ? iconSize.X : 0) - (showInfoIcon ? spacingX : 0) - pauseIconSize.X - spacingX);
if (showInfoIcon) if (showInfoIcon)
{ {
@@ -574,7 +573,6 @@ internal sealed class GroupPanel
UiSharedService.AttachToolTip((groupDto.GroupUserPermissions.IsPaused() ? "Resume" : "Pause") + " pairing with all users in this Syncshell"); UiSharedService.AttachToolTip((groupDto.GroupUserPermissions.IsPaused() ? "Resume" : "Pause") + " pairing with all users in this Syncshell");
ImGui.SameLine(); ImGui.SameLine();
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + diffLockUnlockIcons);
if (ImGuiComponents.IconButton(FontAwesomeIcon.Bars)) if (ImGuiComponents.IconButton(FontAwesomeIcon.Bars))
{ {
ImGui.OpenPopup("ShellPopup"); ImGui.OpenPopup("ShellPopup");

View File

@@ -114,10 +114,7 @@ public class PairGroupsUi
DrawName(tag, isSpecialTag, visibleInThisTag, usersInThisTag.Count(), otherUidsTaggedWithTag?.Count); DrawName(tag, isSpecialTag, visibleInThisTag, usersInThisTag.Count(), otherUidsTaggedWithTag?.Count);
if (!isSpecialTag) if (!isSpecialTag)
{ {
if (onlineUsers.Any() && onlineUsers.First() is DrawUserPair) 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());
}
} }
if (!_tagHandler.IsTagOpen(tag)) return; if (!_tagHandler.IsTagOpen(tag)) return;

View File

@@ -114,7 +114,7 @@ public class IntroUi : WindowMediatorSubscriberBase
ImGui.TextUnformatted(Strings.ToS.LanguageLabel); ImGui.TextUnformatted(Strings.ToS.LanguageLabel);
ImGui.SameLine(); ImGui.SameLine();
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + textSize.Y / 2 - (languageSize.Y + ImGui.GetStyle().FramePadding.Y) / 2); ImGui.SetCursorPosY(ImGui.GetCursorPosY() + textSize.Y / 2 - (languageSize.Y + ImGui.GetStyle().FramePadding.Y) / 2);
ImGui.SetNextItemWidth(80); ImGui.SetNextItemWidth(80 * ImGuiHelpers.GlobalScale);
if (ImGui.Combo("", ref _currentLanguage, _languages.Keys.ToArray(), _languages.Count)) if (ImGui.Combo("", ref _currentLanguage, _languages.Keys.ToArray(), _languages.Count))
{ {
GetToSLocalization(_currentLanguage); GetToSLocalization(_currentLanguage);

View File

@@ -167,7 +167,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.AlignTextToFramePadding(); ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted("Global Download Speed Limit"); ImGui.TextUnformatted("Global Download Speed Limit");
ImGui.SameLine(); ImGui.SameLine();
ImGui.SetNextItemWidth(100); ImGui.SetNextItemWidth(100 * ImGuiHelpers.GlobalScale);
if (ImGui.InputInt("###speedlimit", ref downloadSpeedLimit)) if (ImGui.InputInt("###speedlimit", ref downloadSpeedLimit))
{ {
_configService.Current.DownloadSpeedLimitInBytes = downloadSpeedLimit; _configService.Current.DownloadSpeedLimitInBytes = downloadSpeedLimit;
@@ -175,7 +175,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
Mediator.Publish(new DownloadLimitChangedMessage()); Mediator.Publish(new DownloadLimitChangedMessage());
} }
ImGui.SameLine(); ImGui.SameLine();
ImGui.SetNextItemWidth(100); ImGui.SetNextItemWidth(100 * ImGuiHelpers.GlobalScale);
_uiShared.DrawCombo("###speed", new[] { DownloadSpeeds.Bps, DownloadSpeeds.KBps, DownloadSpeeds.MBps }, _uiShared.DrawCombo("###speed", new[] { DownloadSpeeds.Bps, DownloadSpeeds.KBps, DownloadSpeeds.MBps },
(s) => s switch (s) => s switch
{ {
@@ -193,7 +193,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.AlignTextToFramePadding(); ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted("0 = No limit/infinite"); ImGui.TextUnformatted("0 = No limit/infinite");
ImGui.SetNextItemWidth(250); ImGui.SetNextItemWidth(250 * ImGuiHelpers.GlobalScale);
if (ImGui.SliderInt("Maximum Parallel Downloads", ref maxParallelDownloads, 1, 10)) if (ImGui.SliderInt("Maximum Parallel Downloads", ref maxParallelDownloads, 1, 10))
{ {
_configService.Current.ParallelDownloads = maxParallelDownloads; _configService.Current.ParallelDownloads = maxParallelDownloads;
@@ -249,7 +249,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
} }
UiSharedService.DrawHelpText("Shows download text (amount of MiB downloaded) in the transfer bars"); UiSharedService.DrawHelpText("Shows download text (amount of MiB downloaded) in the transfer bars");
int transferBarWidth = _configService.Current.TransferBarsWidth; int transferBarWidth = _configService.Current.TransferBarsWidth;
ImGui.SetNextItemWidth(250); ImGui.SetNextItemWidth(500 * ImGuiHelpers.GlobalScale);
if (ImGui.SliderInt("Transfer Bar Width", ref transferBarWidth, 10, 500)) if (ImGui.SliderInt("Transfer Bar Width", ref transferBarWidth, 10, 500))
{ {
_configService.Current.TransferBarsWidth = transferBarWidth; _configService.Current.TransferBarsWidth = transferBarWidth;
@@ -257,7 +257,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
} }
UiSharedService.DrawHelpText("Width of the displayed transfer bars (will never be less wide than the displayed text)"); UiSharedService.DrawHelpText("Width of the displayed transfer bars (will never be less wide than the displayed text)");
int transferBarHeight = _configService.Current.TransferBarsHeight; int transferBarHeight = _configService.Current.TransferBarsHeight;
ImGui.SetNextItemWidth(250); ImGui.SetNextItemWidth(500 * ImGuiHelpers.GlobalScale);
if (ImGui.SliderInt("Transfer Bar Height", ref transferBarHeight, 2, 50)) if (ImGui.SliderInt("Transfer Bar Height", ref transferBarHeight, 2, 50))
{ {
_configService.Current.TransferBarsHeight = transferBarHeight; _configService.Current.TransferBarsHeight = transferBarHeight;
@@ -698,7 +698,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Save(); _configService.Save();
} }
ImGui.SetNextItemWidth(250); ImGui.SetNextItemWidth(250 * ImGuiHelpers.GlobalScale);
_uiShared.DrawCombo("Server Info Bar style", Enumerable.Range(0, DtrEntry.NumStyles), (i) => DtrEntry.RenderDtrStyle(i, "123"), _uiShared.DrawCombo("Server Info Bar style", Enumerable.Range(0, DtrEntry.NumStyles), (i) => DtrEntry.RenderDtrStyle(i, "123"),
(i) => (i) =>
{ {
@@ -755,7 +755,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
Mediator.Publish(new CompactUiChange(Vector2.Zero, Vector2.Zero)); Mediator.Publish(new CompactUiChange(Vector2.Zero, Vector2.Zero));
} }
UiSharedService.DrawHelpText("Will show profiles on the right side of the main UI"); UiSharedService.DrawHelpText("Will show profiles on the right side of the main UI");
ImGui.SetNextItemWidth(250); ImGui.SetNextItemWidth(250 * ImGuiHelpers.GlobalScale);
if (ImGui.SliderFloat("Hover Delay", ref profileDelay, 1, 10)) if (ImGui.SliderFloat("Hover Delay", ref profileDelay, 1, 10))
{ {
_configService.Current.ProfileDelay = profileDelay; _configService.Current.ProfileDelay = profileDelay;
@@ -780,7 +780,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
var onlineNotifsNamedOnly = _configService.Current.ShowOnlineNotificationsOnlyForNamedPairs; var onlineNotifsNamedOnly = _configService.Current.ShowOnlineNotificationsOnlyForNamedPairs;
UiSharedService.FontText("Notifications", _uiShared.UidFont); UiSharedService.FontText("Notifications", _uiShared.UidFont);
ImGui.SetNextItemWidth(250); ImGui.SetNextItemWidth(250 * ImGuiHelpers.GlobalScale);
_uiShared.DrawCombo("Info Notification Display##settingsUi", (NotificationLocation[])Enum.GetValues(typeof(NotificationLocation)), (i) => i.ToString(), _uiShared.DrawCombo("Info Notification Display##settingsUi", (NotificationLocation[])Enum.GetValues(typeof(NotificationLocation)), (i) => i.ToString(),
(i) => (i) =>
{ {
@@ -793,7 +793,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
+ Environment.NewLine + "'Toast' will show Warning toast notifications in the bottom right corner" + 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"); + Environment.NewLine + "'Both' will show chat as well as the toast notification");
ImGui.SetNextItemWidth(250); ImGui.SetNextItemWidth(250 * ImGuiHelpers.GlobalScale);
_uiShared.DrawCombo("Warning Notification Display##settingsUi", (NotificationLocation[])Enum.GetValues(typeof(NotificationLocation)), (i) => i.ToString(), _uiShared.DrawCombo("Warning Notification Display##settingsUi", (NotificationLocation[])Enum.GetValues(typeof(NotificationLocation)), (i) => i.ToString(),
(i) => (i) =>
{ {
@@ -806,7 +806,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
+ Environment.NewLine + "'Toast' will show Warning toast notifications in the bottom right corner" + 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"); + Environment.NewLine + "'Both' will show chat as well as the toast notification");
ImGui.SetNextItemWidth(250); ImGui.SetNextItemWidth(250 * ImGuiHelpers.GlobalScale);
_uiShared.DrawCombo("Error Notification Display##settingsUi", (NotificationLocation[])Enum.GetValues(typeof(NotificationLocation)), (i) => i.ToString(), _uiShared.DrawCombo("Error Notification Display##settingsUi", (NotificationLocation[])Enum.GetValues(typeof(NotificationLocation)), (i) => i.ToString(),
(i) => (i) =>
{ {

View File

@@ -573,7 +573,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); 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; var cacheDirectory = _configService.Current.CacheFolder;
ImGui.SetNextItemWidth(400); ImGui.SetNextItemWidth(400 * ImGuiHelpers.GlobalScale);
ImGui.InputText("Storage Folder##cache", ref cacheDirectory, 255, ImGuiInputTextFlags.ReadOnly); ImGui.InputText("Storage Folder##cache", ref cacheDirectory, 255, ImGuiInputTextFlags.ReadOnly);
ImGui.SameLine(); ImGui.SameLine();
@@ -624,7 +624,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
} }
float maxCacheSize = (float)_configService.Current.MaxLocalCacheInGiB; float maxCacheSize = (float)_configService.Current.MaxLocalCacheInGiB;
ImGui.SetNextItemWidth(250); ImGui.SetNextItemWidth(400 * ImGuiHelpers.GlobalScale);
if (ImGui.SliderFloat("Maximum Storage Size", ref maxCacheSize, 1f, 200f, "%.2f GiB")) if (ImGui.SliderFloat("Maximum Storage Size", ref maxCacheSize, 1f, 200f, "%.2f GiB"))
{ {
_configService.Current.MaxLocalCacheInGiB = maxCacheSize; _configService.Current.MaxLocalCacheInGiB = maxCacheSize;
@@ -820,7 +820,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
if (string.Equals(_serverConfigurationManager.CurrentServer?.ServerName, comboEntries[i], StringComparison.OrdinalIgnoreCase)) if (string.Equals(_serverConfigurationManager.CurrentServer?.ServerName, comboEntries[i], StringComparison.OrdinalIgnoreCase))
comboEntries[i] += " [Current]"; comboEntries[i] += " [Current]";
} }
ImGui.SetNextItemWidth(250); ImGui.SetNextItemWidth(250 * ImGuiHelpers.GlobalScale);
if (ImGui.BeginCombo("Select Service", comboEntries[_serverSelectionIndex])) if (ImGui.BeginCombo("Select Service", comboEntries[_serverSelectionIndex]))
{ {
for (int i = 0; i < comboEntries.Length; i++) for (int i = 0; i < comboEntries.Length; i++)
@@ -858,9 +858,9 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
if (ImGui.TreeNode("Add Custom Service")) if (ImGui.TreeNode("Add Custom Service"))
{ {
ImGui.SetNextItemWidth(250); ImGui.SetNextItemWidth(250 * ImGuiHelpers.GlobalScale);
ImGui.InputText("Custom Service URI", ref _customServerUri, 255); ImGui.InputText("Custom Service URI", ref _customServerUri, 255);
ImGui.SetNextItemWidth(250); ImGui.SetNextItemWidth(250 * ImGuiHelpers.GlobalScale);
ImGui.InputText("Custom Service Name", ref _customServerName, 255); ImGui.InputText("Custom Service Name", ref _customServerName, 255);
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Plus, "Add Custom Service") if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Plus, "Add Custom Service")
&& !string.IsNullOrEmpty(_customServerUri) && !string.IsNullOrEmpty(_customServerUri)
@@ -884,7 +884,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
public void DrawTimeSpanBetweenScansSetting() public void DrawTimeSpanBetweenScansSetting()
{ {
var timeSpan = _configService.Current.TimeSpanBetweenScansInSeconds; var timeSpan = _configService.Current.TimeSpanBetweenScansInSeconds;
ImGui.SetNextItemWidth(250); ImGui.SetNextItemWidth(250 * ImGuiHelpers.GlobalScale);
if (ImGui.SliderInt("Seconds between scans##timespan", ref timeSpan, 20, 60)) if (ImGui.SliderInt("Seconds between scans##timespan", ref timeSpan, 20, 60))
{ {
_configService.Current.TimeSpanBetweenScansInSeconds = timeSpan; _configService.Current.TimeSpanBetweenScansInSeconds = timeSpan;